Commit graph

25439 commits

Author SHA1 Message Date
Dave Rodgman
2c91f4b8b2 Fix for big-endian architectures
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-07 19:59:05 +01:00
Dave Rodgman
2f0f998ec4 Unify ABSORB and ABSORB8 to fix compile error
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-07 19:12:04 +01:00
Dave Rodgman
a8af4f4da2 Fix test dependency
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-07 18:27:09 +01:00
Dave Rodgman
b61cd1042a Correct minor merge mistakes
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-07 18:14:45 +01:00
Dave Rodgman
8b0deef299 Add HMAC DRBG SHA-3 tests
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-07 18:05:02 +01:00
Dave Rodgman
05d71ffe5b Merge remote-tracking branch 'origin/development' into sha3-updated 2023-06-07 18:02:04 +01:00
Dave Rodgman
f213d0a7b0 Tidy-up
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-07 17:09:47 +01:00
Dave Rodgman
1b42763516 Remove NULL checks
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-07 17:09:02 +01:00
Dave Rodgman
f9d8f4cd68 Remove reference to SHAKE
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-07 17:08:29 +01:00
Dave Rodgman
a35551ef01 Use MBEDTLS_PRIVATE
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-07 17:08:19 +01:00
Dave Rodgman
cf4d2bdc09 Spell as SHA-3 not SHA3
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-07 17:08:09 +01:00
Dave Rodgman
2468ad10d7 Add tests for invalid paramters
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-07 17:06:35 +01:00
Dave Rodgman
c3048b3eea Tidy-up definition of mbedtls_sha3_context
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-07 16:50:15 +01:00
Dave Rodgman
9d7fa93e6c move mbedtls_sha3_family_functions out of public interface
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-07 16:50:15 +01:00
Dave Rodgman
e627bef2f8 Use faster type for state index
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-07 16:50:15 +01:00
Dave Rodgman
1789d84282 remove not-needed fields from SHA-3 context
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-07 16:50:15 +01:00
Dave Rodgman
bcfd79c699 Consume input in 8-byte chunks
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-07 16:50:15 +01:00
David Horstmann
feb1757ead Add clangd compilation databases to gitignore
The clangd language server uses a file called compile_commands.json to
interpret the source tree. This is generated by CMake and must be
present in the source tree in order to use clangd properly.

Add this to the gitignore to improve the developer experience for users
of clangd.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-06-07 15:21:59 +01:00
Gilles Peskine
13230a4ad3
Merge pull request #7349 from mpg/rm-hash-info
Remove `hash_info` module
2023-06-06 21:05:13 +02:00
Gilles Peskine
d598eaf212
Merge pull request #7106 from davidhorstmann-arm/parse-oid-from-string
Parse an OID from a string
2023-06-06 20:57:17 +02:00
Gilles Peskine
a5cd318137
Merge pull request #7670 from lpy4105/issue/fix-wrong-command-for-ec-key-files
Fix invalid commands for ec_x{25519,448}_{prv,pub}.{der,pem}
2023-06-06 20:56:52 +02:00
Gilles Peskine
259903b179
Merge pull request #7643 from lpy4105/issue/renew_cert_2024-01-01
Updating crt/crl files due to expiry before 2024-01-01
2023-06-06 20:55:23 +02:00
Przemek Stekiel
4d3fc216fc Use safe snprintf
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
2023-06-06 11:44:25 +02:00
Przemek Stekiel
63973ab80e Add test for invalid IP length (+use der format in tests)
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
2023-06-06 11:44:25 +02:00
Przemek Stekiel
01cb6eb251 Fix parsing of SAN IP (use mbedtls_snprintf, validate buffer length)
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
2023-06-06 11:44:25 +02:00
Przemek Stekiel
093c97d492 Add separate case for ip address
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
2023-06-06 11:44:25 +02:00
Przemek Stekiel
63a4cdd1eb Add test to parse ipV4 and ipV6 addresses
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
2023-06-06 11:44:25 +02:00
Przemek Stekiel
0ab5b93922 Add support for parsing SAN IP address
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
2023-06-06 11:44:25 +02:00
Gilles Peskine
265ce7c1da
Merge pull request #5451 from gilles-peskine-arm/psa-driver-kdf-spec
PSA drivers: specification for key derivation
2023-06-06 11:37:28 +02:00
Manuel Pégourié-Gonnard
cf61a74209 Add static check for macros that should be in sync
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2023-06-06 10:33:54 +02:00
Manuel Pégourié-Gonnard
c9d9829533 Add comment on macros that should be kept in sync
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2023-06-06 10:33:54 +02:00
Manuel Pégourié-Gonnard
f76c2208f6 Remove mbedtls_psa_translate_md().
The header clearly states all functions here are internal, so we're free
to remove them at any time.

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2023-06-06 10:33:54 +02:00
Manuel Pégourié-Gonnard
45b34517fb Keep MD and PSA max size in sync
Some TLS code is using MD_MAX_SIZE in parts that are common to USE_PSA
and non-USE_PSA, then using PSA_HASH_MAX_SIZE in parts specific to
USE_PSA, and having different values causes trouble.

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2023-06-06 10:33:54 +02:00
Manuel Pégourié-Gonnard
28f504e892 Use PSA-neutral function for availability check
We just want to check if this hash is available, and the check is
present in builds both with PSA and without it. The function we were
using is only present in builds with PSA, so it wasn't appropriate.

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2023-06-06 10:33:54 +02:00
Manuel Pégourié-Gonnard
725d2e24aa Fix guard for PSA->MD error conversion
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2023-06-06 10:33:54 +02:00
Manuel Pégourié-Gonnard
b3b54abf8a Fix duplicated definition of a function
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2023-06-06 10:33:54 +02:00
Manuel Pégourié-Gonnard
3761e9e8fd Use function instead of macro for error conversion
tests/scripts/all.sh build_arm_none_eabi_gcc_m0plus | grep TOTALS

Before: 323003
After:  322883
Saved:     120 bytes

Not huge, but still nice to have.

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2023-06-06 10:33:54 +02:00
Manuel Pégourié-Gonnard
a14b8f0a17 Add total when printing sizes in all.sh
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2023-06-06 10:33:54 +02:00
Manuel Pégourié-Gonnard
02b10d8266 Add missing include
Fix build failures with config full

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2023-06-06 10:33:54 +02:00
Manuel Pégourié-Gonnard
ddbf61a938 Use general framework for PSA status conversion
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2023-06-06 10:33:54 +02:00
Manuel Pégourié-Gonnard
1c32e37b0c Formally deprecate mbedtls_psa_translate_md()
The previous informal comment was not enough to prevent it from being
used in several places in the library. This should have more effect,
considering with have builds with DEPRECATED_REMOVED.

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2023-06-06 10:33:54 +02:00
Manuel Pégourié-Gonnard
1f2a587cdf Use actual function instead of static inline
Large static inline functions used from several translation units in the
library are bad for code size as we end up with multiple copies. Use the
actual function instead. There's already a comment that says so.

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2023-06-06 10:33:54 +02:00
Manuel Pégourié-Gonnard
6076f4124a Remove hash_info.[ch]
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2023-06-06 10:33:54 +02:00
Manuel Pégourié-Gonnard
2d6d993662 Use MD<->PSA functions from MD light
As usual, just a search-and-replace plus:

1. Removing things from hash_info.[ch]
2. Adding new auto-enable MD_LIGHT in build-info.h
3. Including md_psa.h where needed

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2023-06-06 10:33:54 +02:00
Manuel Pégourié-Gonnard
36fb12e7dd Add MD <-> PSA translation functions to MD light
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2023-06-06 10:33:54 +02:00
Manuel Pégourié-Gonnard
1b180bec40 Remove unused function
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2023-06-06 10:33:54 +02:00
Manuel Pégourié-Gonnard
8857984b2f Replace hash_info macro with MD macro
Now the MD macro also accounts for PSA-only hashes.

Just a search-and-replace, plus manually removing the definition in
hash_info.h.

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2023-06-06 10:33:54 +02:00
Manuel Pégourié-Gonnard
9b41eb8533 Replace hash_info_get_type with MD function
Mostly a search and replace with just two manual changes:

1. Now PK and TLS need MD light, so auto-enable it.
2. Remove the old function in hash_info.[ch]

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2023-06-06 10:33:54 +02:00
Manuel Pégourié-Gonnard
1ef26e285e Add convenience inline function to md.h
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2023-06-06 10:33:54 +02:00
Gilles Peskine
d1d08c67dd
Merge pull request #7699 from yuhaoth/bug/fix-file-missing-fail-on-development
Fix file missing fail on development
2023-06-06 10:17:24 +02:00