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/keymaster0.h> 18 19 #ifndef SOFTKEYMASTER_INCLUDE_KEYMASTER_SOFTKEYMASTER_H_ 20 #define SOFTKEYMASTER_INCLUDE_KEYMASTER_SOFTKEYMASTER_H_ 21 22 int openssl_generate_keypair(const keymaster0_device_t* dev, const keymaster_keypair_t key_type, 23 const void* key_params, uint8_t** keyBlob, size_t* keyBlobLength); 24 25 int openssl_import_keypair(const keymaster0_device_t* dev, const uint8_t* key, 26 const size_t key_length, uint8_t** key_blob, size_t* key_blob_length); 27 28 int openssl_get_keypair_public(const struct keymaster0_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 32 int openssl_sign_data(const keymaster0_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 36 int openssl_verify_data(const keymaster0_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 int openssl_open(const hw_module_t* module, const char* name, hw_device_t** device); 42 43 extern struct keystore_module softkeymaster_module; 44 45 #endif // SOFTKEYMASTER_INCLUDE_KEYMASTER_SOFTKEYMASTER_H_ 46