Skip to content

Commit e8c7403

Browse files
committed
Release v3.7.5 (20240626)
1 parent 405d831 commit e8c7403

File tree

80 files changed

+6250
-8017
lines changed

Some content is hidden

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

80 files changed

+6250
-8017
lines changed

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ cmake_minimum_required(VERSION 3.1.0)
22
project (cryptoauthlib C)
33

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

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

app/tng/tng_atca.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,23 +77,24 @@ const atcacert_def_t* tng_map_get_device_cert_def(int index)
7777
}
7878
}
7979

80-
ATCA_STATUS tng_get_device_cert_def(const atcacert_def_t **cert_def)
80+
ATCA_STATUS tng_get_device_cert_def_ext(ATCADevice device, const atcacert_def_t **cert_def)
8181
{
8282
ATCA_STATUS status;
83-
char otpcode[32];
83+
char otpcode[(ATCA_OTP_SIZE / 2u)];
84+
uint8_t otp_rd_byte_max_sz = (ATCA_OTP_SIZE / 2u);
8485
uint8_t i;
8586

8687
if (cert_def == NULL)
8788
{
8889
return ATCA_BAD_PARAM;
8990
}
9091

91-
status = atcab_read_zone(ATCA_ZONE_OTP, 0, 0, 0, (uint8_t*)otpcode, 32);
92+
status = atcab_read_zone_ext(device, ATCA_ZONE_OTP, 0, 0, 0, (uint8_t*)otpcode, otp_rd_byte_max_sz);
9293
if (ATCA_SUCCESS == status)
9394
{
9495
for (i = 0; i < g_tng_cert_def_cnt; i++)
9596
{
96-
if (0 == strncmp(g_tng_cert_def_map[i].otpcode, otpcode, 8))
97+
if (0 == strncmp(g_tng_cert_def_map[i].otpcode, otpcode, ATCA_OTP_CODE_SIZE))
9798
{
9899
*cert_def = g_tng_cert_def_map[i].cert_def;
99100
break;
@@ -109,6 +110,11 @@ ATCA_STATUS tng_get_device_cert_def(const atcacert_def_t **cert_def)
109110
return status;
110111
}
111112

113+
ATCA_STATUS tng_get_device_cert_def(const atcacert_def_t **cert_def)
114+
{
115+
return tng_get_device_cert_def_ext(atcab_get_device(), cert_def);
116+
}
117+
112118
ATCA_STATUS tng_get_device_pubkey(uint8_t *public_key)
113119
{
114120
ATCA_STATUS status;

app/tng/tng_atca.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@
3535
extern "C" {
3636
#endif
3737

38+
#define ATCA_OTP_CODE_SIZE (8u)
39+
3840
/** \defgroup tng_ TNG API (tng_)
3941
*
4042
* \brief These methods provide some convenience functions (mostly around
@@ -60,6 +62,17 @@ const atcacert_def_t* tng_map_get_device_cert_def(int index);
6062

6163
ATCA_STATUS tng_get_device_cert_def(const atcacert_def_t **cert_def);
6264

65+
66+
/** \brief Get the TNG device certificate definition.
67+
*
68+
* \param[in] device Pointer to the device context pointer
69+
* \param[out] cert_def TNG device certificate defnition is returned here.
70+
*
71+
* \return ATCA_SUCCESS on success, otherwise an error code.
72+
*/
73+
74+
ATCA_STATUS tng_get_device_cert_def_ext(ATCADevice device, const atcacert_def_t **cert_def);
75+
6376
/** \brief Uses GenKey command to calculate the public key from the primary
6477
* device public key.
6578
*

cmake/config_install.cmake

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,8 @@ install(CODE "
2525
endif()
2626
")
2727
endif()
28+
29+
if (UNIX)
30+
configure_file(cmake/libcryptoauth.pc.in libcryptoauth.pc @ONLY)
31+
install(FILES ${CMAKE_BINARY_DIR}/libcryptoauth.pc DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}/pkgconfig")
32+
endif (UNIX)

cmake/libcryptoauth.pc.in

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
libdir=@CMAKE_INSTALL_FULL_LIBDIR@
2+
includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@
3+
4+
Name: libcryptoauth
5+
Version: @PROJECT_VERSION@
6+
Description: @PROJECT_DESCRIPTION@
7+
URL: https://github.com/MicrochipTech/cryptoauthlib.git
8+
Requires:
9+
Libs: -L${libdir} -lcryptoauth
10+
Cflags: -I${includedir} -I${includedir}/cryptoauthlib

cryptoauthlib-manual.pdf

14.5 KB
Binary file not shown.

lib/atca_basic.c

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2458,12 +2458,14 @@ ATCA_STATUS atcab_random(uint8_t* rand_out)
24582458

24592459
// Read command functions
24602460

2461+
#if ATCAB_READ_EN && defined(ATCA_USE_ATCAB_FUNCTIONS)
24612462
/** \brief Executes Read command, which reads either 4 or 32 bytes of data from
24622463
* a given slot, configuration zone, or the OTP zone.
24632464
*
24642465
* When reading a slot or OTP, data zone must be locked and the slot
24652466
* configuration must not be secret for a slot to be successfully read.
24662467
*
2468+
* \param[in] device Device context
24672469
* \param[in] zone Zone to be read from device. Options are
24682470
* ATCA_ZONE_CONFIG, ATCA_ZONE_OTP, or ATCA_ZONE_DATA.
24692471
* \param[in] slot Slot number for data zone and ignored for other zones.
@@ -2475,16 +2477,15 @@ ATCA_STATUS atcab_random(uint8_t* rand_out)
24752477
*
24762478
* returns ATCA_SUCCESS on success, otherwise an error code.
24772479
*/
2478-
#if ATCAB_READ_EN && defined(ATCA_USE_ATCAB_FUNCTIONS)
2479-
ATCA_STATUS atcab_read_zone(uint8_t zone, uint16_t slot, uint8_t block, uint8_t offset, uint8_t* data, uint8_t len)
2480+
ATCA_STATUS atcab_read_zone_ext(ATCADevice device, uint8_t zone, uint16_t slot, uint8_t block, uint8_t offset, uint8_t* data, uint8_t len)
24802481
{
24812482
ATCA_STATUS status = ATCA_UNIMPLEMENTED;
2482-
ATCADeviceType dev_type = atcab_get_device_type();
2483+
ATCADeviceType dev_type = atcab_get_device_type_ext(device);
24832484

24842485
if (atcab_is_ca_device(dev_type) || atcab_is_ca2_device(dev_type))
24852486
{
24862487
#if ATCA_CA_SUPPORT
2487-
status = calib_read_zone_ext(g_atcab_device_ptr, zone, slot, block, offset, data, len);
2488+
status = calib_read_zone_ext(device, zone, slot, block, offset, data, len);
24882489
#endif
24892490
}
24902491
else if (atcab_is_ta_device(dev_type))
@@ -2497,6 +2498,28 @@ ATCA_STATUS atcab_read_zone(uint8_t zone, uint16_t slot, uint8_t block, uint8_t
24972498
}
24982499
return status;
24992500
}
2501+
2502+
/** \brief Executes Read command, which reads either 4 or 32 bytes of data from
2503+
* a given slot, configuration zone, or the OTP zone.
2504+
*
2505+
* When reading a slot or OTP, data zone must be locked and the slot
2506+
* configuration must not be secret for a slot to be successfully read.
2507+
*
2508+
* \param[in] zone Zone to be read from device. Options are
2509+
* ATCA_ZONE_CONFIG, ATCA_ZONE_OTP, or ATCA_ZONE_DATA.
2510+
* \param[in] slot Slot number for data zone and ignored for other zones.
2511+
* \param[in] block 32 byte block index within the zone.
2512+
* \param[in] offset 4 byte work index within the block. Ignored for 32 byte
2513+
* reads.
2514+
* \param[out] data Read data is returned here.
2515+
* \param[in] len Length of the data to be read. Must be either 4 or 32.
2516+
*
2517+
* returns ATCA_SUCCESS on success, otherwise an error code.
2518+
*/
2519+
ATCA_STATUS atcab_read_zone(uint8_t zone, uint16_t slot, uint8_t block, uint8_t offset, uint8_t* data, uint8_t len)
2520+
{
2521+
return atcab_read_zone_ext(atcab_get_device(), zone, slot, block, offset, data, len);
2522+
}
25002523
#endif /* ATCAB_READ_EN */
25012524

25022525
#ifdef ATCA_USE_ATCAB_FUNCTIONS

lib/atca_basic.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@ ATCA_STATUS atcab_random_ext(ATCADevice device, uint8_t* rand_out);
206206

207207
// Read command functions
208208
ATCA_STATUS atcab_read_zone(uint8_t zone, uint16_t slot, uint8_t block, uint8_t offset, uint8_t* data, uint8_t len);
209+
ATCA_STATUS atcab_read_zone_ext(ATCADevice device, uint8_t zone, uint16_t slot, uint8_t block, uint8_t offset, uint8_t* data, uint8_t len);
209210
ATCA_STATUS atcab_is_locked(uint8_t zone, bool* is_locked);
210211
ATCA_STATUS atcab_is_config_locked(bool* is_locked);
211212
ATCA_STATUS atcab_is_config_locked_ext(ATCADevice device, bool* is_locked);

lib/atca_compiler.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,10 @@
142142

143143
#elif defined(_MSC_VER)
144144
/* Microsoft Visual Studio. --------------------------------- */
145+
#if _MSC_VER >= 1914
146+
// This warning was added in MSCV 2017 Update 7 (15.7.1)
145147
#pragma warning(disable:5045) //Spectre mitigation informative
148+
#endif
146149
#pragma warning(disable:4820) //Stucture packing
147150
#pragma warning(disable:4061) //Missing enumerations from switch statements
148151

lib/atca_config_check.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,13 @@
6161
#define ATCA_CA2_SUPPORT DEFAULT_DISABLED
6262
#endif
6363

64+
/* Support for cert feature in second generation of cryptoauth parts */
65+
#if defined(ATCA_ECC204_SUPPORT) || defined(ATCA_TA010_SUPPORT)
66+
#define ATCA_CA2_CERT_SUPPORT DEFAULT_ENABLED
67+
#else
68+
#define ATCA_CA2_CERT_SUPPORT DEFAULT_DISABLED
69+
#endif
70+
6471
/* Classic Cryptoauth Devices */
6572
#if defined(ATCA_SHA_SUPPORT) || defined(ATCA_ECC_SUPPORT) || ATCA_CA2_SUPPORT
6673
#define ATCA_CA_SUPPORT DEFAULT_ENABLED

0 commit comments

Comments
 (0)