Skip to content

Commit c6c6adc

Browse files
committed
Release v3.7.1 (20231215)
1 parent b3fcd83 commit c6c6adc

117 files changed

Lines changed: 4749 additions & 1715 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

app/kit_host/ascii_kit_host.c

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -342,8 +342,8 @@ static ATCA_STATUS kit_host_ca_select(ascii_kit_host_context_t* ctx, int argc, c
342342

343343
#if ATCA_CA_SUPPORT
344344
static kit_host_map_entry_t kit_host_ca_physical_map[] = {
345-
{ "select", kit_host_ca_select },
346-
{ NULL, NULL }
345+
{ "select", kit_host_ca_select },
346+
{ NULL, NULL }
347347
};
348348

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

354354
/* Cryptoauth Device commands */
355355
static kit_host_map_entry_t kit_host_ca_map[] = {
356-
{ "wake", kit_host_ca_wake },
357-
{ "idle", kit_host_ca_idle },
358-
{ "sleep", kit_host_ca_sleep },
359-
{ "talk", kit_host_ca_talk },
360-
{ "physical", kit_host_ca_physical },
361-
{ NULL, NULL }
356+
{ "wake", kit_host_ca_wake },
357+
{ "idle", kit_host_ca_idle },
358+
{ "sleep", kit_host_ca_sleep },
359+
{ "talk", kit_host_ca_talk },
360+
{ "physical", kit_host_ca_physical },
361+
{ NULL, NULL }
362362
};
363363

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

393393
if (ctx && argc && response && rlen)
394394
{
395-
ATCA_TA_CmdPacket* packet = (ATCA_TA_CmdPacket*)ctx->buffer;
395+
cal_buffer* packet = talib_packet_alloc();
396396

397-
if (packet)
397+
if (NULL != packet)
398398
{
399399
size_t plen = sizeof(ctx->buffer) - 2;
400+
packet->buf = ctx->buffer;
400401

401-
atcab_hex2bin(argv[0], strlen(argv[0]), (uint8_t*)&packet->length, &plen);
402+
atcab_hex2bin(argv[0], strlen(argv[0]), packet->buf, &plen);
402403
if (ATCA_SUCCESS == (status = talib_execute_command_raw(packet, ctx->device)))
403404
{
404-
ATCA_TA_RspPacket * resp = (ATCA_TA_RspPacket*)packet;
405-
*rlen = kit_host_format_response(response, *rlen, status, resp->data, resp->resp_code);
405+
406+
*rlen = kit_host_format_response(response, *rlen, status, &packet->buf[PKT_CAL_BUF_DATA_IDX], packet->buf[2]);
406407
}
407408
else
408409
{
@@ -477,7 +478,7 @@ static ATCA_STATUS kit_host_ta_receive(ascii_kit_host_context_t* ctx, int argc,
477478
status = ATCA_SMALL_BUFFER;
478479
break;
479480
}
480-
if (read_length < (3 + length_size)) //status(1) and CRC(2) size are same for CA and TA, length is variable.
481+
if (read_length < (3 + length_size)) //status(1) and CRC(2) size are same for CA and TA, length is variable.
481482
{
482483
status = ATCA_RX_FAIL;
483484
break;
@@ -513,8 +514,7 @@ static ATCA_STATUS kit_host_ta_receive(ascii_kit_host_context_t* ctx, int argc,
513514
}
514515

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

530530
static kit_host_map_entry_t kit_host_ta_physical_map[] = {
531-
{ "select", kit_host_ca_select }, /* Selection logic is the same */
532-
{ NULL, NULL }
531+
{ "select", kit_host_ca_select }, /* Selection logic is the same */
532+
{ NULL, NULL }
533533
};
534534

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

540540
static kit_host_map_entry_t kit_host_ta_map[] = {
541-
{ "wake", kit_host_ta_wake },
542-
{ "idle", kit_host_ta_idle },
543-
{ "sleep", kit_host_ta_sleep },
544-
{ "talk", kit_host_ta_talk },
545-
{ "send", kit_host_ta_send },
546-
{ "receive", kit_host_ta_receive },
547-
{ "physical", kit_host_ta_physical },
548-
{ NULL, NULL }
541+
{ "wake", kit_host_ta_wake },
542+
{ "idle", kit_host_ta_idle },
543+
{ "sleep", kit_host_ta_sleep },
544+
{ "talk", kit_host_ta_talk },
545+
{ "send", kit_host_ta_send },
546+
{ "receive", kit_host_ta_receive },
547+
{ "physical", kit_host_ta_physical },
548+
{ NULL, NULL }
549549
};
550550

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

587587

588588
static kit_host_map_entry_t kit_host_board_map[] = {
589-
{ "version", kit_host_board_get_version },
590-
{ "firmware", kit_host_board_get_firmware },
591-
{ "device", kit_host_board_get_device },
592-
{ NULL, NULL }
589+
{ "version", kit_host_board_get_version },
590+
{ "firmware", kit_host_board_get_firmware },
591+
{ "device", kit_host_board_get_device },
592+
{ NULL, NULL }
593593
};
594594

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

600600

601601
static const kit_host_map_entry_t kit_host_target_map[] = {
602-
{ "board", kit_host_process_board },
602+
{ "board", kit_host_process_board },
603603
#if ATCA_CA_SUPPORT
604-
{ "ecc", kit_host_process_ca },
605-
{ "sha", kit_host_process_ca },
604+
{ "ecc", kit_host_process_ca },
605+
{ "sha", kit_host_process_ca },
606606
#endif
607607
#if ATCA_TA_SUPPORT
608-
{ "ta", kit_host_process_ta },
608+
{ "ta", kit_host_process_ta },
609609
#endif
610-
{ NULL, NULL }
610+
{ NULL, NULL }
611611
};
612612

613613
static ATCA_STATUS kit_host_process_target(ascii_kit_host_context_t* ctx, int argc, char* argv[], uint8_t* response, size_t* rlen)

app/tng/tng_atca.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ static const size_t g_tng_cert_def_cnt = sizeof(g_tng_cert_def_map) / sizeof(tng
6767

6868
const atcacert_def_t* tng_map_get_device_cert_def(int index)
6969
{
70-
if ((index > 0) && ((size_t)index < g_tng_cert_def_cnt))
70+
if ((index >= 0) && ((size_t)index < g_tng_cert_def_cnt))
7171
{
7272
return g_tng_cert_def_map[index].cert_def;
7373
}

app/tng/tng_atcacert_client.c

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,27 +30,41 @@
3030
#include "tng_atcacert_client.h"
3131
#include "tngtls_cert_def_1_signer.h"
3232
#include "tng_root_cert.h"
33+
#include <limits.h>
3334

3435
int tng_atcacert_max_device_cert_size(size_t* max_cert_size)
3536
{
3637
int ret = ATCACERT_E_WRONG_CERT_DEF;
3738
int index = 0;
38-
size_t cert_size;
39+
size_t cert_size = 0;
3940
const atcacert_def_t* cert_def;
4041

41-
do
42+
if (NULL != max_cert_size)
4243
{
43-
cert_def = tng_map_get_device_cert_def(index++);
44-
if (NULL != cert_def)
44+
do
4545
{
46-
ret = atcacert_max_cert_size(cert_def, &cert_size);
47-
if (cert_size > *max_cert_size)
46+
cert_def = tng_map_get_device_cert_def(index);
47+
48+
if (NULL != cert_def)
4849
{
49-
*max_cert_size = cert_size;
50+
ret = atcacert_max_cert_size(cert_def, &cert_size);
51+
if (cert_size > *max_cert_size)
52+
{
53+
*max_cert_size = cert_size;
54+
}
55+
56+
if (index < INT_MAX)
57+
{
58+
index++;
59+
}
60+
else
61+
{
62+
ret = ATCACERT_E_WRONG_CERT_DEF;
63+
break;
64+
}
5065
}
51-
}
66+
} while ((NULL != cert_def) && (ret == ATCACERT_E_SUCCESS));
5267
}
53-
while ((NULL != cert_def) && (ret != ATCACERT_E_SUCCESS));
5468

5569
return ret;
5670
}

harmony/config/cryptoauthlib.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -381,10 +381,14 @@ def instantiateComponent(calComponent):
381381
calEnablejwt = calComponent.createBooleanSymbol("CAL_ENABLE_JWT", None)
382382
calEnablejwt.setLabel("Enable jwt functionality?")
383383
calEnablejwt.setVisible(True)
384-
384+
385385
calMaxPacketSize = calComponent.createIntegerSymbol('CAL_MAX_PACKET_SIZE', None)
386386
calMaxPacketSize.setLabel('Maximum packet size (bytes)')
387-
calMaxPacketSize.setDefaultValue(1072)
387+
calMaxPacketSize.setDefaultValue(1073)
388+
389+
calMultiPartBuffer = calComponent.createBooleanSymbol("CAL_ENABLE_MULTIPART_BUF", None)
390+
calMultiPartBuffer.setLabel("Enable MultiPart Buffer")
391+
calMultiPartBuffer.setVisible(True)
388392

389393
# Symmetric Cryptography Commands
390394
symmetricCommands = calComponent.createMenuSymbol("cal_symmetric_commands", None)

harmony/config/device_instance.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424

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

3030
caldevcfglist = []
3131

harmony/config/pkcs11.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,10 @@ def instantiateComponent(calPkcs11Component):
131131
calPkcs11MaxObjects.setLabel('Maximum number of PKCS11 objects')
132132
calPkcs11MaxObjects.setDefaultValue(16)
133133

134+
calPkcs11MaxCertsCache = calPkcs11Component.createIntegerSymbol('CAL_PKCS11_MAX_CERTS_CACHED', None)
135+
calPkcs11MaxCertsCache.setLabel('Maximum number of certificates cached')
136+
calPkcs11MaxCertsCache.setDefaultValue(5)
137+
134138
calPkcs11MaxConfig = calPkcs11Component.createIntegerSymbol('CAL_PKCS11_MAX_CONFIG', None)
135139
calPkcs11MaxConfig.setLabel('Maximum number of PKCS11 Config Options')
136140
calPkcs11MaxConfig.setDefaultValue(7)

harmony/config/test_app.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
fileSymbolName = "CAL_FILE_SRC_TEST_"
2828
numFileCntr = 0
2929

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

harmony/module.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
import os
2525

2626
_CALIB_SUPPORTED_DEVICES = ['ATECC108A', 'ATECC508A', 'ATECC608', 'ATSHA204A', 'ATSHA206A', 'ECC204', 'TA010', 'SHA104', 'SHA105']
27-
_TALIB_SUPPORTED_DEVICES = ['TA100']
27+
_TALIB_SUPPORTED_DEVICES = ['TA100', 'TA101']
2828

2929
def loadModule():
3030
cryptoAuthLib = Module.CreateSharedComponent("cryptoauthlib", "Core", "/Libraries/Cryptoauthlib", "/harmony/config/cryptoauthlib.py")

harmony/templates/atca_config.h.ftl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -460,6 +460,10 @@
460460
#endif
461461
</#if>
462462

463+
#ifndef MULTIPART_BUF_EN
464+
#define MULTIPART_BUF_EN ${CAL_ENABLE_MULTIPART_BUF?c}
465+
#endif
466+
463467
#ifndef ATCA_PREPROCESSOR_WARNING
464468
#define ATCA_PREPROCESSOR_WARNING ${CAL_ENABLE_PREPROCESSOR_WARNING?c}
465469
#endif

harmony/templates/pkcs11_config.h.ftl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,11 @@
7474
#define PKCS11_MAX_SESSIONS_ALLOWED ${CAL_PKCS11_MAX_SESSIONS}
7575
#endif
7676

77+
/** Maximum number of x509 certificates allowed to be cached for parsing */
78+
#ifndef PKCS11_MAX_CERTS_CACHED
79+
#define PKCS11_MAX_CERTS_CACHED ${CAL_PKCS11_MAX_CERTS_CACHED}
80+
#endif
81+
7782
/** Maximum number of cryptographic objects allowed to be cached */
7883
#ifndef PKCS11_MAX_OBJECTS_ALLOWED
7984
#define PKCS11_MAX_OBJECTS_ALLOWED ${CAL_PKCS11_MAX_OBJECTS}

0 commit comments

Comments
 (0)