Skip to content

Commit 8c74146

Browse files
committed
Release 1.3.0
1 parent 6341da9 commit 8c74146

File tree

176 files changed

+37950
-26807
lines changed

Some content is hidden

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

176 files changed

+37950
-26807
lines changed

CHANGELOG.md

+29
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,34 @@
11
# Oberon PSA Crypto change log
22

3+
## Oberon PSA Crypto 1.3.0
4+
<https://github.com/oberon-microsystems/oberon-psa-crypto-nrf/releases/tag/v1.3.0>
5+
8-May-2024 (c18f101)
6+
7+
Oberon crypto software drivers require _ocrypto_ version 3.5.x
8+
9+
### New Features
10+
- Align with Mbed TLS 3.6.0.
11+
- Unify `crypto.h` for API usage with or without isolation boundary
12+
(adopted from Mbed TLS 3.6).
13+
- Add optional thread safety to Oberon PSA core by reusing Mbed TLS mutex
14+
abstraction (software drivers are already thread-safe). Multi-threading
15+
support can be enabled via define `MBEDTLS_THREADING_C`
16+
(adopted from Mbed TLS 3.6).
17+
- Add CMake option to run tests on host with multi-threading option.
18+
19+
### Improvements
20+
- Cleanup PSA key attributes
21+
(adopted from Mbed TLS 3.6).
22+
- Add new Mbed TLS PSA tests and align with Mbed TLS test updates
23+
(adopted from Mbed TLS 3.6).
24+
- Align Mbed TLS error return codes in drivers
25+
(adopted from Mbed TLS 3.6).
26+
- Limit key derivation capacity for 64-bit ISA.
27+
- Adjust test support for TLS/SSL protocol test suite.
28+
- Improve key import parameter checks.
29+
30+
--------------------------------------------------------------------------------
31+
332
## Oberon PSA Crypto 1.2.3
433
<https://github.com/oberon-microsystems/oberon-psa-crypto-nrf/releases/tag/v1.2.3>
534
26-Mar-2024 (79d5e26)

CMakeLists.txt

+12-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ set(PLATFORM demo CACHE STRING "Default generic 'demo' platform.")
77

88
option(CONFIG_PSA_API_TESTS "Build PSA Certified APIs Architecture Test Suite" ON)
99
option(CONFIG_MBEDTLS_PSA_TESTS "Build Mbed TLS tests" ON)
10+
option(CONFIG_MBEDTLS_THREADING "Build for multi-threading" ON)
1011

1112
if(MSVC)
1213
set(CONFIG_PSA_API_TESTS OFF)
@@ -61,6 +62,7 @@ set(MBED_SOURCES
6162
${CMAKE_SOURCE_DIR}/library/psa_crypto_storage.h
6263
${CMAKE_SOURCE_DIR}/library/psa_crypto_storage.c
6364
${CMAKE_SOURCE_DIR}/library/psa_its_file.c
65+
${CMAKE_SOURCE_DIR}/library/threading.c
6466
)
6567

6668
# common sources and includes
@@ -89,6 +91,7 @@ message(STATUS "Options:")
8991
if(EXISTS ${CMAKE_SOURCE_DIR}/oberon/platforms/${PLATFORM}/CMakeLists.txt)
9092
message(STATUS " - CONFIG_MBEDTLS_PSA_TESTS: ${CONFIG_MBEDTLS_PSA_TESTS}")
9193
message(STATUS " - CONFIG_PSA_API_TESTS: ${CONFIG_PSA_API_TESTS}")
94+
message(STATUS " - CONFIG_MBEDTLS_THREADING: ${CONFIG_MBEDTLS_THREADING}")
9295
else()
9396
set(CONFIG_MBEDTLS_PSA_TESTS OFF)
9497
message(STATUS " - CONFIG_MBEDTLS_PSA_TESTS: SKIPPED, not available for ${PLATFORM}")
@@ -112,6 +115,7 @@ if (CONFIG_MBEDTLS_PSA_TESTS OR CONFIG_PSA_API_TESTS)
112115
test_suite_psa_crypto_generate_key.generated
113116
test_suite_psa_crypto_hash
114117
# test_suite_psa_crypto_init # n.a. - tests Mbed TLS entropy initialization only /* !!OM */
118+
test_suite_psa_crypto_memory
115119
test_suite_psa_crypto_metadata
116120
test_suite_psa_crypto_not_supported.generated
117121
test_suite_psa_crypto_not_supported.misc
@@ -125,6 +129,7 @@ if (CONFIG_MBEDTLS_PSA_TESTS OR CONFIG_PSA_API_TESTS)
125129
test_suite_psa_crypto_storage_format.current
126130
test_suite_psa_crypto_storage_format.misc
127131
test_suite_psa_crypto_storage_format.v0
132+
# test_suite_psa_crypto_util # n.a. - tests Mbed TLS specific funtions
128133
test_suite_psa_its
129134
)
130135

@@ -141,7 +146,7 @@ if (CONFIG_MBEDTLS_PSA_TESTS OR CONFIG_PSA_API_TESTS)
141146
${CMAKE_SOURCE_DIR}/tests/src/asn1write_min.c # forked from asn1write.c
142147
${CMAKE_SOURCE_DIR}/tests/src/psa_crypto_helpers.c
143148
${CMAKE_SOURCE_DIR}/tests/src/psa_exercise_key.c
144-
${CMAKE_SOURCE_DIR}/tests/src/helpers_min.c
149+
${CMAKE_SOURCE_DIR}/tests/src/helpers.c
145150
)
146151
endif()
147152

@@ -177,6 +182,12 @@ if (CONFIG_PSA_API_TESTS AND "${PLATFORM}" STREQUAL "demo")
177182
add_subdirectory(api-tests)
178183
add_executable(${PROJECT_NAME} api-tests/platform/targets/${PROJECT_NAME}/nspe/main.c)
179184

185+
if(CONFIG_MBEDTLS_THREADING)
186+
target_compile_definitions(${PROJECT_NAME} PRIVATE MBEDTLS_THREADING_C)
187+
target_compile_definitions(${PROJECT_NAME} PRIVATE MBEDTLS_THREADING_PTHREAD)
188+
target_sources(${PROJECT_NAME} PRIVATE "${CMAKE_SOURCE_DIR}/library/threading.c")
189+
endif()
190+
180191
target_link_libraries(${PROJECT_NAME} PUBLIC ocrypto)
181192

182193
add_subdirectory(oberon/drivers oberon/drivers/${TARGET})

LICENSING.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ This specification is licensed under _CC SA-BY 4.0_.
2525
### PSA Crypto Driver API
2626

2727
_PSA Crypto Driver API_ (Arm proposal):
28-
<https://github.com/Mbed-TLS/mbedtls/blob/v3.5.1/docs/proposed/psa-driver-interface.md>
28+
<https://github.com/Mbed-TLS/mbedtls/blob/v3.6.0/docs/proposed/psa-driver-interface.md>
2929

3030
This specification has been published as part of _Mbed TLS_ and the same licenses
3131
apply, see below.

README.md

+18-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ hardware crypto accelerators.
1212

1313
The library is compatible with the _PSA Certified Crypto API_ version as
1414
specified in
15-
[PSA Certified Crypto API 1.1.2 and PAKE extension 1.1 Beta 1](https://arm-software.github.io/psa-api/crypto/),
16-
and to Arm's _Mbed TLS_ 3.5.0.
15+
[PSA Certified Crypto API 1.2.1 and PAKE extension 1.2 Final 1](https://arm-software.github.io/psa-api/crypto/),
16+
and to Arm's _Mbed TLS_ 3.6.0.
1717

1818
The supported crypto feature set is documented in
1919
[Appendix A: Supported Crypto Features](oberon/docs/Appendix_A_Supported_Crypto_Features.md).
@@ -121,6 +121,22 @@ Supported platforms with demonstration drivers, configurations, and includes
121121
are located in path `oberon/platforms` and can be provided to CMake via
122122
`-DPLATFORM=folder_name`.
123123

124+
Multi-threading support can be enabled with define `MBEDTLS_THREADING_C` in
125+
`mbedtls_config.h`.
126+
127+
### Build with Tests
128+
By default, _Oberon PSA Crypto_ is build for a set of configurations, with
129+
PSA-related _Mbed TLS_ tests, a _PSA Certified APIs Architecture Test Suite_,
130+
and in variants with and without multi-threading support based on the POSIX
131+
mutex reference implemenentation.
132+
133+
To select for which tests Oberon PSA Crypto is built, the following CMAKE
134+
options are provided:
135+
136+
- PSA-related _Mbed TLS_ tests: `-DCONFIG_MBEDTLS_PSA_TESTS=ON/OFF`
137+
- _PSA Certified APIs Architecture Test Suite_: `DCONFIG_PSA_API_TESTS=ON/OFF`
138+
- Multi-threading support: `-DCONFIG_MBEDTLS_THREADING=ON/OFF`
139+
124140
### Run Tests
125141

126142
Run all tests from the same `build` directory:

VERSION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.2.3 26-Mar-2024 79d5e26
1+
1.3.0 8-May-2024 c18f101

include/mbedtls/aes.h

+5-13
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,7 @@
2222

2323
/*
2424
* Copyright The Mbed TLS Contributors
25-
* SPDX-License-Identifier: Apache-2.0
26-
*
27-
* Licensed under the Apache License, Version 2.0 (the "License"); you may
28-
* not use this file except in compliance with the License.
29-
* You may obtain a copy of the License at
30-
*
31-
* http://www.apache.org/licenses/LICENSE-2.0
32-
*
33-
* Unless required by applicable law or agreed to in writing, software
34-
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
35-
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
36-
* See the License for the specific language governing permissions and
37-
* limitations under the License.
25+
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
3826
*/
3927

4028
#ifndef MBEDTLS_AES_H
@@ -167,6 +155,7 @@ MBEDTLS_CHECK_RETURN_TYPICAL
167155
int mbedtls_aes_setkey_enc(mbedtls_aes_context *ctx, const unsigned char *key,
168156
unsigned int keybits);
169157

158+
#if !defined(MBEDTLS_BLOCK_CIPHER_NO_DECRYPT)
170159
/**
171160
* \brief This function sets the decryption key.
172161
*
@@ -185,6 +174,7 @@ int mbedtls_aes_setkey_enc(mbedtls_aes_context *ctx, const unsigned char *key,
185174
MBEDTLS_CHECK_RETURN_TYPICAL
186175
int mbedtls_aes_setkey_dec(mbedtls_aes_context *ctx, const unsigned char *key,
187176
unsigned int keybits);
177+
#endif /* !MBEDTLS_BLOCK_CIPHER_NO_DECRYPT */
188178

189179
#if defined(MBEDTLS_CIPHER_MODE_XTS)
190180
/**
@@ -604,6 +594,7 @@ int mbedtls_internal_aes_encrypt(mbedtls_aes_context *ctx,
604594
const unsigned char input[16],
605595
unsigned char output[16]);
606596

597+
#if !defined(MBEDTLS_BLOCK_CIPHER_NO_DECRYPT)
607598
/**
608599
* \brief Internal AES block decryption function. This is only
609600
* exposed to allow overriding it using see
@@ -619,6 +610,7 @@ MBEDTLS_CHECK_RETURN_TYPICAL
619610
int mbedtls_internal_aes_decrypt(mbedtls_aes_context *ctx,
620611
const unsigned char input[16],
621612
unsigned char output[16]);
613+
#endif /* !MBEDTLS_BLOCK_CIPHER_NO_DECRYPT */
622614

623615
#if defined(MBEDTLS_SELF_TEST)
624616
/**

include/mbedtls/asn1.h

+6-17
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,7 @@
55
*/
66
/*
77
* Copyright The Mbed TLS Contributors
8-
* SPDX-License-Identifier: Apache-2.0
9-
*
10-
* Licensed under the Apache License, Version 2.0 (the "License"); you may
11-
* not use this file except in compliance with the License.
12-
* You may obtain a copy of the License at
13-
*
14-
* http://www.apache.org/licenses/LICENSE-2.0
15-
*
16-
* Unless required by applicable law or agreed to in writing, software
17-
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
18-
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19-
* See the License for the specific language governing permissions and
20-
* limitations under the License.
8+
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
219
*/
2210
#ifndef MBEDTLS_ASN1_H
2311
#define MBEDTLS_ASN1_H
@@ -209,7 +197,8 @@ typedef struct mbedtls_asn1_named_data {
209197
}
210198
mbedtls_asn1_named_data;
211199

212-
#if defined(MBEDTLS_ASN1_PARSE_C) || defined(MBEDTLS_X509_CREATE_C)
200+
#if defined(MBEDTLS_ASN1_PARSE_C) || defined(MBEDTLS_X509_CREATE_C) || \
201+
defined(MBEDTLS_PSA_UTIL_HAVE_ECDSA)
213202
/**
214203
* \brief Get the length of an ASN.1 element.
215204
* Updates the pointer to immediately behind the length.
@@ -256,7 +245,7 @@ int mbedtls_asn1_get_len(unsigned char **p,
256245
int mbedtls_asn1_get_tag(unsigned char **p,
257246
const unsigned char *end,
258247
size_t *len, int tag);
259-
#endif /* MBEDTLS_ASN1_PARSE_C || MBEDTLS_X509_CREATE_C */
248+
#endif /* MBEDTLS_ASN1_PARSE_C || MBEDTLS_X509_CREATE_C || MBEDTLS_PSA_UTIL_HAVE_ECDSA */
260249

261250
#if defined(MBEDTLS_ASN1_PARSE_C)
262251
/**
@@ -644,10 +633,10 @@ void mbedtls_asn1_free_named_data_list_shallow(mbedtls_asn1_named_data *name);
644633
/** \} name Functions to parse ASN.1 data structures */
645634
/** \} addtogroup asn1_module */
646635

636+
#endif /* MBEDTLS_ASN1_PARSE_C */
637+
647638
#ifdef __cplusplus
648639
}
649640
#endif
650641

651-
#endif /* MBEDTLS_ASN1_PARSE_C */
652-
653642
#endif /* asn1.h */

include/mbedtls/asn1write.h

+4-15
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,7 @@
55
*/
66
/*
77
* Copyright The Mbed TLS Contributors
8-
* SPDX-License-Identifier: Apache-2.0
9-
*
10-
* Licensed under the Apache License, Version 2.0 (the "License"); you may
11-
* not use this file except in compliance with the License.
12-
* You may obtain a copy of the License at
13-
*
14-
* http://www.apache.org/licenses/LICENSE-2.0
15-
*
16-
* Unless required by applicable law or agreed to in writing, software
17-
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
18-
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19-
* See the License for the specific language governing permissions and
20-
* limitations under the License.
8+
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
219
*/
2210
#ifndef MBEDTLS_ASN1_WRITE_H
2311
#define MBEDTLS_ASN1_WRITE_H
@@ -48,7 +36,8 @@
4836
extern "C" {
4937
#endif
5038

51-
#if defined(MBEDTLS_ASN1_WRITE_C) || defined(MBEDTLS_X509_USE_C)
39+
#if defined(MBEDTLS_ASN1_WRITE_C) || defined(MBEDTLS_X509_USE_C) || \
40+
defined(MBEDTLS_PSA_UTIL_HAVE_ECDSA)
5241
/**
5342
* \brief Write a length field in ASN.1 format.
5443
*
@@ -77,7 +66,7 @@ int mbedtls_asn1_write_len(unsigned char **p, const unsigned char *start,
7766
*/
7867
int mbedtls_asn1_write_tag(unsigned char **p, const unsigned char *start,
7968
unsigned char tag);
80-
#endif /* MBEDTLS_ASN1_WRITE_C || MBEDTLS_X509_USE_C */
69+
#endif /* MBEDTLS_ASN1_WRITE_C || MBEDTLS_X509_USE_C || MBEDTLS_PSA_UTIL_HAVE_ECDSA*/
8170

8271
#if defined(MBEDTLS_ASN1_WRITE_C)
8372
/**

include/mbedtls/bignum.h

+4-16
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,7 @@
55
*/
66
/*
77
* Copyright The Mbed TLS Contributors
8-
* SPDX-License-Identifier: Apache-2.0
9-
*
10-
* Licensed under the Apache License, Version 2.0 (the "License"); you may
11-
* not use this file except in compliance with the License.
12-
* You may obtain a copy of the License at
13-
*
14-
* http://www.apache.org/licenses/LICENSE-2.0
15-
*
16-
* Unless required by applicable law or agreed to in writing, software
17-
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
18-
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19-
* See the License for the specific language governing permissions and
20-
* limitations under the License.
8+
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
219
*/
2210
#ifndef MBEDTLS_BIGNUM_H
2311
#define MBEDTLS_BIGNUM_H
@@ -63,15 +51,15 @@
6351

6452
#if !defined(MBEDTLS_MPI_WINDOW_SIZE)
6553
/*
66-
* Maximum window size used for modular exponentiation. Default: 2
54+
* Maximum window size used for modular exponentiation. Default: 3
6755
* Minimum value: 1. Maximum value: 6.
6856
*
6957
* Result is an array of ( 2 ** MBEDTLS_MPI_WINDOW_SIZE ) MPIs used
70-
* for the sliding window calculation. (So 64 by default)
58+
* for the sliding window calculation. (So 8 by default)
7159
*
7260
* Reduction in size, reduces speed.
7361
*/
74-
#define MBEDTLS_MPI_WINDOW_SIZE 2 /**< Maximum window size used. */
62+
#define MBEDTLS_MPI_WINDOW_SIZE 3 /**< Maximum window size used. */
7563
#endif /* !MBEDTLS_MPI_WINDOW_SIZE */
7664

7765
#if !defined(MBEDTLS_MPI_MAX_SIZE)

0 commit comments

Comments
 (0)