CryptoAuthLib v3.7.8
Microchip CryptoAuthentication Library
 
Loading...
Searching...
No Matches
api_206a.c File Reference

Provides APIs to use with ATSHA206A device. More...

#include <stdlib.h>
#include <stdio.h>
#include "cryptoauthlib.h"
#include "api_206a.h"

Functions

ATCA_STATUS sha206a_diversify_parent_key (uint8_t *parent_key, uint8_t *diversified_key)
 Computes the diversified key based on the parent key provided and device serial number.
 
ATCA_STATUS sha206a_generate_derive_key (uint8_t *parent_key, uint8_t *derived_key, uint8_t param1, uint16_t param2)
 Generates the derived key based on the parent key and other parameters provided.
 
ATCA_STATUS sha206a_generate_challenge_response_pair (uint8_t *key, uint8_t *challenge, uint8_t *response)
 Generates the response based on Key and Challenge provided.
 
ATCA_STATUS sha206a_authenticate (uint8_t *challenge, uint8_t *expected_response, uint8_t *is_authenticated)
 verifies the challenge and provided response using key in device
 
ATCA_STATUS sha206a_verify_device_consumption (uint8_t *is_consumed)
 verifies the device is fully consumed or not based on Parent and Derived Key use flags.
 
ATCA_STATUS sha206a_check_dk_useflag_validity (uint8_t *is_consumed)
 verifies Derived Key use flags for consumption
 
ATCA_STATUS sha206a_check_pk_useflag_validity (uint8_t *is_consumed)
 verifies Parent Key use flags for consumption
 
ATCA_STATUS sha206a_get_dk_useflag_count (uint8_t *dk_available_count)
 calculates available Derived Key use counts
 
ATCA_STATUS sha206a_get_pk_useflag_count (uint8_t *pk_available_count)
 calculates available Parent Key use counts
 
ATCA_STATUS sha206a_get_dk_update_count (uint8_t *dk_update_count)
 Read Derived Key slot update count. It will be wraps around 256.
 
ATCA_STATUS sha206a_write_data_store (uint8_t slot, uint8_t *data, uint8_t block, uint8_t offset, uint8_t len, bool lock_after_write)
 Update the data store slot with user data and lock it if necessary.
 
ATCA_STATUS sha206a_read_data_store (uint8_t slot, uint8_t *data, uint8_t offset, uint8_t len)
 Read the data stored in Data store.
 
ATCA_STATUS sha206a_get_data_store_lock_status (uint8_t slot, uint8_t *is_locked)
 Returns the lock status of the given data store.
 

Detailed Description

Provides APIs to use with ATSHA206A device.

Function Documentation

◆ sha206a_authenticate()

ATCA_STATUS sha206a_authenticate ( uint8_t *  challenge,
uint8_t *  expected_response,
uint8_t *  is_authenticated 
)

verifies the challenge and provided response using key in device

Parameters
[in]challengeChallenge to be used in the response calculations
[in]expected_responseExpected response from the device.
[out]is_authenticatedresult of expected of response and calcualted response
Returns
ATCA_SUCCESS on success, otherwise an error code.

◆ sha206a_check_dk_useflag_validity()

ATCA_STATUS sha206a_check_dk_useflag_validity ( uint8_t *  is_consumed)

verifies Derived Key use flags for consumption

Parameters
[out]is_consumedindicates if DK is available for consumption.
Returns
ATCA_SUCCESS on success, otherwise an error code.

◆ sha206a_check_pk_useflag_validity()

ATCA_STATUS sha206a_check_pk_useflag_validity ( uint8_t *  is_consumed)

verifies Parent Key use flags for consumption

Parameters
[out]is_consumedindicates if PK is available for consumption
Returns
ATCA_SUCCESS on success, otherwise an error code

◆ sha206a_diversify_parent_key()

ATCA_STATUS sha206a_diversify_parent_key ( uint8_t *  parent_key,
uint8_t *  diversified_key 
)

Computes the diversified key based on the parent key provided and device serial number.

Parameters
[in]parent_keyparent key to be diversified
[out]diversified_keydiversified parent key
Returns
ATCA_SUCCESS on success, otherwise an error code.

◆ sha206a_generate_challenge_response_pair()

ATCA_STATUS sha206a_generate_challenge_response_pair ( uint8_t *  key,
uint8_t *  challenge,
uint8_t *  response 
)

Generates the response based on Key and Challenge provided.

Parameters
[in]keyInput data contains device's key
[in]challengeInput data to be used in challenge response calculation
[out]responseresponse derived from key and challenge
Returns
ATCA_SUCCESS on success, otherwise an error code.

◆ sha206a_generate_derive_key()

ATCA_STATUS sha206a_generate_derive_key ( uint8_t *  parent_key,
uint8_t *  derived_key,
uint8_t  param1,
uint16_t  param2 
)

Generates the derived key based on the parent key and other parameters provided.

Parameters
[in]parent_keyInput data contains device's parent key
[out]derived_keyOutput data derived from parent key
[in]param1Input data to be used in derive key calculation
[in]param2Input data to be used in derive key calculation
Returns
ATCA_SUCCESS on success, otherwise an error code.

◆ sha206a_get_data_store_lock_status()

ATCA_STATUS sha206a_get_data_store_lock_status ( uint8_t  slot,
uint8_t *  is_locked 
)

Returns the lock status of the given data store.

Parameters
[in]slotSlot number of the data store
[out]is_lockedlock status of the data store
Returns
ATCA_SUCCESS on success, otherwise an error code.

◆ sha206a_get_dk_update_count()

ATCA_STATUS sha206a_get_dk_update_count ( uint8_t *  dk_update_count)

Read Derived Key slot update count. It will be wraps around 256.

Parameters
[out]dk_update_countreturns number of times the slot has been updated with derived key
Returns
ATCA_SUCCESS on success, otherwise an error code.

◆ sha206a_get_dk_useflag_count()

ATCA_STATUS sha206a_get_dk_useflag_count ( uint8_t *  dk_available_count)

calculates available Derived Key use counts

Parameters
[out]dk_available_countcounts available bit's as 1
Returns
ATCA_SUCCESS on success, otherwise an error code.

◆ sha206a_get_pk_useflag_count()

ATCA_STATUS sha206a_get_pk_useflag_count ( uint8_t *  pk_available_count)

calculates available Parent Key use counts

Parameters
[out]pk_available_countcounts available bit's as 1
Returns
ATCA_SUCCESS on success, otherwise an error code.

◆ sha206a_read_data_store()

ATCA_STATUS sha206a_read_data_store ( uint8_t  slot,
uint8_t *  data,
uint8_t  offset,
uint8_t  len 
)

Read the data stored in Data store.

Parameters
[in]slotSlot number to read from
[in]dataPointer to hold slot data data
[in]offsetByte offset within the zone to read from.
[in]lendata length
Returns
ATCA_SUCCESS on success, otherwise an error code.

◆ sha206a_verify_device_consumption()

ATCA_STATUS sha206a_verify_device_consumption ( uint8_t *  is_consumed)

verifies the device is fully consumed or not based on Parent and Derived Key use flags.

Parameters
[out]is_consumedresult of device consumption
Returns
ATCA_SUCCESS on success, otherwise an error code.

◆ sha206a_write_data_store()

ATCA_STATUS sha206a_write_data_store ( uint8_t  slot,
uint8_t *  data,
uint8_t  block,
uint8_t  offset,
uint8_t  len,
bool  lock_after_write 
)

Update the data store slot with user data and lock it if necessary.

Parameters
[in]slotSlot number to be written with data
[in]dataPointer that holds the data
[in]block32-byte block to write to.
[in]offset4-byte word within the specified block to write to. If performing a 32-byte write, this should be 0.
[in]lendata length
[in]lock_after_writeset 1 to lock slot after write, otherwise 0
Returns
ATCA_SUCCESS on success, otherwise an error code.