xref: /aosp_15_r20/system/security/keystore-engine/android_engine.cpp (revision e1997b9af69e3155ead6e072d106a0077849ffba)
1*e1997b9aSAndroid Build Coastguard Worker /* Copyright 2014 The Android Open Source Project
2*e1997b9aSAndroid Build Coastguard Worker  *
3*e1997b9aSAndroid Build Coastguard Worker  * Redistribution and use in source and binary forms, with or without
4*e1997b9aSAndroid Build Coastguard Worker  * modification, are permitted provided that the following conditions
5*e1997b9aSAndroid Build Coastguard Worker  * are met:
6*e1997b9aSAndroid Build Coastguard Worker  * 1. Redistributions of source code must retain the above copyright
7*e1997b9aSAndroid Build Coastguard Worker  *    notice, this list of conditions and the following disclaimer.
8*e1997b9aSAndroid Build Coastguard Worker  * 2. Redistributions in binary form must reproduce the above copyright
9*e1997b9aSAndroid Build Coastguard Worker  *    notice, this list of conditions and the following disclaimer in the
10*e1997b9aSAndroid Build Coastguard Worker  *    documentation and/or other materials provided with the distribution.
11*e1997b9aSAndroid Build Coastguard Worker  *
12*e1997b9aSAndroid Build Coastguard Worker  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY
13*e1997b9aSAndroid Build Coastguard Worker  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
14*e1997b9aSAndroid Build Coastguard Worker  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
15*e1997b9aSAndroid Build Coastguard Worker  * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY
16*e1997b9aSAndroid Build Coastguard Worker  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
17*e1997b9aSAndroid Build Coastguard Worker  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
18*e1997b9aSAndroid Build Coastguard Worker  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
19*e1997b9aSAndroid Build Coastguard Worker  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
20*e1997b9aSAndroid Build Coastguard Worker  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
21*e1997b9aSAndroid Build Coastguard Worker  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
22*e1997b9aSAndroid Build Coastguard Worker 
23*e1997b9aSAndroid Build Coastguard Worker #define LOG_TAG "keystore-engine"
24*e1997b9aSAndroid Build Coastguard Worker 
25*e1997b9aSAndroid Build Coastguard Worker #include <log/log.h>
26*e1997b9aSAndroid Build Coastguard Worker 
27*e1997b9aSAndroid Build Coastguard Worker #include "keystore2_engine.h"
28*e1997b9aSAndroid Build Coastguard Worker 
29*e1997b9aSAndroid Build Coastguard Worker extern "C" {
30*e1997b9aSAndroid Build Coastguard Worker 
31*e1997b9aSAndroid Build Coastguard Worker EVP_PKEY* EVP_PKEY_from_keystore(const char* key_id) __attribute__((visibility("default")));
32*e1997b9aSAndroid Build Coastguard Worker 
33*e1997b9aSAndroid Build Coastguard Worker /* EVP_PKEY_from_keystore returns an |EVP_PKEY| that contains either an RSA or
34*e1997b9aSAndroid Build Coastguard Worker  * ECDSA key where the public part of the key reflects the value of the key
35*e1997b9aSAndroid Build Coastguard Worker  * named |key_id| in Keystore and the private operations are forwarded onto
36*e1997b9aSAndroid Build Coastguard Worker  * KeyStore. */
EVP_PKEY_from_keystore(const char * key_id)37*e1997b9aSAndroid Build Coastguard Worker EVP_PKEY* EVP_PKEY_from_keystore(const char* key_id) {
38*e1997b9aSAndroid Build Coastguard Worker     ALOGV("EVP_PKEY_from_keystore(\"%s\")", key_id);
39*e1997b9aSAndroid Build Coastguard Worker 
40*e1997b9aSAndroid Build Coastguard Worker     return EVP_PKEY_from_keystore2(key_id);
41*e1997b9aSAndroid Build Coastguard Worker }
42*e1997b9aSAndroid Build Coastguard Worker 
43*e1997b9aSAndroid Build Coastguard Worker }  // extern "C"
44