1 /* 2 * Copyright (c) 2019-2021, Arm Limited. All rights reserved. 3 * 4 * SPDX-License-Identifier: BSD-3-Clause 5 * 6 */ 7 8 #ifndef __CRYPTO_HW_H__ 9 #define __CRYPTO_HW_H__ 10 11 #include <stdint.h> 12 #include <stddef.h> 13 14 #ifdef __cplusplus 15 extern "C" { 16 #endif /* __cplusplus */ 17 18 /** 19 * \brief Initialize the CC312 crypto accelerator 20 * 21 * \return 0 on success, non-zero otherwise 22 */ 23 int crypto_hw_accelerator_init(void); 24 25 /** 26 * \brief Deallocate the CC312 crypto accelerator 27 * 28 * \return 0 on success, non-zero otherwise 29 */ 30 int crypto_hw_accelerator_finish(void); 31 32 /* 33 * \brief This function performs key derivation 34 * 35 * \param[in] label Label for KDF 36 * \param[in] label_size Size of the label 37 * \param[in] context Context for KDF 38 * \param[in] context_size Size of the context 39 * \param[out] key Buffer to output the derived key material 40 * \param[in] key_size Requested size of the derived key material and 41 * minimum size of the key buffer 42 * 43 * \return 0 on success, non-zero otherwise 44 */ 45 int crypto_hw_accelerator_huk_derive_key(const uint8_t *label, 46 size_t label_size, 47 const uint8_t *context, 48 size_t context_size, 49 uint8_t *key, 50 size_t key_size); 51 /** 52 * \brief Apply permissions on debug signals 53 * 54 * \param[in] permissions_mask permission vector for debug signals 55 * vector bits interpretation is specific 56 * to a target and depends on the architecture 57 * \param[in] len length of permission vector 58 * 59 * \return 0 on success, non-zero otherwise 60 */ 61 int crypto_hw_apply_debug_permissions(uint8_t *permissions_mask, uint32_t len); 62 63 #ifdef __cplusplus 64 } 65 #endif /* __cplusplus */ 66 67 #endif /* __CRYPTO_HW_H__ */ 68