123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229 |
- #ifndef NRF_CRYPTO_ECC_SHARED_H__
- #define NRF_CRYPTO_ECC_SHARED_H__
- #if !defined(__SDK_DOXYGEN__)
- #include <stdint.h>
- #include <stddef.h>
- #include <stdbool.h>
- #include "sdk_errors.h"
- #ifdef __cplusplus
- extern "C" {
- #endif
- #define NRF_CRYPTO_INTERNAL_ECC_PRIVATE_KEY_INIT_VALUE (0x4D465276)
- #define NRF_CRYPTO_INTERNAL_ECC_PUBLIC_KEY_INIT_VALUE (0x4D465270)
- struct nrf_crypto_ecc_curve_info_s;
- typedef struct
- {
- uint32_t init_value;
- struct nrf_crypto_ecc_curve_info_s const * p_info;
- } nrf_crypto_internal_ecc_key_header_t;
- typedef ret_code_t (*nrf_crypto_backend_ecc_key_pair_generate_fn_t)(
- void * p_context,
- void * p_private_key,
- void * p_public_key);
- typedef ret_code_t (*nrf_crypto_backend_ecc_public_key_calculate_fn_t)(
- void * p_context,
- void const * p_private_key,
- void * p_public_key);
- typedef ret_code_t (*nrf_crypto_backend_ecc_private_key_from_raw_fn_t)(
- void * p_private_key,
- uint8_t const * p_raw_data);
- typedef ret_code_t (*nrf_crypto_backend_ecc_private_key_to_raw_fn_t)(
- void const * p_private_key,
- uint8_t * p_raw_data);
- typedef ret_code_t (*nrf_crypto_backend_ecc_public_key_from_raw_fn_t)(
- void * p_public_key,
- uint8_t const * p_raw_data);
- typedef ret_code_t (*nrf_crypto_backend_ecc_public_key_to_raw_fn_t)(
- void const * p_public_key,
- uint8_t * p_raw_data);
- typedef ret_code_t (*nrf_crypto_backend_ecc_key_free_fn_t)(
- void * p_key);
- ret_code_t nrf_crypto_internal_ecc_key_output_prepare(
- struct nrf_crypto_ecc_curve_info_s const * p_curve_info,
- nrf_crypto_internal_ecc_key_header_t * p_key_header);
- ret_code_t nrf_crypto_internal_ecc_key_input_check(
- nrf_crypto_internal_ecc_key_header_t const * p_key_header,
- uint32_t init_value);
- ret_code_t nrf_crypto_internal_ecc_raw_output_prepare(
- uint8_t * p_raw_data,
- size_t * p_raw_data_size,
- size_t expected_size);
- ret_code_t nrf_crypto_internal_ecc_raw_input_check(
- uint8_t const * p_raw_data,
- size_t raw_data_size,
- size_t expected_size);
- #ifdef __cplusplus
- }
- #endif
- #endif
- #endif
|