Commit graph

25858 commits

Author SHA1 Message Date
valerio
6c666c6c8d test: add key pair check verification for opaque EC keys
Signed-off-by: valerio <valerio.setti@nordicsemi.no>
2023-06-05 11:05:40 +02:00
valerio
8cbef4d55e pk: allow key pair checking for opaque keys
Signed-off-by: valerio <valerio.setti@nordicsemi.no>
2023-06-05 11:05:40 +02:00
valerio
eab9a85f4c pk_wrap: add support for key pair check for EC opaque keys
Signed-off-by: valerio <valerio.setti@nordicsemi.no>
2023-06-05 11:05:40 +02:00
Manuel Pégourié-Gonnard
f37b94b5bf
Merge pull request #7533 from valeriosetti/issue7484
PK: add support for private key writing with "opaque" EC keys
2023-06-05 10:53:53 +02:00
Yanray Wang
c7a2a6d11d code_size_compare.py: change prompt message in code size measurement
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-06-05 09:54:56 +08:00
Yanray Wang
72b105f1ae code_size_compare: clarify input and return types
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-06-05 09:54:56 +08:00
Yanray Wang
8804db9d99 code_size_compare.py: integrate code with CodeSizeBase
The code size measurement script generates code size
record / comparison csv file in a more readable format.

The script won't generate new record file if there is an existing
one. It reads the record and stores data into dictionary of code_size
for comparison.

Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-06-05 09:54:56 +08:00
Yanray Wang
16ebc5725b code_size_compare.py: add a CodeSizeBase class
CodeSizeBase class aims to store size information for a specific
revision. It also has support to write csv report, comparison result
in a more readable format. This commit lays out foundation to
simplify code for CodeSizeComparison.

Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-06-05 09:54:56 +08:00
Dave Rodgman
9a676a7f98 Comment tidy-up
Signed-off-by: Dave Rodgman <dave.rodgman@gmail.com>
2023-06-04 20:43:05 -04:00
Dave Rodgman
b6e06549f5 Rename MULADDC_PRESERVE_R1 etc to MULADDC_PRESERVE_SCRATCH etc
Signed-off-by: Dave Rodgman <dave.rodgman@gmail.com>
2023-06-04 20:42:17 -04:00
Dave Rodgman
f89e3c5fbd Improve docs & check for non-gcc compilers
Signed-off-by: Dave Rodgman <dave.rodgman@gmail.com>
2023-06-04 20:41:52 -04:00
Dave Rodgman
4db4d6b9b0 Improve changelog
Signed-off-by: Dave Rodgman <dave.rodgman@gmail.com>
2023-06-04 20:41:24 -04:00
Dave Rodgman
e0bd2c2375
Merge branch 'development' into development
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-04 14:57:19 -04:00
Dave Rodgman
b45d58b9a5 Add armclang -O0 build test
Signed-off-by: Dave Rodgman <dave.rodgman@gmail.com>
2023-06-02 13:54:00 -04:00
Dave Rodgman
8c315f2f74 Add build tests for Thumb and Thumb2 with clang
Signed-off-by: Dave Rodgman <dave.rodgman@gmail.com>
2023-06-02 13:53:27 -04:00
Dave Rodgman
6df1e54c1d Do not use assembly on Thumb 1 / clang
Signed-off-by: Dave Rodgman <dave.rodgman@gmail.com>
2023-06-02 13:51:31 -04:00
Gilles Peskine
7df8ba6a10 Rework the description of key derivation output/verify key
Some of the fallback mechanisms between the entry points were not described
corrrectly.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-06-02 18:16:02 +02:00
Gilles Peskine
dcaf104eef Note that we may want to rename derive_key
... if we think of a better name

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-06-02 18:02:41 +02:00
Gilles Peskine
f96a18edc7 Probably resolve concern about the input size for derive_key
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-06-02 18:02:15 +02:00
Gilles Peskine
1414bc34b9 Minor copyediting
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-06-02 17:54:32 +02:00
David Horstmann
62e7fae109 Fix bug in calculation of maximum possible bytes
Each DER-encoded OID byte can only store 7 bits of actual data, so take
account of that.

Calculate the number of bytes required as:

number_of_bytes = ceil(subidentifier_size * 8 / 7)

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-06-02 15:51:28 +01:00
David Horstmann
02127ab022 Allow subidentifiers of size UINT_MAX
Make overflow check more accurate and add testcases

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-06-02 15:51:17 +01:00
Dave Rodgman
49bd1f2cb2 Fix spelling in Changelog
Signed-off-by: Dave Rodgman <dave.rodgman@gmail.com>
2023-06-02 10:31:49 -04:00
Andrzej Kurek
e773978e68 Remove unnecessary addition to buffer size estimation
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2023-06-02 09:42:44 -04:00
Tom Cosgrove
32b06f50df
Merge pull request #7650 from yanrayw/7360-code-size-tfm-medium
code size measurement support for tfm-medium
2023-06-02 13:25:26 +01:00
Tom Cosgrove
9dc219ff9b
Merge pull request #7668 from tom-daubney-arm/code_size_md_light
Remove certain null pointer checks when only MD_LIGHT enabled
2023-06-02 13:09:00 +01:00
Thomas Daubney
5903e9c428 Modify tests in response to review comments.
Address the way the tests have been modified in
response to review comments.

Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
2023-06-02 10:43:08 +01:00
Andrzej Kurek
f994bc51ad Refactor code in cert_write.c
This way is more robust.
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2023-06-02 05:10:17 -04:00
Andrzej Kurek
7c86974d6d Fix overflow checks in x509write_crt
Previous ones could still overflow.
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2023-06-02 05:02:41 -04:00
Andrzej Kurek
154a605ae8 Change the name of the temporary san variable
Explain why it is used.
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2023-06-01 18:20:26 +01:00
Andrzej Kurek
1747304a7a Update the descriptions of SANs
All of them are listed, so the previous description was wrong.

Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2023-06-01 18:20:24 +01:00
Paul Elliott
805a0a2d06
Merge pull request #7591 from minosgalanakis/ecp/6028_xtract_fast_reduction_curve25519
[Bignum] Implement fast reduction curve25519
2023-06-01 17:43:35 +01:00
Yanray Wang
21f1744d76 code_size_compare.py: fix make command logic in default config
If system architecture doesn't match architecture of input argument
for default configuration, it's reported as an error.

Additionally, it prints out help message to show which architecture
and configuration option should be used.

Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-06-01 23:26:48 +08:00
David Horstmann
bf95e9a058 Reword description and change NUL to null
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-06-01 15:33:15 +01:00
David Horstmann
45d5e2dc1a Rename minimum_mem to resized_mem
This new name is clearer about its purpose.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-06-01 15:10:33 +01:00
David Horstmann
5d074168f3 Rearrange declarations for readability
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-06-01 15:09:27 +01:00
David Horstmann
017139751a Change behaviour away from NUL-terminated strings
Instead, require the length of the string to be passed. This is more
useful for our use-case, as it is likely we will parse OIDs from the
middle of strings.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-06-01 15:04:20 +01:00
David Horstmann
d1a203a382 Cosmetic fixes to doxygen comment
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-06-01 15:02:15 +01:00
Thomas Daubney
73cfde8f85 Remove certain null pointer checks when only MD_LIGHT enabled
When MD_LIGHT is enabled but MD_C is not then certain null
pointer checks can be removed on functions that take an
mbedtls_md_context_t * as a parameter, since MD_LIGHT does
not support these null pointers.

Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
2023-06-01 13:05:28 +01:00
Paul Elliott
ee86100963 Add docs for mbedtls_ecp_mod_p448()
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2023-06-01 10:53:20 +01:00
valerio
f9139e55ce pk: minor code fixes
- removing duplicated code
- uninitialized variable usage

Signed-off-by: valerio <valerio.setti@nordicsemi.no>
2023-06-01 11:06:41 +02:00
valerio
c6e6fb320f pk: fix guard position
Signed-off-by: valerio <valerio.setti@nordicsemi.no>
2023-06-01 11:06:41 +02:00
valerio
f1d29136ac test: remove debug echo in component
Signed-off-by: valerio <valerio.setti@nordicsemi.no>
2023-06-01 11:06:41 +02:00
valerio
e279e50a76 pk: optimized/reshape code for writing private key PEM
Signed-off-by: valerio <valerio.setti@nordicsemi.no>
2023-06-01 11:06:41 +02:00
valerio
c0bac57ac9 pk: optimized/reshape code for writing private key DER
Signed-off-by: valerio <valerio.setti@nordicsemi.no>
2023-06-01 11:06:41 +02:00
valerio
52b675ffc3 pk: extend pk_write_ec_private to support opaque keys
Signed-off-by: valerio <valerio.setti@nordicsemi.no>
2023-06-01 11:06:41 +02:00
valerio
ba1fd32eda pk: optimize/reshape public key writing
Signed-off-by: valerio <valerio.setti@nordicsemi.no>
2023-06-01 11:06:41 +02:00
valerio
9ea26173d6 pk: uniformmize public key writing functions
Signed-off-by: valerio <valerio.setti@nordicsemi.no>
2023-06-01 11:06:40 +02:00
valerio
b727314133 pk: add internal helpers for opaque keys
Signed-off-by: valerio <valerio.setti@nordicsemi.no>
2023-06-01 11:06:40 +02:00
valerio
64e0184a39 psa_util: add support for rfc8410's OIDs
Signed-off-by: valerio <valerio.setti@nordicsemi.no>
2023-06-01 11:06:40 +02:00