Skip to content

Commit

Permalink
Release v3.7.1 (20231215)
Browse files Browse the repository at this point in the history
  • Loading branch information
Srinivas-E committed Jan 7, 2024
1 parent b3fcd83 commit c6c6adc
Show file tree
Hide file tree
Showing 117 changed files with 4,749 additions and 1,715 deletions.
70 changes: 35 additions & 35 deletions app/kit_host/ascii_kit_host.c
Original file line number Diff line number Diff line change
Expand Up @@ -342,8 +342,8 @@ static ATCA_STATUS kit_host_ca_select(ascii_kit_host_context_t* ctx, int argc, c

#if ATCA_CA_SUPPORT
static kit_host_map_entry_t kit_host_ca_physical_map[] = {
{ "select", kit_host_ca_select },
{ NULL, NULL }
{ "select", kit_host_ca_select },
{ NULL, NULL }
};

static ATCA_STATUS kit_host_ca_physical(ascii_kit_host_context_t* ctx, int argc, char* argv[], uint8_t* response, size_t* rlen)
Expand All @@ -353,12 +353,12 @@ static ATCA_STATUS kit_host_ca_physical(ascii_kit_host_context_t* ctx, int argc,

/* Cryptoauth Device commands */
static kit_host_map_entry_t kit_host_ca_map[] = {
{ "wake", kit_host_ca_wake },
{ "idle", kit_host_ca_idle },
{ "sleep", kit_host_ca_sleep },
{ "talk", kit_host_ca_talk },
{ "physical", kit_host_ca_physical },
{ NULL, NULL }
{ "wake", kit_host_ca_wake },
{ "idle", kit_host_ca_idle },
{ "sleep", kit_host_ca_sleep },
{ "talk", kit_host_ca_talk },
{ "physical", kit_host_ca_physical },
{ NULL, NULL }
};

static ATCA_STATUS kit_host_process_ca(ascii_kit_host_context_t* ctx, int argc, char* argv[], uint8_t* response, size_t* rlen)
Expand Down Expand Up @@ -392,17 +392,18 @@ static ATCA_STATUS kit_host_ta_talk(ascii_kit_host_context_t* ctx, int argc, cha

if (ctx && argc && response && rlen)
{
ATCA_TA_CmdPacket* packet = (ATCA_TA_CmdPacket*)ctx->buffer;
cal_buffer* packet = talib_packet_alloc();

if (packet)
if (NULL != packet)
{
size_t plen = sizeof(ctx->buffer) - 2;
packet->buf = ctx->buffer;

atcab_hex2bin(argv[0], strlen(argv[0]), (uint8_t*)&packet->length, &plen);
atcab_hex2bin(argv[0], strlen(argv[0]), packet->buf, &plen);
if (ATCA_SUCCESS == (status = talib_execute_command_raw(packet, ctx->device)))
{
ATCA_TA_RspPacket * resp = (ATCA_TA_RspPacket*)packet;
*rlen = kit_host_format_response(response, *rlen, status, resp->data, resp->resp_code);

*rlen = kit_host_format_response(response, *rlen, status, &packet->buf[PKT_CAL_BUF_DATA_IDX], packet->buf[2]);
}
else
{
Expand Down Expand Up @@ -477,7 +478,7 @@ static ATCA_STATUS kit_host_ta_receive(ascii_kit_host_context_t* ctx, int argc,
status = ATCA_SMALL_BUFFER;
break;
}
if (read_length < (3 + length_size)) //status(1) and CRC(2) size are same for CA and TA, length is variable.
if (read_length < (3 + length_size)) //status(1) and CRC(2) size are same for CA and TA, length is variable.
{
status = ATCA_RX_FAIL;
break;
Expand Down Expand Up @@ -513,8 +514,7 @@ static ATCA_STATUS kit_host_ta_receive(ascii_kit_host_context_t* ctx, int argc,
}

(void)atcontrol(&ctx->device->mIface, ATCA_HAL_CONTROL_DESELECT, NULL, 0);
}
while (0);
} while (0);
if (ATCA_SUCCESS == status)
{
*rlen = kit_host_format_response(ctx->buffer, sizeof(ctx->buffer), status, &ctx->buffer[sizeof(ctx->buffer) / 2], read_length + length_size);
Expand All @@ -528,8 +528,8 @@ static ATCA_STATUS kit_host_ta_receive(ascii_kit_host_context_t* ctx, int argc,
}

static kit_host_map_entry_t kit_host_ta_physical_map[] = {
{ "select", kit_host_ca_select }, /* Selection logic is the same */
{ NULL, NULL }
{ "select", kit_host_ca_select }, /* Selection logic is the same */
{ NULL, NULL }
};

static ATCA_STATUS kit_host_ta_physical(ascii_kit_host_context_t* ctx, int argc, char* argv[], uint8_t* response, size_t* rlen)
Expand All @@ -538,14 +538,14 @@ static ATCA_STATUS kit_host_ta_physical(ascii_kit_host_context_t* ctx, int argc,
}

static kit_host_map_entry_t kit_host_ta_map[] = {
{ "wake", kit_host_ta_wake },
{ "idle", kit_host_ta_idle },
{ "sleep", kit_host_ta_sleep },
{ "talk", kit_host_ta_talk },
{ "send", kit_host_ta_send },
{ "receive", kit_host_ta_receive },
{ "physical", kit_host_ta_physical },
{ NULL, NULL }
{ "wake", kit_host_ta_wake },
{ "idle", kit_host_ta_idle },
{ "sleep", kit_host_ta_sleep },
{ "talk", kit_host_ta_talk },
{ "send", kit_host_ta_send },
{ "receive", kit_host_ta_receive },
{ "physical", kit_host_ta_physical },
{ NULL, NULL }
};

ATCA_STATUS kit_host_process_ta(ascii_kit_host_context_t* ctx, int argc, char* argv[], uint8_t* response, size_t* rlen)
Expand Down Expand Up @@ -586,10 +586,10 @@ static ATCA_STATUS kit_host_board_get_device(ascii_kit_host_context_t* ctx, int


static kit_host_map_entry_t kit_host_board_map[] = {
{ "version", kit_host_board_get_version },
{ "firmware", kit_host_board_get_firmware },
{ "device", kit_host_board_get_device },
{ NULL, NULL }
{ "version", kit_host_board_get_version },
{ "firmware", kit_host_board_get_firmware },
{ "device", kit_host_board_get_device },
{ NULL, NULL }
};

static ATCA_STATUS kit_host_process_board(ascii_kit_host_context_t* ctx, int argc, char* argv[], uint8_t* response, size_t* rlen)
Expand All @@ -599,15 +599,15 @@ static ATCA_STATUS kit_host_process_board(ascii_kit_host_context_t* ctx, int arg


static const kit_host_map_entry_t kit_host_target_map[] = {
{ "board", kit_host_process_board },
{ "board", kit_host_process_board },
#if ATCA_CA_SUPPORT
{ "ecc", kit_host_process_ca },
{ "sha", kit_host_process_ca },
{ "ecc", kit_host_process_ca },
{ "sha", kit_host_process_ca },
#endif
#if ATCA_TA_SUPPORT
{ "ta", kit_host_process_ta },
{ "ta", kit_host_process_ta },
#endif
{ NULL, NULL }
{ NULL, NULL }
};

static ATCA_STATUS kit_host_process_target(ascii_kit_host_context_t* ctx, int argc, char* argv[], uint8_t* response, size_t* rlen)
Expand Down
2 changes: 1 addition & 1 deletion app/tng/tng_atca.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ static const size_t g_tng_cert_def_cnt = sizeof(g_tng_cert_def_map) / sizeof(tng

const atcacert_def_t* tng_map_get_device_cert_def(int index)
{
if ((index > 0) && ((size_t)index < g_tng_cert_def_cnt))
if ((index >= 0) && ((size_t)index < g_tng_cert_def_cnt))
{
return g_tng_cert_def_map[index].cert_def;
}
Expand Down
32 changes: 23 additions & 9 deletions app/tng/tng_atcacert_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,27 +30,41 @@
#include "tng_atcacert_client.h"
#include "tngtls_cert_def_1_signer.h"
#include "tng_root_cert.h"
#include <limits.h>

int tng_atcacert_max_device_cert_size(size_t* max_cert_size)
{
int ret = ATCACERT_E_WRONG_CERT_DEF;
int index = 0;
size_t cert_size;
size_t cert_size = 0;
const atcacert_def_t* cert_def;

do
if (NULL != max_cert_size)
{
cert_def = tng_map_get_device_cert_def(index++);
if (NULL != cert_def)
do
{
ret = atcacert_max_cert_size(cert_def, &cert_size);
if (cert_size > *max_cert_size)
cert_def = tng_map_get_device_cert_def(index);

if (NULL != cert_def)
{
*max_cert_size = cert_size;
ret = atcacert_max_cert_size(cert_def, &cert_size);
if (cert_size > *max_cert_size)
{
*max_cert_size = cert_size;
}

if (index < INT_MAX)
{
index++;
}
else
{
ret = ATCACERT_E_WRONG_CERT_DEF;
break;
}
}
}
} while ((NULL != cert_def) && (ret == ATCACERT_E_SUCCESS));
}
while ((NULL != cert_def) && (ret != ATCACERT_E_SUCCESS));

return ret;
}
Expand Down
8 changes: 6 additions & 2 deletions harmony/config/cryptoauthlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -381,10 +381,14 @@ def instantiateComponent(calComponent):
calEnablejwt = calComponent.createBooleanSymbol("CAL_ENABLE_JWT", None)
calEnablejwt.setLabel("Enable jwt functionality?")
calEnablejwt.setVisible(True)

calMaxPacketSize = calComponent.createIntegerSymbol('CAL_MAX_PACKET_SIZE', None)
calMaxPacketSize.setLabel('Maximum packet size (bytes)')
calMaxPacketSize.setDefaultValue(1072)
calMaxPacketSize.setDefaultValue(1073)

calMultiPartBuffer = calComponent.createBooleanSymbol("CAL_ENABLE_MULTIPART_BUF", None)
calMultiPartBuffer.setLabel("Enable MultiPart Buffer")
calMultiPartBuffer.setVisible(True)

# Symmetric Cryptography Commands
symmetricCommands = calComponent.createMenuSymbol("cal_symmetric_commands", None)
Expand Down
4 changes: 2 additions & 2 deletions harmony/config/device_instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@

_DEFAULT_I2C_ADDRESS = {'ecc': 0xC0, 'sha': 0xC8, 'ecc204': 0x66, 'ta100': 0x2e, 'sha104': 0x62, 'sha105': 0x64}
_SWI_DEVICES = ['ATSHA204A', 'ATSHA206A', 'ATECC108A', 'ATECC508A', 'ATECC608', 'ECC204', 'TA010', 'SHA104']
_I2C_DEVICES = ['ATSHA204A', 'ATECC108A', 'ATECC508A', 'ATECC608', 'TA100', 'ECC204', 'TA010', 'SHA104', 'SHA105']
_SPI_DEVICES = ['TA100']
_I2C_DEVICES = ['ATSHA204A', 'ATECC108A', 'ATECC508A', 'ATECC608', 'TA100', 'TA101', 'ECC204', 'TA010', 'SHA104', 'SHA105']
_SPI_DEVICES = ['TA100', 'TA101']

caldevcfglist = []

Expand Down
4 changes: 4 additions & 0 deletions harmony/config/pkcs11.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,10 @@ def instantiateComponent(calPkcs11Component):
calPkcs11MaxObjects.setLabel('Maximum number of PKCS11 objects')
calPkcs11MaxObjects.setDefaultValue(16)

calPkcs11MaxCertsCache = calPkcs11Component.createIntegerSymbol('CAL_PKCS11_MAX_CERTS_CACHED', None)
calPkcs11MaxCertsCache.setLabel('Maximum number of certificates cached')
calPkcs11MaxCertsCache.setDefaultValue(5)

calPkcs11MaxConfig = calPkcs11Component.createIntegerSymbol('CAL_PKCS11_MAX_CONFIG', None)
calPkcs11MaxConfig.setLabel('Maximum number of PKCS11 Config Options')
calPkcs11MaxConfig.setDefaultValue(7)
Expand Down
2 changes: 1 addition & 1 deletion harmony/config/test_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
fileSymbolName = "CAL_FILE_SRC_TEST_"
numFileCntr = 0

_TEST_PATHS = ['atcacert/*', 'integration/*', 'jwt/*', 'api_atcab/*', 'api_calib/*', 'api_crypto/*', 'api_talib/*', 'vectors/*']
_TEST_PATHS = ['atcacert/*', 'integration/*', 'jwt/*', 'api_atcab/*', 'api_calib/*', 'api_crypto/*', 'api_talib/*', 'hal/*', 'vectors/*']
_TEST_SOURCES = ['atca_test.c', 'atca_test_config.c', 'atca_test_console.c', 'atca_utils_atecc608.c', 'cmd-processor.c']
_TEST_HEADERS = ['atca_test.h', 'cbuf.h', 'cmd-processor.h']

Expand Down
2 changes: 1 addition & 1 deletion harmony/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import os

_CALIB_SUPPORTED_DEVICES = ['ATECC108A', 'ATECC508A', 'ATECC608', 'ATSHA204A', 'ATSHA206A', 'ECC204', 'TA010', 'SHA104', 'SHA105']
_TALIB_SUPPORTED_DEVICES = ['TA100']
_TALIB_SUPPORTED_DEVICES = ['TA100', 'TA101']

def loadModule():
cryptoAuthLib = Module.CreateSharedComponent("cryptoauthlib", "Core", "/Libraries/Cryptoauthlib", "/harmony/config/cryptoauthlib.py")
Expand Down
4 changes: 4 additions & 0 deletions harmony/templates/atca_config.h.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,10 @@
#endif
</#if>

#ifndef MULTIPART_BUF_EN
#define MULTIPART_BUF_EN ${CAL_ENABLE_MULTIPART_BUF?c}
#endif

#ifndef ATCA_PREPROCESSOR_WARNING
#define ATCA_PREPROCESSOR_WARNING ${CAL_ENABLE_PREPROCESSOR_WARNING?c}
#endif
Expand Down
5 changes: 5 additions & 0 deletions harmony/templates/pkcs11_config.h.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@
#define PKCS11_MAX_SESSIONS_ALLOWED ${CAL_PKCS11_MAX_SESSIONS}
#endif

/** Maximum number of x509 certificates allowed to be cached for parsing */
#ifndef PKCS11_MAX_CERTS_CACHED
#define PKCS11_MAX_CERTS_CACHED ${CAL_PKCS11_MAX_CERTS_CACHED}
#endif

/** Maximum number of cryptographic objects allowed to be cached */
#ifndef PKCS11_MAX_OBJECTS_ALLOWED
#define PKCS11_MAX_OBJECTS_ALLOWED ${CAL_PKCS11_MAX_OBJECTS}
Expand Down
1 change: 0 additions & 1 deletion harmony/templates/talib_config.h.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
#ifndef TALIB_CONFIG_H
#define TALIB_CONFIG_H


/******************** Device Configuration Section *************************/

<#if CAL_ENABLE_TA10x_AES_AUTH>
Expand Down
11 changes: 4 additions & 7 deletions lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ option(ATCA_NO_HEAP "Do not use dynamic (heap) allocation functions" OFF)
option(ATCA_USE_ATCAB_FUNCTIONS "Build the atcab_ api functions rather than using macros" OFF)
option(ATCA_ENABLE_DEPRECATED "Enable the use of older APIs that that been replaced" OFF)
option(ATCA_STRICT_C99 "Enable strict C99 compliance for the libray" OFF)
option(MULTIPART_BUF_EN "Enable MultiPart Buffer" OFF)

# Software Cryptographic backend for host crypto abstractions
option(ATCA_MBEDTLS "Integrate with mbedtls" OFF)
Expand Down Expand Up @@ -62,10 +63,6 @@ if (TARGET zephyr_interface)
SET(ATCA_ZEPHYR_SUPPORT ON CACHE INTERNAL "Include zephyr hal drivers")
endif()

# Set maximum packet size that is allowed in bytes
SET(MAX_PACKET_SIZE 1072 CACHE STRING "Dafault packet size allowed in bytes")


# Check Integration Options
if (ATCA_MBEDTLS AND (ATCA_WOLFSSL OR ATCA_OPENSSL))
message(FATAL_ERROR "Only one external SSL/TLS library can be supported")
Expand Down Expand Up @@ -309,12 +306,12 @@ endif(BUILD_TESTS)
configure_file(atca_config.h.in atca_config.h @ONLY)
set(LIB_INC ${LIB_INC} ${CMAKE_CURRENT_BINARY_DIR}/atca_config.h)

include_directories(cryptoauth PUBLIC ${CMAKE_CURRENT_BINARY_DIR}
include_directories(cryptoauth PUBLIC ${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_BINARY_DIR}/downloaded
../app/tng
../third_party
../third_party/hidapi/hidapi
../third_party
../third_party/hidapi/hidapi
${USB_INCLUDE_DIR})

if(ATCA_MBEDTLS)
Expand Down

0 comments on commit c6c6adc

Please sign in to comment.