blob: e86ba3de08eb17a9024f4a69b68b7f587dd44134 [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
Shawn Willden80843db2015-02-24 09:31:25 -070017#include <hardware/keymaster0.h>
Kenny Root17208e02013-09-04 13:56:03 -070018
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 Willden80843db2015-02-24 09:31:25 -070022int openssl_generate_keypair(const keymaster0_device_t* dev, const keymaster_keypair_t key_type,
Shawn Willden1406b8a2014-06-12 11:39:48 -060023 const void* key_params, uint8_t** keyBlob, size_t* keyBlobLength);
Kenny Root17208e02013-09-04 13:56:03 -070024
Shawn Willden80843db2015-02-24 09:31:25 -070025int openssl_import_keypair(const keymaster0_device_t* dev, const uint8_t* key,
Shawn Willden1406b8a2014-06-12 11:39:48 -060026 const size_t key_length, uint8_t** key_blob, size_t* key_blob_length);
Kenny Root17208e02013-09-04 13:56:03 -070027
Shawn Willden80843db2015-02-24 09:31:25 -070028int openssl_get_keypair_public(const struct keymaster0_device* dev, const uint8_t* key_blob,
Shawn Willden1406b8a2014-06-12 11:39:48 -060029 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 Willden80843db2015-02-24 09:31:25 -070032int openssl_sign_data(const keymaster0_device_t* dev, const void* params, const uint8_t* keyBlob,
Shawn Willden1406b8a2014-06-12 11:39:48 -060033 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 Willden80843db2015-02-24 09:31:25 -070036int openssl_verify_data(const keymaster0_device_t* dev, const void* params, const uint8_t* keyBlob,
Shawn Willden1406b8a2014-06-12 11:39:48 -060037 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_