#include "sha204_comm.h"
Data Structures | |
struct | sha204_check_mac_parameters |
This structure contains the parameters for the sha204m_check_mac function. More... | |
struct | sha204_command_parameters |
This structure contains the parameters for the sha204m_execute function. More... | |
struct | sha204_derive_key_parameters |
This structure contains the parameters for the sha204m_derive_key function. More... | |
struct | sha204_dev_rev_parameters |
This structure contains the parameters for the sha204m_dev_rev function. More... | |
struct | sha204_gen_dig_parameters |
This structure contains the parameters for the sha204m_gen_dig function. More... | |
struct | sha204_hmac_parameters |
This structure contains the parameters for the sha204m_hmac function. More... | |
struct | sha204_lock_parameters |
This structure contains the parameters for the sha204m_lock function. More... | |
struct | sha204_mac_parameters |
This structure contains the parameters for the sha204m_mac function. More... | |
struct | sha204_nonce_parameters |
This structure contains the parameters for the sha204m_nonce function. More... | |
struct | sha204_pause_parameters |
This structure contains the parameters for the sha204m_pause function. More... | |
struct | sha204_random_parameters |
This structure contains the parameters for the sha204m_random function. More... | |
struct | sha204_read_parameters |
This structure contains the parameters for the sha204m_read function. More... | |
struct | sha204_update_extra_parameters |
This structure contains the parameters for the sha204m_update_extra function. More... | |
struct | sha204_write_parameters |
This structure contains the parameters for the sha204m_write function. More... | |
Macros | |
#define | CHECKMAC_CLIENT_CHALLENGE_IDX SHA204_DATA_IDX |
CheckMAC command index for client challenge. More... | |
#define | CHECKMAC_CLIENT_CHALLENGE_SIZE (32) |
CheckMAC size of client challenge. More... | |
#define | CHECKMAC_CLIENT_COMMAND_SIZE ( 4) |
CheckMAC size of client command header size inside "other data". More... | |
#define | CHECKMAC_CLIENT_RESPONSE_IDX (37) |
CheckMAC command index for client response. More... | |
#define | CHECKMAC_CLIENT_RESPONSE_SIZE (32) |
CheckMAC size of client response. More... | |
#define | CHECKMAC_COUNT (84) |
CheckMAC command packet size. More... | |
#define | CHECKMAC_DATA_IDX (69) |
CheckMAC command index for other data. More... | |
#define | CHECKMAC_DELAY (12) |
CheckMAC typical command delay. More... | |
#define | CHECKMAC_EXEC_MAX (38) |
CheckMAC maximum execution time. More... | |
#define | CHECKMAC_KEYID_IDX SHA204_PARAM2_IDX |
CheckMAC command index for key identifier. More... | |
#define | CHECKMAC_MODE_IDX SHA204_PARAM1_IDX |
CheckMAC command index for mode. More... | |
#define | CHECKMAC_MODE_MASK ((uint8_t) 0x27) |
CheckMAC mode bits 3, 4, 6, and 7 are 0. More... | |
#define | CHECKMAC_OTHER_DATA_SIZE (13) |
CheckMAC size of "other data". More... | |
#define | CHECKMAC_RSP_SIZE SHA204_RSP_SIZE_MIN |
response size of DeriveKey command More... | |
#define | DERIVE_KEY_COUNT_LARGE (39) |
DeriveKey command packet size with MAC. More... | |
#define | DERIVE_KEY_COUNT_SMALL SHA204_CMD_SIZE_MIN |
DeriveKey command packet size without MAC. More... | |
#define | DERIVE_KEY_DELAY (14) |
DeriveKey typical command delay. More... | |
#define | DERIVE_KEY_EXEC_MAX (62) |
DeriveKey maximum execution time. More... | |
#define | DERIVE_KEY_MAC_IDX SHA204_DATA_IDX |
DeriveKey command index for optional MAC. More... | |
#define | DERIVE_KEY_MAC_SIZE (32) |
DeriveKey MAC size. More... | |
#define | DERIVE_KEY_RANDOM_FLAG ((uint8_t) 4) |
DeriveKey 1. parameter. More... | |
#define | DERIVE_KEY_RANDOM_IDX SHA204_PARAM1_IDX |
DeriveKey command index for random bit. More... | |
#define | DERIVE_KEY_RSP_SIZE SHA204_RSP_SIZE_MIN |
response size of DeriveKey command More... | |
#define | DERIVE_KEY_TARGETKEY_IDX SHA204_PARAM2_IDX |
DeriveKey command index for target slot. More... | |
#define | DEVREV_COUNT SHA204_CMD_SIZE_MIN |
DevRev command packet size. More... | |
#define | DEVREV_DELAY ( 1) |
DevRev typical command delay. More... | |
#define | DEVREV_EXEC_MAX ( 2) |
DevRev maximum execution time. More... | |
#define | DEVREV_PARAM1_IDX SHA204_PARAM1_IDX |
DevRev command index for 1. parameter (ignored) More... | |
#define | DEVREV_PARAM2_IDX SHA204_PARAM2_IDX |
DevRev command index for 2. parameter (ignored) More... | |
#define | DEVREV_RSP_SIZE SHA204_RSP_SIZE_VAL |
response size of DevRev command returns 4 bytes More... | |
#define | GENDIG_COUNT SHA204_CMD_SIZE_MIN |
GenDig command packet size without "other data". More... | |
#define | GENDIG_COUNT_DATA (11) |
GenDig command packet size with "other data". More... | |
#define | GENDIG_DATA_IDX SHA204_DATA_IDX |
GenDig command index for optional data. More... | |
#define | GENDIG_DELAY (11) |
GenDig typical command delay. More... | |
#define | GENDIG_EXEC_MAX (43) |
GenDig maximum execution time. More... | |
#define | GENDIG_KEYID_IDX SHA204_PARAM2_IDX |
GenDig command index for key id. More... | |
#define | GENDIG_OTHER_DATA_SIZE (4) |
GenDig size of "other data". More... | |
#define | GENDIG_RSP_SIZE SHA204_RSP_SIZE_MIN |
response size of GenDig command More... | |
#define | GENDIG_ZONE_DATA ((uint8_t) 2) |
GenDig zone id data. More... | |
#define | GENDIG_ZONE_IDX SHA204_PARAM1_IDX |
GenDig command index for zone. More... | |
#define | GENDIG_ZONE_OTP ((uint8_t) 1) |
GenDig zone id OTP. More... | |
#define | HMAC_COUNT SHA204_CMD_SIZE_MIN |
HMAC command packet size. More... | |
#define | HMAC_DELAY (27) |
HMAC typical command delay. More... | |
#define | HMAC_EXEC_MAX (69) |
HMAC maximum execution time. More... | |
#define | HMAC_KEYID_IDX SHA204_PARAM2_IDX |
HMAC command index for key id. More... | |
#define | HMAC_MODE_IDX SHA204_PARAM1_IDX |
HMAC command index for mode. More... | |
#define | HMAC_MODE_MASK ((uint8_t) 0x74) |
HMAC mode bits 0, 1, 3, and 7 are 0. More... | |
#define | HMAC_RSP_SIZE SHA204_RSP_SIZE_MAX |
response size of HMAC command More... | |
#define | LOCK_COUNT SHA204_CMD_SIZE_MIN |
Lock command packet size. More... | |
#define | LOCK_DELAY ( 5) |
Lock typical command delay. More... | |
#define | LOCK_EXEC_MAX (24) |
Lock maximum execution time. More... | |
#define | LOCK_RSP_SIZE SHA204_RSP_SIZE_MIN |
response size of Lock command More... | |
#define | LOCK_SUMMARY_IDX SHA204_PARAM2_IDX |
Lock command index for summary. More... | |
#define | LOCK_ZONE_IDX SHA204_PARAM1_IDX |
Lock command index for zone. More... | |
#define | LOCK_ZONE_MASK (0x81) |
Lock parameter 1 bits 2 to 6 are 0. More... | |
#define | LOCK_ZONE_NO_CONFIG ((uint8_t) 0x01) |
Lock zone is OTP or Data. More... | |
#define | LOCK_ZONE_NO_CRC ((uint8_t) 0x80) |
Lock command: Ignore summary. More... | |
#define | MAC_CHALLENGE_IDX SHA204_DATA_IDX |
MAC command index for optional challenge. More... | |
#define | MAC_CHALLENGE_SIZE (32) |
MAC size of challenge. More... | |
#define | MAC_COUNT_LONG (39) |
MAC command packet size with challenge. More... | |
#define | MAC_COUNT_SHORT SHA204_CMD_SIZE_MIN |
MAC command packet size without challenge. More... | |
#define | MAC_DELAY (12) |
MAC typical command delay. More... | |
#define | MAC_EXEC_MAX (35) |
MAC maximum execution time. More... | |
#define | MAC_KEYID_IDX SHA204_PARAM2_IDX |
MAC command index for key id. More... | |
#define | MAC_MODE_BLOCK1_TEMPKEY ((uint8_t) 0x02) |
MAC mode bit 1: first SHA block from TempKey. More... | |
#define | MAC_MODE_BLOCK2_TEMPKEY ((uint8_t) 0x01) |
MAC mode bit 0: second SHA block from TempKey. More... | |
#define | MAC_MODE_IDX SHA204_PARAM1_IDX |
MAC command index for mode. More... | |
#define | MAC_MODE_INCLUDE_OTP_64 ((uint8_t) 0x20) |
MAC mode bit 5: include first 64 OTP bits. More... | |
#define | MAC_MODE_INCLUDE_OTP_88 ((uint8_t) 0x10) |
MAC mode bit 4: include first 88 OTP bits. More... | |
#define | MAC_MODE_INCLUDE_SN ((uint8_t) 0x50) |
MAC mode bit 6: include serial number. More... | |
#define | MAC_MODE_MASK ((uint8_t) 0x77) |
MAC mode bits 3 and 7 are 0. More... | |
#define | MAC_MODE_PASSTHROUGH ((uint8_t) 0x07) |
MAC mode bit 0-2: pass-through mode. More... | |
#define | MAC_MODE_SOURCE_FLAG_MATCH ((uint8_t) 0x04) |
MAC mode bit 2: match TempKey.SourceFlag. More... | |
#define | MAC_RSP_SIZE SHA204_RSP_SIZE_MAX |
response size of MAC command More... | |
#define | NONCE_COUNT_LONG (39) |
Nonce command packet size for 32 bytes of data. More... | |
#define | NONCE_COUNT_SHORT (27) |
Nonce command packet size for 20 bytes of data. More... | |
#define | NONCE_DELAY (22) |
Nonce typical command delay. More... | |
#define | NONCE_EXEC_MAX (60) |
Nonce maximum execution time. More... | |
#define | NONCE_INPUT_IDX SHA204_DATA_IDX |
Nonce command index for input data. More... | |
#define | NONCE_MODE_IDX SHA204_PARAM1_IDX |
Nonce command index for mode. More... | |
#define | NONCE_MODE_INVALID ((uint8_t) 0x02) |
Nonce mode 2 is invalid. More... | |
#define | NONCE_MODE_MASK ((uint8_t) 3) |
Nonce mode bits 2 to 7 are 0. More... | |
#define | NONCE_MODE_NO_SEED_UPDATE ((uint8_t) 0x01) |
Nonce mode: do not update seed. More... | |
#define | NONCE_MODE_PASSTHROUGH ((uint8_t) 0x03) |
Nonce mode: pass-through. More... | |
#define | NONCE_MODE_SEED_UPDATE ((uint8_t) 0x00) |
Nonce mode: update seed. More... | |
#define | NONCE_NUMIN_SIZE (20) |
Nonce data length. More... | |
#define | NONCE_NUMIN_SIZE_PASSTHROUGH (32) |
Nonce data length in pass-through mode (mode = 3) More... | |
#define | NONCE_PARAM2_IDX SHA204_PARAM2_IDX |
Nonce command index for 2. parameter. More... | |
#define | NONCE_RSP_SIZE_LONG SHA204_RSP_SIZE_MAX |
response size of Nonce command More... | |
#define | NONCE_RSP_SIZE_SHORT SHA204_RSP_SIZE_MIN |
response size of Nonce command with mode[0:1] = 3 More... | |
#define | PAUSE_COUNT SHA204_CMD_SIZE_MIN |
Pause command packet size. More... | |
#define | PAUSE_DELAY ( 1) |
Pause typical command delay. More... | |
#define | PAUSE_EXEC_MAX ( 2) |
Pause maximum execution time. More... | |
#define | PAUSE_PARAM2_IDX SHA204_PARAM2_IDX |
Pause command index for 2. parameter. More... | |
#define | PAUSE_RSP_SIZE SHA204_RSP_SIZE_MIN |
response size of Pause command More... | |
#define | PAUSE_SELECT_IDX SHA204_PARAM1_IDX |
Pause command index for Selector. More... | |
#define | RANDOM_COUNT SHA204_CMD_SIZE_MIN |
Random command packet size. More... | |
#define | RANDOM_DELAY (11) |
Random typical command delay. More... | |
#define | RANDOM_EXEC_MAX (50) |
Random maximum execution time. More... | |
#define | RANDOM_MODE_IDX SHA204_PARAM1_IDX |
Random command index for mode. More... | |
#define | RANDOM_NO_SEED_UPDATE ((uint8_t) 0x01) |
Random mode for no seed update. More... | |
#define | RANDOM_PARAM2_IDX SHA204_PARAM2_IDX |
Random command index for 2. parameter. More... | |
#define | RANDOM_RSP_SIZE SHA204_RSP_SIZE_MAX |
response size of Random command More... | |
#define | RANDOM_SEED_UPDATE ((uint8_t) 0x00) |
Random mode for automatic seed update. More... | |
#define | READ_32_RSP_SIZE SHA204_RSP_SIZE_MAX |
response size of Read command when reading 32 bytes More... | |
#define | READ_4_RSP_SIZE SHA204_RSP_SIZE_VAL |
response size of Read command when reading 4 bytes More... | |
#define | READ_ADDR_IDX SHA204_PARAM2_IDX |
Read command index for address. More... | |
#define | READ_COUNT SHA204_CMD_SIZE_MIN |
Read command packet size. More... | |
#define | READ_DELAY ( 1) |
Read typical command delay. More... | |
#define | READ_EXEC_MAX ( 4) |
Read maximum execution time. More... | |
#define | READ_ZONE_IDX SHA204_PARAM1_IDX |
Read command index for zone. More... | |
#define | READ_ZONE_MASK ((uint8_t) 0x83) |
Read zone bits 2 to 6 are 0. More... | |
#define | READ_ZONE_MODE_32_BYTES ((uint8_t) 0x80) |
Read mode: 32 bytes. More... | |
#define | SHA204_ADDRESS_MASK ( 0x007F) |
Address bit 7 to 15 are always 0. More... | |
#define | SHA204_ADDRESS_MASK_CONFIG ( 0x001F) |
Address bits 5 to 7 are 0 for Configuration zone. More... | |
#define | SHA204_ADDRESS_MASK_OTP ( 0x000F) |
Address bits 4 to 7 are 0 for OTP zone. More... | |
#define | SHA204_CHECKMAC ((uint8_t) 0x28) |
CheckMac command op-code. More... | |
#define | SHA204_COUNT_IDX ( 0) |
command packet index for count More... | |
#define | SHA204_DATA_IDX ( 5) |
command packet index for second parameter More... | |
#define | SHA204_DERIVE_KEY ((uint8_t) 0x1C) |
DeriveKey command op-code. More... | |
#define | SHA204_DEVREV ((uint8_t) 0x30) |
DevRev command op-code. More... | |
#define | SHA204_GENDIG ((uint8_t) 0x15) |
GenDig command op-code. More... | |
#define | SHA204_HMAC ((uint8_t) 0x11) |
HMAC command op-code. More... | |
#define | SHA204_KEY_ID_MAX ((uint8_t) 15) |
maximum value for key id More... | |
#define | SHA204_LOCK ((uint8_t) 0x17) |
Lock command op-code. More... | |
#define | SHA204_MAC ((uint8_t) 0x08) |
MAC command op-code. More... | |
#define | SHA204_NONCE ((uint8_t) 0x16) |
Nonce command op-code. More... | |
#define | SHA204_OPCODE_IDX ( 1) |
command packet index for op-code More... | |
#define | SHA204_OTP_BLOCK_MAX ((uint8_t) 1) |
maximum value for OTP block More... | |
#define | SHA204_PARAM1_IDX ( 2) |
command packet index for first parameter More... | |
#define | SHA204_PARAM2_IDX ( 3) |
command packet index for second parameter More... | |
#define | SHA204_PAUSE ((uint8_t) 0x01) |
Pause command op-code. More... | |
#define | SHA204_RANDOM ((uint8_t) 0x1B) |
Random command op-code. More... | |
#define | SHA204_READ ((uint8_t) 0x02) |
Read command op-code. More... | |
#define | SHA204_RSP_SIZE_VAL ((uint8_t) 7) |
size of response packet containing four bytes of data More... | |
#define | SHA204_UPDATE_EXTRA ((uint8_t) 0x20) |
UpdateExtra command op-code. More... | |
#define | SHA204_WRITE ((uint8_t) 0x12) |
Write command op-code. More... | |
#define | SHA204_ZONE_ACCESS_32 ((uint8_t) 32) |
Read or write 32 bytes. More... | |
#define | SHA204_ZONE_ACCESS_4 ((uint8_t) 4) |
Read or write 4 bytes. More... | |
#define | SHA204_ZONE_CONFIG ((uint8_t) 0x00) |
Configuration zone. More... | |
#define | SHA204_ZONE_COUNT_FLAG ((uint8_t) 0x80) |
Zone bit 7 set: Access 32 bytes, otherwise 4 bytes. More... | |
#define | SHA204_ZONE_DATA ((uint8_t) 0x02) |
Data zone. More... | |
#define | SHA204_ZONE_MASK ((uint8_t) 0x03) |
Zone mask. More... | |
#define | SHA204_ZONE_OTP ((uint8_t) 0x01) |
OTP (One Time Programming) zone. More... | |
#define | UPDATE_CONFIG_BYTE_86 ((uint8_t) 0x01) |
UpdateExtra mode: update Config byte 86. More... | |
#define | UPDATE_COUNT SHA204_CMD_SIZE_MIN |
UpdateExtra command packet size. More... | |
#define | UPDATE_DELAY ( 8) |
UpdateExtra typical command delay. More... | |
#define | UPDATE_EXEC_MAX (12) |
UpdateExtra maximum execution time. More... | |
#define | UPDATE_MODE_IDX SHA204_PARAM1_IDX |
UpdateExtra command index for mode. More... | |
#define | UPDATE_RSP_SIZE SHA204_RSP_SIZE_MIN |
response size of UpdateExtra command More... | |
#define | UPDATE_VALUE_IDX SHA204_PARAM2_IDX |
UpdateExtra command index for new value. More... | |
#define | WRITE_ADDR_IDX SHA204_PARAM2_IDX |
Write command index for address. More... | |
#define | WRITE_COUNT_LONG (39) |
Write command packet size with long data and no MAC. More... | |
#define | WRITE_COUNT_LONG_MAC (71) |
Write command packet size with long data and MAC. More... | |
#define | WRITE_COUNT_SHORT (11) |
Write command packet size with short data and no MAC. More... | |
#define | WRITE_COUNT_SHORT_MAC (43) |
Write command packet size with short data and MAC. More... | |
#define | WRITE_DELAY ( 4) |
Write typical command delay. More... | |
#define | WRITE_EXEC_MAX (42) |
Write maximum execution time. More... | |
#define | WRITE_MAC_SIZE (32) |
Write MAC size. More... | |
#define | WRITE_MAC_VL_IDX (37) |
Write command index for MAC following long data. More... | |
#define | WRITE_MAC_VS_IDX ( 9) |
Write command index for MAC following short data. More... | |
#define | WRITE_RSP_SIZE SHA204_RSP_SIZE_MIN |
response size of Write command More... | |
#define | WRITE_VALUE_IDX SHA204_DATA_IDX |
Write command index for data. More... | |
#define | WRITE_ZONE_IDX SHA204_PARAM1_IDX |
Write command index for zone. More... | |
#define | WRITE_ZONE_MASK ((uint8_t) 0xC1) |
Write zone bits 2 to 5 are 0. More... | |
#define | WRITE_ZONE_WITH_MAC ((uint8_t) 0x40) |
Write zone bit 6: write encrypted with MAC. More... | |
Functions | |
uint8_t | sha204m_check_mac (struct sha204_check_mac_parameters *args) |
This function sends a CheckMAC command to the device and receives its response. More... | |
uint8_t | sha204m_derive_key (struct sha204_derive_key_parameters *args) |
This function sends a DeriveKey command to the device and receives its response. More... | |
uint8_t | sha204m_dev_rev (struct sha204_dev_rev_parameters *args) |
This function sends a DevRev command to the device and receives its response. More... | |
uint8_t | sha204m_execute (struct sha204_command_parameters *args) |
This function creates a command packet, sends it, and receives its response. More... | |
uint8_t | sha204m_gen_dig (struct sha204_gen_dig_parameters *args) |
This function sends a GenDig command to the device and receives its response. More... | |
uint8_t | sha204m_hmac (struct sha204_hmac_parameters *args) |
This function sends an HMAC command to the device and receives its response. More... | |
uint8_t | sha204m_lock (struct sha204_lock_parameters *args) |
This function sends a Lock command to the device and receives its response. More... | |
uint8_t | sha204m_mac (struct sha204_mac_parameters *args) |
This function sends a MAC command to the device and receives its response. More... | |
uint8_t | sha204m_nonce (struct sha204_nonce_parameters *args) |
This function sends a Nonce command to the device and receives its response. More... | |
uint8_t | sha204m_pause (struct sha204_pause_parameters *args) |
This function sends a Pause command to SWI devices and receives a response from the selected device. More... | |
uint8_t | sha204m_random (struct sha204_random_parameters *args) |
This function sends a Random command to the device and receives its response. More... | |
uint8_t | sha204m_read (struct sha204_read_parameters *args) |
This function sends a Read command to the device and receives its response. More... | |
uint8_t | sha204m_update_extra (struct sha204_update_extra_parameters *args) |
This function sends an UpdateExtra command to the device and receives its response. More... | |
uint8_t | sha204m_write (struct sha204_write_parameters *args) |
This function sends a Write command to the device and receives its response. More... | |
#define CHECKMAC_CLIENT_CHALLENGE_IDX SHA204_DATA_IDX |
CheckMAC command index for client challenge.
Referenced by sha204m_check_mac().
#define CHECKMAC_CLIENT_CHALLENGE_SIZE (32) |
CheckMAC size of client challenge.
Referenced by sha204m_check_mac().
#define CHECKMAC_CLIENT_COMMAND_SIZE ( 4) |
CheckMAC size of client command header size inside "other data".
Referenced by main().
#define CHECKMAC_CLIENT_RESPONSE_IDX (37) |
CheckMAC command index for client response.
Referenced by sha204m_check_mac().
#define CHECKMAC_CLIENT_RESPONSE_SIZE (32) |
CheckMAC size of client response.
Referenced by sha204m_check_mac().
#define CHECKMAC_COUNT (84) |
CheckMAC command packet size.
Referenced by main(), and sha204m_check_mac().
#define CHECKMAC_DATA_IDX (69) |
CheckMAC command index for other data.
Referenced by sha204m_check_mac().
#define CHECKMAC_DELAY (12) |
CheckMAC typical command delay.
Referenced by sha204m_check_mac(), and sha204m_execute().
#define CHECKMAC_EXEC_MAX (38) |
CheckMAC maximum execution time.
Referenced by sha204m_check_mac(), and sha204m_execute().
#define CHECKMAC_KEYID_IDX SHA204_PARAM2_IDX |
CheckMAC command index for key identifier.
Referenced by sha204m_check_mac().
#define CHECKMAC_MODE_IDX SHA204_PARAM1_IDX |
CheckMAC command index for mode.
Referenced by sha204m_check_mac().
#define CHECKMAC_MODE_MASK ((uint8_t) 0x27) |
CheckMAC mode bits 3, 4, 6, and 7 are 0.
Referenced by sha204m_check_mac(), and sha204m_check_parameters().
#define CHECKMAC_OTHER_DATA_SIZE (13) |
CheckMAC size of "other data".
Referenced by main(), and sha204m_check_mac().
#define CHECKMAC_RSP_SIZE SHA204_RSP_SIZE_MIN |
response size of DeriveKey command
Referenced by sha204m_check_mac(), and sha204m_execute().
#define DERIVE_KEY_COUNT_LARGE (39) |
DeriveKey command packet size with MAC.
Referenced by sha204m_derive_key().
#define DERIVE_KEY_COUNT_SMALL SHA204_CMD_SIZE_MIN |
DeriveKey command packet size without MAC.
Referenced by sha204m_derive_key().
#define DERIVE_KEY_DELAY (14) |
DeriveKey typical command delay.
Referenced by sha204m_derive_key(), and sha204m_execute().
#define DERIVE_KEY_EXEC_MAX (62) |
DeriveKey maximum execution time.
Referenced by sha204m_derive_key(), and sha204m_execute().
#define DERIVE_KEY_MAC_IDX SHA204_DATA_IDX |
DeriveKey command index for optional MAC.
Referenced by sha204m_derive_key().
#define DERIVE_KEY_MAC_SIZE (32) |
DeriveKey MAC size.
Referenced by sha204m_derive_key().
#define DERIVE_KEY_RANDOM_FLAG ((uint8_t) 4) |
DeriveKey 1. parameter.
Referenced by sha204m_check_parameters(), and sha204m_derive_key().
#define DERIVE_KEY_RANDOM_IDX SHA204_PARAM1_IDX |
DeriveKey command index for random bit.
Referenced by sha204m_derive_key().
#define DERIVE_KEY_RSP_SIZE SHA204_RSP_SIZE_MIN |
response size of DeriveKey command
Referenced by sha204m_derive_key(), and sha204m_execute().
#define DERIVE_KEY_TARGETKEY_IDX SHA204_PARAM2_IDX |
DeriveKey command index for target slot.
Referenced by sha204m_derive_key().
#define DEVREV_COUNT SHA204_CMD_SIZE_MIN |
DevRev command packet size.
Referenced by sha204m_dev_rev(), and test_sha204_wakeup().
#define DEVREV_DELAY ( 1) |
DevRev typical command delay.
Referenced by sha204m_dev_rev(), and sha204m_execute().
#define DEVREV_EXEC_MAX ( 2) |
DevRev maximum execution time.
Referenced by sha204m_dev_rev(), and sha204m_execute().
#define DEVREV_PARAM1_IDX SHA204_PARAM1_IDX |
DevRev command index for 1. parameter (ignored)
Referenced by sha204m_dev_rev().
#define DEVREV_PARAM2_IDX SHA204_PARAM2_IDX |
DevRev command index for 2. parameter (ignored)
Referenced by sha204m_dev_rev().
#define DEVREV_RSP_SIZE SHA204_RSP_SIZE_VAL |
response size of DevRev command returns 4 bytes
Referenced by main(), sha204m_dev_rev(), sha204m_execute(), and test_sha204_wakeup().
#define GENDIG_COUNT SHA204_CMD_SIZE_MIN |
GenDig command packet size without "other data".
Referenced by sha204m_gen_dig().
#define GENDIG_COUNT_DATA (11) |
GenDig command packet size with "other data".
Referenced by sha204m_gen_dig().
#define GENDIG_DATA_IDX SHA204_DATA_IDX |
GenDig command index for optional data.
Referenced by sha204m_gen_dig().
#define GENDIG_DELAY (11) |
GenDig typical command delay.
Referenced by sha204m_execute(), and sha204m_gen_dig().
#define GENDIG_EXEC_MAX (43) |
GenDig maximum execution time.
Referenced by sha204m_execute(), and sha204m_gen_dig().
#define GENDIG_KEYID_IDX SHA204_PARAM2_IDX |
GenDig command index for key id.
Referenced by sha204m_gen_dig().
#define GENDIG_OTHER_DATA_SIZE (4) |
GenDig size of "other data".
Referenced by sha204m_gen_dig().
#define GENDIG_RSP_SIZE SHA204_RSP_SIZE_MIN |
response size of GenDig command
Referenced by sha204m_execute(), and sha204m_gen_dig().
#define GENDIG_ZONE_DATA ((uint8_t) 2) |
GenDig zone id data.
Referenced by sha204m_check_parameters(), and sha204m_gen_dig().
#define GENDIG_ZONE_IDX SHA204_PARAM1_IDX |
GenDig command index for zone.
Referenced by sha204m_gen_dig().
#define GENDIG_ZONE_OTP ((uint8_t) 1) |
GenDig zone id OTP.
Referenced by sha204m_check_parameters(), and sha204m_gen_dig().
#define HMAC_COUNT SHA204_CMD_SIZE_MIN |
HMAC command packet size.
Referenced by sha204m_hmac().
#define HMAC_DELAY (27) |
HMAC typical command delay.
Referenced by sha204m_execute(), and sha204m_hmac().
#define HMAC_EXEC_MAX (69) |
HMAC maximum execution time.
Referenced by sha204m_execute(), and sha204m_hmac().
#define HMAC_KEYID_IDX SHA204_PARAM2_IDX |
HMAC command index for key id.
Referenced by sha204m_hmac().
#define HMAC_MODE_IDX SHA204_PARAM1_IDX |
HMAC command index for mode.
Referenced by sha204m_hmac().
#define HMAC_MODE_MASK ((uint8_t) 0x74) |
HMAC mode bits 0, 1, 3, and 7 are 0.
Referenced by sha204m_check_parameters(), and sha204m_hmac().
#define HMAC_RSP_SIZE SHA204_RSP_SIZE_MAX |
response size of HMAC command
Referenced by sha204m_execute(), and sha204m_hmac().
#define LOCK_COUNT SHA204_CMD_SIZE_MIN |
Lock command packet size.
Referenced by sha204m_lock().
#define LOCK_DELAY ( 5) |
Lock typical command delay.
Referenced by sha204m_execute(), and sha204m_lock().
#define LOCK_EXEC_MAX (24) |
Lock maximum execution time.
Referenced by sha204m_execute(), and sha204m_lock().
#define LOCK_RSP_SIZE SHA204_RSP_SIZE_MIN |
response size of Lock command
Referenced by sha204m_execute(), and sha204m_lock().
#define LOCK_SUMMARY_IDX SHA204_PARAM2_IDX |
Lock command index for summary.
Referenced by sha204m_lock().
#define LOCK_ZONE_IDX SHA204_PARAM1_IDX |
Lock command index for zone.
Referenced by sha204m_lock().
#define LOCK_ZONE_MASK (0x81) |
Lock parameter 1 bits 2 to 6 are 0.
Referenced by sha204m_check_parameters(), and sha204m_lock().
#define LOCK_ZONE_NO_CONFIG ((uint8_t) 0x01) |
Lock zone is OTP or Data.
#define LOCK_ZONE_NO_CRC ((uint8_t) 0x80) |
Lock command: Ignore summary.
Referenced by sha204m_check_parameters(), and sha204m_lock().
#define MAC_CHALLENGE_IDX SHA204_DATA_IDX |
MAC command index for optional challenge.
Referenced by sha204m_mac().
#define MAC_CHALLENGE_SIZE (32) |
MAC size of challenge.
Referenced by main(), and sha204m_mac().
#define MAC_COUNT_LONG (39) |
MAC command packet size with challenge.
Referenced by sha204m_mac().
#define MAC_COUNT_SHORT SHA204_CMD_SIZE_MIN |
MAC command packet size without challenge.
Referenced by sha204m_mac().
#define MAC_DELAY (12) |
MAC typical command delay.
Referenced by sha204m_execute(), and sha204m_mac().
#define MAC_EXEC_MAX (35) |
MAC maximum execution time.
Referenced by sha204m_execute(), and sha204m_mac().
#define MAC_KEYID_IDX SHA204_PARAM2_IDX |
MAC command index for key id.
Referenced by sha204m_mac().
#define MAC_MODE_BLOCK1_TEMPKEY ((uint8_t) 0x02) |
MAC mode bit 1: first SHA block from TempKey.
#define MAC_MODE_BLOCK2_TEMPKEY ((uint8_t) 0x01) |
MAC mode bit 0: second SHA block from TempKey.
Referenced by sha204m_check_parameters(), and sha204m_mac().
#define MAC_MODE_IDX SHA204_PARAM1_IDX |
MAC command index for mode.
Referenced by sha204m_mac().
#define MAC_MODE_INCLUDE_OTP_64 ((uint8_t) 0x20) |
MAC mode bit 5: include first 64 OTP bits.
#define MAC_MODE_INCLUDE_OTP_88 ((uint8_t) 0x10) |
MAC mode bit 4: include first 88 OTP bits.
#define MAC_MODE_INCLUDE_SN ((uint8_t) 0x50) |
MAC mode bit 6: include serial number.
#define MAC_MODE_MASK ((uint8_t) 0x77) |
MAC mode bits 3 and 7 are 0.
Referenced by sha204m_check_parameters(), and sha204m_mac().
#define MAC_MODE_PASSTHROUGH ((uint8_t) 0x07) |
MAC mode bit 0-2: pass-through mode.
#define MAC_MODE_SOURCE_FLAG_MATCH ((uint8_t) 0x04) |
MAC mode bit 2: match TempKey.SourceFlag.
#define MAC_RSP_SIZE SHA204_RSP_SIZE_MAX |
response size of MAC command
Referenced by sha204m_execute(), and sha204m_mac().
#define NONCE_COUNT_LONG (39) |
Nonce command packet size for 32 bytes of data.
Referenced by sha204m_nonce().
#define NONCE_COUNT_SHORT (27) |
Nonce command packet size for 20 bytes of data.
Referenced by sha204m_nonce().
#define NONCE_DELAY (22) |
Nonce typical command delay.
Referenced by sha204m_execute(), and sha204m_nonce().
#define NONCE_EXEC_MAX (60) |
Nonce maximum execution time.
Referenced by sha204m_execute(), and sha204m_nonce().
#define NONCE_INPUT_IDX SHA204_DATA_IDX |
Nonce command index for input data.
Referenced by sha204m_nonce().
#define NONCE_MODE_IDX SHA204_PARAM1_IDX |
Nonce command index for mode.
Referenced by sha204m_nonce().
#define NONCE_MODE_INVALID ((uint8_t) 0x02) |
Nonce mode 2 is invalid.
Referenced by sha204m_check_parameters(), and sha204m_nonce().
#define NONCE_MODE_MASK ((uint8_t) 3) |
Nonce mode bits 2 to 7 are 0.
#define NONCE_MODE_NO_SEED_UPDATE ((uint8_t) 0x01) |
Nonce mode: do not update seed.
#define NONCE_MODE_PASSTHROUGH ((uint8_t) 0x03) |
Nonce mode: pass-through.
Referenced by sha204m_check_parameters(), sha204m_execute(), and sha204m_nonce().
#define NONCE_MODE_SEED_UPDATE ((uint8_t) 0x00) |
Nonce mode: update seed.
#define NONCE_NUMIN_SIZE (20) |
Nonce data length.
Referenced by sha204m_nonce().
#define NONCE_NUMIN_SIZE_PASSTHROUGH (32) |
Nonce data length in pass-through mode (mode = 3)
Referenced by sha204m_nonce().
#define NONCE_PARAM2_IDX SHA204_PARAM2_IDX |
Nonce command index for 2. parameter.
Referenced by sha204m_nonce().
#define NONCE_RSP_SIZE_LONG SHA204_RSP_SIZE_MAX |
response size of Nonce command
Referenced by sha204m_execute(), and sha204m_nonce().
#define NONCE_RSP_SIZE_SHORT SHA204_RSP_SIZE_MIN |
response size of Nonce command with mode[0:1] = 3
Referenced by sha204m_execute(), and sha204m_nonce().
#define PAUSE_COUNT SHA204_CMD_SIZE_MIN |
Pause command packet size.
Referenced by sha204m_pause().
#define PAUSE_DELAY ( 1) |
Pause typical command delay.
Referenced by sha204m_execute(), and sha204m_pause().
#define PAUSE_EXEC_MAX ( 2) |
Pause maximum execution time.
Referenced by sha204m_execute(), and sha204m_pause().
#define PAUSE_PARAM2_IDX SHA204_PARAM2_IDX |
Pause command index for 2. parameter.
Referenced by sha204m_pause().
#define PAUSE_RSP_SIZE SHA204_RSP_SIZE_MIN |
response size of Pause command
Referenced by sha204m_execute(), and sha204m_pause().
#define PAUSE_SELECT_IDX SHA204_PARAM1_IDX |
Pause command index for Selector.
Referenced by sha204m_pause().
#define RANDOM_COUNT SHA204_CMD_SIZE_MIN |
Random command packet size.
Referenced by sha204m_random().
#define RANDOM_DELAY (11) |
Random typical command delay.
Referenced by sha204m_execute(), and sha204m_random().
#define RANDOM_EXEC_MAX (50) |
Random maximum execution time.
Referenced by sha204m_execute(), and sha204m_random().
#define RANDOM_MODE_IDX SHA204_PARAM1_IDX |
Random command index for mode.
Referenced by sha204m_random().
#define RANDOM_NO_SEED_UPDATE ((uint8_t) 0x01) |
Random mode for no seed update.
Referenced by sha204m_check_parameters(), and sha204m_random().
#define RANDOM_PARAM2_IDX SHA204_PARAM2_IDX |
Random command index for 2. parameter.
Referenced by sha204m_random().
#define RANDOM_RSP_SIZE SHA204_RSP_SIZE_MAX |
response size of Random command
Referenced by sha204m_execute(), and sha204m_random().
#define RANDOM_SEED_UPDATE ((uint8_t) 0x00) |
Random mode for automatic seed update.
Referenced by sha204m_random().
#define READ_32_RSP_SIZE SHA204_RSP_SIZE_MAX |
response size of Read command when reading 32 bytes
Referenced by sha204m_execute(), and sha204m_read().
#define READ_4_RSP_SIZE SHA204_RSP_SIZE_VAL |
response size of Read command when reading 4 bytes
Referenced by sha204m_execute(), sha204m_read(), and test_all_devices().
#define READ_ADDR_IDX SHA204_PARAM2_IDX |
Read command index for address.
Referenced by sha204m_read().
#define READ_COUNT SHA204_CMD_SIZE_MIN |
Read command packet size.
Referenced by sha204m_read(), and test_all_devices().
#define READ_DELAY ( 1) |
Read typical command delay.
Referenced by sha204m_execute(), and sha204m_read().
#define READ_EXEC_MAX ( 4) |
Read maximum execution time.
Referenced by sha204m_execute(), and sha204m_read().
#define READ_ZONE_IDX SHA204_PARAM1_IDX |
Read command index for zone.
Referenced by sha204m_read().
#define READ_ZONE_MASK ((uint8_t) 0x83) |
Read zone bits 2 to 6 are 0.
Referenced by sha204m_check_parameters(), and sha204m_read().
#define READ_ZONE_MODE_32_BYTES ((uint8_t) 0x80) |
Read mode: 32 bytes.
Referenced by sha204m_check_parameters(), and sha204m_read().
#define SHA204_ADDRESS_MASK ( 0x007F) |
Address bit 7 to 15 are always 0.
Referenced by sha204m_read(), and sha204m_write().
#define SHA204_ADDRESS_MASK_CONFIG ( 0x001F) |
Address bits 5 to 7 are 0 for Configuration zone.
Referenced by sha204m_read(), and sha204m_write().
#define SHA204_ADDRESS_MASK_OTP ( 0x000F) |
Address bits 4 to 7 are 0 for OTP zone.
Referenced by sha204m_read(), and sha204m_write().
#define SHA204_CHECKMAC ((uint8_t) 0x28) |
CheckMac command op-code.
Referenced by sha204m_check_mac(), sha204m_check_parameters(), and sha204m_execute().
#define SHA204_COUNT_IDX ( 0) |
command packet index for count
Referenced by main(), sha204m_check_mac(), sha204m_derive_key(), sha204m_dev_rev(), sha204m_gen_dig(), sha204m_hmac(), sha204m_lock(), sha204m_mac(), sha204m_nonce(), sha204m_pause(), sha204m_random(), sha204m_read(), sha204m_update_extra(), and sha204m_write().
#define SHA204_DATA_IDX ( 5) |
command packet index for second parameter
#define SHA204_DERIVE_KEY ((uint8_t) 0x1C) |
DeriveKey command op-code.
Referenced by sha204m_check_parameters(), sha204m_derive_key(), and sha204m_execute().
#define SHA204_DEVREV ((uint8_t) 0x30) |
DevRev command op-code.
Referenced by sha204m_check_parameters(), sha204m_dev_rev(), sha204m_execute(), and test_sha204_wakeup().
#define SHA204_GENDIG ((uint8_t) 0x15) |
GenDig command op-code.
Referenced by sha204m_check_parameters(), sha204m_execute(), and sha204m_gen_dig().
#define SHA204_HMAC ((uint8_t) 0x11) |
HMAC command op-code.
Referenced by sha204m_check_parameters(), sha204m_execute(), and sha204m_hmac().
#define SHA204_KEY_ID_MAX ((uint8_t) 15) |
maximum value for key id
Referenced by sha204m_check_mac(), sha204m_check_parameters(), sha204m_derive_key(), and sha204m_gen_dig().
#define SHA204_LOCK ((uint8_t) 0x17) |
Lock command op-code.
Referenced by sha204m_check_parameters(), sha204m_execute(), and sha204m_lock().
#define SHA204_MAC ((uint8_t) 0x08) |
MAC command op-code.
Referenced by sha204m_check_parameters(), sha204m_execute(), and sha204m_mac().
#define SHA204_NONCE ((uint8_t) 0x16) |
Nonce command op-code.
Referenced by sha204m_check_parameters(), sha204m_execute(), and sha204m_nonce().
#define SHA204_OPCODE_IDX ( 1) |
command packet index for op-code
Referenced by main(), sha204m_check_mac(), sha204m_derive_key(), sha204m_dev_rev(), sha204m_gen_dig(), sha204m_hmac(), sha204m_lock(), sha204m_mac(), sha204m_nonce(), sha204m_pause(), sha204m_random(), sha204m_read(), sha204m_update_extra(), and sha204m_write().
#define SHA204_OTP_BLOCK_MAX ((uint8_t) 1) |
maximum value for OTP block
Referenced by sha204m_gen_dig().
#define SHA204_PARAM1_IDX ( 2) |
command packet index for first parameter
#define SHA204_PARAM2_IDX ( 3) |
command packet index for second parameter
#define SHA204_PAUSE ((uint8_t) 0x01) |
Pause command op-code.
Referenced by sha204m_check_parameters(), sha204m_execute(), and sha204m_pause().
#define SHA204_RANDOM ((uint8_t) 0x1B) |
Random command op-code.
Referenced by sha204m_check_parameters(), sha204m_execute(), and sha204m_random().
#define SHA204_READ ((uint8_t) 0x02) |
Read command op-code.
Referenced by sha204m_check_parameters(), sha204m_execute(), and sha204m_read().
#define SHA204_RSP_SIZE_VAL ((uint8_t) 7) |
size of response packet containing four bytes of data
#define SHA204_UPDATE_EXTRA ((uint8_t) 0x20) |
UpdateExtra command op-code.
Referenced by sha204m_check_parameters(), sha204m_execute(), and sha204m_update_extra().
#define SHA204_WRITE ((uint8_t) 0x12) |
Write command op-code.
Referenced by sha204m_check_parameters(), sha204m_execute(), and sha204m_write().
#define SHA204_ZONE_ACCESS_32 ((uint8_t) 32) |
Read or write 32 bytes.
Referenced by sha204m_write().
#define SHA204_ZONE_ACCESS_4 ((uint8_t) 4) |
Read or write 4 bytes.
Referenced by sha204m_write().
#define SHA204_ZONE_CONFIG ((uint8_t) 0x00) |
Configuration zone.
Referenced by sha204m_read(), sha204m_write(), and test_all_devices().
#define SHA204_ZONE_COUNT_FLAG ((uint8_t) 0x80) |
Zone bit 7 set: Access 32 bytes, otherwise 4 bytes.
Referenced by sha204m_execute(), sha204m_read(), and sha204m_write().
#define SHA204_ZONE_DATA ((uint8_t) 0x02) |
Data zone.
Referenced by sha204m_read(), and sha204m_write().
#define SHA204_ZONE_MASK ((uint8_t) 0x03) |
Zone mask.
Referenced by sha204m_read(), and sha204m_write().
#define SHA204_ZONE_OTP ((uint8_t) 0x01) |
OTP (One Time Programming) zone.
Referenced by sha204m_check_parameters(), sha204m_read(), and sha204m_write().
#define UPDATE_CONFIG_BYTE_86 ((uint8_t) 0x01) |
UpdateExtra mode: update Config byte 86.
Referenced by sha204m_check_parameters(), and sha204m_update_extra().
#define UPDATE_COUNT SHA204_CMD_SIZE_MIN |
UpdateExtra command packet size.
Referenced by sha204m_update_extra().
#define UPDATE_DELAY ( 8) |
UpdateExtra typical command delay.
Referenced by sha204m_execute(), and sha204m_update_extra().
#define UPDATE_EXEC_MAX (12) |
UpdateExtra maximum execution time.
Referenced by sha204m_execute(), and sha204m_update_extra().
#define UPDATE_MODE_IDX SHA204_PARAM1_IDX |
UpdateExtra command index for mode.
Referenced by sha204m_update_extra().
#define UPDATE_RSP_SIZE SHA204_RSP_SIZE_MIN |
response size of UpdateExtra command
Referenced by sha204m_execute(), and sha204m_update_extra().
#define UPDATE_VALUE_IDX SHA204_PARAM2_IDX |
UpdateExtra command index for new value.
Referenced by sha204m_update_extra().
#define WRITE_ADDR_IDX SHA204_PARAM2_IDX |
Write command index for address.
#define WRITE_COUNT_LONG (39) |
Write command packet size with long data and no MAC.
#define WRITE_COUNT_LONG_MAC (71) |
Write command packet size with long data and MAC.
#define WRITE_COUNT_SHORT (11) |
Write command packet size with short data and no MAC.
#define WRITE_COUNT_SHORT_MAC (43) |
Write command packet size with short data and MAC.
#define WRITE_DELAY ( 4) |
Write typical command delay.
Referenced by sha204m_execute(), and sha204m_write().
#define WRITE_EXEC_MAX (42) |
Write maximum execution time.
Referenced by sha204m_execute(), and sha204m_write().
#define WRITE_MAC_SIZE (32) |
Write MAC size.
Referenced by sha204m_write().
#define WRITE_MAC_VL_IDX (37) |
Write command index for MAC following long data.
#define WRITE_MAC_VS_IDX ( 9) |
Write command index for MAC following short data.
#define WRITE_RSP_SIZE SHA204_RSP_SIZE_MIN |
response size of Write command
Referenced by sha204m_execute(), and sha204m_write().
#define WRITE_VALUE_IDX SHA204_DATA_IDX |
Write command index for data.
#define WRITE_ZONE_IDX SHA204_PARAM1_IDX |
Write command index for zone.
#define WRITE_ZONE_MASK ((uint8_t) 0xC1) |
Write zone bits 2 to 5 are 0.
Referenced by sha204m_check_parameters(), and sha204m_write().
#define WRITE_ZONE_WITH_MAC ((uint8_t) 0x40) |
Write zone bit 6: write encrypted with MAC.