1 /* SPDX-License-Identifier: BSD-2-Clause */ 2 /* 3 * Copyright (c) 2017-2020, Linaro Limited 4 */ 5 6 #ifndef TOKEN_CAPABILITIES_H 7 #define TOKEN_CAPABILITIES_H 8 9 #include <pkcs11_ta.h> 10 #include <stdbool.h> 11 #include <stdint.h> 12 13 bool mechanism_flags_complies_pkcs11(uint32_t mechanism_type, uint32_t flags); 14 15 bool mechanism_is_one_shot_only(uint32_t mechanism_type); 16 17 bool mechanism_is_valid(enum pkcs11_mechanism_id id); 18 19 #if CFG_TEE_TA_LOG_LEVEL > 0 20 const char *mechanism_string_id(enum pkcs11_mechanism_id id); 21 #endif 22 23 uint32_t *tee_malloc_mechanism_list(size_t *out_count); 24 25 uint32_t mechanism_supported_flags(enum pkcs11_mechanism_id id); 26 27 void pkcs11_mechanism_supported_key_sizes(uint32_t proc_id, 28 uint32_t *min_key_size, 29 uint32_t *max_key_size); 30 31 void mechanism_supported_key_sizes_bytes(uint32_t proc_id, 32 uint32_t *min_key_size, 33 uint32_t *max_key_size); 34 mechanism_is_supported(enum pkcs11_mechanism_id id)35static inline bool mechanism_is_supported(enum pkcs11_mechanism_id id) 36 { 37 return mechanism_supported_flags(id) != 0; 38 } 39 40 #endif /*TOKEN_CAPABILITIES_H*/ 41