CryptoAuthLib v3.7.6
Microchip CryptoAuthentication Library
 
Loading...
Searching...
No Matches
atca_helpers.h File Reference

Helpers to support the CryptoAuthLib Basic API methods. More...

#include "cryptoauthlib.h"
#define IS_ADD_SAFE_UINT16_T(a, b)   (((UINT16_MAX - (a)) >= (b)) ? true : false)
 
#define IS_ADD_SAFE_UINT32_T(a, b)   (((UINT32_MAX - (a)) >= (b)) ? true : false)
 
#define IS_ADD_SAFE_UINT64_T(a, b)   (((UINT64_MAX - (a)) >= (b)) ? true : false)
 
#define IS_ADD_SAFE_SIZE_T(a, b)   (((SIZE_MAX - (a)) >= (b)) ? true : false)
 
#define IS_MUL_SAFE_UINT16_T(a, b)   ((((a) <= UINT16_MAX / (b))) ? true : false)
 
#define IS_MUL_SAFE_UINT32_T(a, b)   ((((a) <= UINT32_MAX / (b))) ? true : false)
 
#define IS_MUL_SAFE_UINT64_T(a, b)   ((((a) <= UINT64_MAX / (b))) ? true : false)
 
#define IS_MUL_SAFE_SIZE_T(a, b)   ((((a) <= SIZE_MAX / (b))) ? true : false)
 
ATCA_STATUS atcab_bin2hex (const uint8_t *bin, size_t bin_size, char *hex, size_t *hex_size)
 Convert a binary buffer to a hex string for easy reading.
 
ATCA_STATUS atcab_bin2hex_ (const uint8_t *bin, size_t bin_size, char *hex, size_t *hex_size, bool is_pretty, bool is_space, bool is_upper)
 Function that converts a binary buffer to a hex string suitable for easy reading.
 
ATCA_STATUS atcab_hex2bin (const char *ascii_hex, size_t ascii_hex_len, uint8_t *binary, size_t *bin_len)
 Function that converts a hex string to binary buffer.
 
ATCA_STATUS atcab_hex2bin_ (const char *hex, size_t hex_size, uint8_t *bin, size_t *bin_size, bool is_space)
 
ATCA_STATUS packHex (const char *ascii_hex, size_t ascii_hex_len, char *packed_hex, size_t *packed_len)
 Remove spaces from a ASCII hex string.
 
bool isDigit (char c)
 Checks to see if a character is an ASCII representation of a digit ((c ge '0') and (c le '9'))
 
bool isBlankSpace (char c)
 Checks to see if a character is blank space.
 
bool isAlpha (char c)
 Checks to see if a character is an ASCII representation of hex ((c >= 'A') and (c <= 'F')) || ((c >= 'a') and (c <= 'f'))
 
bool isHexAlpha (char c)
 Checks to see if a character is an ASCII representation of hex ((c >= 'A') and (c <= 'F')) || ((c >= 'a') and (c <= 'f'))
 
bool isHex (char c)
 Returns true if this character is a valid hex character or if this is blankspace (The character can be included in a valid hexstring).
 
bool isHexDigit (char c)
 Returns true if this character is a valid hex character.
 
bool isBase64 (char c, const uint8_t *rules)
 Returns true if this character is a valid base 64 character or if this is space (A character can be included in a valid base 64 string).
 
bool isBase64Digit (char c, const uint8_t *rules)
 Returns true if this character is a valid base 64 character.
 
const uint8_t * atcab_b64rules_default (void)
 
const uint8_t * atcab_b64rules_mime (void)
 
const uint8_t * atcab_b64rules_urlsafe (void)
 
ATCA_STATUS atcab_base64decode_ (const char *encoded, size_t encoded_size, uint8_t *data, size_t *data_size, const uint8_t *rules)
 Decode base64 string to data with ruleset option.
 
ATCA_STATUS atcab_base64encode (const uint8_t *byte_array, size_t array_len, char *encoded, size_t *encoded_len)
 Encode data as base64 string.
 
ATCA_STATUS atcab_base64encode_ (const uint8_t *data, size_t data_size, char *encoded, size_t *encoded_size, const uint8_t *rules)
 Encode data as base64 string with ruleset option.
 
ATCA_STATUS atcab_base64decode (const char *encoded, size_t encoded_len, uint8_t *byte_array, size_t *array_len)
 Decode base64 string to data.
 
ATCA_STATUS atcab_reversal (const uint8_t *bin, size_t bin_size, uint8_t *dest, size_t *dest_size)
 To reverse the input data.
 
int atcab_memset_s (void *dest, size_t destsz, int ch, size_t count)
 Guaranteed to perform memory writes regardless of optimization level. Matches memset_s signature.
 
size_t atcab_pointer_delta (const void *start, const void *end)
 Helper function to calculate the number of bytes between two pointers.
 
char lib_toupper (char c)
 Converts a character to uppercase.
 
char lib_tolower (char c)
 Converts a character to lowercase.
 

Detailed Description

Helpers to support the CryptoAuthLib Basic API methods.