Branch data Line data Source code
1 : : /* 2 : : * Copyright (c) 2019 Nordic Semiconductor ASA 3 : : * 4 : : * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause 5 : : */ 6 : : /**@file 7 : : * @defgroup nrf_cc3xx_platform_abort nrf_cc3xx_platform abort APIs 8 : : * @ingroup nrf_cc3xx_platform 9 : : * @{ 10 : : * @brief The nrf_cc3xx_platform_entropy APIs provides callbacks to abort 11 : : * from nrf_cc3xx_platform and/or dependent libraries. 12 : : */ 13 : : #ifndef NRF_CC3XX_PLATFORM_ABORT_H__ 14 : : #define NRF_CC3XX_PLATFORM_ABORT_H__ 15 : : 16 : : #ifdef __cplusplus 17 : : extern "C" 18 : : { 19 : : #endif 20 : : 21 : : /** @brief Type definition of handle used for abort 22 : : * 23 : : * This handle could point to the thread or task to abort or any other 24 : : * static memory required for aborting the on-going cryptographic routine(s). 25 : : */ 26 : : typedef void* nrf_cc3xx_platform_abort_handle_t; 27 : : 28 : : 29 : : /** @brief Type definition of platform abort function 30 : : * 31 : : * @note This function pointer will be used when the nrf_cc3xx_platform 32 : : * and/or dependent libraries raises an error that can't be recovered. 33 : : */ 34 : : typedef void (*nrf_cc3xx_platform_abort_fn_t)(char const * const reason); 35 : : 36 : : 37 : : /** @brief Type definition of structure holding platform abort APIs 38 : : */ 39 : : typedef struct nrf_cc3xx_platform_abort_apis_t 40 : : { 41 : : nrf_cc3xx_platform_abort_handle_t abort_handle; //!< Handle to use when crypto operations are aborted. 42 : : nrf_cc3xx_platform_abort_fn_t abort_fn; //!< Function to use when crypto operations are aborted. 43 : : 44 : : } nrf_cc3xx_platform_abort_apis_t; 45 : : 46 : : 47 : : /** @brief External reference to the platform abort APIs 48 : : */ 49 : : extern nrf_cc3xx_platform_abort_apis_t platform_abort_apis; 50 : : 51 : : 52 : : /** @brief Function to set platform abort APIs 53 : : * 54 : : * @param[in] apis Pointer to platform APIs. 55 : : */ 56 : : void nrf_cc3xx_platform_set_abort( 57 : : nrf_cc3xx_platform_abort_apis_t const * const apis); 58 : : 59 : : 60 : : /** @brief Function to initialize platform abort APIs 61 : : * 62 : : * @note This function must be called once before calling 63 : : * @ref nrf_cc3xx_platform_init or @ref nrf_cc3xx_platform_init_no_rng. 64 : : * 65 : : * @note This function is not expected to be thread-safe. 66 : : */ 67 : 1 : void nrf_cc3xx_platform_abort_init(void); 68 : : 69 : : 70 : : #ifdef __cplusplus 71 : : } 72 : : #endif 73 : : 74 : : #endif /* NRF_CC3XX_PLATFORM_ABORT_H__ */ 75 : : 76 : : /** @} */