You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

122 lines
3.6 KiB

/*
* Copyright (c) Hisilicon Technologies Co., Ltd. 2019-2020. All rights reserved.
* Description: Define API about key slot driver
* Author: Hisilicon
* Create: 2019-6-26
*/
#ifndef UAPI_SLOT_H
#define UAPI_SLOT_H
#include "td_type.h"
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif
#endif /* __cplusplus */
/*
* Define the maximum number of TScipher keyslot.
* CNcomment: TScipher keyslot
*/
#define UAPI_KEYSLOT_TSCIPHER_MAX 256
/*
* Define the maximum number of Mcipher keyslot.
* CNcomment: Mcipher keyslot
*/
#define UAPI_KEYSLOT_MCIPHER_MAX 15
/*
* Define the maximum number of HMAC keyslot.
* CNcomment: HMAC keyslot
*/
#define UAPI_KEYSLOT_HMAC_MAX 1
/*
* Define the keyslot type.
* CNcomment: keyslot
*/
typedef enum {
UAPI_KEYSLOT_TYPE_TSCIPHER = 0x00,
UAPI_KEYSLOT_TYPE_MCIPHER,
UAPI_KEYSLOT_TYPE_HMAC,
UAPI_KEYSLOT_TYPE_MAX
} uapi_keyslot_type;
/*
* Define the keyslot secure mode.
* CNcomment: keyslot
*/
typedef enum {
UAPI_KEYSLOT_SECURE_MODE_NONE = 0x00,
UAPI_KEYSLOT_SECURE_MODE_TEE,
UAPI_KEYSLOT_SECURE_MODE_MAX
} uapi_keyslot_secure_mode;
/*
* Define the keyslot attribute.
* CNcomment: keyslot
*/
typedef struct {
uapi_keyslot_type type;
uapi_keyslot_secure_mode secure_mode;
} uapi_keyslot_attr;
/*
* brief Initializes the keyslot module. CNcomment:keyslot CNend
* attention \n
* Before calling any other api in keyslot, you must call this function first.
* CNcomment: keyslot CNend
* param N/A
* retval ::TD_SUCCESS Success CNcomment: CNend
* retval ::TD_FAILURE Failure CNcomment: CNend
* see \n
* N/A CNcomment: CNend
*/
td_s32 uapi_keyslot_init(td_void);
/*
* brief Deinitializes the keyslot module. CNcomment:keyslot CNend
* attention \n
* Before calling this api, you should call uapi_keyslot_destroy to destroy all the keyslot instance.
* CNcomment: keyslotuapi_keyslot_destroykeyslot CNend
* param N/A
* retval ::TD_SUCCESS Success CNcomment: CNend
* retval ::TD_FAILURE Failure CNcomment: CNend
* see \n
* N/A CNcomment: CNend
*/
td_s32 uapi_keyslot_deinit(td_void);
/*
* brief Creates a keyslot instance. CNcomment:keyslot CNend
* param[in] attr The attribute that created the instance. CNcomment:. CNend
* param[out] key_slot Pointer to the handle of an allocated instance. CNcomment:. CNend
* retval ::TD_SUCCESS Success CNcomment: CNend
* retval ::TD_FAILURE Failure CNcomment: CNend
* see \n
* N/A CNcomment: CNend
*/
td_s32 uapi_keyslot_create(const uapi_keyslot_attr *attr, td_handle *key_slot);
/*
* brief Destroys a keyslot instance. CNcomment:keyslot CNend
* attention \n
* N/A
* param[in] key_slot instance handle. CNcomment:. CNend
* retval ::TD_SUCCESS Success CNcomment: CNend
* retval ::TD_FAILURE Failure CNcomment: CNend
* see \n
* N/A CNcomment: CNend
*/
td_s32 uapi_keyslot_destroy(td_handle key_slot);
#ifdef __cplusplus
#if __cplusplus
}
#endif
#endif /* __cplusplus */
#endif /* UAPI_SLOT_H */