CryptoAuthLib
Atmel CryptoAuthentication Library
|
Definitions and Prototypes for ATCA Utility Functions. More...
#include "cryptoauthlib.h"
Go to the source code of this file.
Data Structures | |
struct | atca_temp_key |
Structure to hold TempKey fields. More... | |
struct | atca_include_data_in_out |
Input / output parameters for function atca_include_data(). More... | |
struct | atca_nonce_in_out |
Input/output parameters for function atca_nonce(). More... | |
struct | atca_mac_in_out |
Input/output parameters for function atca_mac(). More... | |
struct | atca_hmac_in_out |
Input/output parameters for function atca_hmac(). More... | |
struct | atca_gen_dig_in_out |
Input/output parameters for function atca_gen_dig(). More... | |
struct | atca_write_mac_in_out |
Input/output parameters for function atca_auth_mac(). More... | |
struct | atca_derive_key_in_out |
Input/output parameters for function atca_derive_key(). More... | |
struct | atca_derive_key_mac_in_out |
Input/output parameters for function atca_derive_key_mac(). More... | |
struct | atca_encrypt_in_out |
Input/output parameters for function atca_encrypt(). More... | |
struct | atca_decrypt_in_out |
Input/output parameters for function atca_decrypt(). More... | |
struct | atca_check_mac_in_out |
Input/output parameters for function atca_check_mac(). More... | |
struct | atca_verify_in_out |
Input/output parameters for function atca_verify(). More... | |
Macros | |
#define | ATAC_STANDARD_KEY_SIZE 32 |
Definitions for ATECC Message Sizes to Calculate a SHA256 Hash | |
"||" is the concatenation operator. The number in braces is the length of the hash input value in bytes. | |
#define | ATCA_MSG_SIZE_NONCE (55) |
RandOut{32} || NumIn{20} || OpCode{1} || Mode{1} || LSB of Param2{1}. More... | |
#define | ATCA_MSG_SIZE_MAC (88) |
(Key or TempKey){32} || (Challenge or TempKey){32} || OpCode{1} || Mode{1} || Param2{2} || (OTP0_7 or 0){8} || (OTP8_10 or 0){3} || SN8{1} || (SN4_7 or 0){4} || SN0_1{2} || (SN2_3 or 0){2} More... | |
#define | ATCA_MSG_SIZE_HMAC_INNER (152) |
HMAC = sha(HMAC outer || HMAC inner) HMAC inner = sha((zero-padded key ^ ipad) || message) = sha256( (Key{32} || 0x36{32}) || 0{32} || Key{32} || OpCode{1} || Mode{1} || KeyId{2} || OTP0_7{8} || OTP8_10{3} || SN8{1} || SN4_7{4} || SN0_1{2} || SN2_3{2} ){32}. More... | |
#define | ATCA_MSG_SIZE_HMAC (96) |
HMAC = sha(HMAC outer || HMAC inner) = sha256((Key{32} || 0x5C{32}) || HMAC inner{32}) More... | |
#define | ATCA_MSG_SIZE_GEN_DIG (96) |
KeyId{32} || OpCode{1} || Param1{1} || Param2{2} || SN8{1} || SN0_1{2} || 0{25} || TempKey{32}. More... | |
#define | ATCA_MSG_SIZE_DERIVE_KEY (96) |
KeyId{32} || OpCode{1} || Param1{1} || Param2{2} || SN8{1} || SN0_1{2} || 0{25} || TempKey{32}. More... | |
#define | ATCA_MSG_SIZE_DERIVE_KEY_MAC (39) |
KeyId{32} || OpCode{1} || Param1{1} || Param2{2} || SN8{1} || SN0_1{2}. More... | |
#define | ATCA_MSG_SIZE_ENCRYPT_MAC (96) |
KeyId{32} || OpCode{1} || Param1{1} || Param2{2}|| SN8{1} || SN0_1{2} || 0{25} || TempKey{32}. More... | |
#define | ATCA_MSG_SIZE_PRIVWRITE_MAC (96) |
KeyId{32} || OpCode{1} || Param1{1} || Param2{2}|| SN8{1} || SN0_1{2} || 0{21} || PlainText{36}. More... | |
#define | ATCA_COMMAND_HEADER_SIZE ( 4) |
#define | ATCA_GENDIG_ZEROS_SIZE (25) |
#define | ATCA_PRIVWRITE_MAC_ZEROS_SIZE (21) |
#define | ATCA_PLAIN_TEXT_SIZE (36) |
#define | ATCA_DERIVE_KEY_ZEROS_SIZE (25) |
#define | ATCA_OTP_SIZE_8 ( 8) |
#define | ATCA_OTP_SIZE_3 ( 3) |
#define | ATCA_SN_SIZE_4 ( 4) |
#define | ATCA_SN_SIZE_2 ( 2) |
#define | ATCA_OTHER_DATA_SIZE_2 ( 2) |
#define | ATCA_OTHER_DATA_SIZE_3 ( 3) |
#define | ATCA_OTHER_DATA_SIZE_4 ( 4) |
#define | HMAC_BLOCK_SIZE (64) |
Fixed Byte Values of Serial Number (SN[0:1] and SN[8]) | |
#define | ATCA_SN_0 (0x01) |
#define | ATCA_SN_1 (0x23) |
#define | ATCA_SN_8 (0xEE) |
Definition for TempKey Mode | |
#define | MAC_MODE_USE_TEMPKEY_MASK ((uint8_t)0x03) |
mode mask for MAC command when using TempKey More... | |
Typedefs | |
typedef struct atca_temp_key | atca_temp_key_t |
typedef struct atca_nonce_in_out | atca_nonce_in_out_t |
typedef struct atca_gen_dig_in_out | atca_gen_dig_in_out_t |
typedef struct atca_write_mac_in_out | atca_write_mac_in_out_t |
Functions | |
ATCA_STATUS | atcah_nonce (struct atca_nonce_in_out *param) |
This function calculates a 32-byte nonce based on a 20-byte input value (param->num_in) and 32-byte random number (param->rand_out). More... | |
ATCA_STATUS | atcah_mac (struct atca_mac_in_out *param) |
This function generates an SHA-256 digest (MAC) of a key, challenge, and other information. More... | |
ATCA_STATUS | atcah_check_mac (struct atca_check_mac_in_out *param) |
This function calculates a SHA-256 digest (MAC) of a password and other information, to be verified using the CheckMac device command. More... | |
ATCA_STATUS | atcah_hmac (struct atca_hmac_in_out *param) |
This function generates an HMAC / SHA-256 hash of a key and other information. More... | |
ATCA_STATUS | atcah_gen_dig (struct atca_gen_dig_in_out *param) |
This function combines the current TempKey with a stored value. More... | |
ATCA_STATUS | atcah_gen_mac (struct atca_gen_dig_in_out *param) |
This function combines the session key with a plain text. More... | |
ATCA_STATUS | atcah_write_auth_mac (struct atca_write_mac_in_out *param) |
This function calculates the input MAC for the PrivWrite command. More... | |
ATCA_STATUS | atcah_privwrite_auth_mac (struct atca_write_mac_in_out *param) |
This function calculates the input MAC for the PrivWrite command. More... | |
ATCA_STATUS | atcah_derive_key (struct atca_derive_key_in_out *param) |
This function combines a key with the TempKey. More... | |
ATCA_STATUS | atcah_derive_key_mac (struct atca_derive_key_mac_in_out *param) |
This function calculates the input MAC for a DeriveKey command. More... | |
ATCA_STATUS | atcah_encrypt (struct atca_encrypt_in_out *param) |
This function encrypts 32-byte plain text data to be written using Write opcode, and optionally calculates input MAC. More... | |
ATCA_STATUS | atcah_decrypt (struct atca_decrypt_in_out *param) |
This function decrypts 32-byte encrypted data received with the Read command. More... | |
ATCA_STATUS | atcah_sha256 (int32_t len, const uint8_t *message, uint8_t *digest) |
This function creates a SHA256 digest on a little-endian system. More... | |
uint8_t * | atcah_include_data (struct atca_include_data_in_out *param) |
This function copies otp and sn data into a command buffer. More... | |
Definitions and Prototypes for ATCA Utility Functions.