• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**
2  * Copyright (c) 2020 HiSilicon (Shanghai) Technologies CO., LIMITED.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  * Description: key manager kernel API header file.
15  *
16  * Create: 2023-05-26
17 */
18 
19 #ifndef KAPI_KM_H
20 #define KAPI_KM_H
21 
22 #include "crypto_km_struct.h"
23 
24 #define KAPI_KEYSLOT_MODULE_ID              0x03
25 #define KAPI_KLAD_MODULE_ID                 0x04
26 
27 #ifdef __cplusplus
28 #if __cplusplus
29 extern "C" {
30 #endif /* __cplusplus */
31 #endif /* __cplusplus */
32 
33 td_s32 kapi_km_deinit(td_void);
34 
35 /* Keyslot. */
36 td_s32 kapi_keyslot_create(td_handle *kapi_keyslot_handle, crypto_keyslot_type keyslot_type);
37 td_s32 kapi_keyslot_destroy(td_handle kapi_keyslot_handle);
38 
39 /* Klad. */
40 td_s32 kapi_klad_create(td_handle *kapi_klad_handle);
41 td_s32 kapi_klad_destroy(td_handle kapi_klad_handle);
42 
43 td_s32 kapi_klad_attach(td_handle kapi_klad_handle, crypto_klad_dest klad_type,
44     td_handle kapi_keyslot_handle);
45 td_s32 kapi_klad_detach(td_handle kapi_klad_handle, crypto_klad_dest klad_type,
46     td_handle kapi_keyslot_handle);
47 
48 td_s32 kapi_klad_set_attr(td_handle kapi_klad_handle, const crypto_klad_attr *attr);
49 td_s32 kapi_klad_get_attr(td_handle kapi_klad_handle, crypto_klad_attr *attr);
50 
51 td_s32 kapi_klad_set_effective_key(td_handle kapi_klad_handle, const crypto_klad_effective_key *effective_key);
52 
53 td_s32 kapi_klad_set_clear_key(td_handle kapi_klad_handle, const crypto_klad_clear_key *key);
54 
55 td_s32 kapi_kdf_update(crypto_kdf_otp_key otp_key, crypto_kdf_update_alg alg);
56 
57 #ifdef __cplusplus
58 #if __cplusplus
59 }
60 #endif /* __cplusplus */
61 #endif /* __cplusplus */
62 
63 #endif