softkeymaster.h revision 1406b8af2b1490405557561fc88fb70ae17a6b79
1/*
2 * Copyright 2013 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#include <hardware/keymaster.h>
18
19#ifndef SOFTKEYMASTER_INCLUDE_KEYMASTER_SOFTKEYMASTER_H_
20#define SOFTKEYMASTER_INCLUDE_KEYMASTER_SOFTKEYMASTER_H_
21
22int openssl_generate_keypair(const keymaster_device_t* dev, const keymaster_keypair_t key_type,
23                             const void* key_params, uint8_t** keyBlob, size_t* keyBlobLength);
24
25int openssl_import_keypair(const keymaster_device_t* dev, const uint8_t* key,
26                           const size_t key_length, uint8_t** key_blob, size_t* key_blob_length);
27
28int openssl_get_keypair_public(const struct keymaster_device* dev, const uint8_t* key_blob,
29                               const size_t key_blob_length, uint8_t** x509_data,
30                               size_t* x509_data_length);
31
32int openssl_sign_data(const keymaster_device_t* dev, const void* params, const uint8_t* keyBlob,
33                      const size_t keyBlobLength, const uint8_t* data, const size_t dataLength,
34                      uint8_t** signedData, size_t* signedDataLength);
35
36int openssl_verify_data(const keymaster_device_t* dev, const void* params, const uint8_t* keyBlob,
37                        const size_t keyBlobLength, const uint8_t* signedData,
38                        const size_t signedDataLength, const uint8_t* signature,
39                        const size_t signatureLength);
40
41#endif  // SOFTKEYMASTER_INCLUDE_KEYMASTER_SOFTKEYMASTER_H_
42