68 #define ATCA_MSG_SIZE_NONCE (55)
75 #define ATCA_MSG_SIZE_MAC (88)
86 #define ATCA_MSG_SIZE_HMAC_INNER (152)
92 #define ATCA_MSG_SIZE_HMAC (96)
96 #define ATCA_MSG_SIZE_GEN_DIG (96)
100 #define ATCA_MSG_SIZE_DERIVE_KEY (96)
104 #define ATCA_MSG_SIZE_DERIVE_KEY_MAC (39)
107 #define ATCA_MSG_SIZE_ENCRYPT_MAC (96)
110 #define ATCA_MSG_SIZE_PRIVWRITE_MAC (96)
112 #define ATCA_COMMAND_HEADER_SIZE ( 4)
113 #define ATCA_GENDIG_ZEROS_SIZE (25)
114 #define ATCA_PRIVWRITE_MAC_ZEROS_SIZE (21)
115 #define ATCA_PLAIN_TEXT_SIZE (36)
116 #define ATCA_DERIVE_KEY_ZEROS_SIZE (25)
117 #define ATCA_OTP_SIZE_8 ( 8)
118 #define ATCA_OTP_SIZE_3 ( 3)
119 #define ATCA_SN_SIZE_4 ( 4)
120 #define ATCA_SN_SIZE_2 ( 2)
121 #define ATCA_OTHER_DATA_SIZE_2 ( 2)
122 #define ATCA_OTHER_DATA_SIZE_3 ( 3)
123 #define ATCA_OTHER_DATA_SIZE_4 ( 4)
124 #define HMAC_BLOCK_SIZE (64)
129 #define ATCA_SN_0 (0x01)
130 #define ATCA_SN_1 (0x23)
131 #define ATCA_SN_8 (0xEE)
137 #define MAC_MODE_USE_TEMPKEY_MASK ((uint8_t)0x03)
141 #define ATAC_STANDARD_KEY_SIZE 32
Input / output parameters for function atca_include_data().
Definition: atca_host.h:177
struct atca_temp_key * temp_key
Definition: atca_host.h:305
ATCA_STATUS atcah_derive_key(struct atca_derive_key_in_out *param)
This function combines a key with the TempKey.
Definition: atca_host.c:763
Input/output parameters for function atca_hmac().
Definition: atca_host.h:252
ATCA_STATUS atcah_derive_key_mac(struct atca_derive_key_mac_in_out *param)
This function calculates the input MAC for a DeriveKey command.
Definition: atca_host.c:835
const uint8_t * key
[in] Pointer to 32-byte key used to generate MAC digest.
Definition: atca_host.h:227
struct atca_temp_key atca_temp_key_t
Definition: atca_host.h:298
uint8_t * target_key
[out] Pointer to 32-byte TargetKey.
Definition: atca_host.h:325
unsigned int source_flag
The source of the randomness in TempKey: 0=Rand, 1=Input.
Definition: atca_host.h:161
ATCA_STATUS atcah_decrypt(struct atca_decrypt_in_out *param)
This function decrypts 32-byte encrypted data received with the Read command.
Definition: atca_host.c:989
unsigned int valid
Indicates if the information in TempKey is valid.
Definition: atca_host.h:164
#define ATAC_STANDARD_KEY_SIZE
Definition: atca_host.h:141
uint8_t mode
Definition: atca_host.h:181
uint16_t address
[in] Address parameter used in Write command (Param2).
Definition: atca_host.h:364
uint8_t * client_resp
[out] Pointer to 32-byte ClientResp to be used in CheckMac command.
Definition: atca_host.h:407
uint8_t * auth_mac
Definition: atca_host.h:304
struct atca_temp_key * temp_key
[in,out] Pointer to TempKey structure.
Definition: atca_host.h:200
struct atca_gen_dig_in_out atca_gen_dig_in_out_t
Input/output parameters for function atca_gen_dig().
Definition: atca_host.h:274
const uint8_t * sn
[in] pointer to serial number data
Definition: atca_host.h:180
unsigned int gen_data
Indicates if TempKey has been generated by GenDig using Data zone.
Definition: atca_host.h:162
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 calcu...
Definition: atca_host.c:895
const uint8_t * public_key
Definition: atca_host.h:426
ATCA_STATUS atcah_hmac(struct atca_hmac_in_out *param)
This function generates an HMAC / SHA-256 hash of a key and other information.
Definition: atca_host.c:333
const uint8_t * parent_key
[in] Pointer to 32-byte ParentKey. Set equal to target_key if Roll Key operation is intended...
Definition: atca_host.h:324
uint8_t * rand_out
[in] Pointer to 32-byte RandOut data from Nonce command.
Definition: atca_host.h:199
uint8_t random
[in] Random parameter used in DeriveKey command (Param1).
Definition: atca_host.h:322
Input/output parameters for function atca_derive_key_mac().
Definition: atca_host.h:341
struct atca_temp_key * temp_key
Definition: atca_host.h:427
ATCA_STATUS atcah_privwrite_auth_mac(struct atca_write_mac_in_out *param)
This function calculates the input MAC for the PrivWrite command.
Definition: atca_host.c:667
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.
Definition: atca_host.c:1034
unsigned int check_flag
Not used in the library.
Definition: atca_host.h:163
Input/output parameters for function atca_nonce().
Definition: atca_host.h:196
ATCA_STATUS atcah_gen_dig(struct atca_gen_dig_in_out *param)
This function combines the current TempKey with a stored value.
Definition: atca_host.c:443
Input/output parameters for function atca_check_mac().
Definition: atca_host.h:401
struct atca_nonce_in_out atca_nonce_in_out_t
const uint8_t * stored_value
[in] Pointer to 32-byte stored value, can be a data slot, OTP page, configuration zone...
Definition: atca_host.h:277
const uint8_t * input_data
Definition: atca_host.h:302
Input/output parameters for function atca_verify().
Definition: atca_host.h:423
uint8_t mode
[in] Mode parameter used in Nonce command (Param1).
Definition: atca_host.h:197
uint8_t zone
[in] Zone parameter used in GenDig command (Param1).
Definition: atca_host.h:275
Input/output parameters for function atca_derive_key().
Definition: atca_host.h:321
uint8_t * atcah_include_data(struct atca_include_data_in_out *param)
This function copies otp and sn data into a command buffer.
Definition: atca_host.c:51
const uint8_t * other_data
[in] Pointer to 13-byte OtherData that will be used in CheckMac command.
Definition: atca_host.h:404
ATCA_STATUS atcah_write_auth_mac(struct atca_write_mac_in_out *param)
This function calculates the input MAC for the PrivWrite command.
Definition: atca_host.c:592
Input/output parameters for function atca_encrypt().
Definition: atca_host.h:362
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.
Definition: atca_host.c:158
const uint8_t * otp
[in] pointer to one-time-programming data
Definition: atca_host.h:179
const uint8_t * challenge
[in] Pointer to 32-byte Challenge data used in MAC command, depending on mode.
Definition: atca_host.h:226
Input/output parameters for function atca_mac().
Definition: atca_host.h:223
uint16_t target_key_id
[in] KeyID to be derived, TargetKey parameter used in DeriveKey command (Param2). ...
Definition: atca_host.h:323
uint8_t * crypto_data
[in,out] Pointer to 32-byte data. Input cleartext data, output encrypted data to Write command (Value...
Definition: atca_host.h:365
const uint8_t * num_in
[in] Pointer to 20-byte NumIn data used in Nonce command.
Definition: atca_host.h:198
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.
Definition: atca_host.c:249
const uint8_t * encryption_key
Definition: atca_host.h:301
Single aggregation point for all CryptoAuthLib header files.
ATCA_STATUS atcah_gen_mac(struct atca_gen_dig_in_out *param)
This function combines the session key with a plain text.
Definition: atca_host.c:518
uint8_t * p_temp
[out] pointer to output buffer
Definition: atca_host.h:178
const uint8_t * signature
Definition: atca_host.h:425
ATCA_STATUS
Definition: atca_status.h:55
uint8_t * response
[out] Pointer to 32-byte SHA-256 digest (MAC).
Definition: atca_host.h:230
uint8_t * encrypted_data
Definition: atca_host.h:303
uint8_t value[ATAC_STANDARD_KEY_SIZE]
The value of TempKey. Nonce (from nonce command) or Digest (from GenDig command)
Definition: atca_host.h:159
uint16_t key_id
Definition: atca_host.h:300
Structure to hold TempKey fields.
Definition: atca_host.h:158
Input/output parameters for function atca_decrypt().
Definition: atca_host.h:378
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 r...
Definition: atca_host.c:102
unsigned int key_id
If TempKey was generated by GenDig (see the GenData and CheckFlag bits), these bits indicate which ke...
Definition: atca_host.h:160
const uint8_t * password
[in] Pointer to 32-byte password that will be verified against Key[KeyID] in the Device.
Definition: atca_host.h:403
struct atca_write_mac_in_out atca_write_mac_in_out_t
uint16_t curve_type
[in] Curve type used in Verify command (Param2).
Definition: atca_host.h:424
uint8_t * mac
[out] Pointer to 32-byte Mac.
Definition: atca_host.h:345
uint8_t zone
Definition: atca_host.h:299