Skip to content

Commit a7bbe3a

Browse files
committed
Release v3.7.8 (20250505)
1 parent 5135c92 commit a7bbe3a

Some content is hidden

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

67 files changed

+1480
-487
lines changed

CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
cmake_minimum_required(VERSION 3.10.0)
1+
cmake_minimum_required(VERSION 3.20.0)
22
project (cryptoauthlib C)
33

44
# Set the current release version
5-
set(VERSION "3.7.7")
5+
set(VERSION "3.7.8")
66
set(VERSION_MAJOR 3)
77
set(VERSION_MINOR 7)
8-
set(VERSION_PATCH 7)
8+
set(VERSION_PATCH 8)
99

1010
# Build Options
1111
option(BUILD_TESTS "Create Test Application with library" OFF)

app/tng/tng_atcacert_client.c

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ int tng_atcacert_max_device_cert_size(size_t* max_cert_size)
3939
int ret = ATCACERT_E_WRONG_CERT_DEF;
4040
int index = 0;
4141
size_t cert_size = 0;
42+
size_t current_max_cert_size = 0;
4243
const atcacert_def_t* cert_def;
4344

4445
if (NULL != max_cert_size)
@@ -50,13 +51,14 @@ int tng_atcacert_max_device_cert_size(size_t* max_cert_size)
5051
if (NULL != cert_def)
5152
{
5253
ret = atcacert_max_cert_size(cert_def, &cert_size);
53-
if (ATCACERT_E_SUCCESS == ret)
54+
if (ATCACERT_E_SUCCESS != ret)
5455
{
55-
*max_cert_size = cert_size;
56+
break;
5657
}
57-
else
58+
59+
if (cert_size > current_max_cert_size)
5860
{
59-
break;
61+
current_max_cert_size = cert_size;
6062
}
6163

6264
if (index < INT_MAX)
@@ -70,6 +72,11 @@ int tng_atcacert_max_device_cert_size(size_t* max_cert_size)
7072
}
7173
}
7274
} while ((NULL != cert_def) && (ret == ATCACERT_E_SUCCESS));
75+
76+
if (ret == ATCACERT_E_SUCCESS)
77+
{
78+
*max_cert_size = current_max_cert_size;
79+
}
7380
}
7481

7582
return ret;
@@ -165,19 +172,13 @@ int tng_atcacert_read_signer_cert(uint8_t* cert, size_t* cert_size)
165172
{
166173
int ret;
167174
const atcacert_def_t* cert_def = NULL;
168-
uint8_t* ca_public_key = NULL;
169-
cal_buffer ca_pubkey = CAL_BUF_INIT(ATCA_ECCP256_PUBKEY_SIZE, NULL);
175+
const cal_buffer ca_public_key = cal_buf_init_const_ptr(ATCA_ECCP256_PUBKEY_SIZE, &g_cryptoauth_root_ca_002_cert[CRYPTOAUTH_ROOT_CA_002_PUBLIC_KEY_OFFSET]);
170176

171177
ret = tng_get_device_cert_def(&cert_def);
172178
if (ATCA_SUCCESS == ret)
173179
{
174180
cert_def = cert_def->ca_cert_def;
175-
176-
// Get the CA (root) public key
177-
ca_public_key = &g_cryptoauth_root_ca_002_cert[CRYPTOAUTH_ROOT_CA_002_PUBLIC_KEY_OFFSET];
178-
179-
ca_pubkey.buf = ca_public_key;
180-
ret = atcacert_read_cert(cert_def, &ca_pubkey, cert, cert_size);
181+
ret = atcacert_read_cert(cert_def, &ca_public_key, cert, cert_size);
181182
}
182183

183184
return ret;

cryptoauthlib-manual.pdf

-4.19 KB
Binary file not shown.

harmony/config/cryptoauthlib.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,11 @@ def instantiateComponent(calComponent):
402402
calDebugPrint.setLabel("Enable Debug Print?")
403403
calDebugPrint.setVisible(True)
404404

405+
calEnableCheckParams = calComponent.createBooleanSymbol("CAL_ENABLE_CHECK_PARAMS", None)
406+
calEnableCheckParams.setLabel("Enable Check Params?")
407+
calEnableCheckParams.setVisible(True)
408+
calEnableCheckParams.setDefaultValue(True)
409+
405410
calPreprocessorWarning = calComponent.createBooleanSymbol("CAL_ENABLE_PREPROCESSOR_WARNING", None)
406411
calPreprocessorWarning.setLabel("Enable Preprocessor Warning?")
407412
calPreprocessorWarning.setVisible(True)

harmony/templates/atca_config.h.ftl

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,13 @@
5353
#endif
5454
</#if>
5555

56+
/** Define if the library is not to use malloc/free */
57+
<#if CAL_ENABLE_CHECK_PARAMS == false>
58+
<#lt>#define ATCA_CHECK_PARAMS_EN (FEATURE_DISABLED)
59+
<#else>
60+
<#lt>#define ATCA_CHECK_PARAMS_EN (FEATURE_ENABLED)
61+
</#if>
62+
5663
/** Symmetric Commands Configurations */
5764

5865
/* AES Command */
@@ -530,8 +537,8 @@
530537
#define PLIB_I2C_TRANSFER_SETUP I2C_TRANSFER_SETUP
531538
</#if>
532539

533-
typedef bool (* atca_i2c_plib_read)( uint16_t, uint8_t *, ${size_var} );
534-
typedef bool (* atca_i2c_plib_write)( uint16_t, uint8_t *, ${size_var} );
540+
typedef bool (* atca_i2c_plib_read)( uint16_t address, uint8_t * data, ${size_var} datalen);
541+
typedef bool (* atca_i2c_plib_write)( uint16_t address, uint8_t * data, ${size_var} datalen);
535542
typedef bool (* atca_i2c_plib_is_busy)( void );
536543
typedef PLIB_I2C_ERROR (* atca_i2c_error_get)( void );
537544
typedef bool (* atca_i2c_plib_transfer_setup)(PLIB_I2C_TRANSFER_SETUP* setup, uint32_t srcClkFreq);
@@ -550,8 +557,8 @@ typedef struct atca_plib_i2c_api
550557

551558
<#if plib_info[plib_info?size-1] == "spi">
552559
<#if is_atca_plib_spi_exists == "False">
553-
typedef bool (* atca_spi_plib_read)( void * , size_t );
554-
typedef bool (* atca_spi_plib_write)( void *, size_t );
560+
typedef bool (* atca_spi_plib_read)( void * data, size_t datalen);
561+
typedef bool (* atca_spi_plib_write)( void * data, size_t datalen);
555562
typedef bool (* atca_spi_plib_is_busy)( void );
556563
typedef void (* atca_spi_plib_select)(uint32_t pin, bool value);
557564

@@ -597,8 +604,8 @@ typedef struct atca_plib_spi_api
597604
#define PLIB_SWI_EVENT USART_EVENT
598605
</#if>
599606

600-
typedef size_t (* atca_uart_plib_read)( uint8_t *, const size_t );
601-
typedef size_t (* atca_uart_plib_write)( uint8_t *, const size_t );
607+
typedef size_t (* atca_uart_plib_read)( uint8_t * data, const size_t datalen);
608+
typedef size_t (* atca_uart_plib_write)( uint8_t * data, const size_t datalen);
602609
typedef PLIB_SWI_ERROR (* atca_uart_error_get)( void );
603610
typedef bool (* atca_uart_plib_serial_setup)(PLIB_SWI_SERIAL_SETUP* , uint32_t );
604611
typedef size_t (* atca_uart_plib_readcount_get)( void );

harmony/templates/hal_cortex_m_delay.c.ftl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -154,16 +154,16 @@ void _delay_cycles(void *const hw, uint32_t cycles)
154154
/**
155155
* \brief Perform delay in us
156156
*/
157-
void hal_delay_us(const uint32_t us)
157+
void hal_delay_us(uint32_t delay)
158158
{
159-
uint32_t cycles = (GET_CYCLES_FOR_US_INTERNAL(us,CONF_CPU_FREQUENCY));
159+
uint32_t cycles = (GET_CYCLES_FOR_US_INTERNAL(delay,CONF_CPU_FREQUENCY));
160160
DELAY_CYCLES_US(cycles);
161161
}
162162

163163
/**
164164
* \brief Perform delay in ms
165165
*/
166-
void hal_delay_ms(const uint32_t ms)
166+
void hal_delay_ms(uint32_t delay)
167167
{
168-
_delay_cycles((void*)0,(_get_cycles_for_ms(ms)/ MS_CYCLE_COUNT_DIVIDER));
168+
_delay_cycles((void*)0,(_get_cycles_for_ms(delay)/ MS_CYCLE_COUNT_DIVIDER));
169169
}

lib/CMakeLists.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.10.0)
1+
cmake_minimum_required(VERSION 3.20.0)
22
project(cryptoauth C)
33

44
include(CheckSymbolExists)
@@ -18,6 +18,7 @@ option(ATCA_JWT_EN "Enable jwt functionality")
1818
option(ATCA_PKCS11 "Build PKCS11 Library")
1919
option(ATCA_BUILD_SHARED_LIBS "Build CryptoAuthLib as shared library" ON)
2020
option(ATCA_NO_HEAP "Do not use dynamic (heap) allocation functions" OFF)
21+
option(ATCA_CHECK_PARAMS_EN "Check parameters" ON)
2122
option(ATCA_USE_ATCAB_FUNCTIONS "Build the atcab_ api functions rather than using macros" OFF)
2223
option(ATCA_ENABLE_DEPRECATED "Enable the use of older APIs that that been replaced" OFF)
2324
option(ATCA_STRICT_C99 "Enable strict C99 compliance for the libray" OFF)
@@ -327,6 +328,10 @@ include_directories(cryptoauth PUBLIC ${CMAKE_CURRENT_BINARY_DIR}
327328
../third_party/hidapi/hidapi
328329
${USB_INCLUDE_DIR})
329330

331+
if(APPLE)
332+
include_directories(cryptoauth PUBLIC ../third_party/hidapi/mac)
333+
endif()
334+
330335
if(ATCA_MBEDTLS)
331336
target_link_libraries(cryptoauth mbedtls)
332337
endif()

lib/atca_basic.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@
3737
#endif
3838
#endif
3939

40+
#ifdef __COVERITY__
41+
#pragma coverity compliance block deviate "MISRA C-2012 Rule 8.4" "The object prototype is defined "
42+
#endif
43+
4044
SHARED_LIB_EXPORT ATCADevice g_atcab_device_ptr = NULL;
4145

4246
#ifdef ATCA_NO_HEAP
@@ -4629,3 +4633,7 @@ ATCA_STATUS atcab_write_config_counter(uint16_t counter_id, uint32_t counter_val
46294633
return status;
46304634
}
46314635
#endif /* ATCAB_WRITE_CONFIG_BYTES_ZONE */
4636+
4637+
#ifdef __COVERITY__
4638+
#pragma coverity compliance end_block "MISRA C-2012 Rule 8.4"
4639+
#endif

lib/atca_compiler.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,10 @@
8888
#define SHARED_LIB_IMPORT extern
8989
#endif
9090

91+
#ifdef __APPLE__
92+
#define ATCA_VECTOR_NO_PRAGMA_PACK
93+
#endif
94+
9195
//#elif defined(__ICC) || defined(__INTEL_COMPILER)
9296
/* Intel ICC/ICPC. ------------------------------------------ */
9397

@@ -139,6 +143,9 @@
139143
#define SHARED_LIB_IMPORT extern
140144
#endif
141145

146+
#ifdef __APPLE__
147+
#define ATCA_VECTOR_NO_PRAGMA_PACK
148+
#endif
142149

143150
//#elif defined(__HP_cc) || defined(__HP_aCC)
144151
/* Hewlett-Packard C/aC++. ---------------------------------- */

lib/atca_config.h.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ selected plus however additional slots one would like */
6060
/** Enable preprocessor warning messages */
6161
#cmakedefine01 ATCA_PREPROCESSOR_WARNING
6262

63+
/** Enable check params */
64+
#cmakedefine01 ATCA_CHECK_PARAMS_EN
65+
6366
/** Enable jwt functionality */
6467
#cmakedefine ATCA_JWT_EN
6568

0 commit comments

Comments
 (0)