CryptoAuthLib
Atmel CryptoAuthentication Library
Basic Crypto API methods (atcab_)

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...
 

Detailed Description

These methods provide the most convenient, simple API to CryptoAuth chips.

Macro Definition Documentation

#define atcab_bin2hex

Function Documentation

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)

Parameters
[in]challenge- pointer to 32 bytes of data which will be sent as the challenge
Returns
ATCA_STATUS
ATCA_STATUS atcab_challenge_seed_update ( const uint8_t *  seed,
uint8_t *  rand_out 
)

send a challenge to the device (a seed update nonce)

Parameters
[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
Returns
ATCA_STATUS
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.

Parameters
[in]modeControls which fields within the device are used in the message
[in]key_idThe key in the CryptoAuth device to use for the MAC
[in]challengeThe 32 byte challenge number
[in]responseThe 32 byte mac response number
[in]other_dataThe 13 byte other data number
Returns
ATCA_STATUS
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.

Parameters
[in]config_datapointer to all 128 bytes in configuration zone. Not used if NULL.
[out]same_configpointer to boolean status whether config data passed in matches the actual config zone
Returns
ATCA_STATUS
ATCA_STATUS atcab_ecdh ( uint16_t  key_id,
const uint8_t *  pubkey,
uint8_t *  ret_ecdh 
)

issues ecdh command

Parameters
[in]key_idslot of key for ECDH computation
[in]pubkeypublic key
[out]ret_ecdh- computed ECDH key - A buffer with size of ATCA_KEY_SIZE
Returns
ATCA_STATUS
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

Parameters
[in]slotidslot of key for ECDH computation
[in]pubkeypublic key
[out]ret_ecdh- computed ECDH key - A buffer with size of ATCA_KEY_SIZE
Returns
ATCA_STATUS
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.

Parameters
[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
Returns
ATCA_STATUS
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.

Parameters
[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
Returns
ATCA_STATUS
ATCA_STATUS atcab_genkey ( int  slot,
uint8_t *  pubkey 
)

generate a key on given slot

Parameters
[in]slotslot number where ECC key is configured
[out]pubkey64 bytes of returned public key for given slot
Returns
ATCA_STATUS
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.

Parameters
[in]zone
[in]slot
[in]block
[in]offset
[in]addr
Returns
ATCA_STATUS
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.

Parameters
[in]slot
[out]pubkey- pointer to space receiving the contents of the public key that was generated
Returns
ATCA_STATUS
ATCADevice atcab_getDevice ( void  )

a way to get the global device object. Generally for more sophisticated users of atca

Returns
instance of global ATCADevice
ATCA_STATUS atcab_idle ( void  )

idle the CryptoAuth device

Returns
ATCA_STATUS
ATCA_STATUS atcab_info ( uint8_t *  revision)

get the device revision information

Parameters
[out]revision- 4-byte storage for receiving the revision number from the device
Returns
ATCA_STATUS
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

Parameters
[in]cfgis a pointer to an interface configuration. This is usually a predefined configuration found in atca_cfgs.h
Returns
ATCA_STATUS
See also
atcab_init_device()
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.

Parameters
[in]cadeviceATCADevice instance to use as the global Basic API crypto device instance
Returns
ATCA_STATUS
ATCA_STATUS atcab_is_locked ( uint8_t  zone,
bool *  islocked 
)

Query to see if the specified zone is locked.

Parameters
[in]zoneThe zone to query for locked (use LOCK_ZONE_CONFIG or LOCK_ZONE_DATA)
[out]islockedtrue if the specified zone is locked
Returns
ATCA_STATUS
ATCA_STATUS atcab_is_slot_locked ( uint8_t  slot,
bool *  islocked 
)

Query to see if the specified slot is locked.

Parameters
[in]slotThe slot to query for locked (slot 0-15)
[out]islockedtrue if the specified slot is locked
Returns
ATCA_STATUS
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

Parameters
[in]lock_response
Returns
ATCA_STATUS
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

Parameters
[in]slotto be locked in data zone
[in]lock_responsepointer to the lock response from the chip - 0 is successful lock
Returns
ATAC_STATUS
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

Parameters
[in]lock_response
Returns
ATCA_STATUS
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.

Parameters
[in]modeControls which fields within the device are used in the message
[in]key_idThe key in the CryptoAuth device to use for the MAC
[in]challengeThe 32 byte challenge number
[out]digestThe response of the MAC command using the given challenge
Returns
ATCA_STATUS
ATCA_STATUS atcab_nonce ( const uint8_t *  tempkey)

Execute a pass-through Nonce command to initialize TempKey to the specified value.

Parameters
[in]tempkey- pointer to 32 bytes of data which will be used to initialize TempKey
Returns
ATCA_STATUS
ATCA_STATUS atcab_nonce_rand ( const uint8_t *  seed,
uint8_t *  rand_out 
)

Initialize TempKey with a random Nonce.

Parameters
[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
Returns
ATCA_STATUS
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

Parameters
[in]slot
[in]priv_keyfirst 4 bytes of 36 bytes should be zero
[in]write_key_slotslot to make a session key
[in]write_keykey to make a session key
Returns
ATCA_STATUS
ATCA_STATUS atcab_random ( uint8_t *  rand_out)

Get a 32 byte random number from the CryptoAuth device.

Parameters
[out]rand_outptr to 32 bytes of storage for random number
Returns
status of the operation
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

Parameters
[in]dev_typeto identify device
[in]zoneto write data
[in]addressof pointed zone
[in]lenlength to be read
[out]databuffer to be read data
Returns
ATCA_STATUS
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

Parameters
[in]dev_typedevice type
[out]config_datapointer to buffer containing a contiguous set of bytes to write to the config zone
Returns
ATCA_STATUS
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

Parameters
[in]config_datapointer 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.

Parameters
[in]slotid
[in]block
[out]dataThe 32 bytes of clear text data that was read encrypted from the slot, then decrypted
[in]enckeyThe key to encrypt with for writing
[in]enckeyidThe 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

Parameters
[in]slot8toF- slot number to read, expected value is 0x8 through 0xF
[out]pubkey- space to receive read pubkey
Returns
ATCA_STATUS
ATCA_STATUS atcab_read_serial_number ( uint8_t *  serial_number)

read the serial number of the device

Parameters
[out]serial_numberpointer to space to receive serial number. This space should be 9 bytes long
Returns
ATCA_STATUS
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

Parameters
[out]config_datapointer to buffer containing a contiguous set of bytes to write to the config zone
Returns
ATCA_STATUS
ATCA_STATUS atcab_read_sig ( uint8_t  slot8toF,
uint8_t *  sig 
)

reads a signature found in one of slots 8 through F.

Parameters
[in]slot8toF- which slot to read
[out]sig- pointer to the space to receive the signature found in the slot
Returns
ATCA_STATUS
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

Parameters
[in]zone
[in]slot
[in]block
[in]offset
[in]data
[in]lenMust 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.

Returns
ATCA_STATUS
ATCA_STATUS atcab_sha ( uint16_t  length,
const uint8_t *  message,
uint8_t *  digest 
)

Computes a SHA-256 digest.

Parameters
[in]lengthThe number of bytes in the message parameter
[in]messageup to 64 bytes of data to be included into the hash operation.
[out]digestThe SHA256 digest
Returns
ATCA_STATUS
ATCA_STATUS atcab_sha_end ( uint8_t *  digest)

The SHA-256 calculation is complete.

Parameters
[out]digestThe SHA256 digest that is calculated
Returns
ATCA_STATUS
ATCA_STATUS atcab_sha_start ( void  )

Initialize SHA-256 calculation engine.

Returns
ATCA_STATUS
ATCA_STATUS atcab_sha_update ( uint16_t  length,
const uint8_t *  message 
)

Adds the message to be digested.

Parameters
[in]lengthThe number of bytes in the Message parameter
[in]messageup to 64 bytes of data to be included into the hash operation.
Returns
ATCA_STATUS
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

Parameters
[in]slot
[in]msgshould point to a 32 byte buffer
[out]signatureof msg. signature should point to buffer SIGN_RSP_SIZE big
Returns
ATCA_STATUS
ATCA_STATUS atcab_sleep ( void  )

invoke sleep on the CryptoAuth device

Returns
ATCA_STATUS
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)

Parameters
[in]messagepointer
[in]signaturepointer
[in]pubkeypointer
[out]verifiedboolean whether or not the challenge/signature/pubkey verified
Returns
ATCA_STATUS
ATCA_STATUS atcab_version ( char *  verstr)

returns a version string for the CryptoAuthLib release. The format of the version string returned is "yyyymmdd"

Parameters
[out]verstrptr to space to receive version string
Returns
ATCA_STATUS
ATCA_STATUS atcab_wakeup ( void  )

wakeup the CryptoAuth device

Returns
ATCA_STATUS
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

Parameters
[in]slotto write data
[in]offsetof pointed slot
[in]datapointer to write data
[in]datalength corresponding to data
Returns
ATCA_STATUS
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

Parameters
[in]dev_typeto identify device
[in]zoneto write data
[in]addressto pointed zone
[in]datapointer of to write data
[in]lendata length corresponding to data
Returns
ATCA_STATUS
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

Parameters
[in]config_datapointer to buffer containing a contiguous set of bytes to write to the config zone
Returns
ATCA_STATUS
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

Parameters
[in]config_datapointer to buffer containing a contiguous set of bytes to write to the config zone
Returns
ATCA_STATUS
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.

Parameters
[in]slotid
[in]block
[in]dataThe 32 bytes of clear text data to be written to the slot
[in]enckeyThe key to encrypt with for writing
[in]enckeyidThe 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

Parameters
[in]config_datapointer to buffer containing a contiguous set of bytes to write to the config zone
Returns
ATCA_STATUS
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

Parameters
[in]zone
[in]slot
[in]block
[in]offset
[in]data
[in]lenMust be either 4 or 32
Returns
ATCA_STATUS
bool isDigit ( char  c)

Checks to see if a character is an ASCII representation of a digit ((c ge '0') and (c le '9'))

Parameters
[in]ccharacter to check
Returns
True if the character is a digit
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).

Parameters
[in]ccharacter to check
Returns
True if the character can be included in a valid hexstring
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'))

Parameters
[in]ccharacter to check
Returns
True if the character is a hex
bool isHexDigit ( char  c)

Returns true if this character is a valid hex character.

Parameters
[in]ccharacter to check
Returns
True if the character can be included in a valid hexstring
bool isWhiteSpace ( char  c)

Checks to see if a character is whitespace ((c == '
') || (c == '') || (c == '') || (c == ' '))

Parameters
[in]ccharacter to check
Returns
True if the character is whitespace
ATCA_STATUS packHex ( const char *  asciiHex,
int  asciiHexLen,
char *  packedHex,
int *  packedLen 
)