123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969 |
- #ifndef NRF_CRYPTO_ECC_H__
- #define NRF_CRYPTO_ECC_H__
- #include <stdint.h>
- #include <stddef.h>
- #include "nrf_crypto_error.h"
- #include "nrf_crypto_ecc_shared.h"
- #include "nrf_crypto_ecc_backend.h"
- #ifdef __cplusplus
- extern "C" {
- #endif
- #if defined(__SDK_DOXYGEN__)
- #define NRF_CRYPTO_ECC_SECP160R1_ENABLED 1
- #define NRF_CRYPTO_ECC_SECP160R2_ENABLED 1
- #define NRF_CRYPTO_ECC_SECP192R1_ENABLED 1
- #define NRF_CRYPTO_ECC_SECP224R1_ENABLED 1
- #define NRF_CRYPTO_ECC_SECP256R1_ENABLED 1
- #define NRF_CRYPTO_ECC_SECP384R1_ENABLED 1
- #define NRF_CRYPTO_ECC_SECP521R1_ENABLED 1
- #define NRF_CRYPTO_ECC_SECP160K1_ENABLED 1
- #define NRF_CRYPTO_ECC_SECP192K1_ENABLED 1
- #define NRF_CRYPTO_ECC_SECP224K1_ENABLED 1
- #define NRF_CRYPTO_ECC_SECP256K1_ENABLED 1
- #define NRF_CRYPTO_ECC_BP256R1_ENABLED 1
- #define NRF_CRYPTO_ECC_BP384R1_ENABLED 1
- #define NRF_CRYPTO_ECC_BP512R1_ENABLED 1
- #define NRF_CRYPTO_ECC_CURVE25519_ENABLED 1
- #define NRF_CRYPTO_ECC_ED25519_ENABLED 1
- #endif
- #define NRF_CRYPTO_ECC_SECP160R1_RAW_PRIVATE_KEY_SIZE (160 / 8)
- #define NRF_CRYPTO_ECC_SECP160R2_RAW_PRIVATE_KEY_SIZE (160 / 8)
- #define NRF_CRYPTO_ECC_SECP192R1_RAW_PRIVATE_KEY_SIZE (192 / 8)
- #define NRF_CRYPTO_ECC_SECP224R1_RAW_PRIVATE_KEY_SIZE (224 / 8)
- #define NRF_CRYPTO_ECC_SECP256R1_RAW_PRIVATE_KEY_SIZE (256 / 8)
- #define NRF_CRYPTO_ECC_SECP384R1_RAW_PRIVATE_KEY_SIZE (384 / 8)
- #define NRF_CRYPTO_ECC_SECP521R1_RAW_PRIVATE_KEY_SIZE (528 / 8)
- #define NRF_CRYPTO_ECC_SECP160K1_RAW_PRIVATE_KEY_SIZE (160 / 8)
- #define NRF_CRYPTO_ECC_SECP192K1_RAW_PRIVATE_KEY_SIZE (192 / 8)
- #define NRF_CRYPTO_ECC_SECP224K1_RAW_PRIVATE_KEY_SIZE (224 / 8)
- #define NRF_CRYPTO_ECC_SECP256K1_RAW_PRIVATE_KEY_SIZE (256 / 8)
- #define NRF_CRYPTO_ECC_BP256R1_RAW_PRIVATE_KEY_SIZE (256 / 8)
- #define NRF_CRYPTO_ECC_BP384R1_RAW_PRIVATE_KEY_SIZE (384 / 8)
- #define NRF_CRYPTO_ECC_BP512R1_RAW_PRIVATE_KEY_SIZE (512 / 8)
- #define NRF_CRYPTO_ECC_CURVE25519_RAW_PRIVATE_KEY_SIZE (256 / 8)
- #define NRF_CRYPTO_ECC_ED25519_RAW_PRIVATE_KEY_SIZE (256 / 8)
- #define NRF_CRYPTO_ECC_SECP160R1_RAW_PUBLIC_KEY_SIZE (2 * 160 / 8)
- #define NRF_CRYPTO_ECC_SECP160R2_RAW_PUBLIC_KEY_SIZE (2 * 160 / 8)
- #define NRF_CRYPTO_ECC_SECP192R1_RAW_PUBLIC_KEY_SIZE (2 * 192 / 8)
- #define NRF_CRYPTO_ECC_SECP224R1_RAW_PUBLIC_KEY_SIZE (2 * 224 / 8)
- #define NRF_CRYPTO_ECC_SECP256R1_RAW_PUBLIC_KEY_SIZE (2 * 256 / 8)
- #define NRF_CRYPTO_ECC_SECP384R1_RAW_PUBLIC_KEY_SIZE (2 * 384 / 8)
- #define NRF_CRYPTO_ECC_SECP521R1_RAW_PUBLIC_KEY_SIZE (2 * 528 / 8)
- #define NRF_CRYPTO_ECC_SECP160K1_RAW_PUBLIC_KEY_SIZE (2 * 160 / 8)
- #define NRF_CRYPTO_ECC_SECP192K1_RAW_PUBLIC_KEY_SIZE (2 * 192 / 8)
- #define NRF_CRYPTO_ECC_SECP224K1_RAW_PUBLIC_KEY_SIZE (2 * 224 / 8)
- #define NRF_CRYPTO_ECC_SECP256K1_RAW_PUBLIC_KEY_SIZE (2 * 256 / 8)
- #define NRF_CRYPTO_ECC_BP256R1_RAW_PUBLIC_KEY_SIZE (2 * 256 / 8)
- #define NRF_CRYPTO_ECC_BP384R1_RAW_PUBLIC_KEY_SIZE (2 * 384 / 8)
- #define NRF_CRYPTO_ECC_BP512R1_RAW_PUBLIC_KEY_SIZE (2 * 512 / 8)
- #define NRF_CRYPTO_ECC_CURVE25519_RAW_PUBLIC_KEY_SIZE (256 / 8)
- #define NRF_CRYPTO_ECC_ED25519_RAW_PUBLIC_KEY_SIZE (256 / 8)
- #define NRF_CRYPTO_ECC_RAW_PRIVATE_KEY_MAX_SIZE NRF_CRYPTO_BACKEND_ECC_RAW_PRIVATE_KEY_MAX_SIZE
- #define NRF_CRYPTO_ECC_RAW_PUBLIC_KEY_MAX_SIZE NRF_CRYPTO_BACKEND_ECC_RAW_PUBLIC_KEY_MAX_SIZE
- typedef enum
- {
- #if NRF_CRYPTO_ECC_SECP160R1_ENABLED
- NRF_CRYPTO_ECC_SECP160R1_CURVE_TYPE,
- #endif
- #if NRF_CRYPTO_ECC_SECP160R2_ENABLED
- NRF_CRYPTO_ECC_SECP160R2_CURVE_TYPE,
- #endif
- #if NRF_CRYPTO_ECC_SECP192R1_ENABLED
- NRF_CRYPTO_ECC_SECP192R1_CURVE_TYPE,
- #endif
- #if NRF_CRYPTO_ECC_SECP224R1_ENABLED
- NRF_CRYPTO_ECC_SECP224R1_CURVE_TYPE,
- #endif
- #if NRF_CRYPTO_ECC_SECP256R1_ENABLED
- NRF_CRYPTO_ECC_SECP256R1_CURVE_TYPE,
- #endif
- #if NRF_CRYPTO_ECC_SECP384R1_ENABLED
- NRF_CRYPTO_ECC_SECP384R1_CURVE_TYPE,
- #endif
- #if NRF_CRYPTO_ECC_SECP521R1_ENABLED
- NRF_CRYPTO_ECC_SECP521R1_CURVE_TYPE,
- #endif
- #if NRF_CRYPTO_ECC_SECP160K1_ENABLED
- NRF_CRYPTO_ECC_SECP160K1_CURVE_TYPE,
- #endif
- #if NRF_CRYPTO_ECC_SECP192K1_ENABLED
- NRF_CRYPTO_ECC_SECP192K1_CURVE_TYPE,
- #endif
- #if NRF_CRYPTO_ECC_SECP224K1_ENABLED
- NRF_CRYPTO_ECC_SECP224K1_CURVE_TYPE,
- #endif
- #if NRF_CRYPTO_ECC_SECP256K1_ENABLED
- NRF_CRYPTO_ECC_SECP256K1_CURVE_TYPE,
- #endif
- #if NRF_CRYPTO_ECC_BP256R1_ENABLED
- NRF_CRYPTO_ECC_BP256R1_CURVE_TYPE,
- #endif
- #if NRF_CRYPTO_ECC_BP384R1_ENABLED
- NRF_CRYPTO_ECC_BP384R1_CURVE_TYPE,
- #endif
- #if NRF_CRYPTO_ECC_BP512R1_ENABLED
- NRF_CRYPTO_ECC_BP512R1_CURVE_TYPE,
- #endif
- #if NRF_CRYPTO_ECC_CURVE25519_ENABLED
- NRF_CRYPTO_ECC_CURVE25519_CURVE_TYPE,
- #endif
- #if NRF_CRYPTO_ECC_ED25519_ENABLED
- NRF_CRYPTO_ECC_ED25519_CURVE_TYPE,
- #endif
- #if !NRF_CRYPTO_ECC_SECP160R1_ENABLED
- NRF_CRYPTO_ECC_SECP160R1_CURVE_TYPE,
- #endif
- #if !NRF_CRYPTO_ECC_SECP160R2_ENABLED
- NRF_CRYPTO_ECC_SECP160R2_CURVE_TYPE,
- #endif
- #if !NRF_CRYPTO_ECC_SECP192R1_ENABLED
- NRF_CRYPTO_ECC_SECP192R1_CURVE_TYPE,
- #endif
- #if !NRF_CRYPTO_ECC_SECP224R1_ENABLED
- NRF_CRYPTO_ECC_SECP224R1_CURVE_TYPE,
- #endif
- #if !NRF_CRYPTO_ECC_SECP256R1_ENABLED
- NRF_CRYPTO_ECC_SECP256R1_CURVE_TYPE,
- #endif
- #if !NRF_CRYPTO_ECC_SECP384R1_ENABLED
- NRF_CRYPTO_ECC_SECP384R1_CURVE_TYPE,
- #endif
- #if !NRF_CRYPTO_ECC_SECP521R1_ENABLED
- NRF_CRYPTO_ECC_SECP521R1_CURVE_TYPE,
- #endif
- #if !NRF_CRYPTO_ECC_SECP160K1_ENABLED
- NRF_CRYPTO_ECC_SECP160K1_CURVE_TYPE,
- #endif
- #if !NRF_CRYPTO_ECC_SECP192K1_ENABLED
- NRF_CRYPTO_ECC_SECP192K1_CURVE_TYPE,
- #endif
- #if !NRF_CRYPTO_ECC_SECP224K1_ENABLED
- NRF_CRYPTO_ECC_SECP224K1_CURVE_TYPE,
- #endif
- #if !NRF_CRYPTO_ECC_SECP256K1_ENABLED
- NRF_CRYPTO_ECC_SECP256K1_CURVE_TYPE,
- #endif
- #if !NRF_CRYPTO_ECC_BP256R1_ENABLED
- NRF_CRYPTO_ECC_BP256R1_CURVE_TYPE,
- #endif
- #if !NRF_CRYPTO_ECC_BP384R1_ENABLED
- NRF_CRYPTO_ECC_BP384R1_CURVE_TYPE,
- #endif
- #if !NRF_CRYPTO_ECC_BP512R1_ENABLED
- NRF_CRYPTO_ECC_BP512R1_CURVE_TYPE,
- #endif
- #if !NRF_CRYPTO_ECC_CURVE25519_ENABLED
- NRF_CRYPTO_ECC_CURVE25519_CURVE_TYPE,
- #endif
- #if !NRF_CRYPTO_ECC_ED25519_ENABLED
- NRF_CRYPTO_ECC_ED25519_CURVE_TYPE,
- #endif
- } nrf_crypto_ecc_curve_type_t;
- typedef struct nrf_crypto_ecc_curve_info_s
- {
- uint16_t public_key_size;
- uint16_t private_key_size;
- nrf_crypto_ecc_curve_type_t curve_type;
- uint8_t raw_private_key_size;
- uint8_t raw_public_key_size;
- void * p_backend_data;
- } nrf_crypto_ecc_curve_info_t;
- typedef nrf_crypto_backend_secp160r1_key_pair_generate_context_t
- nrf_crypto_ecc_secp160r1_key_pair_generate_context_t;
- typedef nrf_crypto_backend_secp160r1_public_key_calculate_context_t
- nrf_crypto_ecc_secp160r1_public_key_calculate_context_t;
- typedef nrf_crypto_backend_secp160r1_private_key_t
- nrf_crypto_ecc_secp160r1_private_key_t;
- typedef nrf_crypto_backend_secp160r1_public_key_t
- nrf_crypto_ecc_secp160r1_public_key_t;
- typedef uint8_t nrf_crypto_ecc_secp160r1_raw_private_key_t
- [NRF_CRYPTO_ECC_SECP160R1_RAW_PRIVATE_KEY_SIZE];
- typedef uint8_t nrf_crypto_ecc_secp160r1_raw_public_key_t
- [NRF_CRYPTO_ECC_SECP160R1_RAW_PUBLIC_KEY_SIZE];
- extern const nrf_crypto_ecc_curve_info_t g_nrf_crypto_ecc_secp160r1_curve_info;
- typedef nrf_crypto_backend_secp160r2_key_pair_generate_context_t
- nrf_crypto_ecc_secp160r2_key_pair_generate_context_t;
- typedef nrf_crypto_backend_secp160r2_public_key_calculate_context_t
- nrf_crypto_ecc_secp160r2_public_key_calculate_context_t;
- typedef nrf_crypto_backend_secp160r2_private_key_t
- nrf_crypto_ecc_secp160r2_private_key_t;
- typedef nrf_crypto_backend_secp160r2_public_key_t
- nrf_crypto_ecc_secp160r2_public_key_t;
- typedef uint8_t nrf_crypto_ecc_secp160r2_raw_private_key_t
- [NRF_CRYPTO_ECC_SECP160R2_RAW_PRIVATE_KEY_SIZE];
- typedef uint8_t nrf_crypto_ecc_secp160r2_raw_public_key_t
- [NRF_CRYPTO_ECC_SECP160R2_RAW_PUBLIC_KEY_SIZE];
- extern const nrf_crypto_ecc_curve_info_t g_nrf_crypto_ecc_secp160r2_curve_info;
- typedef nrf_crypto_backend_secp192r1_key_pair_generate_context_t
- nrf_crypto_ecc_secp192r1_key_pair_generate_context_t;
- typedef nrf_crypto_backend_secp192r1_public_key_calculate_context_t
- nrf_crypto_ecc_secp192r1_public_key_calculate_context_t;
- typedef nrf_crypto_backend_secp192r1_private_key_t
- nrf_crypto_ecc_secp192r1_private_key_t;
- typedef nrf_crypto_backend_secp192r1_public_key_t
- nrf_crypto_ecc_secp192r1_public_key_t;
- typedef uint8_t nrf_crypto_ecc_secp192r1_raw_private_key_t
- [NRF_CRYPTO_ECC_SECP192R1_RAW_PRIVATE_KEY_SIZE];
- typedef uint8_t nrf_crypto_ecc_secp192r1_raw_public_key_t
- [NRF_CRYPTO_ECC_SECP192R1_RAW_PUBLIC_KEY_SIZE];
- extern const nrf_crypto_ecc_curve_info_t g_nrf_crypto_ecc_secp192r1_curve_info;
- typedef nrf_crypto_backend_secp224r1_key_pair_generate_context_t
- nrf_crypto_ecc_secp224r1_key_pair_generate_context_t;
- typedef nrf_crypto_backend_secp224r1_public_key_calculate_context_t
- nrf_crypto_ecc_secp224r1_public_key_calculate_context_t;
- typedef nrf_crypto_backend_secp224r1_private_key_t
- nrf_crypto_ecc_secp224r1_private_key_t;
- typedef nrf_crypto_backend_secp224r1_public_key_t
- nrf_crypto_ecc_secp224r1_public_key_t;
- typedef uint8_t nrf_crypto_ecc_secp224r1_raw_private_key_t
- [NRF_CRYPTO_ECC_SECP224R1_RAW_PRIVATE_KEY_SIZE];
- typedef uint8_t nrf_crypto_ecc_secp224r1_raw_public_key_t
- [NRF_CRYPTO_ECC_SECP224R1_RAW_PUBLIC_KEY_SIZE];
- extern const nrf_crypto_ecc_curve_info_t g_nrf_crypto_ecc_secp224r1_curve_info;
- typedef nrf_crypto_backend_secp256r1_key_pair_generate_context_t
- nrf_crypto_ecc_secp256r1_key_pair_generate_context_t;
- typedef nrf_crypto_backend_secp256r1_public_key_calculate_context_t
- nrf_crypto_ecc_secp256r1_public_key_calculate_context_t;
- typedef nrf_crypto_backend_secp256r1_private_key_t
- nrf_crypto_ecc_secp256r1_private_key_t;
- typedef nrf_crypto_backend_secp256r1_public_key_t
- nrf_crypto_ecc_secp256r1_public_key_t;
- typedef uint8_t nrf_crypto_ecc_secp256r1_raw_private_key_t
- [NRF_CRYPTO_ECC_SECP256R1_RAW_PRIVATE_KEY_SIZE];
- typedef uint8_t nrf_crypto_ecc_secp256r1_raw_public_key_t
- [NRF_CRYPTO_ECC_SECP256R1_RAW_PUBLIC_KEY_SIZE];
- extern const nrf_crypto_ecc_curve_info_t g_nrf_crypto_ecc_secp256r1_curve_info;
- typedef nrf_crypto_backend_secp384r1_key_pair_generate_context_t
- nrf_crypto_ecc_secp384r1_key_pair_generate_context_t;
- typedef nrf_crypto_backend_secp384r1_public_key_calculate_context_t
- nrf_crypto_ecc_secp384r1_public_key_calculate_context_t;
- typedef nrf_crypto_backend_secp384r1_private_key_t
- nrf_crypto_ecc_secp384r1_private_key_t;
- typedef nrf_crypto_backend_secp384r1_public_key_t
- nrf_crypto_ecc_secp384r1_public_key_t;
- typedef uint8_t nrf_crypto_ecc_secp384r1_raw_private_key_t
- [NRF_CRYPTO_ECC_SECP384R1_RAW_PRIVATE_KEY_SIZE];
- typedef uint8_t nrf_crypto_ecc_secp384r1_raw_public_key_t
- [NRF_CRYPTO_ECC_SECP384R1_RAW_PUBLIC_KEY_SIZE];
- extern const nrf_crypto_ecc_curve_info_t g_nrf_crypto_ecc_secp384r1_curve_info;
- typedef nrf_crypto_backend_secp521r1_key_pair_generate_context_t
- nrf_crypto_ecc_secp521r1_key_pair_generate_context_t;
- typedef nrf_crypto_backend_secp521r1_public_key_calculate_context_t
- nrf_crypto_ecc_secp521r1_public_key_calculate_context_t;
- typedef nrf_crypto_backend_secp521r1_private_key_t
- nrf_crypto_ecc_secp521r1_private_key_t;
- typedef nrf_crypto_backend_secp521r1_public_key_t
- nrf_crypto_ecc_secp521r1_public_key_t;
- typedef uint8_t nrf_crypto_ecc_secp521r1_raw_private_key_t
- [NRF_CRYPTO_ECC_SECP521R1_RAW_PRIVATE_KEY_SIZE];
- typedef uint8_t nrf_crypto_ecc_secp521r1_raw_public_key_t
- [NRF_CRYPTO_ECC_SECP521R1_RAW_PUBLIC_KEY_SIZE];
- extern const nrf_crypto_ecc_curve_info_t g_nrf_crypto_ecc_secp521r1_curve_info;
- typedef nrf_crypto_backend_secp160k1_key_pair_generate_context_t
- nrf_crypto_ecc_secp160k1_key_pair_generate_context_t;
- typedef nrf_crypto_backend_secp160k1_public_key_calculate_context_t
- nrf_crypto_ecc_secp160k1_public_key_calculate_context_t;
- typedef nrf_crypto_backend_secp160k1_private_key_t
- nrf_crypto_ecc_secp160k1_private_key_t;
- typedef nrf_crypto_backend_secp160k1_public_key_t
- nrf_crypto_ecc_secp160k1_public_key_t;
- typedef uint8_t nrf_crypto_ecc_secp160k1_raw_private_key_t
- [NRF_CRYPTO_ECC_SECP160K1_RAW_PRIVATE_KEY_SIZE];
- typedef uint8_t nrf_crypto_ecc_secp160k1_raw_public_key_t
- [NRF_CRYPTO_ECC_SECP160K1_RAW_PUBLIC_KEY_SIZE];
- extern const nrf_crypto_ecc_curve_info_t g_nrf_crypto_ecc_secp160k1_curve_info;
- typedef nrf_crypto_backend_secp192k1_key_pair_generate_context_t
- nrf_crypto_ecc_secp192k1_key_pair_generate_context_t;
- typedef nrf_crypto_backend_secp192k1_public_key_calculate_context_t
- nrf_crypto_ecc_secp192k1_public_key_calculate_context_t;
- typedef nrf_crypto_backend_secp192k1_private_key_t
- nrf_crypto_ecc_secp192k1_private_key_t;
- typedef nrf_crypto_backend_secp192k1_public_key_t
- nrf_crypto_ecc_secp192k1_public_key_t;
- typedef uint8_t nrf_crypto_ecc_secp192k1_raw_private_key_t
- [NRF_CRYPTO_ECC_SECP192K1_RAW_PRIVATE_KEY_SIZE];
- typedef uint8_t nrf_crypto_ecc_secp192k1_raw_public_key_t
- [NRF_CRYPTO_ECC_SECP192K1_RAW_PUBLIC_KEY_SIZE];
- extern const nrf_crypto_ecc_curve_info_t g_nrf_crypto_ecc_secp192k1_curve_info;
- typedef nrf_crypto_backend_secp224k1_key_pair_generate_context_t
- nrf_crypto_ecc_secp224k1_key_pair_generate_context_t;
- typedef nrf_crypto_backend_secp224k1_public_key_calculate_context_t
- nrf_crypto_ecc_secp224k1_public_key_calculate_context_t;
- typedef nrf_crypto_backend_secp224k1_private_key_t
- nrf_crypto_ecc_secp224k1_private_key_t;
- typedef nrf_crypto_backend_secp224k1_public_key_t
- nrf_crypto_ecc_secp224k1_public_key_t;
- typedef uint8_t nrf_crypto_ecc_secp224k1_raw_private_key_t
- [NRF_CRYPTO_ECC_SECP224K1_RAW_PRIVATE_KEY_SIZE];
- typedef uint8_t nrf_crypto_ecc_secp224k1_raw_public_key_t
- [NRF_CRYPTO_ECC_SECP224K1_RAW_PUBLIC_KEY_SIZE];
- extern const nrf_crypto_ecc_curve_info_t g_nrf_crypto_ecc_secp224k1_curve_info;
- typedef nrf_crypto_backend_secp256k1_key_pair_generate_context_t
- nrf_crypto_ecc_secp256k1_key_pair_generate_context_t;
- typedef nrf_crypto_backend_secp256k1_public_key_calculate_context_t
- nrf_crypto_ecc_secp256k1_public_key_calculate_context_t;
- typedef nrf_crypto_backend_secp256k1_private_key_t
- nrf_crypto_ecc_secp256k1_private_key_t;
- typedef nrf_crypto_backend_secp256k1_public_key_t
- nrf_crypto_ecc_secp256k1_public_key_t;
- typedef uint8_t nrf_crypto_ecc_secp256k1_raw_private_key_t
- [NRF_CRYPTO_ECC_SECP256K1_RAW_PRIVATE_KEY_SIZE];
- typedef uint8_t nrf_crypto_ecc_secp256k1_raw_public_key_t
- [NRF_CRYPTO_ECC_SECP256K1_RAW_PUBLIC_KEY_SIZE];
- extern const nrf_crypto_ecc_curve_info_t g_nrf_crypto_ecc_secp256k1_curve_info;
- typedef nrf_crypto_backend_bp256r1_key_pair_generate_context_t
- nrf_crypto_ecc_bp256r1_key_pair_generate_context_t;
- typedef nrf_crypto_backend_bp256r1_public_key_calculate_context_t
- nrf_crypto_ecc_bp256r1_public_key_calculate_context_t;
- typedef nrf_crypto_backend_bp256r1_private_key_t
- nrf_crypto_ecc_bp256r1_private_key_t;
- typedef nrf_crypto_backend_bp256r1_public_key_t
- nrf_crypto_ecc_bp256r1_public_key_t;
- typedef uint8_t nrf_crypto_ecc_bp256r1_raw_private_key_t
- [NRF_CRYPTO_ECC_BP256R1_RAW_PRIVATE_KEY_SIZE];
- typedef uint8_t nrf_crypto_ecc_bp256r1_raw_public_key_t
- [NRF_CRYPTO_ECC_BP256R1_RAW_PUBLIC_KEY_SIZE];
- extern const nrf_crypto_ecc_curve_info_t g_nrf_crypto_ecc_bp256r1_curve_info;
- typedef nrf_crypto_backend_bp384r1_key_pair_generate_context_t
- nrf_crypto_ecc_bp384r1_key_pair_generate_context_t;
- typedef nrf_crypto_backend_bp384r1_public_key_calculate_context_t
- nrf_crypto_ecc_bp384r1_public_key_calculate_context_t;
- typedef nrf_crypto_backend_bp384r1_private_key_t
- nrf_crypto_ecc_bp384r1_private_key_t;
- typedef nrf_crypto_backend_bp384r1_public_key_t
- nrf_crypto_ecc_bp384r1_public_key_t;
- typedef uint8_t nrf_crypto_ecc_bp384r1_raw_private_key_t
- [NRF_CRYPTO_ECC_BP384R1_RAW_PRIVATE_KEY_SIZE];
- typedef uint8_t nrf_crypto_ecc_bp384r1_raw_public_key_t
- [NRF_CRYPTO_ECC_BP384R1_RAW_PUBLIC_KEY_SIZE];
- extern const nrf_crypto_ecc_curve_info_t g_nrf_crypto_ecc_bp384r1_curve_info;
- typedef nrf_crypto_backend_bp512r1_key_pair_generate_context_t
- nrf_crypto_ecc_bp512r1_key_pair_generate_context_t;
- typedef nrf_crypto_backend_bp512r1_public_key_calculate_context_t
- nrf_crypto_ecc_bp512r1_public_key_calculate_context_t;
- typedef nrf_crypto_backend_bp512r1_private_key_t
- nrf_crypto_ecc_bp512r1_private_key_t;
- typedef nrf_crypto_backend_bp512r1_public_key_t
- nrf_crypto_ecc_bp512r1_public_key_t;
- typedef uint8_t nrf_crypto_ecc_bp512r1_raw_private_key_t
- [NRF_CRYPTO_ECC_BP512R1_RAW_PRIVATE_KEY_SIZE];
- typedef uint8_t nrf_crypto_ecc_bp512r1_raw_public_key_t
- [NRF_CRYPTO_ECC_BP512R1_RAW_PUBLIC_KEY_SIZE];
- extern const nrf_crypto_ecc_curve_info_t g_nrf_crypto_ecc_bp512r1_curve_info;
- typedef nrf_crypto_backend_curve25519_key_pair_generate_context_t
- nrf_crypto_ecc_curve25519_key_pair_generate_context_t;
- typedef nrf_crypto_backend_curve25519_public_key_calculate_context_t
- nrf_crypto_ecc_curve25519_public_key_calculate_context_t;
- typedef nrf_crypto_backend_curve25519_private_key_t
- nrf_crypto_ecc_curve25519_private_key_t;
- typedef nrf_crypto_backend_curve25519_public_key_t
- nrf_crypto_ecc_curve25519_public_key_t;
- typedef uint8_t nrf_crypto_ecc_curve25519_raw_private_key_t
- [NRF_CRYPTO_ECC_CURVE25519_RAW_PRIVATE_KEY_SIZE];
- typedef uint8_t nrf_crypto_ecc_curve25519_raw_public_key_t
- [NRF_CRYPTO_ECC_CURVE25519_RAW_PUBLIC_KEY_SIZE];
- extern const nrf_crypto_ecc_curve_info_t g_nrf_crypto_ecc_curve25519_curve_info;
- typedef nrf_crypto_backend_ed25519_key_pair_generate_context_t
- nrf_crypto_ecc_ed25519_key_pair_generate_context_t;
- typedef nrf_crypto_backend_ed25519_public_key_calculate_context_t
- nrf_crypto_ecc_ed25519_public_key_calculate_context_t;
- typedef nrf_crypto_backend_ed25519_private_key_t
- nrf_crypto_ecc_ed25519_private_key_t;
- typedef nrf_crypto_backend_ed25519_public_key_t
- nrf_crypto_ecc_ed25519_public_key_t;
- typedef uint8_t nrf_crypto_ecc_ed25519_raw_private_key_t
- [NRF_CRYPTO_ECC_ED25519_RAW_PRIVATE_KEY_SIZE];
- typedef uint8_t nrf_crypto_ecc_ed25519_raw_public_key_t
- [NRF_CRYPTO_ECC_ED25519_RAW_PUBLIC_KEY_SIZE];
- extern const nrf_crypto_ecc_curve_info_t g_nrf_crypto_ecc_ed25519_curve_info;
- typedef uint8_t nrf_crypto_ecc_raw_private_key_t[NRF_CRYPTO_ECC_RAW_PRIVATE_KEY_MAX_SIZE];
- typedef uint8_t nrf_crypto_ecc_raw_public_key_t [NRF_CRYPTO_ECC_RAW_PUBLIC_KEY_MAX_SIZE];
- typedef union
- {
- nrf_crypto_ecc_secp160r1_key_pair_generate_context_t context_secp160r1;
- nrf_crypto_ecc_secp160r2_key_pair_generate_context_t context_secp160r2;
- nrf_crypto_ecc_secp192r1_key_pair_generate_context_t context_secp192r1;
- nrf_crypto_ecc_secp224r1_key_pair_generate_context_t context_secp224r1;
- nrf_crypto_ecc_secp256r1_key_pair_generate_context_t context_secp256r1;
- nrf_crypto_ecc_secp384r1_key_pair_generate_context_t context_secp384r1;
- nrf_crypto_ecc_secp521r1_key_pair_generate_context_t context_secp521r1;
- nrf_crypto_ecc_secp160k1_key_pair_generate_context_t context_secp160k1;
- nrf_crypto_ecc_secp192k1_key_pair_generate_context_t context_secp192k1;
- nrf_crypto_ecc_secp224k1_key_pair_generate_context_t context_secp224k1;
- nrf_crypto_ecc_secp256k1_key_pair_generate_context_t context_secp256k1;
- nrf_crypto_ecc_bp256r1_key_pair_generate_context_t context_bp256r1;
- nrf_crypto_ecc_bp384r1_key_pair_generate_context_t context_bp384r1;
- nrf_crypto_ecc_bp512r1_key_pair_generate_context_t context_bp512r1;
- nrf_crypto_ecc_curve25519_key_pair_generate_context_t context_curve25519;
- nrf_crypto_ecc_ed25519_key_pair_generate_context_t context_ed25519;
- } nrf_crypto_ecc_key_pair_generate_context_t;
- typedef union
- {
- nrf_crypto_ecc_secp160r1_public_key_calculate_context_t context_secp160r1;
- nrf_crypto_ecc_secp160r2_public_key_calculate_context_t context_secp160r2;
- nrf_crypto_ecc_secp192r1_public_key_calculate_context_t context_secp192r1;
- nrf_crypto_ecc_secp224r1_public_key_calculate_context_t context_secp224r1;
- nrf_crypto_ecc_secp256r1_public_key_calculate_context_t context_secp256r1;
- nrf_crypto_ecc_secp384r1_public_key_calculate_context_t context_secp384r1;
- nrf_crypto_ecc_secp521r1_public_key_calculate_context_t context_secp521r1;
- nrf_crypto_ecc_secp160k1_public_key_calculate_context_t context_secp160k1;
- nrf_crypto_ecc_secp192k1_public_key_calculate_context_t context_secp192k1;
- nrf_crypto_ecc_secp224k1_public_key_calculate_context_t context_secp224k1;
- nrf_crypto_ecc_secp256k1_public_key_calculate_context_t context_secp256k1;
- nrf_crypto_ecc_bp256r1_public_key_calculate_context_t context_bp256r1;
- nrf_crypto_ecc_bp384r1_public_key_calculate_context_t context_bp384r1;
- nrf_crypto_ecc_bp512r1_public_key_calculate_context_t context_bp512r1;
- nrf_crypto_ecc_curve25519_public_key_calculate_context_t context_curve25519;
- nrf_crypto_ecc_ed25519_public_key_calculate_context_t context_ed25519;
- } nrf_crypto_ecc_public_key_calculate_context_t;
- typedef union
- {
- nrf_crypto_ecc_secp160r1_private_key_t key_secp160r1;
- nrf_crypto_ecc_secp160r2_private_key_t key_secp160r2;
- nrf_crypto_ecc_secp192r1_private_key_t key_secp192r1;
- nrf_crypto_ecc_secp224r1_private_key_t key_secp224r1;
- nrf_crypto_ecc_secp256r1_private_key_t key_secp256r1;
- nrf_crypto_ecc_secp384r1_private_key_t key_secp384r1;
- nrf_crypto_ecc_secp521r1_private_key_t key_secp521r1;
- nrf_crypto_ecc_secp160k1_private_key_t key_secp160k1;
- nrf_crypto_ecc_secp192k1_private_key_t key_secp192k1;
- nrf_crypto_ecc_secp224k1_private_key_t key_secp224k1;
- nrf_crypto_ecc_secp256k1_private_key_t key_secp256k1;
- nrf_crypto_ecc_bp256r1_private_key_t key_bp256r1;
- nrf_crypto_ecc_bp384r1_private_key_t key_bp384r1;
- nrf_crypto_ecc_bp512r1_private_key_t key_bp512r1;
- nrf_crypto_ecc_curve25519_private_key_t key_curve25519;
- nrf_crypto_ecc_ed25519_private_key_t key_ed25519;
- } nrf_crypto_ecc_private_key_t;
- typedef union
- {
- nrf_crypto_ecc_secp160r1_public_key_t key_secp160r1;
- nrf_crypto_ecc_secp160r2_public_key_t key_secp160r2;
- nrf_crypto_ecc_secp192r1_public_key_t key_secp192r1;
- nrf_crypto_ecc_secp224r1_public_key_t key_secp224r1;
- nrf_crypto_ecc_secp256r1_public_key_t key_secp256r1;
- nrf_crypto_ecc_secp384r1_public_key_t key_secp384r1;
- nrf_crypto_ecc_secp521r1_public_key_t key_secp521r1;
- nrf_crypto_ecc_secp160k1_public_key_t key_secp160k1;
- nrf_crypto_ecc_secp192k1_public_key_t key_secp192k1;
- nrf_crypto_ecc_secp224k1_public_key_t key_secp224k1;
- nrf_crypto_ecc_secp256k1_public_key_t key_secp256k1;
- nrf_crypto_ecc_bp256r1_public_key_t key_bp256r1;
- nrf_crypto_ecc_bp384r1_public_key_t key_bp384r1;
- nrf_crypto_ecc_bp512r1_public_key_t key_bp512r1;
- nrf_crypto_ecc_curve25519_public_key_t key_curve25519;
- nrf_crypto_ecc_ed25519_public_key_t key_ed25519;
- } nrf_crypto_ecc_public_key_t;
- ret_code_t nrf_crypto_ecc_key_pair_generate(
- nrf_crypto_ecc_key_pair_generate_context_t * p_context,
- nrf_crypto_ecc_curve_info_t const * p_curve_info,
- nrf_crypto_ecc_private_key_t * p_private_key,
- nrf_crypto_ecc_public_key_t * p_public_key);
- ret_code_t nrf_crypto_ecc_public_key_calculate(
- nrf_crypto_ecc_public_key_calculate_context_t * p_context,
- nrf_crypto_ecc_private_key_t const * p_private_key,
- nrf_crypto_ecc_public_key_t * p_public_key);
- ret_code_t nrf_crypto_ecc_private_key_from_raw(
- nrf_crypto_ecc_curve_info_t const * p_curve_info,
- nrf_crypto_ecc_private_key_t * p_private_key,
- uint8_t const * p_raw_data,
- size_t raw_data_size);
- ret_code_t nrf_crypto_ecc_private_key_to_raw(
- nrf_crypto_ecc_private_key_t const * p_private_key,
- uint8_t * p_raw_data,
- size_t * p_raw_data_size);
- ret_code_t nrf_crypto_ecc_public_key_from_raw(
- nrf_crypto_ecc_curve_info_t const * p_curve_info,
- nrf_crypto_ecc_public_key_t * p_public_key,
- uint8_t const * p_raw_data,
- size_t raw_data_size);
- ret_code_t nrf_crypto_ecc_public_key_to_raw(
- nrf_crypto_ecc_public_key_t const * p_public_key,
- uint8_t * p_raw_data,
- size_t * p_raw_data_size);
- ret_code_t nrf_crypto_ecc_private_key_free(
- nrf_crypto_ecc_private_key_t * p_private_key);
- ret_code_t nrf_crypto_ecc_public_key_free(
- nrf_crypto_ecc_public_key_t * p_public_key);
- ret_code_t nrf_crypto_ecc_curve_info_get(
- void const * p_key,
- nrf_crypto_ecc_curve_info_t const ** pp_curve_info);
- ret_code_t nrf_crypto_ecc_byte_order_invert(
- nrf_crypto_ecc_curve_info_t const * p_curve_info,
- uint8_t const * p_raw_input,
- uint8_t * p_raw_output,
- size_t raw_data_size);
- #ifdef __cplusplus
- }
- #endif
- #endif
|