Skip to content

Commit

Permalink
Release v3.7.5 (20240626)
Browse files Browse the repository at this point in the history
  • Loading branch information
Srinivas-E committed Jun 27, 2024
1 parent 405d831 commit e8c7403
Show file tree
Hide file tree
Showing 80 changed files with 6,250 additions and 8,017 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ cmake_minimum_required(VERSION 3.1.0)
project (cryptoauthlib C)

# Set the current release version
set(VERSION "3.7.4")
set(VERSION "3.7.5")
set(VERSION_MAJOR 3)
set(VERSION_MINOR 7)
set(VERSION_PATCH 4)
set(VERSION_PATCH 5)

# Build Options
option(BUILD_TESTS "Create Test Application with library" OFF)
Expand Down
14 changes: 10 additions & 4 deletions app/tng/tng_atca.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,23 +77,24 @@ const atcacert_def_t* tng_map_get_device_cert_def(int index)
}
}

ATCA_STATUS tng_get_device_cert_def(const atcacert_def_t **cert_def)
ATCA_STATUS tng_get_device_cert_def_ext(ATCADevice device, const atcacert_def_t **cert_def)
{
ATCA_STATUS status;
char otpcode[32];
char otpcode[(ATCA_OTP_SIZE / 2u)];
uint8_t otp_rd_byte_max_sz = (ATCA_OTP_SIZE / 2u);
uint8_t i;

if (cert_def == NULL)
{
return ATCA_BAD_PARAM;
}

status = atcab_read_zone(ATCA_ZONE_OTP, 0, 0, 0, (uint8_t*)otpcode, 32);
status = atcab_read_zone_ext(device, ATCA_ZONE_OTP, 0, 0, 0, (uint8_t*)otpcode, otp_rd_byte_max_sz);
if (ATCA_SUCCESS == status)
{
for (i = 0; i < g_tng_cert_def_cnt; i++)
{
if (0 == strncmp(g_tng_cert_def_map[i].otpcode, otpcode, 8))
if (0 == strncmp(g_tng_cert_def_map[i].otpcode, otpcode, ATCA_OTP_CODE_SIZE))
{
*cert_def = g_tng_cert_def_map[i].cert_def;
break;
Expand All @@ -109,6 +110,11 @@ ATCA_STATUS tng_get_device_cert_def(const atcacert_def_t **cert_def)
return status;
}

ATCA_STATUS tng_get_device_cert_def(const atcacert_def_t **cert_def)
{
return tng_get_device_cert_def_ext(atcab_get_device(), cert_def);
}

ATCA_STATUS tng_get_device_pubkey(uint8_t *public_key)
{
ATCA_STATUS status;
Expand Down
13 changes: 13 additions & 0 deletions app/tng/tng_atca.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
extern "C" {
#endif

#define ATCA_OTP_CODE_SIZE (8u)

/** \defgroup tng_ TNG API (tng_)
*
* \brief These methods provide some convenience functions (mostly around
Expand All @@ -60,6 +62,17 @@ const atcacert_def_t* tng_map_get_device_cert_def(int index);

ATCA_STATUS tng_get_device_cert_def(const atcacert_def_t **cert_def);


/** \brief Get the TNG device certificate definition.
*
* \param[in] device Pointer to the device context pointer
* \param[out] cert_def TNG device certificate defnition is returned here.
*
* \return ATCA_SUCCESS on success, otherwise an error code.
*/

ATCA_STATUS tng_get_device_cert_def_ext(ATCADevice device, const atcacert_def_t **cert_def);

/** \brief Uses GenKey command to calculate the public key from the primary
* device public key.
*
Expand Down
5 changes: 5 additions & 0 deletions cmake/config_install.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,8 @@ install(CODE "
endif()
")
endif()

if (UNIX)
configure_file(cmake/libcryptoauth.pc.in libcryptoauth.pc @ONLY)
install(FILES ${CMAKE_BINARY_DIR}/libcryptoauth.pc DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}/pkgconfig")
endif (UNIX)
10 changes: 10 additions & 0 deletions cmake/libcryptoauth.pc.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
libdir=@CMAKE_INSTALL_FULL_LIBDIR@
includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@

Name: libcryptoauth
Version: @PROJECT_VERSION@
Description: @PROJECT_DESCRIPTION@
URL: https://github.com/MicrochipTech/cryptoauthlib.git
Requires:
Libs: -L${libdir} -lcryptoauth
Cflags: -I${includedir} -I${includedir}/cryptoauthlib
Binary file modified cryptoauthlib-manual.pdf
Binary file not shown.
31 changes: 27 additions & 4 deletions lib/atca_basic.c
Original file line number Diff line number Diff line change
Expand Up @@ -2458,12 +2458,14 @@ ATCA_STATUS atcab_random(uint8_t* rand_out)

// Read command functions

#if ATCAB_READ_EN && defined(ATCA_USE_ATCAB_FUNCTIONS)
/** \brief Executes Read command, which reads either 4 or 32 bytes of data from
* a given slot, configuration zone, or the OTP zone.
*
* When reading a slot or OTP, data zone must be locked and the slot
* configuration must not be secret for a slot to be successfully read.
*
* \param[in] device Device context
* \param[in] zone Zone to be read from device. Options are
* ATCA_ZONE_CONFIG, ATCA_ZONE_OTP, or ATCA_ZONE_DATA.
* \param[in] slot Slot number for data zone and ignored for other zones.
Expand All @@ -2475,16 +2477,15 @@ ATCA_STATUS atcab_random(uint8_t* rand_out)
*
* returns ATCA_SUCCESS on success, otherwise an error code.
*/
#if ATCAB_READ_EN && defined(ATCA_USE_ATCAB_FUNCTIONS)
ATCA_STATUS atcab_read_zone(uint8_t zone, uint16_t slot, uint8_t block, uint8_t offset, uint8_t* data, uint8_t len)
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)
{
ATCA_STATUS status = ATCA_UNIMPLEMENTED;
ATCADeviceType dev_type = atcab_get_device_type();
ATCADeviceType dev_type = atcab_get_device_type_ext(device);

if (atcab_is_ca_device(dev_type) || atcab_is_ca2_device(dev_type))
{
#if ATCA_CA_SUPPORT
status = calib_read_zone_ext(g_atcab_device_ptr, zone, slot, block, offset, data, len);
status = calib_read_zone_ext(device, zone, slot, block, offset, data, len);
#endif
}
else if (atcab_is_ta_device(dev_type))
Expand All @@ -2497,6 +2498,28 @@ ATCA_STATUS atcab_read_zone(uint8_t zone, uint16_t slot, uint8_t block, uint8_t
}
return status;
}

/** \brief Executes Read command, which reads either 4 or 32 bytes of data from
* a given slot, configuration zone, or the OTP zone.
*
* When reading a slot or OTP, data zone must be locked and the slot
* configuration must not be secret for a slot to be successfully read.
*
* \param[in] zone Zone to be read from device. Options are
* ATCA_ZONE_CONFIG, ATCA_ZONE_OTP, or ATCA_ZONE_DATA.
* \param[in] slot Slot number for data zone and ignored for other zones.
* \param[in] block 32 byte block index within the zone.
* \param[in] offset 4 byte work index within the block. Ignored for 32 byte
* reads.
* \param[out] data Read data is returned here.
* \param[in] len Length of the data to be read. Must be either 4 or 32.
*
* returns ATCA_SUCCESS on success, otherwise an error code.
*/
ATCA_STATUS atcab_read_zone(uint8_t zone, uint16_t slot, uint8_t block, uint8_t offset, uint8_t* data, uint8_t len)
{
return atcab_read_zone_ext(atcab_get_device(), zone, slot, block, offset, data, len);
}
#endif /* ATCAB_READ_EN */

#ifdef ATCA_USE_ATCAB_FUNCTIONS
Expand Down
1 change: 1 addition & 0 deletions lib/atca_basic.h
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ ATCA_STATUS atcab_random_ext(ATCADevice device, uint8_t* rand_out);

// Read command functions
ATCA_STATUS atcab_read_zone(uint8_t zone, uint16_t slot, uint8_t block, uint8_t offset, uint8_t* data, uint8_t len);
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);
ATCA_STATUS atcab_is_locked(uint8_t zone, bool* is_locked);
ATCA_STATUS atcab_is_config_locked(bool* is_locked);
ATCA_STATUS atcab_is_config_locked_ext(ATCADevice device, bool* is_locked);
Expand Down
3 changes: 3 additions & 0 deletions lib/atca_compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,10 @@

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

Expand Down
7 changes: 7 additions & 0 deletions lib/atca_config_check.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,13 @@
#define ATCA_CA2_SUPPORT DEFAULT_DISABLED
#endif

/* Support for cert feature in second generation of cryptoauth parts */
#if defined(ATCA_ECC204_SUPPORT) || defined(ATCA_TA010_SUPPORT)
#define ATCA_CA2_CERT_SUPPORT DEFAULT_ENABLED
#else
#define ATCA_CA2_CERT_SUPPORT DEFAULT_DISABLED
#endif

/* Classic Cryptoauth Devices */
#if defined(ATCA_SHA_SUPPORT) || defined(ATCA_ECC_SUPPORT) || ATCA_CA2_SUPPORT
#define ATCA_CA_SUPPORT DEFAULT_ENABLED
Expand Down
2 changes: 1 addition & 1 deletion lib/atca_device.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
@{ */


#ifndef ATCA_NO_HEAP
#ifdef ATCA_HEAP
/** \brief constructor for a Microchip CryptoAuth device
* \param[in] cfg Interface configuration object
* \return Reference to a new ATCADevice on success. NULL on failure.
Expand Down
6 changes: 3 additions & 3 deletions lib/atca_iface.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ ATCA_STATUS initATCAIface(ATCAIfaceCfg *cfg, ATCAIface ca_iface)
return ATCA_SUCCESS;
}

#if !defined(ATCA_NO_HEAP) && defined(ENABLE_NEWATCAIFACE)
#if defined(ATCA_HEAP) && defined(ENABLE_NEWATCAIFACE)
#if ATCA_PREPROCESSOR_WARNING
#warning "NewATCAIface function is deprecated"
#endif
Expand Down Expand Up @@ -566,7 +566,7 @@ ATCA_STATUS releaseATCAIface(ATCAIface ca_iface)
}
if (ATCA_CUSTOM_IFACE == ca_iface->mIfaceCFG->iface_type)
{
#ifndef ATCA_NO_HEAP
#ifdef ATCA_HEAP
hal_free(ca_iface->hal);
#endif
ca_iface->hal = NULL;
Expand All @@ -575,7 +575,7 @@ ATCA_STATUS releaseATCAIface(ATCAIface ca_iface)
return status;
}

#ifndef ATCA_NO_HEAP
#ifdef ATCA_HEAP
/** \brief Instruct the HAL driver to release any resources associated with
* this interface, then delete the object.
* \param[in] ca_iface Device interface.
Expand Down
2 changes: 1 addition & 1 deletion lib/atca_iface.h
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ ATCA_STATUS initATCAIface(ATCAIfaceCfg *cfg, ATCAIface ca_iface);
ATCA_STATUS releaseATCAIface(ATCAIface ca_iface);
void deleteATCAIface(ATCAIface *ca_iface);

#if !defined(ATCA_NO_HEAP) && defined(ENABLE_NEWATCAIFACE)
#if defined(ATCA_HEAP) && defined(ENABLE_NEWATCAIFACE)
ATCAIface newATCAIface(ATCAIfaceCfg *cfg);
#endif

Expand Down
4 changes: 2 additions & 2 deletions lib/atca_version.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@
#define ATCA_VERSION_H

// Version format yyyymmdd
#define ATCA_LIBRARY_VERSION_DATE "20240308"
#define ATCA_LIBRARY_VERSION_DATE "20240626"
#define ATCA_LIBRARY_VERSION_MAJOR 3
#define ATCA_LIBRARY_VERSION_MINOR 7
#define ATCA_LIBRARY_VERSION_BUILD 4
#define ATCA_LIBRARY_VERSION_BUILD 5

#endif /* ATCA_VERSION_H */
4 changes: 2 additions & 2 deletions lib/atcacert/atcacert_check_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@
#endif

#ifndef ATCACERT_COMPCERT_EN
#if ATCA_CA_SUPPORT
#define ATCACERT_COMPCERT_EN CALIB_ECC_SUPPORT
#if ATCA_CA_SUPPORT || ATCA_CA2_CERT_SUPPORT
#define ATCACERT_COMPCERT_EN (CALIB_ECC_SUPPORT || CALIB_CA2_CERT_SUPPORT)
#else
#define ATCACERT_COMPCERT_EN DEFAULT_DISABLED
#endif
Expand Down
Loading

0 comments on commit e8c7403

Please sign in to comment.