blob: e4b173c4c7125a636615a01106fba924eee6b6d4 [file] [log] [blame]
Kenny Root17208e02013-09-04 13:56:03 -07001/*
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
Shawn Willden1406b8a2014-06-12 11:39:48 -060019#ifndef SOFTKEYMASTER_INCLUDE_KEYMASTER_SOFTKEYMASTER_H_
20#define SOFTKEYMASTER_INCLUDE_KEYMASTER_SOFTKEYMASTER_H_
Kenny Root17208e02013-09-04 13:56:03 -070021
Shawn Willden1406b8a2014-06-12 11:39:48 -060022int 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);
Kenny Root17208e02013-09-04 13:56:03 -070024
Shawn Willden1406b8a2014-06-12 11:39:48 -060025int 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);
Kenny Root17208e02013-09-04 13:56:03 -070027
Shawn Willden1406b8a2014-06-12 11:39:48 -060028int 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);
Kenny Root17208e02013-09-04 13:56:03 -070031
Shawn Willden1406b8a2014-06-12 11:39:48 -060032int 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);
Kenny Root17208e02013-09-04 13:56:03 -070035
Shawn Willden1406b8a2014-06-12 11:39:48 -060036int 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);
Kenny Root17208e02013-09-04 13:56:03 -070040
Chad Brubakerc0703ac2015-01-12 14:13:14 -080041int openssl_open(const hw_module_t* module, const char* name, hw_device_t** device);
42
Dmitriy Ivanovc55c2162015-01-29 17:24:09 -080043extern struct keystore_module softkeymaster_module;
44
Shawn Willden1406b8a2014-06-12 11:39:48 -060045#endif // SOFTKEYMASTER_INCLUDE_KEYMASTER_SOFTKEYMASTER_H_