Skip to content

Commit e723fd0

Browse files
committed
Release v3.4 (20221027)
Signed-off-by: Bryan Hunt <[email protected]>
1 parent ec8cff5 commit e723fd0

File tree

216 files changed

+13449
-4226
lines changed

Some content is hidden

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

216 files changed

+13449
-4226
lines changed

.gitignore

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ local.properties
4848
*.o
4949

5050
.vs
51+
.vscode
5152

5253
# Python
5354
.tox/
@@ -61,3 +62,14 @@ dist/
6162
/python/venv*
6263
/python/cryptoauthlib.egg-info
6364
/python/VERSION
65+
66+
# Documents
67+
docs/**/*
68+
docs/html/**/*
69+
docs/latex/**/*
70+
dist-tools/cryptoauthlib*
71+
72+
# Third party libraries
73+
third_party/mbedtls/*
74+
third_party/wolfssl/*
75+

CMakeLists.txt

Lines changed: 15 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,28 @@
1-
cmake_minimum_required(VERSION 2.6.4)
1+
cmake_minimum_required(VERSION 3.1.0)
22
project (cryptoauthlib C)
33

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

1010
# Build Options
1111
option(BUILD_TESTS "Create Test Application with library" OFF)
12-
#set(ATCA_PKCS11 ON CACHE INTERNAL "")
12+
13+
if(UNIX)
14+
option(SETUP_INSTALLER "Setup installation and packaging as well" ON)
15+
else()
16+
set(SETUP_INSTALLER OFF CACHE INTERNAL "Disabling installation on this platform")
17+
endif()
1318

1419
# Default install root which is normally /usr/local/
1520
set(CMAKE_INSTALL_PREFIX "/" CACHE INTERNAL "")
1621

1722
# If including certificate definitions into the library then include them as ATCACERT_DEF_SRC
1823
#file(GLOB ATCACERT_DEF_SRC ABSOLUTE "app/*.c")
1924

20-
if(WIN32)
21-
string(REPLACE "\\" "/" LOCAL_APP_DATA "$ENV{LOCALAPPDATA}/Microchip")
22-
set(DEFAULT_LIB_PATH "${LOCAL_APP_DATA}" CACHE
23-
STRING "The default absolute library path")
24-
set(DEFAULT_INC_PATH "${LOCAL_APP_DATA}/${PROJECT_NAME}" CACHE
25-
STRING "The default include install path")
26-
set(DEFAULT_CONF_PATH "${LOCAL_APP_DATA}" CACHE
27-
STRING "The default location of ${PROJECT_NAME}.conf")
28-
set(DEFAULT_STORE_PATH "${LOCAL_APP_DATA}/${PROJECT_NAME}" CACHE
29-
STRING "The default location of the filestore directory")
30-
else()
31-
include(GNUInstallDirs)
32-
set(DEFAULT_LIB_PATH "${CMAKE_INSTALL_FULL_LIBDIR}" CACHE
33-
STRING "The default absolute library path")
34-
set(DEFAULT_INC_PATH "${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}" CACHE
35-
STRING "The default include install path")
36-
set(DEFAULT_CONF_PATH "${CMAKE_INSTALL_FULL_SYSCONFDIR}/${PROJECT_NAME}" CACHE
37-
STRING "The default location of ${PROJECT_NAME}.conf")
38-
set(DEFAULT_STORE_PATH "${CMAKE_INSTALL_FULL_LOCALSTATEDIR}/lib/${PROJECT_NAME}" CACHE
39-
STRING "The default location of the filestore directory")
40-
endif()
41-
42-
set(DEFAULT_CONF_FILE_NAME "${PROJECT_NAME}.conf" CACHE
43-
STRING "The default file for library configuration")
44-
45-
if(NOT CMAKE_BUILD_TYPE)
46-
if(WIN32)
47-
set(CMAKE_BUILD_TYPE Release CACHE STRING "Default build type" FORCE)
48-
else()
49-
set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Default build type" FORCE)
50-
endif()
51-
endif()
52-
53-
# Set up a default configuration file to install
54-
configure_file(${PROJECT_SOURCE_DIR}/app/pkcs11/cryptoauthlib.conf.in ${PROJECT_BINARY_DIR}/${DEFAULT_CONF_FILE_NAME})
55-
56-
# Packaging
57-
set(CPACK_PACKAGE_VENDOR "Microchip Technology Inc")
58-
set(CPACK_PACKAGE_VERSION_MAJOR ${VERSION_MAJOR})
59-
set(CPACK_PACKAGE_VERSION_MINOR ${VERSION_MINOR})
60-
set(CPACK_PACKAGE_VERSION_PATCH ${VERSION_PATCH})
61-
set(CPACK_GENERATOR "TGZ")
62-
set(CPACK_SOURCE_GENERATOR "TGZ")
63-
set(CPACK_SOURCE_IGNORE_FILES "build/*;\\.git/*")
64-
65-
include(CPack)
25+
include(cmake/check_environment.cmake)
6626

6727
# Make sure when testing that everything goes where it should
6828
if(BUILD_TESTS)
@@ -78,23 +38,7 @@ add_subdirectory(test)
7838
set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT cryptoauth_test)
7939
endif(BUILD_TESTS)
8040

81-
# Installation
82-
install(DIRECTORY DESTINATION ${DEFAULT_CONF_PATH})
83-
install(CODE "
84-
if(NOT EXISTS ${DEFAULT_CONF_PATH}/${DEFAULT_CONF_FILE_NAME})
85-
file(INSTALL ${PROJECT_BINARY_DIR}/${DEFAULT_CONF_FILE_NAME}
86-
DESTINATION ${DEFAULT_CONF_PATH})
87-
endif()
88-
")
89-
install(DIRECTORY DESTINATION ${DEFAULT_STORE_PATH}
90-
DIRECTORY_PERMISSIONS
91-
OWNER_EXECUTE OWNER_WRITE OWNER_READ
92-
GROUP_EXECUTE GROUP_WRITE GROUP_READ
93-
WORLD_EXECUTE WORLD_WRITE WORLD_READ
94-
)
95-
install(CODE "
96-
if(NOT EXISTS ${DEFAULT_STORE_PATH}/slot.conf.tmpl)
97-
file(INSTALL ${PROJECT_SOURCE_DIR}/app/pkcs11/slot.conf.tmpl
98-
DESTINATION ${DEFAULT_STORE_PATH})
99-
endif()
100-
")
41+
# If we're installing the library then we'll add the global configuration files
42+
if(SETUP_INSTALLER)
43+
include(cmake/config_install.cmake)
44+
endif()

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,9 @@ There are two major compiler defines that affect the operation of the library.
9494
changes required. The lower-level API will no longer use the new/delete
9595
functions and the init/release functions should be used directly.
9696

97+
Some specific options are available in the fully documented configuration files `lib/calib/calib_config.h`,
98+
`atca_configuration.h`, `lib/crypto/crypto_config.h`, `lib/host/atca_host_config.h` which is also the place where features can be selected.
99+
We provide some configurations focused on specific use cases and the checks are enabled by default.
97100

98101
Release notes
99102
-----------

SECURITY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ The previous API version is maintained for a year after a new version is release
1212

1313
| Version | Supported | Notes |
1414
| ------- | ------------------ | ----- |
15+
| 3.4.x | :heavy_check_mark: | |
1516
| 3.3.x | :heavy_check_mark: | |
1617
| 3.2.x | :x: | Security updates until January 2022 |
1718
| < 3.2 | :x: | |

app/pkcs11/example_pkcs11_config.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ CK_RV pkcs11_config_load_objects(pkcs11_slot_ctx_ptr pSlot)
127127

128128
if (CKR_OK == rv)
129129
{
130-
rv = pkcs11_object_alloc(&pObject);
130+
rv = pkcs11_object_alloc(pSlot->slot_id, &pObject);
131131
if (pObject)
132132
{
133133
/* Slot 0 - Device Private Key */
@@ -140,7 +140,7 @@ CK_RV pkcs11_config_load_objects(pkcs11_slot_ctx_ptr pSlot)
140140

141141
if (CKR_OK == rv)
142142
{
143-
rv = pkcs11_object_alloc(&pObject);
143+
rv = pkcs11_object_alloc(pSlot->slot_id, &pObject);
144144
if (pObject)
145145
{
146146
/* Slot 0 - Device Public Key */
@@ -153,7 +153,7 @@ CK_RV pkcs11_config_load_objects(pkcs11_slot_ctx_ptr pSlot)
153153

154154
if (CKR_OK == rv)
155155
{
156-
rv = pkcs11_object_alloc(&pObject);
156+
rv = pkcs11_object_alloc(pSlot->slot_id, &pObject);
157157
if (pObject)
158158
{
159159
/* Slot 0 - Device Public Key */
@@ -166,7 +166,7 @@ CK_RV pkcs11_config_load_objects(pkcs11_slot_ctx_ptr pSlot)
166166

167167
if (CKR_OK == rv)
168168
{
169-
rv = pkcs11_object_alloc(&pObject);
169+
rv = pkcs11_object_alloc(pSlot->slot_id, &pObject);
170170
if (pObject)
171171
{
172172
/* Slot 0 - Device Public Key */

app/pkcs11/trust_pkcs11_config.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ CK_RV pkcs11_trust_load_objects(pkcs11_slot_ctx_ptr pSlot)
164164

165165
if (CKR_OK == rv)
166166
{
167-
rv = pkcs11_object_alloc(&pObject);
167+
rv = pkcs11_object_alloc(pSlot->slot_id, &pObject);
168168
if (pObject)
169169
{
170170
/* Slot 0 - Device Private Key */
@@ -177,7 +177,7 @@ CK_RV pkcs11_trust_load_objects(pkcs11_slot_ctx_ptr pSlot)
177177

178178
if (CKR_OK == rv)
179179
{
180-
rv = pkcs11_object_alloc(&pObject);
180+
rv = pkcs11_object_alloc(pSlot->slot_id, &pObject);
181181
if (pObject)
182182
{
183183
/* Slot 0 - Device Public Key */
@@ -190,7 +190,7 @@ CK_RV pkcs11_trust_load_objects(pkcs11_slot_ctx_ptr pSlot)
190190

191191
if (CKR_OK == rv)
192192
{
193-
rv = pkcs11_object_alloc(&pObject);
193+
rv = pkcs11_object_alloc(pSlot->slot_id, &pObject);
194194
if (pObject)
195195
{
196196
/* Device Certificate */
@@ -203,7 +203,7 @@ CK_RV pkcs11_trust_load_objects(pkcs11_slot_ctx_ptr pSlot)
203203

204204
if (CKR_OK == rv)
205205
{
206-
rv = pkcs11_object_alloc(&pObject);
206+
rv = pkcs11_object_alloc(pSlot->slot_id, &pObject);
207207
if (pObject)
208208
{
209209
/* Signer Certificate */

app/wpc/atca_config.h

Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
/* Auto-generated config file atca_config.h */
2+
#ifndef ATCA_CONFIG_H
3+
#define ATCA_CONFIG_H
4+
5+
/* MPLAB Harmony Common Include */
6+
#include "definitions.h"
7+
8+
#ifndef ATCA_HAL_I2C
9+
#define ATCA_HAL_I2C
10+
#endif
11+
12+
13+
14+
/** Include Device Support Options */
15+
#define ATCA_ATECC608_SUPPORT
16+
17+
18+
19+
20+
/* Polling Configuration Options */
21+
#ifndef ATCA_POLLING_INIT_TIME_MSEC
22+
#define ATCA_POLLING_INIT_TIME_MSEC 1
23+
#endif
24+
#ifndef ATCA_POLLING_FREQUENCY_TIME_MSEC
25+
#define ATCA_POLLING_FREQUENCY_TIME_MSEC 2
26+
#endif
27+
#ifndef ATCA_POLLING_MAX_TIME_MSEC
28+
#define ATCA_POLLING_MAX_TIME_MSEC 2500
29+
#endif
30+
31+
/** Define if the library is not to use malloc/free */
32+
#define ATCA_NO_HEAP
33+
34+
#define atca_delay_ms hal_delay_ms
35+
#define atca_delay_us hal_delay_us
36+
37+
/* \brief How long to wait after an initial wake failure for the POST to
38+
* complete.
39+
* If Power-on self test (POST) is enabled, the self test will run on waking
40+
* from sleep or during power-on, which delays the wake reply.
41+
*/
42+
#ifndef ATCA_POST_DELAY_MSEC
43+
#define ATCA_POST_DELAY_MSEC 25
44+
#endif
45+
46+
47+
/* Define generic interfaces to the processor libraries */
48+
49+
#define PLIB_I2C_ERROR SERCOM_I2C_ERROR
50+
#define PLIB_I2C_ERROR_NONE SERCOM_I2C_ERROR_NONE
51+
#define PLIB_I2C_TRANSFER_SETUP SERCOM_I2C_TRANSFER_SETUP
52+
53+
typedef bool (* atca_i2c_plib_read)(uint16_t, uint8_t *, uint32_t);
54+
typedef bool (* atca_i2c_plib_write)(uint16_t, uint8_t *, uint32_t);
55+
typedef bool (* atca_i2c_plib_is_busy)(void);
56+
typedef PLIB_I2C_ERROR (* atca_i2c_error_get)(void);
57+
typedef bool (* atca_i2c_plib_transfer_setup)(PLIB_I2C_TRANSFER_SETUP* setup, uint32_t srcClkFreq);
58+
59+
typedef struct atca_plib_i2c_api
60+
{
61+
atca_i2c_plib_read read;
62+
atca_i2c_plib_write write;
63+
atca_i2c_plib_is_busy is_busy;
64+
atca_i2c_error_get error_get;
65+
atca_i2c_plib_transfer_setup transfer_setup;
66+
} atca_plib_i2c_api_t;
67+
68+
69+
70+
71+
extern atca_plib_i2c_api_t sercom2_plib_i2c_api;
72+
73+
/* WPC Configuration */
74+
#define WPC_CHAIN_DIGEST_HANDLE_0 0x03
75+
#define WPC_CHAIN_CERT_DEF_0 g_cert_def_2_device
76+
77+
/* Define for a simple mapping of slot to certificate */
78+
#define WPC_STRICT_SLOT_INDEX
79+
80+
/* One of the certificate format options is to generate the certificate serial
81+
number from a hash of several data elements - this saves storage in the device
82+
at the expense of code space and time */
83+
#define WPC_CERT_SN_FROM_HASH_EN FEATURE_DISABLED
84+
85+
/* Enable the Power Transmitter API */
86+
#define WPC_MSG_PT_EN FEATURE_ENABLED
87+
88+
/* Disable the Power Receiver API since this project is demonstrating the transmitter */
89+
#define WPC_MSG_PR_EN FEATURE_DISABLED
90+
91+
92+
/* Turn off parameter checking in the library - enable for easier debugging in development */
93+
//#define ATCA_CHECK_PARAMS_EN FEATURE_DISABLED
94+
95+
/* API Configuration Options */
96+
#define ATCAB_AES_EN FEATURE_DISABLED
97+
#define ATCAB_AES_GCM_EN FEATURE_DISABLED
98+
#define ATCAB_COUNTER_EN FEATURE_DISABLED
99+
#define ATCAB_DERIVEKEY_EN FEATURE_DISABLED
100+
#define ATCAB_ECDH_EN FEATURE_DISABLED
101+
#define ATCAB_ECDH_ENC_EN FEATURE_DISABLED
102+
#define ATCAB_GENDIG_EN FEATURE_DISABLED
103+
#define ATCAB_GENKEY_MAC_EN FEATURE_DISABLED
104+
#define ATCAB_HMAC_EN FEATURE_DISABLED
105+
#define ATCAB_INFO_LATCH_EN FEATURE_DISABLED
106+
#define ATCAB_KDF_EN FEATURE_DISABLED
107+
#define ATCAB_LOCK_EN FEATURE_DISABLED
108+
#define ATCAB_MAC_EN FEATURE_DISABLED
109+
#define ATCAB_PRIVWRITE_EN FEATURE_DISABLED
110+
/* By default the random command is only required for the power receiver to generate
111+
challenges - because a health check on the rng before a sign can return failures
112+
the power transmitter has a choice - enable the random command which will use more
113+
code or retry the sign operation if a health check failure occurs. */
114+
#define ATCAB_RANDOM_EN WPC_MSG_PR_EN
115+
#define ATCAB_READ_ENC_EN FEATURE_DISABLED
116+
#define ATCAB_SECUREBOOT_EN FEATURE_DISABLED
117+
#define ATCAB_SECUREBOOT_MAC_EN FEATURE_DISABLED
118+
#define ATCAB_SELFTEST_EN FEATURE_DISABLED
119+
#define ATCAB_SHA_HMAC_EN FEATURE_DISABLED
120+
#define ATCAB_SIGN_INTERNAL_EN FEATURE_DISABLED
121+
#define ATCAB_UPDATEEXTRA_EN FEATURE_DISABLED
122+
/* Enable the verify command when the power receiver api is enabled - this helps
123+
with testing - it is unnecessary for the power transmitter */
124+
#define ATCAB_VERIFY_EN WPC_MSG_PR_EN
125+
#define ATCAB_WRITE_EN FEATURE_DISABLED
126+
127+
/* Disable software cryptography */
128+
#define ATCAC_SHA1_EN FEATURE_DISABLED
129+
#define ATCAC_SHA256_EN FEATURE_DISABLED
130+
131+
/* Certificate Processing Configuration */
132+
#define ATCACERT_DATEFMT_UTC_EN FEATURE_ENABLED
133+
#define ATCACERT_DATEFMT_GEN_EN FEATURE_ENABLED
134+
135+
#define ATCACERT_DATEFMT_ISO_EN FEATURE_DISABLED
136+
#define ATCACERT_DATEFMT_POSIX_EN FEATURE_DISABLED
137+
138+
139+
#endif // ATCA_CONFIG_H

0 commit comments

Comments
 (0)