CryptoAuthLib
Atmel CryptoAuthentication Library
ATCACommand (atca_)

CryptoAuthLib command builder object, ATCACommand. Member functions for the ATCACommand object. More...

Data Structures

struct  atca_command
 atca_command is the C object backing ATCACommand. See the atca_command.h file for details on the ATCACommand methods More...
 

Functions

ATCACommand newATCACommand (ATCADeviceType device_type)
 constructor for ATCACommand More...
 
ATCA_STATUS atCheckMAC (ATCACommand cacmd, ATCAPacket *packet)
 ATCACommand CheckMAC method. More...
 
ATCA_STATUS atCounter (ATCACommand cacmd, ATCAPacket *packet)
 ATCACommand Counter method. More...
 
ATCA_STATUS atDeriveKey (ATCACommand cacmd, ATCAPacket *packet, bool hasMAC)
 ATCACommand DeriveKey method. More...
 
ATCA_STATUS atECDH (ATCACommand cacmd, ATCAPacket *packet)
 ATCACommand ECDH method. More...
 
ATCA_STATUS atGenDig (ATCACommand cacmd, ATCAPacket *packet, bool hasMACKey)
 ATCACommand Generate Digest method. More...
 
ATCA_STATUS atGenKey (ATCACommand cacmd, ATCAPacket *packet, bool isPubKey)
 ATCACommand Generate Key method. More...
 
ATCA_STATUS atHMAC (ATCACommand cacmd, ATCAPacket *packet)
 ATCACommand HMAC method. More...
 
ATCA_STATUS atInfo (ATCACommand cacmd, ATCAPacket *packet)
 ATCACommand Info method. More...
 
ATCA_STATUS atLock (ATCACommand cacmd, ATCAPacket *packet)
 ATCACommand Lock method. More...
 
ATCA_STATUS atMAC (ATCACommand cacmd, ATCAPacket *packet)
 ATCACommand MAC method. More...
 
ATCA_STATUS atNonce (ATCACommand cacmd, ATCAPacket *packet)
 ATCACommand Nonce method. More...
 
ATCA_STATUS atPause (ATCACommand cacmd, ATCAPacket *packet)
 ATCACommand Pause method. More...
 
ATCA_STATUS atPrivWrite (ATCACommand cacmd, ATCAPacket *packet)
 ATCACommand PrivWrite method. More...
 
ATCA_STATUS atRandom (ATCACommand cacmd, ATCAPacket *packet)
 ATCACommand Random method. More...
 
ATCA_STATUS atRead (ATCACommand cacmd, ATCAPacket *packet)
 ATCACommand Read method. More...
 
ATCA_STATUS atSHA (ATCACommand cacmd, ATCAPacket *packet)
 ATCACommand SHA method. More...
 
ATCA_STATUS atSign (ATCACommand cacmd, ATCAPacket *packet)
 ATCACommand Sign method. More...
 
ATCA_STATUS atUpdateExtra (ATCACommand cacmd, ATCAPacket *packet)
 ATCACommand UpdateExtra method. More...
 
ATCA_STATUS atVerify (ATCACommand cacmd, ATCAPacket *packet)
 ATCACommand ECDSA Verify method. More...
 
ATCA_STATUS atWrite (ATCACommand cacmd, ATCAPacket *packet)
 ATCACommand Write method. More...
 
ATCA_STATUS atWriteEnc (ATCACommand cacmd, ATCAPacket *packet)
 ATCACommand Write encrypted method. More...
 
void deleteATCACommand (ATCACommand *cacmd)
 ATCACommand destructor. More...
 
ATCA_STATUS atInitExecTimes (ATCACommand cacmd, ATCADeviceType device_type)
 initialize the execution times for a given device type More...
 
uint16_t atGetExecTime (ATCACommand cacmd, ATCA_CmdMap cmd)
 return the typical execution type for the given command More...
 
void atCRC (uint8_t length, uint8_t *data, uint8_t *crc)
 This function calculates CRC given raw data, puts the CRC to given pointer. More...
 
void atCalcCrc (ATCAPacket *packet)
 This function calculates CRC and adds it to the correct offset in the packet data. More...
 
uint8_t atCheckCrc (uint8_t *response)
 This function checks the consistency of a response. More...
 
bool atIsSHAFamily (ATCADeviceType deviceType)
 determines if a given device type is a SHA device or a superset of a SHA device More...
 
bool atIsECCFamily (ATCADeviceType deviceType)
 determines if a given device type is an ECC device or a superset of a ECC device More...
 
ATCA_STATUS isATCAError (uint8_t *data)
 checks for basic error frame in data More...
 

Variables

uint16_t exectimes_x08a []
 execution times for x08a family, these are based on the typical value from the datasheet More...
 
uint16_t exectimes_204a []
 execution times for 204a, these are based on the typical value from the datasheet More...
 

Detailed Description

CryptoAuthLib command builder object, ATCACommand. Member functions for the ATCACommand object.

Function Documentation

void atCalcCrc ( ATCAPacket packet)

This function calculates CRC and adds it to the correct offset in the packet data.

Parameters
[in]packetPacket to calculate CRC data for
uint8_t atCheckCrc ( uint8_t *  response)

This function checks the consistency of a response.

Parameters
[in]responsepointer to response
Returns
status of the consistency check
ATCA_STATUS atCheckMAC ( ATCACommand  cacmd,
ATCAPacket packet 
)

ATCACommand CheckMAC method.

Parameters
[in]cacmdinstance
[in]packetpointer to the packet containing the command being built
Returns
ATCA_STATUS
ATCA_STATUS atCounter ( ATCACommand  cacmd,
ATCAPacket packet 
)

ATCACommand Counter method.

Parameters
[in]cacmdinstance
[in]packetpointer to the packet containing the command being built
Returns
ATCA_STATUS
void atCRC ( uint8_t  length,
uint8_t *  data,
uint8_t *  crc 
)

This function calculates CRC given raw data, puts the CRC to given pointer.

Parameters
[in]lengthsize of data not including the CRC byte positions
[in]datapointer to the data over which to compute the CRC
[out]crcpointer to the place where the two-bytes of CRC will be placed
ATCA_STATUS atDeriveKey ( ATCACommand  cacmd,
ATCAPacket packet,
bool  hasMAC 
)

ATCACommand DeriveKey method.

Parameters
[in]cacmdinstance
[in]packetpointer to the packet containing the command being built
[in]hasMAChasMAC determines if MAC data is present in the packet input
Returns
ATCA_STATUS
ATCA_STATUS atECDH ( ATCACommand  cacmd,
ATCAPacket packet 
)

ATCACommand ECDH method.

Parameters
[in]cacmdinstance
[in]packetpointer to the packet containing the command being built
Returns
ATCA_STATUS
ATCA_STATUS atGenDig ( ATCACommand  cacmd,
ATCAPacket packet,
bool  hasMACKey 
)

ATCACommand Generate Digest method.

Parameters
[in]cacmdinstance
[in]packetpointer to the packet containing the command being built
[in]hasMACKey
Returns
ATCA_STATUS
ATCA_STATUS atGenKey ( ATCACommand  cacmd,
ATCAPacket packet,
bool  isPubKey 
)

ATCACommand Generate Key method.

Parameters
[in]cacmdinstance
[in]packetpointer to the packet containing the command being built
[in]isPubKeyindicates whether "other data" is present in packet
Returns
ATCA_STATUS
uint16_t atGetExecTime ( ATCACommand  cacmd,
ATCA_CmdMap  cmd 
)

return the typical execution type for the given command

Parameters
[in]cacmdthe command object for which the execution times are associated
[in]cmd- the specific command for which to lookup the execution time
Returns
typical execution time in milleseconds for the given command
ATCA_STATUS atHMAC ( ATCACommand  cacmd,
ATCAPacket packet 
)

ATCACommand HMAC method.

Parameters
[in]cacmdinstance
[in]packetpointer to the packet containing the command being built
Returns
ATCA_STATUS
ATCA_STATUS atInfo ( ATCACommand  cacmd,
ATCAPacket packet 
)

ATCACommand Info method.

Parameters
[in]cacmdinstance
[in]packetpointer to the packet containing the command being built
Returns
ATCA_STATUS
ATCA_STATUS atInitExecTimes ( ATCACommand  cacmd,
ATCADeviceType  device_type 
)

initialize the execution times for a given device type

Parameters
[in]cacmd- the command containing the list of execution times for the device
[in]device_type- the device type - execution times vary by device type
Returns
ATCA_STATUS
bool atIsECCFamily ( ATCADeviceType  deviceType)

determines if a given device type is an ECC device or a superset of a ECC device

Parameters
[in]deviceType- the type of device to check for family type
Returns
boolean indicating whether the given device is an ECC family device.
bool atIsSHAFamily ( ATCADeviceType  deviceType)

determines if a given device type is a SHA device or a superset of a SHA device

Parameters
[in]deviceType- the type of device to check for family type
Returns
boolean indicating whether the given device is a SHA family device.
ATCA_STATUS atLock ( ATCACommand  cacmd,
ATCAPacket packet 
)

ATCACommand Lock method.

Parameters
[in]cacmdinstance
[in]packetpointer to the packet containing the command being built
Returns
ATCA_STATUS
ATCA_STATUS atMAC ( ATCACommand  cacmd,
ATCAPacket packet 
)

ATCACommand MAC method.

Parameters
[in]cacmdinstance
[in]packetpointer to the packet containing the command being built
Returns
ATCA_STATUS
ATCA_STATUS atNonce ( ATCACommand  cacmd,
ATCAPacket packet 
)

ATCACommand Nonce method.

Parameters
[in]cacmdinstance
[in]packetpointer to the packet containing the command being built
Returns
ATCA_STATUS
ATCA_STATUS atPause ( ATCACommand  cacmd,
ATCAPacket packet 
)

ATCACommand Pause method.

Parameters
[in]cacmdinstance
[in]packetpointer to the packet containing the command being built
Returns
ATCA_STATUS
ATCA_STATUS atPrivWrite ( ATCACommand  cacmd,
ATCAPacket packet 
)

ATCACommand PrivWrite method.

Parameters
[in]cacmdinstance
[in]packetpointer to the packet containing the command being built
Returns
ATCA_STATUS
ATCA_STATUS atRandom ( ATCACommand  cacmd,
ATCAPacket packet 
)

ATCACommand Random method.

Parameters
[in]cacmdinstance
[in]packetpointer to the packet containing the command being built
Returns
ATCA_STATUS
ATCA_STATUS atRead ( ATCACommand  cacmd,
ATCAPacket packet 
)

ATCACommand Read method.

Parameters
[in]cacmdinstance
[in]packetpointer to the packet containing the command being built
Returns
ATCA_STATUS
ATCA_STATUS atSHA ( ATCACommand  cacmd,
ATCAPacket packet 
)

ATCACommand SHA method.

Parameters
[in]cacmdinstance
[in]packetpointer to the packet containing the command being built
Returns
ATCA_STATUS
ATCA_STATUS atSign ( ATCACommand  cacmd,
ATCAPacket packet 
)

ATCACommand Sign method.

Parameters
[in]cacmdinstance
[in]packetpointer to the packet containing the command being built
Returns
ATCA_STATUS
ATCA_STATUS atUpdateExtra ( ATCACommand  cacmd,
ATCAPacket packet 
)

ATCACommand UpdateExtra method.

Parameters
[in]cacmdinstance
[in]packetpointer to the packet containing the command being built
Returns
ATCA_STATUS
ATCA_STATUS atVerify ( ATCACommand  cacmd,
ATCAPacket packet 
)

ATCACommand ECDSA Verify method.

Parameters
[in]cacmdinstance
[in]packetpointer to the packet containing the command being built
Returns
ATCA_STATUS
ATCA_STATUS atWrite ( ATCACommand  cacmd,
ATCAPacket packet 
)

ATCACommand Write method.

Parameters
[in]cacmdinstance
[in]packetpointer to the packet containing the command being built
Returns
ATCA_STATUS
ATCA_STATUS atWriteEnc ( ATCACommand  cacmd,
ATCAPacket packet 
)

ATCACommand Write encrypted method.

Parameters
[in]cacmdinstance
[in]packetpointer to the packet containing the command being built
Returns
ATCA_STATUS
void deleteATCACommand ( ATCACommand cacmd)

ATCACommand destructor.

Parameters
[in]cacmdinstance of a command object
ATCA_STATUS isATCAError ( uint8_t *  data)

checks for basic error frame in data

Parameters
[in]datapointer to received data - expected to be in the form of a CA device response frame
Returns
ATCA_STATUS indicating type of error or no error
ATCACommand newATCACommand ( ATCADeviceType  device_type)

constructor for ATCACommand

Parameters
[in]device_type- specifies which set of commands and execution times should be associated with this command object
Returns
ATCACommand instance

Variable Documentation

uint16_t exectimes_204a[]
Initial value:
= {
3,
38,
0,
62,
0,
43,
0,
69,
2,
24,
35,
60,
2,
0,
50,
4,
22,
0,
12,
0,
42
}

execution times for 204a, these are based on the typical value from the datasheet

uint16_t exectimes_x08a[]
Initial value:
= {
1,
13,
20,
50,
58,
11,
115,
23,
2,
32,
14,
29,
3,
48,
23,
1,
9,
60,
10,
72,
26
}

execution times for x08a family, these are based on the typical value from the datasheet