27#include <wolfssl/wolfcrypt/settings.h>
30#if defined(WOLFSSL_ATECC508A) || defined(WOLFSSL_ATECC_PKCB)
32 #define SHA_BLOCK_SIZE SHA_BLOCK_SIZE_REMAP
33 #include <cryptoauthlib.h>
38#define ATECC_KEY_SIZE (32)
39#define ATECC_PUBKEY_SIZE (ATECC_KEY_SIZE*2)
40#define ATECC_SIG_SIZE (ATECC_KEY_SIZE*2)
42#define ATECC_MAX_SLOT (0x8)
44#define ATECC_INVALID_SLOT (0xFF)
47#ifndef ATECC_SLOT_AUTH_PRIV
48#define ATECC_SLOT_AUTH_PRIV (0x0)
51#ifndef ATECC_SLOT_ECDHE_PRIV
52#define ATECC_SLOT_ECDHE_PRIV (0x2)
55#ifndef ATECC_SLOT_I2C_ENC
56#define ATECC_SLOT_I2C_ENC (0x04)
59#ifndef ATECC_SLOT_ENC_PARENT
60#define ATECC_SLOT_ENC_PARENT (0x7)
73void atmel_finish(
void);
74int atmel_get_random_number(uint32_t count, uint8_t* rand_out);
75#ifndef ATMEL_GET_RANDOM_BLOCK_DEFINED
76 int atmel_get_random_block(
unsigned char* output,
unsigned int sz);
77 #define ATMEL_GET_RANDOM_BLOCK_DEFINED
79long atmel_get_curr_time_and_date(
long* tm);
81#ifdef WOLFSSL_ATECC508A
91int atmel_ecc_alloc(
int slotType);
92void atmel_ecc_free(
int slotId);
94typedef int (*atmel_slot_alloc_cb)(int);
95typedef void (*atmel_slot_dealloc_cb)(int);
96int atmel_set_slot_allocator(atmel_slot_alloc_cb alloc,
97 atmel_slot_dealloc_cb dealloc);
99int atmel_ecc_translate_err(
int status);
100int atmel_get_rev_info(word32* revision);
101void atmel_show_rev_info(
void);
105#ifndef ATECC_GET_ENC_KEY
106 #define ATECC_GET_ENC_KEY(enckey, keysize) atmel_get_enc_key_default((enckey), (keysize))
108int atmel_get_enc_key_default(
byte* enckey, word16 keysize);
109int atmel_ecc_create_pms(
int slotId,
const uint8_t* peerKey, uint8_t* pms);
110int atmel_ecc_create_key(
int slotId,
byte* peerKey);
111int atmel_ecc_sign(
int slotId,
const byte* message,
byte* signature);
112int atmel_ecc_verify(
const byte* message,
const byte* signature,
113 const byte* pubkey,
int* verified);
117#ifdef HAVE_PK_CALLBACKS
118 int atcatls_create_key_cb(
struct WOLFSSL* ssl,
struct ecc_key* key,
unsigned int keySz,
119 int ecc_curve,
void* ctx);
120 int atcatls_create_pms_cb(
struct WOLFSSL* ssl,
struct ecc_key* otherKey,
121 unsigned char* pubKeyDer, word32* pubKeySz,
122 unsigned char* out, word32* outlen,
123 int side,
void* ctx);
124 int atcatls_sign_certificate_cb(
struct WOLFSSL* ssl,
const byte* in,
unsigned int inSz,
125 byte* out, word32* outSz,
const byte* key,
unsigned int keySz,
void* ctx);
126 int atcatls_verify_signature_cb(
struct WOLFSSL* ssl,
const byte* sig,
unsigned int sigSz,
127 const byte* hash,
unsigned int hashSz,
const byte* key,
unsigned int keySz,
128 int* result,
void* ctx);
130 int atcatls_set_callbacks(
struct WOLFSSL_CTX* ctx);
131 int atcatls_set_callback_ctx(
struct WOLFSSL* ssl,
void* user_ctx);
Definition internal.h:2595
Definition internal.h:3849