xref: /optee_os/ta/pkcs11/src/pkcs11_helpers.h (revision 8849c12619aee7069963595d8f85dae559daf2d8)
1 /* SPDX-License-Identifier: BSD-2-Clause */
2 /*
3  * Copyright (c) 2018-2020, Linaro Limited
4  */
5 
6 #ifndef PKCS11_HELPERS_H
7 #define PKCS11_HELPERS_H
8 
9 #include <stdint.h>
10 #include <stddef.h>
11 
12 #include <token_capabilities.h>
13 
14 /*
15  * TEE invocation parameter#0 is an in/out buffer of at least 32bit
16  * to store the TA PKCS#11 compliant return value.
17  */
18 #define TEE_PARAM0_SIZE_MIN		sizeof(uint32_t)
19 
20 #if CFG_TEE_TA_LOG_LEVEL > 0
21 /* Id-to-string conversions only for trace support */
22 const char *id2str_ta_cmd(uint32_t id);
23 const char *id2str_rc(uint32_t id);
24 const char *id2str_slot_flag(uint32_t id);
25 const char *id2str_token_flag(uint32_t id);
26 static inline const char *id2str_mechanism(enum pkcs11_mechanism_id id)
27 {
28 	return mechanism_string_id(id);
29 }
30 #endif /* CFG_TEE_TA_LOG_LEVEL > 0 */
31 #endif /*PKCS11_HELPERS_H*/
32