CryptoAuthLib
Atmel CryptoAuthentication Library
|
These methods provide the most convenient, simple API to CryptoAuth chips. More...
Macros | |
#define | atcab_bin2hex |
Functions | |
ATCA_STATUS | atcab_version (char *verstr) |
returns a version string for the CryptoAuthLib release. The format of the version string returned is "yyyymmdd" More... | |
ATCA_STATUS | atcab_init (ATCAIfaceCfg *cfg) |
atcab_init is called once for the life of the application and creates a global ATCADevice object used by Basic API. This method builds a global ATCADevice instance behinds the scenes that's used for all Basic API operations More... | |
ATCA_STATUS | atcab_init_device (ATCADevice cadevice) |
atcab_init_device can be used to initialize the global ATCADevice object to point to one of your choosing for use with all the atcab_ basic API. More... | |
ATCA_STATUS | atcab_release (void) |
release (free) the global ATCADevice instance. This must be called in order to release or free up the interface. More... | |
ATCADevice | atcab_getDevice (void) |
a way to get the global device object. Generally for more sophisticated users of atca More... | |
ATCA_STATUS | atcab_wakeup (void) |
wakeup the CryptoAuth device More... | |
ATCA_STATUS | atcab_idle (void) |
idle the CryptoAuth device More... | |
ATCA_STATUS | atcab_sleep (void) |
invoke sleep on the CryptoAuth device More... | |
ATCA_STATUS | atcab_cfg_discover (ATCAIfaceCfg cfgArray[], int max) |
ATCA_STATUS | atcab_info (uint8_t *revision) |
get the device revision information More... | |
ATCA_STATUS | atcab_challenge (const uint8_t *challenge) |
send a challenge to the device (a pass-through nonce) More... | |
ATCA_STATUS | atcab_challenge_seed_update (const uint8_t *seed, uint8_t *rand_out) |
send a challenge to the device (a seed update nonce) More... | |
ATCA_STATUS | atcab_nonce (const uint8_t *tempkey) |
Execute a pass-through Nonce command to initialize TempKey to the specified value. More... | |
ATCA_STATUS | atcab_nonce_rand (const uint8_t *seed, uint8_t *rand_out) |
Initialize TempKey with a random Nonce. More... | |
ATCA_STATUS | atcab_random (uint8_t *rand_out) |
Get a 32 byte random number from the CryptoAuth device. More... | |
ATCA_STATUS | atcab_is_locked (uint8_t zone, bool *lock_state) |
Query to see if the specified zone is locked. More... | |
ATCA_STATUS | atcab_is_slot_locked (uint8_t slot, bool *lock_state) |
Query to see if the specified slot is locked. More... | |
ATCA_STATUS | atcab_get_addr (uint8_t zone, uint8_t slot, uint8_t block, uint8_t offset, uint16_t *addr) |
Compute the address given the zone, slot, block, and offset. More... | |
ATCA_STATUS | atcab_read_zone (uint8_t zone, uint8_t slot, uint8_t block, uint8_t offset, uint8_t *data, uint8_t len) |
read either 4 or 32 bytes of data into given slot More... | |
ATCA_STATUS | atcab_write_zone (uint8_t zone, uint8_t slot, uint8_t block, uint8_t offset, const uint8_t *data, uint8_t len) |
write either 4 or 32 bytes of data into the device zone More... | |
ATCA_STATUS | atcab_write_bytes_slot (uint8_t slot, uint16_t offset, const uint8_t *data, uint8_t len) |
write data into given slot of data zone with offset address More... | |
ATCA_STATUS | atcab_write_bytes_zone (ATCADeviceType dev_type, uint8_t zone, uint16_t address, const uint8_t *data, uint8_t len) |
write data into config, otp or data zone with given zone and offset More... | |
ATCA_STATUS | atcab_read_bytes_zone (ATCADeviceType dev_type, uint8_t zone, uint16_t address, uint8_t len, uint8_t *data) |
read data from config, otp or data zone with given zone, offset and len More... | |
ATCA_STATUS | atcab_read_serial_number (uint8_t *serial_number) |
read the serial number of the device More... | |
ATCA_STATUS | atcab_read_pubkey (uint8_t slot8toF, uint8_t *pubkey) |
reads a pub key from a readable data slot versus atcab_get_pubkey which generates a pubkey from a private key slot More... | |
ATCA_STATUS | atcab_read_sig (uint8_t slot8toF, uint8_t *sig) |
reads a signature found in one of slots 8 through F. More... | |
ATCA_STATUS | atcab_read_ecc_config_zone (uint8_t *config_data) |
read the config zone by block by block for 32 byte read, offset is ignored data receives the contents read from the slot Config zone can be read regardless of it being locked or unlocked More... | |
ATCA_STATUS | atcab_write_ecc_config_zone (const uint8_t *config_data) |
given an ECC configuration zone buffer, write its parts to the device's config zone More... | |
ATCA_STATUS | atcab_read_sha_config_zone (uint8_t *config_data) |
given an SHA configuration zone buffer, read its parts from the device's config zone More... | |
ATCA_STATUS | atcab_write_sha_config_zone (const uint8_t *config_data) |
given an SHA configuration zone buffer, write its parts to the device's config zone More... | |
ATCA_STATUS | atcab_read_config_zone (ATCADeviceType dev_type, uint8_t *config_data) |
given an SHA configuration zone buffer and dev type, read its parts from the device's config zone More... | |
ATCA_STATUS | atcab_write_config_zone (ATCADeviceType dev_type, const uint8_t *config_data) |
given an SHA configuration zone buffer and dev type, write its parts to the device's config zone More... | |
ATCA_STATUS | atcab_cmp_config_zone (uint8_t *config_data, bool *same_config) |
This function compares all writable bytes in the configuration zone that is passed in to the bytes on the device. More... | |
ATCA_STATUS | atcab_read_enc (uint8_t slotid, uint8_t block, uint8_t *data, const uint8_t *enckey, const uint16_t enckeyid) |
Read 32 bytes of data from the given slot. The function returns clear text bytes. Encrypted bytes are read over the wire, then subsequently decrypted Data zone must be locked and the slot configuration must be set to encrypted read for the block to be successfully read. More... | |
ATCA_STATUS | atcab_write_enc (uint8_t slotid, uint8_t block, const uint8_t *data, const uint8_t *enckey, const uint16_t enckeyid) |
Write 32 bytes of data into given slot. The function takes clear text bytes, but encrypts them for writing over the wire Data zone must be locked and the slot configuration must be set to encrypted write for the block to be successfully written. More... | |
ATCA_STATUS | atcab_lock_config_zone (uint8_t *lock_response) |
lock the ATCA ECC config zone. config zone must be unlocked for the zone to be successfully locked More... | |
ATCA_STATUS | atcab_lock_data_zone (uint8_t *lock_response) |
lock the ATCA ECC Data zone. More... | |
ATCA_STATUS | atcab_lock_data_slot (uint8_t slot, uint8_t *lock_response) |
lock the ATCA ECC Data Slot ConfigZone must be locked and DataZone may or may not be locked for a individual data slot to be locked More... | |
ATCA_STATUS | atcab_priv_write (uint8_t slot, const uint8_t priv_key[36], uint8_t write_key_slot, const uint8_t write_key[32]) |
write a P256 private key in given slot using mac computation More... | |
ATCA_STATUS | atcab_genkey (int slot, uint8_t *pubkey) |
generate a key on given slot More... | |
ATCA_STATUS | atcab_get_pubkey (uint8_t slot, uint8_t *pubkey) |
returns a public key found in a designated slot. The slot must be configured as a slot with a private key. This method will use GenKey t geenrate the corresponding public key from the private key in the given slot. More... | |
ATCA_STATUS | atcab_sign (uint16_t slot, const uint8_t *msg, uint8_t *signature) |
sign a buffer using private key in given slot, stuff the signature More... | |
ATCA_STATUS | atcab_verify_extern (const uint8_t *message, const uint8_t *signature, const uint8_t *pubkey, bool *verified) |
verify a signature using CryptoAuth hardware (as opposed to an ECDSA software implementation) More... | |
ATCA_STATUS | atcab_ecdh (uint16_t key_id, const uint8_t *pub_key, uint8_t *ret_ecdh) |
issues ecdh command More... | |
ATCA_STATUS | atcab_ecdh_enc (uint16_t slotid, const uint8_t *pubkey, uint8_t *ret_ecdh, const uint8_t *enckey, const uint8_t enckeyid) |
issues ecdh command More... | |
ATCA_STATUS | atcab_gendig (uint8_t zone, uint16_t key_id) |
Issues a GenDig command to SHA256 hash the source data indicated by zone with the contents of TempKey. See the CryptoAuth datasheet for your chip to see what the values of zone correspond to. More... | |
ATCA_STATUS | atcab_gendig_host (uint8_t zone, uint16_t key_id, uint8_t *other_data, uint8_t len) |
Similar to atcab_gendig except this method does the operation in software on the host. More... | |
ATCA_STATUS | atcab_mac (uint8_t mode, uint16_t key_id, const uint8_t *challenge, uint8_t *digest) |
Get a 32 byte MAC from the CryptoAuth device given a key ID and a challenge. More... | |
ATCA_STATUS | atcab_checkmac (uint8_t mode, uint16_t key_id, const uint8_t *challenge, const uint8_t *response, const uint8_t *other_data) |
Compares a MAC response with input values. More... | |
ATCA_STATUS | atcab_sha_start (void) |
Initialize SHA-256 calculation engine. More... | |
ATCA_STATUS | atcab_sha_update (uint16_t length, const uint8_t *message) |
Adds the message to be digested. More... | |
ATCA_STATUS | atcab_sha_end (uint8_t *digest) |
The SHA-256 calculation is complete. More... | |
ATCA_STATUS | atcab_sha (uint16_t length, const uint8_t *message, uint8_t *digest) |
Computes a SHA-256 digest. More... | |
ATCA_STATUS | packHex (const char *asciiHex, int asciiHexLen, char *packedHex, int *packedLen) |
bool | isDigit (char c) |
Checks to see if a character is an ASCII representation of a digit ((c ge '0') and (c le '9')) More... | |
bool | isWhiteSpace (char c) |
Checks to see if a character is whitespace ((c == ' ') || (c == '') || (c == '') || (c == ' ')) More... | |
bool | isHexAlpha (char c) |
Checks to see if a character is an ASCII representation of hex ((c ge 'A') and (c le 'F')) || ((c ge 'a') and (c le 'f')) More... | |
bool | isHex (char c) |
Returns true if this character is a valid hex character or if this is whitespace (The character can be included in a valid hexstring). More... | |
bool | isHexDigit (char c) |
Returns true if this character is a valid hex character. More... | |
These methods provide the most convenient, simple API to CryptoAuth chips.
#define atcab_bin2hex |
ATCA_STATUS atcab_cfg_discover | ( | ATCAIfaceCfg | cfgArray[], |
int | max | ||
) |
ATCA_STATUS atcab_challenge | ( | const uint8_t * | challenge | ) |
send a challenge to the device (a pass-through nonce)
[in] | challenge | - pointer to 32 bytes of data which will be sent as the challenge |
ATCA_STATUS atcab_challenge_seed_update | ( | const uint8_t * | seed, |
uint8_t * | rand_out | ||
) |
send a challenge to the device (a seed update nonce)
[in] | seed | - pointer to 32 bytes of data which will be sent as the challenge |
[out] | rand_out | - points to space to receive random number |
ATCA_STATUS atcab_checkmac | ( | uint8_t | mode, |
uint16_t | key_id, | ||
const uint8_t * | challenge, | ||
const uint8_t * | response, | ||
const uint8_t * | other_data | ||
) |
Compares a MAC response with input values.
[in] | mode | Controls which fields within the device are used in the message |
[in] | key_id | The key in the CryptoAuth device to use for the MAC |
[in] | challenge | The 32 byte challenge number |
[in] | response | The 32 byte mac response number |
[in] | other_data | The 13 byte other data number |
ATCA_STATUS atcab_cmp_config_zone | ( | uint8_t * | config_data, |
bool * | same_config | ||
) |
This function compares all writable bytes in the configuration zone that is passed in to the bytes on the device.
[in] | config_data | pointer to all 128 bytes in configuration zone. Not used if NULL. |
[out] | same_config | pointer to boolean status whether config data passed in matches the actual config zone |
ATCA_STATUS atcab_ecdh | ( | uint16_t | key_id, |
const uint8_t * | pubkey, | ||
uint8_t * | ret_ecdh | ||
) |
issues ecdh command
[in] | key_id | slot of key for ECDH computation |
[in] | pubkey | public key |
[out] | ret_ecdh | - computed ECDH key - A buffer with size of ATCA_KEY_SIZE |
ATCA_STATUS atcab_ecdh_enc | ( | uint16_t | slotid, |
const uint8_t * | pubkey, | ||
uint8_t * | ret_ecdh, | ||
const uint8_t * | enckey, | ||
const uint8_t | enckeyid | ||
) |
issues ecdh command
[in] | slotid | slot of key for ECDH computation |
[in] | pubkey | public key |
[out] | ret_ecdh | - computed ECDH key - A buffer with size of ATCA_KEY_SIZE |
ATCA_STATUS atcab_gendig | ( | uint8_t | zone, |
uint16_t | key_id | ||
) |
Issues a GenDig command to SHA256 hash the source data indicated by zone with the contents of TempKey. See the CryptoAuth datasheet for your chip to see what the values of zone correspond to.
[in] | zone | - designates the source of the data to hash with TempKey |
[in] | key_id | - indicates the key, OTP block or message order for shared nonce mode |
ATCA_STATUS atcab_gendig_host | ( | uint8_t | zone, |
uint16_t | key_id, | ||
uint8_t * | other_data, | ||
uint8_t | len | ||
) |
Similar to atcab_gendig except this method does the operation in software on the host.
[in] | zone | - designates the source of the data to hash with TempKey |
[in] | key_id | - indicates the key, OTP block or message order for shared nonce mode |
[in] | other_data | - pointer to 4 or 32 bytes of data depending upon the mode |
[in] | len | - length of data |
ATCA_STATUS atcab_genkey | ( | int | slot, |
uint8_t * | pubkey | ||
) |
generate a key on given slot
[in] | slot | slot number where ECC key is configured |
[out] | pubkey | 64 bytes of returned public key for given slot |
ATCA_STATUS atcab_get_addr | ( | uint8_t | zone, |
uint8_t | slot, | ||
uint8_t | block, | ||
uint8_t | offset, | ||
uint16_t * | addr | ||
) |
Compute the address given the zone, slot, block, and offset.
[in] | zone | |
[in] | slot | |
[in] | block | |
[in] | offset | |
[in] | addr |
ATCA_STATUS atcab_get_pubkey | ( | uint8_t | slot, |
uint8_t * | pubkey | ||
) |
returns a public key found in a designated slot. The slot must be configured as a slot with a private key. This method will use GenKey t geenrate the corresponding public key from the private key in the given slot.
[in] | slot | |
[out] | pubkey | - pointer to space receiving the contents of the public key that was generated |
ATCADevice atcab_getDevice | ( | void | ) |
a way to get the global device object. Generally for more sophisticated users of atca
ATCA_STATUS atcab_idle | ( | void | ) |
idle the CryptoAuth device
ATCA_STATUS atcab_info | ( | uint8_t * | revision | ) |
get the device revision information
[out] | revision | - 4-byte storage for receiving the revision number from the device |
ATCA_STATUS atcab_init | ( | ATCAIfaceCfg * | cfg | ) |
atcab_init is called once for the life of the application and creates a global ATCADevice object used by Basic API. This method builds a global ATCADevice instance behinds the scenes that's used for all Basic API operations
[in] | cfg | is a pointer to an interface configuration. This is usually a predefined configuration found in atca_cfgs.h |
ATCA_STATUS atcab_init_device | ( | ATCADevice | cadevice | ) |
atcab_init_device can be used to initialize the global ATCADevice object to point to one of your choosing for use with all the atcab_ basic API.
[in] | cadevice | ATCADevice instance to use as the global Basic API crypto device instance |
ATCA_STATUS atcab_is_locked | ( | uint8_t | zone, |
bool * | islocked | ||
) |
Query to see if the specified zone is locked.
[in] | zone | The zone to query for locked (use LOCK_ZONE_CONFIG or LOCK_ZONE_DATA) |
[out] | islocked | true if the specified zone is locked |
ATCA_STATUS atcab_is_slot_locked | ( | uint8_t | slot, |
bool * | islocked | ||
) |
Query to see if the specified slot is locked.
[in] | slot | The slot to query for locked (slot 0-15) |
[out] | islocked | true if the specified slot is locked |
ATCA_STATUS atcab_lock_config_zone | ( | uint8_t * | lock_response | ) |
lock the ATCA ECC config zone. config zone must be unlocked for the zone to be successfully locked
[in] | lock_response |
ATCA_STATUS atcab_lock_data_slot | ( | uint8_t | slot, |
uint8_t * | lock_response | ||
) |
lock the ATCA ECC Data Slot ConfigZone must be locked and DataZone may or may not be locked for a individual data slot to be locked
[in] | slot | to be locked in data zone |
[in] | lock_response | pointer to the lock response from the chip - 0 is successful lock |
ATCA_STATUS atcab_lock_data_zone | ( | uint8_t * | lock_response | ) |
lock the ATCA ECC Data zone.
ConfigZone must be locked and DataZone must be unlocked for the zone to be successfully locked
[in] | lock_response |
ATCA_STATUS atcab_mac | ( | uint8_t | mode, |
uint16_t | key_id, | ||
const uint8_t * | challenge, | ||
uint8_t * | digest | ||
) |
Get a 32 byte MAC from the CryptoAuth device given a key ID and a challenge.
[in] | mode | Controls which fields within the device are used in the message |
[in] | key_id | The key in the CryptoAuth device to use for the MAC |
[in] | challenge | The 32 byte challenge number |
[out] | digest | The response of the MAC command using the given challenge |
ATCA_STATUS atcab_nonce | ( | const uint8_t * | tempkey | ) |
Execute a pass-through Nonce command to initialize TempKey to the specified value.
[in] | tempkey | - pointer to 32 bytes of data which will be used to initialize TempKey |
ATCA_STATUS atcab_nonce_rand | ( | const uint8_t * | seed, |
uint8_t * | rand_out | ||
) |
Initialize TempKey with a random Nonce.
[in] | seed | - pointer to 20 bytes of data which will be used to calculate TempKey |
[out] | rand_out | - pointer to 32 bytes of data that is the output of the Nonce command |
ATCA_STATUS atcab_priv_write | ( | uint8_t | slot, |
const uint8_t | priv_key[36], | ||
uint8_t | write_key_slot, | ||
const uint8_t | write_key[32] | ||
) |
write a P256 private key in given slot using mac computation
[in] | slot | |
[in] | priv_key | first 4 bytes of 36 bytes should be zero |
[in] | write_key_slot | slot to make a session key |
[in] | write_key | key to make a session key |
ATCA_STATUS atcab_random | ( | uint8_t * | rand_out | ) |
Get a 32 byte random number from the CryptoAuth device.
[out] | rand_out | ptr to 32 bytes of storage for random number |
ATCA_STATUS atcab_read_bytes_zone | ( | ATCADeviceType | dev_type, |
uint8_t | zone, | ||
uint16_t | address, | ||
uint8_t | len, | ||
uint8_t * | data | ||
) |
read data from config, otp or data zone with given zone, offset and len
[in] | dev_type | to identify device |
[in] | zone | to write data |
[in] | address | of pointed zone |
[in] | len | length to be read |
[out] | data | buffer to be read data |
ATCA_STATUS atcab_read_config_zone | ( | ATCADeviceType | dev_type, |
uint8_t * | config_data | ||
) |
given an SHA configuration zone buffer and dev type, read its parts from the device's config zone
[in] | dev_type | device type |
[out] | config_data | pointer to buffer containing a contiguous set of bytes to write to the config zone |
ATCA_STATUS atcab_read_ecc_config_zone | ( | uint8_t * | config_data | ) |
read the config zone by block by block for 32 byte read, offset is ignored data receives the contents read from the slot Config zone can be read regardless of it being locked or unlocked
[in] | config_data | pointer to buffer containing a contiguous set of bytes to read from the config zone returns ATCA_STATUS |
ATCA_STATUS atcab_read_enc | ( | uint8_t | slotid, |
uint8_t | block, | ||
uint8_t * | data, | ||
const uint8_t * | enckey, | ||
const uint16_t | enckeyid | ||
) |
Read 32 bytes of data from the given slot. The function returns clear text bytes. Encrypted bytes are read over the wire, then subsequently decrypted Data zone must be locked and the slot configuration must be set to encrypted read for the block to be successfully read.
[in] | slotid | |
[in] | block | |
[out] | data | The 32 bytes of clear text data that was read encrypted from the slot, then decrypted |
[in] | enckey | The key to encrypt with for writing |
[in] | enckeyid | The keyid of the parent encryption key returns ATCA_STATUS |
ATCA_STATUS atcab_read_pubkey | ( | uint8_t | slot8toF, |
uint8_t * | pubkey | ||
) |
reads a pub key from a readable data slot versus atcab_get_pubkey which generates a pubkey from a private key slot
[in] | slot8toF | - slot number to read, expected value is 0x8 through 0xF |
[out] | pubkey | - space to receive read pubkey |
ATCA_STATUS atcab_read_serial_number | ( | uint8_t * | serial_number | ) |
read the serial number of the device
[out] | serial_number | pointer to space to receive serial number. This space should be 9 bytes long |
ATCA_STATUS atcab_read_sha_config_zone | ( | uint8_t * | config_data | ) |
given an SHA configuration zone buffer, read its parts from the device's config zone
[out] | config_data | pointer to buffer containing a contiguous set of bytes to write to the config zone |
ATCA_STATUS atcab_read_sig | ( | uint8_t | slot8toF, |
uint8_t * | sig | ||
) |
reads a signature found in one of slots 8 through F.
[in] | slot8toF | - which slot to read |
[out] | sig | - pointer to the space to receive the signature found in the slot |
ATCA_STATUS atcab_read_zone | ( | uint8_t | zone, |
uint8_t | slot, | ||
uint8_t | block, | ||
uint8_t | offset, | ||
uint8_t * | data, | ||
uint8_t | len | ||
) |
read either 4 or 32 bytes of data into given slot
for 32 byte read, offset is ignored data receives the contents read from the slot
data zone must be locked and the slot configuration must not be secret for a slot to be successfully read
[in] | zone | |
[in] | slot | |
[in] | block | |
[in] | offset | |
[in] | data | |
[in] | len | Must be either 4 or 32 returns ATCA_STATUS |
ATCA_STATUS atcab_release | ( | void | ) |
release (free) the global ATCADevice instance. This must be called in order to release or free up the interface.
ATCA_STATUS atcab_sha | ( | uint16_t | length, |
const uint8_t * | message, | ||
uint8_t * | digest | ||
) |
Computes a SHA-256 digest.
[in] | length | The number of bytes in the message parameter |
[in] | message | up to 64 bytes of data to be included into the hash operation. |
[out] | digest | The SHA256 digest |
ATCA_STATUS atcab_sha_end | ( | uint8_t * | digest | ) |
The SHA-256 calculation is complete.
[out] | digest | The SHA256 digest that is calculated |
ATCA_STATUS atcab_sha_start | ( | void | ) |
Initialize SHA-256 calculation engine.
ATCA_STATUS atcab_sha_update | ( | uint16_t | length, |
const uint8_t * | message | ||
) |
Adds the message to be digested.
[in] | length | The number of bytes in the Message parameter |
[in] | message | up to 64 bytes of data to be included into the hash operation. |
ATCA_STATUS atcab_sign | ( | uint16_t | slot, |
const uint8_t * | msg, | ||
uint8_t * | signature | ||
) |
sign a buffer using private key in given slot, stuff the signature
[in] | slot | |
[in] | msg | should point to a 32 byte buffer |
[out] | signature | of msg. signature should point to buffer SIGN_RSP_SIZE big |
ATCA_STATUS atcab_sleep | ( | void | ) |
invoke sleep on the CryptoAuth device
ATCA_STATUS atcab_verify_extern | ( | const uint8_t * | message, |
const uint8_t * | signature, | ||
const uint8_t * | pubkey, | ||
bool * | verified | ||
) |
verify a signature using CryptoAuth hardware (as opposed to an ECDSA software implementation)
[in] | message | pointer |
[in] | signature | pointer |
[in] | pubkey | pointer |
[out] | verified | boolean whether or not the challenge/signature/pubkey verified |
ATCA_STATUS atcab_version | ( | char * | verstr | ) |
returns a version string for the CryptoAuthLib release. The format of the version string returned is "yyyymmdd"
[out] | verstr | ptr to space to receive version string |
ATCA_STATUS atcab_wakeup | ( | void | ) |
wakeup the CryptoAuth device
ATCA_STATUS atcab_write_bytes_slot | ( | uint8_t | slot, |
uint16_t | offset, | ||
const uint8_t * | data, | ||
uint8_t | len | ||
) |
write data into given slot of data zone with offset address
[in] | slot | to write data |
[in] | offset | of pointed slot |
[in] | data | pointer to write data |
[in] | data | length corresponding to data |
ATCA_STATUS atcab_write_bytes_zone | ( | ATCADeviceType | dev_type, |
uint8_t | zone, | ||
uint16_t | address, | ||
const uint8_t * | data, | ||
uint8_t | len | ||
) |
write data into config, otp or data zone with given zone and offset
[in] | dev_type | to identify device |
[in] | zone | to write data |
[in] | address | to pointed zone |
[in] | data | pointer of to write data |
[in] | len | data length corresponding to data |
ATCA_STATUS atcab_write_config_zone | ( | ATCADeviceType | dev_type, |
const uint8_t * | config_data | ||
) |
given an SHA configuration zone buffer and dev type, write its parts to the device's config zone
[in] | config_data | pointer to buffer containing a contiguous set of bytes to write to the config zone |
ATCA_STATUS atcab_write_ecc_config_zone | ( | const uint8_t * | config_data | ) |
given an ECC configuration zone buffer, write its parts to the device's config zone
[in] | config_data | pointer to buffer containing a contiguous set of bytes to write to the config zone |
ATCA_STATUS atcab_write_enc | ( | uint8_t | slotid, |
uint8_t | block, | ||
const uint8_t * | data, | ||
const uint8_t * | enckey, | ||
const uint16_t | enckeyid | ||
) |
Write 32 bytes of data into given slot. The function takes clear text bytes, but encrypts them for writing over the wire Data zone must be locked and the slot configuration must be set to encrypted write for the block to be successfully written.
[in] | slotid | |
[in] | block | |
[in] | data | The 32 bytes of clear text data to be written to the slot |
[in] | enckey | The key to encrypt with for writing |
[in] | enckeyid | The keyid of the parent encryption key returns ATCA_STATUS |
ATCA_STATUS atcab_write_sha_config_zone | ( | const uint8_t * | config_data | ) |
given an SHA configuration zone buffer, write its parts to the device's config zone
[in] | config_data | pointer to buffer containing a contiguous set of bytes to write to the config zone |
ATCA_STATUS atcab_write_zone | ( | uint8_t | zone, |
uint8_t | slot, | ||
uint8_t | block, | ||
uint8_t | offset, | ||
const uint8_t * | data, | ||
uint8_t | len | ||
) |
write either 4 or 32 bytes of data into the device zone
see ECC108A datasheet, datazone address values, table 9-8
[in] | zone | |
[in] | slot | |
[in] | block | |
[in] | offset | |
[in] | data | |
[in] | len | Must be either 4 or 32 |
bool isDigit | ( | char | c | ) |
Checks to see if a character is an ASCII representation of a digit ((c ge '0') and (c le '9'))
[in] | c | character to check |
bool isHex | ( | char | c | ) |
Returns true if this character is a valid hex character or if this is whitespace (The character can be included in a valid hexstring).
[in] | c | character to check |
bool isHexAlpha | ( | char | c | ) |
Checks to see if a character is an ASCII representation of hex ((c ge 'A') and (c le 'F')) || ((c ge 'a') and (c le 'f'))
[in] | c | character to check |
bool isHexDigit | ( | char | c | ) |
Returns true if this character is a valid hex character.
[in] | c | character to check |
bool isWhiteSpace | ( | char | c | ) |
Checks to see if a character is whitespace ((c == '
') || (c == '') || (c == '') || (c == ' '))
[in] | c | character to check |
ATCA_STATUS packHex | ( | const char * | asciiHex, |
int | asciiHexLen, | ||
char * | packedHex, | ||
int * | packedLen | ||
) |