Przemek Stekiel
615cbcdbdf
Provide additional comments for claryfication
...
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
2023-07-06 12:16:39 +02:00
Yanray Wang
5adfdbdaed
AES: fix mismatch comment in #endif
...
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-07-06 17:10:44 +08:00
Gabor Mezei
c97a407dba
Remove value assignment for enum entries
...
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2023-07-06 10:54:41 +02:00
Gabor Mezei
2a7bcaf8af
Use only MBEDTLS_ECP_WITH_MPI_UINT
to switch between the ecp variants
...
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2023-07-06 10:37:51 +02:00
Tom Cosgrove
836aed7cf8
Merge pull request #6003 from gstrauss/x509_time
...
mbedtls_x509_time performance and reduce memory use
2023-07-06 09:28:14 +01:00
Dave Rodgman
3d0c8255aa
Merge pull request #7825 from daverodgman/cipher_wrap_size
...
Cipher wrap size improvement
2023-07-05 15:45:48 +01:00
Gabor Mezei
1a729dcece
Fix comment
...
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2023-07-05 16:13:46 +02:00
Gabor Mezei
d6789f1e2e
Used preferred macro definition check
...
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2023-07-05 16:13:45 +02:00
David Horstmann
0f1dd57214
Use emptiness-checks rather than DEFINED checks
...
For the MBEDTLS_CONFIG_FILE and MBEDTLS_USER_CONFIG_FILE variables,
check that they are non-empty and defined. This means they can be
unconditionally created in the cache, simplifying the CMakeLists.txt
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-07-05 14:12:13 +01:00
David Horstmann
ae33ab85a5
Pass config file options to mbedtls_test(_helpers)
...
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-07-05 14:11:51 +01:00
David Horstmann
82f11ff6ac
Pass MBEDTLS_CONFIG_FILE defines through cmake
...
When -DMBEDTLS_CONFIG_FILE or -DMBEDTLS_USER_CONFIG_FILE are passed to
cmake, pass them through as compile definitions. This allows different
mbedtls configs to be passed at configure time without modifying any
cmake files.
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-07-05 14:09:58 +01:00
David Horstmann
3ae1c4c0f7
Fix formatting of explanatory commented code
...
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-07-05 11:15:08 +01:00
David Horstmann
b1d27bcd69
Improve comment formatting
...
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-07-05 10:00:31 +01:00
David Horstmann
cdf5283dad
Rename variables to more descriptive names
...
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-07-05 09:58:03 +01:00
Przemek Stekiel
e80bbf4dbf
Fix function name after rebase
...
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
2023-07-05 10:34:40 +02:00
Manuel Pégourié-Gonnard
db084d16ea
Merge pull request #7862 from ronald-cron-arm/improve-write-supported-group-ext
...
Improve write supported group ext
2023-07-05 09:55:33 +02:00
Przemek Stekiel
7ac93bea8c
Adapt names: dh -> xxdh
...
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
2023-07-05 09:26:26 +02:00
Przemek Stekiel
d5f79e7297
Adapt functions names for ffdh
...
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
2023-07-05 09:26:26 +02:00
Przemek Stekiel
6f199859b6
Adapt handshake fields to ffdh
...
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
2023-07-05 09:25:00 +02:00
Przemek Stekiel
e03ddbb497
Use valid size of peerkey buffer (EC vs FF)
...
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
2023-07-05 09:25:00 +02:00
Beniamin Sandu
aa4f621901
aesce: use correct target attribute when building with clang
...
Seems clang has its own issues when it comes to crypto extensions,
and right now the best way to avoid them is to accurately enable
the needed instructions instead of the broad crypto feature.
E.g.: https://github.com/llvm/llvm-project/issues/61645
Signed-off-by: Beniamin Sandu <beniaminsandu@gmail.com>
2023-07-04 21:15:52 +03:00
Dave Rodgman
c8d81ad54d
Merge pull request #7784 from daverodgman/aesce-unroll
2023-07-04 18:41:13 +01:00
Tom Cosgrove
e939464eb7
Merge pull request #7829 from mpg/deduplicate-tls-hashing
...
De-duplicate TLS hashing functions
2023-07-04 16:06:00 +01:00
Tom Cosgrove
b7af7eac05
Merge pull request #7834 from beni-sandu/development
...
aesce: do not specify an arch version when enabling crypto instructions
2023-07-04 13:32:04 +01:00
Ronald Cron
1ffa450882
tls: client: Improve writing of supported_groups ext
...
Align the TLS 1.3 specific and TLS 1.2 specific
tests done before to call
ssl_write_supported_groups_ext() and inside
thsi function.
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2023-07-04 12:16:25 +02:00
Kusumit Ghoderao
3fde8feaa9
FIx name of macro
...
Signed-off-by: Kusumit Ghoderao <Kusumit.Ghoderao@silabs.com>
2023-07-04 15:17:02 +05:30
Kusumit Ghoderao
4536bb6f2b
Change mac_size parameter in driver_mac_compute to output length
...
See #7801 for reference
Signed-off-by: Kusumit Ghoderao <Kusumit.Ghoderao@silabs.com>
2023-07-04 15:17:01 +05:30
Kusumit Ghoderao
a2520a5b7e
Add pbkdf2 cmac to key derivation output_bytes
...
Signed-off-by: Kusumit Ghoderao <Kusumit.Ghoderao@silabs.com>
2023-07-04 15:17:00 +05:30
Kusumit Ghoderao
3d5edb8eef
Add input password function for pbkdf2 cmac
...
Signed-off-by: Kusumit Ghoderao <Kusumit.Ghoderao@silabs.com>
2023-07-04 15:17:00 +05:30
Kusumit Ghoderao
2cd649684a
Add pbkdf2_cmac to key derivation setup
...
Signed-off-by: Kusumit Ghoderao <Kusumit.Ghoderao@silabs.com>
2023-07-04 15:17:00 +05:30
Kusumit Ghoderao
3ab146f99e
Add builtin pbkdf2 cmac guard for all the pbkdf2 functions
...
Signed-off-by: Kusumit Ghoderao <Kusumit.Ghoderao@silabs.com>
2023-07-04 15:16:59 +05:30
Manuel Pégourié-Gonnard
aaad2b6bfc
Rename some local variables
...
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2023-07-04 11:35:16 +02:00
Manuel Pégourié-Gonnard
443589ac53
Merge pull request #7870 from valeriosetti/fix-tls13-guards
...
tls13: fix guards for PSA error translating function
2023-07-04 11:21:14 +02:00
Tom Cosgrove
9b20c6fcc1
Merge pull request #7840 from yanrayw/7381_aes_gen_table
...
AES: use uint8_t for array of pow and log to save RAM usage
2023-07-04 08:34:12 +01:00
Valerio Setti
dbd01cb677
tls13: fix guards for PSA error translating function
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-07-04 09:18:52 +02:00
Dave Rodgman
9cf17dad9d
Merge pull request #7851 from daverodgman/fix-unused-aes
...
Fix AES dependencies - build TF-M config cleanly
2023-07-03 16:49:00 +01:00
Manuel Pégourié-Gonnard
56b159a12a
Merge pull request #7627 from mprse/ffdh_tls13_v2
...
Make use of FFDH keys in TLS 1.3 v.2
2023-07-03 10:12:33 +02:00
Manuel Pégourié-Gonnard
45e009aa97
Merge pull request #7814 from valeriosetti/issue7746
...
PK: refactor wrappers in the USE_PSA case
2023-07-03 09:32:31 +02:00
Valerio Setti
f7cd419ade
pk: ignore opaque EC keys in pk_setup when they are not supported
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-06-30 18:11:29 +02:00
Valerio Setti
35d1dacd82
pk_wrap: fix: always clear buffer holding private key in eckey_check_pair_psa
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-06-30 18:04:16 +02:00
Gabor Mezei
f4aab6f666
Add comments and remove unneeded defines
...
For `check_names.py` it is enough to appear a macro definition in
a comment to validate it.
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2023-06-30 16:54:55 +02:00
Valerio Setti
38913c16b0
pk_wrap: do not support opaque EC keys when !PK_HAVE_ECC_KEYS
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-06-30 16:18:33 +02:00
Tom Cosgrove
c4a760c538
Merge pull request #7849 from davidhorstmann-arm/fix-string-to-names-retcode
...
Fix false success return code in `mbedtls_x509_string_to_names()`
2023-06-30 14:28:29 +01:00
Dave Rodgman
a2c1a387e4
Merge pull request #7630 from daverodgman/prefer-intrinsics
...
Prefer intrinsics over asm for AES-NI
2023-06-30 11:39:38 +01:00
Gabor Mezei
c810707980
Add check for the ecp module variants
...
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2023-06-30 11:39:21 +02:00
Gabor Mezei
1df4c6435f
Enable build of the new ecp_new.c file
...
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2023-06-30 11:39:20 +02:00
Gabor Mezei
a306d20766
Clone the ecp.c file as ecp_new.c
...
Add macro guard for each file defaults to enable the ecp.c file content.
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2023-06-30 11:38:55 +02:00
Valerio Setti
27c501a10c
lib/test: replace BASIC_IMPORT_EXPORT internal symbol with BASIC,IMPORT,EXPORT
...
Also the python script for automatic test generation is fixed accordingly
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-06-30 10:16:22 +02:00
Valerio Setti
86587abde4
psa: fix guards for EC key derivation
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-06-30 10:16:22 +02:00
Valerio Setti
dd24f29105
psa: fix wrong naming for ECC derive symbols in code
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-06-30 10:16:22 +02:00
Valerio Setti
4c0174de2e
psa: replace remaining ECC_KEY_PAIR_LEGACY symbols with proper ones
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-06-30 10:16:22 +02:00
Valerio Setti
5dad7051b4
psa_crypto_ecp: fix wrong comment in #endif
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-06-30 10:16:22 +02:00
Valerio Setti
2a63460248
psa: fix guards for EC key derivation
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-06-30 10:16:21 +02:00
Valerio Setti
6a9d0ee373
library/test: replace LEGACY symbol with BASIC_IMPORT_EXPORT
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-06-30 10:16:21 +02:00
Valerio Setti
bfeaf5b4f6
library: replace ECC_KEY_PAIR_LEGACY with GENERATE
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-06-30 10:16:21 +02:00
Valerio Setti
8ffdb5df7d
library: replace ECC_KEY_PAIR_LEGACY with DERIVE
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-06-30 10:12:19 +02:00
Gilles Peskine
053022fe24
Reduce the size of mbedtls_mpi
...
Reduce the size of mbedtls_mpi from 3 words to 2 on most architectures.
This also reduces the code size significantly in bignum.o and ecp_curves.o,
with negligible variations in other modules.
This removes the ability to set MBEDTLS_MPI_MAX_LIMBS to a value >=65536,
but we don't support customizing this value anyway (it's always 10000).
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-06-29 19:33:44 +02:00
Valerio Setti
88a3aeed9f
pk_wrap: use PK_HAVE_ECC_KEYS as guard for ecdsa_opaque_check_pair_wrap
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-06-29 15:01:10 +02:00
Valerio Setti
d9d74c285b
pk_wrap: guard all ECDSA function with MBEDTLS_PK_HAVE_ECC_KEYS
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-06-29 15:00:02 +02:00
Valerio Setti
4d1daf8f8d
pk_wrap: minor fixes for guards
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-06-29 14:33:27 +02:00
Valerio Setti
97976e3e4c
pk_wrap: always fill all the fields of the pk_info structures
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-06-29 14:33:27 +02:00
Valerio Setti
76d0f9637c
pk: uniform naming of functions and structures in pk/pk_wrap
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-06-29 14:33:27 +02:00
Valerio Setti
884c1ec1f5
pk_wrap: share code for selecting the psa_alg in ECDSA sign
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-06-29 14:33:27 +02:00
Valerio Setti
574a00b576
pk_wrap: minor reorganization for opaque keys
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-06-29 14:33:26 +02:00
Valerio Setti
5c26b30d9e
pk_wrap: add missing labels to #else and #endif
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-06-29 14:33:26 +02:00
Valerio Setti
bb7603a28f
pk_wrap: optimize eckey_check_pair()
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-06-29 14:33:26 +02:00
Valerio Setti
f69514a7d8
pk_wrap: name all the fields of the pk_info structs
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-06-29 14:33:26 +02:00
Valerio Setti
e77307738d
pk_wrap: add support for ECDSA verify for opaque keys
...
This commit also add tests to verify the functionality
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-06-29 14:33:26 +02:00
Valerio Setti
ed7d6af670
pk_wrap: optimize code for ECDSA verify
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-06-29 14:33:26 +02:00
Valerio Setti
4657f10bdb
pk_wrap: optimize code for ECDSA sign
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-06-29 14:33:26 +02:00
Dave Rodgman
f032c9842d
Improve #endif comments
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-29 12:09:27 +01:00
Dave Rodgman
afe85db42b
Improve #endif comments
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-29 12:07:11 +01:00
Dave Rodgman
1be2463d76
Correct #endif comments
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-29 12:01:24 +01:00
Dave Rodgman
710e3c650f
Correct comments on #endif's
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-29 12:00:14 +01:00
Dave Rodgman
9fbb0cf08e
Merge remote-tracking branch 'origin/development' into safer-ct5
2023-06-28 18:52:02 +01:00
Paul Elliott
92a55bf5ea
Merge pull request #7793 from minosgalanakis/ecp/6025_fast_reduction_dispatch
...
[Bignum] Fast reduction dispatch
2023-06-28 17:38:37 +01:00
Dave Rodgman
ffabb7b7da
Fix unused function warning in x509.c
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-28 16:22:50 +01:00
Janos Follath
c439c678e3
Merge pull request #7719 from davidhorstmann-arm/second-jpake-state-machine-rework
...
Change J-PAKE internal state machine
2023-06-28 08:59:23 +01:00
Przemek Stekiel
7dda271c1d
Fix description of functions
...
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
2023-06-28 09:16:08 +02:00
Tom Cosgrove
db041cc82f
Merge pull request #7665 from AndrzejKurek/optimize-error-translation-code-size
...
Optimize error translation code size
2023-06-28 08:09:00 +01:00
Dave Rodgman
2fd8c2c708
code style
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-27 21:03:31 +01:00
Dave Rodgman
160088d769
Fix comment
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-27 20:41:51 +01:00
Dave Rodgman
ad4e76be57
More dependency fixes
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-27 19:23:14 +01:00
Dave Rodgman
34152a48d4
Fix unused variable
...
Fix when MBEDTLS_AES_SETKEY_ENC_ALT, MBEDTLS_AES_DECRYPT_ALT and
MBEDTLS_AES_ROM_TABLE set.
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-27 19:23:09 +01:00
Dave Rodgman
15cd28a264
Fix unused variable if MBEDTLS_AES_SETKEY_ENC_ALT and MBEDTLS_AES_DECRYPT_ALT set
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-27 19:23:06 +01:00
Dave Rodgman
28a539a549
Fix unused fn when MBEDTLS_AES_SETKEY_DEC_ALT and MBEDTLS_AES_SETKEY_ENC_ALT set
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-27 19:23:01 +01:00
Dave Rodgman
8c753f99cb
Fix unused function when MBEDTLS_AES_SETKEY_ENC_ALT set
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-27 19:22:56 +01:00
David Horstmann
8fd98d6e62
Return an error when no name is parsed
...
When less than 1 RDN is successfully parsed in
mbedtls_x509_string_to_names(), return an error. Previously this
returned success when a string containing neither '=' or ',' was
supplied.
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-06-27 15:31:40 +01:00
Dave Rodgman
28e2ca51a9
Docs improvement
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-27 15:25:38 +01:00
Dave Rodgman
9f4fd28eff
Merge pull request #7808 from daverodgman/fix-ct-compile-warning
...
Fix for arm64_32 (aka ILP32) on Clang
2023-06-27 15:23:14 +01:00
Minos Galanakis
c4e4958326
ecp_curves: Adjusted expected_width inputs to use BITS_TO_LIMBS
macro.
...
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2023-06-27 14:07:07 +01:00
Yanray Wang
fe944ce2d8
aes.c: use uint8_t for local x, y, z in aes_gen_tables to save RAM
...
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-06-27 18:18:06 +08:00
Yanray Wang
5c86b1775a
aes.c: use uint8_t for array of pow and log to save RAM
...
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-06-27 18:18:06 +08:00
David Horstmann
246ec5a35e
Replace unnecessary '>=' with '=='
...
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-06-27 10:33:06 +01:00
Dave Rodgman
8c5fae2610
Add explanatory comment
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-27 09:43:55 +01:00
Dave Rodgman
9e868be13a
Fix clang warning from -Wasm-operand-widths
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-27 09:27:27 +01:00
Minos Galanakis
53a16b3fb5
bignum_mod_raw: Updated documentation for mpi_mod_raw_mul
...
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2023-06-26 20:06:36 +01:00
Przemek Stekiel
76669458af
Adapt guards in ssl_write_client_hello_body
...
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
2023-06-26 17:34:36 +02:00
Przemek Stekiel
98d79335d1
Update guards for supported groups
...
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
2023-06-26 16:28:45 +02:00
Valerio Setti
8c3404f3e0
x509: update ECP_LIGHT dependencies to PK_HAVE_ECC_KEYS
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-06-26 15:49:48 +02:00
Minos Galanakis
8eb6104256
bignum_mod_raw: Fixed a documentation typo.
...
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2023-06-26 10:03:19 +01:00
Minos Galanakis
c7408a432e
bignum_mod_raw: Adjusted OPT_RED limb size requirements for mod_raw_mul().
...
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2023-06-25 21:14:44 +01:00
Minos Galanakis
25d998b3b9
ecp_curves: Fixed modp pointers on mbedtls_ecp_modulus_setup
.
...
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2023-06-25 21:08:58 +01:00
Beniamin Sandu
471a975942
aesce: do not specify an arch version when enabling crypto instructions
...
Building mbedtls with different aarch64 tuning variations revealed
that we should use the crypto extensions without forcing a particular
architecture version or core, as that can create issues.
Signed-off-by: Beniamin Sandu <beniaminsandu@gmail.com>
2023-06-25 21:10:53 +03:00
Dave Rodgman
25d77cb9a7
Drop not-used items from the base look-up table
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-24 22:58:51 +01:00
Dave Rodgman
d30eed4d55
More struct re-ordering
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-24 18:35:42 +01:00
Dave Rodgman
92cf6e52d3
Adjust stuct order for better packing / smaller accessor code size
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-24 18:21:11 +01:00
Dave Rodgman
1b8a3b16c4
Add casts for enums in cipher.c
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-24 17:33:14 +01:00
Dave Rodgman
2e8f6aabc2
Fix direct use of cipher_info->type
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-24 17:32:18 +01:00
Dave Rodgman
ef2f3697ec
Fix direct reference to cipher_info->key_bitlen
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-24 17:31:08 +01:00
Dave Rodgman
e59b9d44b1
Fix some compiler type warnings
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-24 16:53:13 +01:00
Dave Rodgman
77049b8b6c
Dependency fixes
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-24 14:39:47 +01:00
Dave Rodgman
85a88133aa
Use fewer bits for block_size
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-24 13:37:28 +01:00
Dave Rodgman
3b46b77cf1
code style
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-24 13:37:28 +01:00
Dave Rodgman
de3de773e6
Use look-up table for base
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-24 12:59:31 +01:00
Dave Rodgman
0ffb68ee3f
Use fewer bits for iv_size
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-24 12:59:31 +01:00
Dave Rodgman
bb521fdbc9
Don't directly access iv_size
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-24 12:59:31 +01:00
Dave Rodgman
6c6c84212e
Use fewer bits for key_bitlen
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-24 11:14:34 +01:00
Dave Rodgman
9282d4f13a
Don't directly access key_bitlen
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-24 11:07:40 +01:00
Dave Rodgman
3319ae9679
Re-order mbedtls_cipher_info_t
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-24 10:55:04 +01:00
Manuel Pégourié-Gonnard
de33278e43
Unify ssl_calc_finished_tls_sha{256,384}
...
Saves about 50-60 bytes on m0+ depending on whether USE_PSA is set.
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2023-06-24 10:13:41 +02:00
Manuel Pégourié-Gonnard
74970664a9
Unify ssl_calc_verify_sha{256,384}
...
Saves about 40 bytes of code size on m0plus with baremetal_size.
Note: the debug messages are change to no longer include the hash name.
That's not a problem as we already know which alg is used from previous
output, and we can also know it form the size of the printed buffer.
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2023-06-24 09:43:26 +02:00
Dave Rodgman
4e5c63d652
Improve documentation in bn_mul.h
...
Co-authored-by: Tom Cosgrove <tom.cosgrove@arm.com>
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-23 15:17:37 +01:00
Minos Galanakis
7b1093240c
bignum_mod_raw: Updated documentation for mbedtls_mpi_mod_raw_mul
...
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2023-06-22 16:52:20 +01:00
Minos Galanakis
2ed8fb7e4f
ecp_mod_raw: Enabled fast reduction.
...
This patch modifies `mbedtls_mpi_mod_raw_mul`
to utilise fast-reduction when available.
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2023-06-22 16:35:30 +01:00
Paul Elliott
3048c8c906
Merge pull request #7725 from minosgalanakis/ecp/7268_add_optimised_reduction_setup_3
...
[Bignum] Add optimised reduction setup
2023-06-22 16:30:39 +01:00
David Horstmann
57727cd3fc
Explain the sequence of mbedtls_psa_pake_ calls
...
Add a comment showing the order in which the mbedtls_psa_pake_xyz()
functions may be called.
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-06-22 15:22:35 +01:00
David Horstmann
88d25f0075
Remove unnecessary checks in psa_jpake_prologue()
...
These checks are not needed as long as the state is intact.
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-06-22 15:22:35 +01:00
David Horstmann
e5b374adaf
Remove comment explaining the state machine
...
The explanation of the dispatch layer's state machine should not be in
the file containing the software implementation and a better
understanding can be had by reading the dispatch layer's code.
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-06-22 15:22:35 +01:00
David Horstmann
74a3d8c99c
Simplify logic of driver step conversion
...
Take advantage of the contiguous nature of XYZ_KEY_SHARE, XYZ_ZK_PUBLIC
and XYZ_ZK_PROOF to simplify the conversion code.
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-06-22 15:22:35 +01:00
David Horstmann
5d878f6c5f
Tweak wording for clarity
...
"inputs this round" -> "inputs for this round"
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-06-22 15:22:35 +01:00
David Horstmann
1b54faed67
Remove unnecessary initialization of state
...
The psa_jpake_computation_stage_t is already initialized in
psa_pake_setup(), so does not need initializing again in
psa_pake_complete_inputs().
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-06-22 15:22:35 +01:00
David Horstmann
16f0151887
Use memset for initialization
...
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-06-22 15:22:35 +01:00
David Horstmann
024e5c5f2e
Rename struct member mode to io_mode
...
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-06-22 15:22:35 +01:00
David Horstmann
00ad6bfabe
Rename function_mode to io_mode
...
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-06-22 15:22:35 +01:00
David Horstmann
5da9560178
Properly namespace enum values within PSA_JPAKE_
...
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-06-22 15:22:35 +01:00
David Horstmann
e7f21e65b6
Change J-PAKE internal state machine
...
Keep track of the J-PAKE internal state in a more intuitive way.
Specifically, replace the current state with a struct of 5 fields:
* The round of J-PAKE we are currently in, FIRST or SECOND
* The 'mode' we are currently working in, INPUT or OUTPUT
* The number of inputs so far this round
* The number of outputs so far this round
* The PAKE step we are expecting, KEY_SHARE, ZK_PUBLIC or ZK_PROOF
This should improve the readability of the state-transformation code.
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-06-22 15:22:35 +01:00
Manuel Pégourié-Gonnard
e25c43bd66
Merge pull request #7791 from valeriosetti/issue7406
...
driver-only ECC: TLS: avoid use of mbedtls_ecp_write_key() (with USE_PSA)
2023-06-22 11:13:44 +02:00
Minos Galanakis
2a03fd3b7b
bignum_mod: Added a typedef for OPT_RED function pointer.
...
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2023-06-22 09:14:28 +01:00
Manuel Pégourié-Gonnard
2fb9d00f6d
Merge pull request #7682 from valeriosetti/issue7453
...
driver-only ECC: ECPf.PK testing
2023-06-22 09:45:57 +02:00
Valerio Setti
6835b4a6ed
tls: always zeroize buffer on exit
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-06-22 09:06:31 +02:00
Valerio Setti
3589a4c644
tls: keep buffer declaration in a single line
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-06-22 09:02:44 +02:00
Dave Rodgman
e6c9996d04
Work around updating pointers from ILP32
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-21 21:16:23 +01:00
Dave Rodgman
5b5dd011d1
code style
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-21 16:36:47 +01:00
Dave Rodgman
b5b6939fc2
Remove redundant checks in constant_time.c
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-21 16:36:42 +01:00
Dave Rodgman
0400ae2f9b
Fix pointer constraint in bn_mul.h
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-21 16:31:52 +01:00
Dave Rodgman
c54f25e26c
code style
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-21 13:39:30 +01:00
Dave Rodgman
63e89b46f8
Use UINTPTR_MAX not SIZE_MAX
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-21 11:58:54 +01:00
Dave Rodgman
85842b8edb
Be strict about pointer size in mbedtls_get_unaligned_volatile_uint32
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-21 11:22:09 +01:00
Manuel Pégourié-Gonnard
a36ef6b410
Omit block_size when MD_C is not enabled
...
It's only used by our HMAC implementation
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2023-06-21 12:02:07 +02:00
Bence Szépkúti
f2154a6e10
Merge pull request #7686 from DemiMarie/do-while
...
Add a do-while loop around macros.
2023-06-21 11:31:41 +02:00
Dave Rodgman
b67db9140e
Separate ILP32 and normal-aarch64 code paths
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-21 09:15:27 +01:00
Manuel Pégourié-Gonnard
9e97e6daed
Remove useless extern declarations and includes
...
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2023-06-21 09:45:36 +02:00
Dave Rodgman
c882adf0ca
Docs improvement
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-21 07:37:56 +01:00
Dave Rodgman
04cb9ac59e
Fix for arm64_32 (aka ILP32) on Clang (attempt 2)
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-21 07:32:22 +01:00
Dave Rodgman
b19f584f2c
Fix for arm64_32 (aka ILP32) on Clang
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-20 23:01:43 +01:00
Gilles Peskine
a3a0025e18
Merge pull request #7806 from paul-elliott-arm/fix_32bit_builds
...
[Bignum] Fix 32 bit unreachable code build failure
2023-06-20 22:13:06 +02:00
Gilles Peskine
5faccf038b
Merge pull request #7805 from paul-elliott-arm/fix_retval
...
Pacify clang15 warnings about empty \retval
2023-06-20 22:12:51 +02:00
Paul Elliott
215ed131cf
Fix 32 bit unreachable code build failure
...
Given the size of ciL is set dependant on MBEDTLS_HAVE_INT32 /
MBEDTLS_HAVE_INT64, clang rightfully reports this as unreachable code in
32 bit builds. Fix this by using #define guards instead.
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2023-06-20 17:55:15 +01:00
Paul Elliott
458b96b1a7
Merge pull request #7638 from AndrzejKurek/cert-apps-use-ips
...
Use better IP parsing in x509 apps
2023-06-20 17:21:04 +01:00
Demi Marie Obenour
690b8c9ca7
Add a do-while loop around macros
...
This is good practice in C.
Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com>
2023-06-20 11:48:04 -04:00
Dave Rodgman
b70ea9fb64
Merge remote-tracking branch 'origin/development' into safer-ct5
2023-06-20 16:12:00 +01:00
Paul Elliott
24f4b73ee5
Pacify clang15 warnings about empty /retval
...
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2023-06-20 15:51:46 +01:00
Manuel Pégourié-Gonnard
ee7a758b85
MD: isolate strings to separate table
...
In the long term, we don't really want those strings in the library.
Start with isolating them in a separate table rather than having them in
the main md_info structure.
This way, the table can easily be garbage-collected by the linker if
none of the two functions using it are called.
Also, simplify the implementation of mbedtls_md_info_from_string().
This saves 151 bytes with MD_C, and 141 with MD_LIGHT only.
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2023-06-20 12:12:22 +02:00
Valerio Setti
e1651360c0
pkwrite: fix wrong guard position for pk_get_opaque_ec_family()
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-06-19 19:24:05 +02:00
Valerio Setti
a9aab1a85b
pk/psa: use PSA guard for mbedtls_ecc_group_to_psa() and mbedtls_ecc_group_of_psa()
...
This allows also to:
- removing the dependency on ECP_C for these functions and only rely
on PSA symbols
- removing extra header inclusing from crypto_extra.h
- return MBEDTLS_PK_USE_PSA_EC_DATA and MBEDTLS_PK_HAVE_ECC_KEYS to
their original position in pk.h
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-06-19 19:24:05 +02:00
Valerio Setti
bc2b1d3288
psa: move mbedtls_ecc_group_to_psa() from inline function to standard one
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-06-19 19:24:05 +02:00
Valerio Setti
30fdc03819
pk: remove useless internal function
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-06-19 19:24:05 +02:00
Valerio Setti
81d75127ba
library: replace occurencies of ECP_LIGHT with PK_HAVE_ECC_KEYS
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-06-19 19:24:05 +02:00
Marek Jansta
8bde649c0b
Fixed AlgorithmIdentifier parameters when used with ECDSA signature algorithm in x509 certificate
...
Signed-off-by: Marek Jansta <jansta@2n.cz>
2023-06-19 12:49:27 +02:00
Dave Rodgman
086e137dc4
code style
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-16 20:21:39 +01:00
Dave Rodgman
96a9e6a9dd
Address test review comments
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-16 20:18:36 +01:00
Dave Rodgman
e1dd6e9e8f
Merge remote-tracking branch 'origin/development' into prefer-intrinsics
2023-06-16 17:46:16 +01:00
Dave Rodgman
4ad81ccdae
Only force O2 when hw acceleration available
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-16 15:04:04 +01:00
Valerio Setti
addeee4531
mbedtls_config: add new MBEDTLS_PK_PARSE_EC_COMPRESSED symbol
...
This includes also:
- auto enabling ECP_LIGHT when MBEDTLS_PK_PARSE_EC_COMPRESSED is
defined
- replacing ECP_LIGHT guards with PK_PARSE_EC_COMPRESSED in pkparse
- disabling PK_PARSE_EC_COMPRESSED in tests with accelarated EC curves
(it get disabled also in the reference components because we want
to achieve test parity)
- remove skipped checks in analyze_outcomes.py
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-06-16 16:03:46 +02:00
Gilles Peskine
5760bf77c7
Merge pull request #7641 from valeriosetti/issue7614
...
Define PSA_WANT_KEY_TYPE_xxx_KEY_PAIR_yyy (step 1)
2023-06-16 16:00:17 +02:00
Dave Rodgman
b2814bd089
Only enable gcc -Os fix if we have AES hw support
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-16 14:50:33 +01:00
Dave Rodgman
73b0c0b051
Improve comment
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-16 14:48:14 +01:00
Przemek Stekiel
f595c5b69a
Use valid guard for filling group list with EC groups
...
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
2023-06-16 15:45:37 +02:00
Dave Rodgman
bd1add94c0
Respect -Os for everything except XTS
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-16 13:50:14 +01:00
Minos Galanakis
de87461c23
ecp_curves: Updated the optimised reduction function pointer.
...
This patch modifies the `mbedtls_mpi_opt_red_struct` to use an
mpi_uint * pointer and size_t limps arguments.
The methods interacting with this pointer have been updated
accordingly:
- mbedtls_mpi_mod_optred_modulus_setup
- mbedtls_ecp_modulus_setup
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2023-06-16 13:48:47 +01:00
Minos Galanakis
5c238d80cd
bignum_mod: Updated documentation.
...
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2023-06-16 13:48:47 +01:00
Minos Galanakis
65210952ec
ecp_curves: Updated mbedtls_ecp_modulus_setup
to use optimised reduction.
...
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2023-06-16 13:48:47 +01:00
Minos Galanakis
1d3e332986
ecp_curves: Updated input argument for mbedtls_ecp_modulus_setup
.
...
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2023-06-16 13:48:47 +01:00
Minos Galanakis
be1bf15f76
bignum_mod: Updated optred_modulus_setup
to use function input.
...
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2023-06-16 13:48:47 +01:00
Minos Galanakis
c6e68ed85d
bignum_mod: Added mbedtls_mpi_opt_red_struct
structure.
...
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2023-06-16 13:48:47 +01:00
Minos Galanakis
0f718c9ed0
bignum_mod: Fixed code-style
...
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2023-06-16 13:48:47 +01:00
Minos Galanakis
f055ad61dc
bignum_mod: Added static standard_modulus_setup()
.
...
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2023-06-16 13:48:47 +01:00
Minos Galanakis
88e16dfa2a
bignum_mod: Refactored mbedtls_mpi_mod_modulus_setup()
...
This patch removes the `int_rep` input parameter for modular
setup, aiming to align it with the optred variant.
Test and test-suite helper functions have been updated
accordingly.
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2023-06-16 13:48:47 +01:00
Minos Galanakis
bbe9db4b29
binum_mod: Added mbedtls_mpi_mod_optred_modulus_setup()
.
...
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2023-06-16 13:48:47 +01:00
Paul Elliott
680233dc3f
Merge pull request #7680 from paul-elliott-arm/raw_ecp_mod_p448
...
[Bignum] Split out raw ECP mod p448
2023-06-16 13:46:25 +01:00
Steve Lhomme
eb0f18acbc
Don't use inet_pton() before Windows Vista
...
On runtime it will attempt to get inet_pton() from ws2_32.dll
but it's not there and the DLL/program containing mbedtls will not load.
Signed-off-by: Steve Lhomme <robux4@ycbcr.xyz>
2023-06-16 14:34:11 +02:00
Steve Lhomme
d50a8cc77c
Don't force the default windows version down
...
The _WIN32_WINNT value will pick the default value for the SDK when
including windows.h.
Signed-off-by: Steve Lhomme <robux4@ycbcr.xyz>
2023-06-16 14:34:11 +02:00
Steve Lhomme
954553f5b1
Don't call wincrypt on builds older than Windows XP
...
On runtime it will attempt to get CryptAcquireContext() from advapi32.dll
but it's not there and the DLL/program containing mbedtls will not load.
Signed-off-by: Steve Lhomme <robux4@ycbcr.xyz>
2023-06-16 14:34:11 +02:00
Dave Rodgman
e07c670e47
Allow all.sh to override intrinsics vs asm selection
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-16 13:21:28 +01:00
Valerio Setti
b46217d5c1
tls: never destroy a priavte key that is not owned/created by TLS module
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-06-16 13:18:52 +02:00
Valerio Setti
01cc88a46b
config_psa: replace USE symbols with BASIC one for all KEY_PAIRs
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-06-16 12:27:02 +02:00
Valerio Setti
b0d9aaee1c
psa: move PSA_WANT checks to check_crypto_config
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-06-16 12:26:26 +02:00
Valerio Setti
8bb5763a85
library: replace deprecated symbols with temporary _LEGACY ones
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-06-16 12:23:55 +02:00
Valerio Setti
0813b6f28d
tls: optimize code in ssl_get_ecdh_params_from_cert()
...
When MBEDTLS_PK_USE_PSA_EC_DATA is defined, opaque and non-opaque keys
are basically stored in the same way (only a diffferent ownership for
the key itself), so they should be treated similarly in the code.
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-06-16 12:18:53 +02:00
Janos Follath
a426dc31cc
Merge pull request #7782 from gilles-peskine-arm/mbedtls_ecp_modulus_type-move
...
Move mbedtls_ecp_modulus_type out of the public headers
2023-06-16 11:12:57 +01:00
Dave Rodgman
9bb7e6f4ce
Rename MBEDTLS_OPTIMIZE_ALWAYS
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-16 09:41:21 +01:00
Dave Rodgman
48fd2ab5d5
Improve readability of unrolled AESCE code
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-16 09:36:50 +01:00
Gilles Peskine
f45a5a0ddd
Merge pull request #7700 from silabs-Kusumit/PBKDF2_output_bytes
...
PBKDF2: Output bytes
2023-06-16 10:08:02 +02:00
Dave Rodgman
2dd15b3ab5
code style
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-15 20:27:53 +01:00
Dave Rodgman
660cd378e1
Use MBEDTLS_OPTIMIZE_ALWAYS for gcm
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-15 18:53:35 +01:00
Dave Rodgman
9149c32192
Use MBEDTLS_OPTIMIZE_ALWAYS for ccm
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-15 18:50:21 +01:00
Dave Rodgman
f88a68cf51
Use MBEDTLS_OPTIMIZE_ALWAYS in aesce
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-15 18:46:41 +01:00
Dave Rodgman
6cfd9b54ae
use MBEDTLS_OPTIMIZE_ALWAYS in AES-XTS
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-15 18:46:23 +01:00
Dave Rodgman
a0b166e11e
Use mbedtls_xor_no_simd from cmac and cbc
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-15 18:44:16 +01:00
Dave Rodgman
03bb526c24
Add a non-NEON variant of mbedtls_xor
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-15 18:43:24 +01:00
Dave Rodgman
b055f75c3d
Introduce MBEDTLS_OPTIMIZE_ALWAYS
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-15 18:42:59 +01:00
Dave Rodgman
7fdfd70b19
Introduce MBEDTLS_COMPILER_IS_GCC
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-15 18:42:25 +01:00
Gilles Peskine
637c049349
Move mbedtls_ecp_modulus_type out of the public headers
...
This is an internal detail of the ECC arithmetic implementation, only
exposed for the sake of the unit tests
Mbed TLS 3.4.0 was released with the type mbedtls_ecp_modulus_type defined
in a public header, but without Doxygen documentation, and without any
public function or data structure using it. So removing it is not an API
break.
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-06-15 19:07:41 +02:00
Kusumit Ghoderao
246e51fd0b
Add cleanup for intermediate buffer
...
Signed-off-by: Kusumit Ghoderao <Kusumit.Ghoderao@silabs.com>
2023-06-15 22:15:43 +05:30
Paul Elliott
a2e48f751b
Split out mbedtls_ecp_mod_p448_raw()
...
Switch testing over to using the generic raw functions.
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2023-06-15 17:16:38 +01:00
Paul Elliott
b4df176610
Merge pull request #7637 from paul-elliott-arm/fixed_ecp_mod_p448
...
[Bignum] Fixed width for ecp mod p448
2023-06-15 17:12:02 +01:00
Dave Rodgman
1c4451d089
Unroll aesce_decrypt_block
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-15 16:28:00 +01:00
Dave Rodgman
96fdfb8e62
Unroll aesce_encrypt_block
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-15 16:26:20 +01:00
Przemek Stekiel
a05e9c1ec8
Fix selection of default FFDH group
...
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
2023-06-15 17:07:16 +02:00
Przemek Stekiel
8c0a95374f
Adapt remaining guards to FFDH
...
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
2023-06-15 17:07:10 +02:00
Dave Rodgman
2e7d57270e
Merge pull request #7624 from daverodgman/aes-perf
...
AES perf improvements
2023-06-15 12:10:06 +01:00
Tom Cosgrove
6edf8b8c7b
Merge pull request #7451 from yanrayw/7376_aes_128bit_only
...
Introduce config option of 128-bit key only in AES calculation
2023-06-15 10:35:32 +01:00
Kusumit Ghoderao
d07761c19c
add return statement
...
Signed-off-by: Kusumit Ghoderao <Kusumit.Ghoderao@silabs.com>
2023-06-15 12:11:15 +05:30
Dave Rodgman
28a97acb3c
code style
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-14 20:15:15 +01:00
Paul Elliott
bed9ac7b2d
Optimise final 2 rounds
...
Final two rounds logic could be significantly simplified.
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2023-06-14 19:20:33 +01:00
Dave Rodgman
d05e7f1ab3
Do not use NEON for AES-CBC on aarch64
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-14 18:58:48 +01:00
Dave Rodgman
906c63cf35
Revert "improve cbc encrypt perf"
...
This reverts commit f1e396c427
.
Performance is slightly better with this reverted, especially
for AES-CBC 192.
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-14 17:55:41 +01:00
Paul Elliott
b8f7305b02
Replace sizeof(mbedtls_mpi_uint) with ciL define
...
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2023-06-14 17:52:42 +01:00
Gilles Peskine
9e930e2887
Rename MBEDTLS_CIPHER_BLKSIZE_MAX internally
...
Replace all occurrences of MBEDTLS_CIPHER_BLKSIZE_MAX by the new name with
the same semantics MBEDTLS_CMAC_MAX_BLOCK_SIZE, except when defining or
testing the old name.
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-06-14 18:00:37 +02:00
Andrzej Kurek
15ddda9ff8
Remove PSA_TO_MD_ERR from ssl_tls.c
...
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2023-06-14 07:37:46 -04:00
Kusumit Ghoderao
257ea00199
Use output block as U_accumulator
...
Signed-off-by: Kusumit Ghoderao <Kusumit.Ghoderao@silabs.com>
2023-06-14 15:55:11 +05:30
Paul Elliott
3646dc78bc
Fix coding style issue
...
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2023-06-14 08:51:08 +01:00
Paul Elliott
436f2ad37c
Three round solution
...
Attempt to fix failing test by dealing with overflow with three rounds,
instead of previous subtract modulus solution. Also optimise out shifts
by using memcpy / memmove instead. Remove final sub to return canonical
result, as this is not required here.
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2023-06-13 17:39:44 +01:00
Przemek Stekiel
7d42c0d0e5
Code cleanup #2
...
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
2023-06-13 12:30:40 +02:00
Andrzej Kurek
a6033ac431
Add missing guards in tls 1.3
...
Error translation is only used with these
defines on.
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2023-06-13 05:46:47 -04:00
Andrzej Kurek
1e4a030b00
Fix wrong array size calculation in error translation code
...
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2023-06-13 05:46:47 -04:00
Andrzej Kurek
b22b9778c7
Move the ARRAY_LENGTH definition to common.h
...
Reuse it in the library and tests.
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2023-06-13 05:46:47 -04:00
Andrzej Kurek
1c7a99856f
Add missing ifdefs
...
Make sure that the error translating functions
are only defined when they're used.
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2023-06-13 05:46:47 -04:00
Andrzej Kurek
0064484a70
Optimize error translation code size
...
Introducing an intermediate function
saves code size that's otherwise taken by excessive,
repeated arguments in each place that
was translating errors.
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2023-06-13 05:46:46 -04:00
Dave Rodgman
c216d94560
Merge remote-tracking branch 'origin/development' into safer-ct5
2023-06-13 10:36:37 +01:00
Przemek Stekiel
75a5a9c205
Code cleanup
...
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
2023-06-13 09:57:23 +02:00
Dave Rodgman
f27727b22e
Docs update
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-12 18:33:20 +01:00
Dave Rodgman
1ab0b48ac3
Code style
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-12 18:22:18 +01:00
Dave Rodgman
58c80f4d92
Make mbedtls_ct_zero non-static
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-12 18:19:46 +01:00
Manuel Pégourié-Gonnard
14f65a47c8
Merge pull request #7714 from daverodgman/sha3-update
...
SHA-3 update
2023-06-12 15:13:30 +02:00
Dave Rodgman
5c394ff203
Use a single fast-path in mbedtls_xor, gains around 1% in benchmarks
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-09 20:10:36 +01:00
Dave Rodgman
159dc099fd
Code style
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-09 19:46:07 +01:00
Dave Rodgman
360e04f379
Fix AES-XTS perf regression
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-09 17:23:15 +01:00
Sergey
b57b048ea7
Fix error: comparison of integers of different signs: 'SOCKET' and 'int'
...
Signed-off-by: Sergey <sergio_nsk@yahoo.de>
2023-06-09 09:18:46 -07:00
Glenn Strauss
06c31fcd9f
x509_parse_time() perf
...
Signed-off-by: Glenn Strauss <gstrauss@gluelogic.com>
2023-06-09 17:02:35 +01:00
Glenn Strauss
4b2a6e8df3
Reuse time when verifying certificate chain
...
Replace mbedtls_x509_time_is_past(), mbedtls_x509_time_is_future()
Signed-off-by: Glenn Strauss <gstrauss@gluelogic.com>
2023-06-09 17:01:03 +01:00
Glenn Strauss
811eeb21d8
mbedtls_x509_time_gmtime() read struct directly
...
Signed-off-by: Glenn Strauss <gstrauss@gluelogic.com>
2023-06-09 17:01:03 +01:00
Glenn Strauss
61d99304da
mbedtls_x509_time_gmtime() to fill struct w/ time
...
Signed-off-by: Glenn Strauss <gstrauss@gluelogic.com>
2023-06-09 17:01:03 +01:00
Glenn Strauss
5aef2971e6
mbedtls_x509_time_cmp() perf
...
faster comparison of mbedtls_x509_time values with valid ranges per elt
Signed-off-by: Glenn Strauss <gstrauss@gluelogic.com>
2023-06-09 17:01:03 +01:00
Glenn Strauss
416dc03467
mbedtls_x509_time_cmp() compare mbedtls_x509_time
...
Signed-off-by: Glenn Strauss <gstrauss@gluelogic.com>
2023-06-09 17:01:03 +01:00
Dave Rodgman
f32176c0e3
Remove unnecessary cast
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-09 16:25:49 +01:00
Tom Cosgrove
ef2aa0ecad
Fix "unterminated '#pragma clang attribute push'" in sha256/sha512.c
...
If we're built with MBEDTLS_SHAxxx_USE_A64_CRYPTO_IF_PRESENT but don't have a
way to detect the crypto extensions required, the code turns off _IF_PRESENT
and falls back to C only (with a warning). This was done after the attributes
are pushed, and the pop is done only #if defined(xxx_IF_PRESENT), so this
commit fixes that.
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
2023-06-09 11:29:50 +01:00
Dave Rodgman
2894d007d3
Strengthen fall-back for mbedtls_ct_compiler_opaque
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-08 18:07:39 +01:00
Dave Rodgman
6d4933e54d
Replace use of MBEDTLS_SHA3_C with MBEDTLS_MD_CAN_SHA3_xxx
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-08 16:03:54 +01:00
Kusumit Ghoderao
d9ec1afd13
Fix failing Ci
...
Signed-off-by: Kusumit Ghoderao <Kusumit.Ghoderao@silabs.com>
2023-06-08 20:19:51 +05:30
Gilles Peskine
e5e8ba654e
Merge pull request #7666 from mprse/ip_info
...
OPC UA: parsing IP's in SubjectAltNames & printing info
2023-06-08 15:23:21 +02:00
Gilles Peskine
95b43a04a9
Merge pull request #7651 from daverodgman/fix-armclang-compile-fail
...
Fix armclang compile fail
2023-06-08 14:36:18 +02:00
Kusumit Ghoderao
109ee3de36
Use size of buffer for mac_size
...
Signed-off-by: Kusumit Ghoderao <Kusumit.Ghoderao@silabs.com>
2023-06-08 16:36:45 +05:30
Kusumit Ghoderao
b821a5fd67
Use multipart mac operation for adding salt and counter
...
Signed-off-by: Kusumit Ghoderao <Kusumit.Ghoderao@silabs.com>
2023-06-08 16:35:55 +05:30
Manuel Pégourié-Gonnard
001cbc98bc
Make MD<->PSA translation static inline
...
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2023-06-08 12:10:03 +02:00
Manuel Pégourié-Gonnard
44176b00ad
Remove guarantee about converting NONE
...
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2023-06-08 12:10:02 +02:00
Manuel Pégourié-Gonnard
1f6d2e352d
Simplify implementation of MD<->PSA translation
...
Also, add tests and comments due from previous commits.
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2023-06-08 12:09:20 +02:00
Xiaokang Qian
fcdd0477b3
Replace loop zeroise with memset
...
Signed-off-by: Xiaokang Qian <xiaokang.qian@arm.com>
2023-06-08 10:03:53 +00:00
Manuel Pégourié-Gonnard
47bb380f6d
Fix missing call to mbedtls_ssl_md_alg_from_hash()
...
I looked around and think this one the only place where a conversion was
missing.
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2023-06-08 11:50:49 +02:00
Janos Follath
035e5fc885
Add comments to 448 optimised reduction
...
Signed-off-by: Janos Follath <janos.follath@arm.com>
2023-06-08 09:44:30 +00:00
Dave Rodgman
ff45d44c02
Replace MBEDTLS_MD_CAN_SHA3 with MBEDTLS_MD_CAN_SHA3_xxx
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-08 10:11:34 +01:00
Manuel Pégourié-Gonnard
eb5920421c
Fix error status for PSA RSA-OAEP unknown hash
...
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2023-06-08 10:53:55 +02:00
Manuel Pégourié-Gonnard
70aa2a110e
Change contract of MD<->PSA conversion
...
This is preparation work for simplifying the implementation of those
functions. Done first in order to get the CI's opinion on it.
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2023-06-08 10:53:54 +02:00
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
b61cd1042a
Correct minor merge mistakes
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-07 18:14:45 +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
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
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
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
Dave Rodgman
2070c2074e
Avoid possible NEON alignment issue
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-07 16:38:26 +01:00
Dave Rodgman
9d1635e742
Revert not-useful changes to AES-CBC decrypt
...
Signed-off-by: Dave Rodgman <dave.rodgman@gmail.com>
2023-06-07 16:38:26 +01:00
Dave Rodgman
f1e396c427
improve cbc encrypt perf
...
Signed-off-by: Dave Rodgman <dave.rodgman@gmail.com>
2023-06-07 16:38:26 +01:00
Dave Rodgman
3f47b3f7a3
Extend NEON use to 32-bit Arm
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-07 16:38:26 +01:00
Andrzej Kurek
c40a1b552c
Remove references to x509_invasive.h
...
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2023-06-07 08:54:34 -04:00
Andrzej Kurek
cd17ecfe85
Use better IP parsing in x509 programs
...
Remove unnecessary duplicated code.
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2023-06-07 08:50:05 -04: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
Przemek Stekiel
ff9fcbcace
ssl_client2, ssl_server2: code optimization + guards adaptation
...
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
2023-06-06 12:53:40 +02:00
Przemek Stekiel
a4700fa69d
mbedtls_psa_ffdh_export_public_key: allow bigger output buffer
...
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
2023-06-06 12:31:09 +02:00
Przemek Stekiel
da4fba64b8
Further code optimizations
...
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
2023-06-06 12:31:09 +02:00
Przemek Stekiel
152bb4632b
Adapt function names
...
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
2023-06-06 12:31:09 +02:00
Przemek Stekiel
29c219c285
Combine mbedtls_ssl_tls13_generate_and_write_ecdh/ffdh_key_exchange functions
...
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
2023-06-06 12:31:09 +02:00
Przemek Stekiel
316c19ef93
Adapt guards, dependencies + optimizations
...
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
2023-06-06 12:31:09 +02:00
Przemek Stekiel
e7db09bede
Move FFDH helper functions and macros to more suitable locations
...
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
2023-06-06 12:31:08 +02:00
Przemek Stekiel
63706628d0
Adapt guards for FFDH
...
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
2023-06-06 12:31:08 +02:00
Przemek Stekiel
947ff56c45
Replace deprecated functions
...
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
2023-06-06 12:31:08 +02:00
Przemek Stekiel
24e50d3dbd
Compile out length check to silent the compiler warning
...
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
2023-06-06 12:31:08 +02:00
Przemek Stekiel
c89f3ea9f2
Add support for FFDH in TLS 1.3
...
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
2023-06-06 12:31:08 +02:00
Przemek Stekiel
cceb933e30
Add FFDH definitions and translation functions
...
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
2023-06-06 12:31:07 +02:00
Przemek Stekiel
060012c5fd
ssl_write_supported_groups_ext(): add support for ffdh keys
...
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
2023-06-06 12:31:07 +02:00
Przemek Stekiel
383f471bf4
Add the DHE groups to the default list of supported groups
...
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
2023-06-06 12:31:07 +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
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
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
Kusumit Ghoderao
f6a0d57e4d
Add pbkdf2 function to key_derivation_output_bytes
...
Signed-off-by: Kusumit Ghoderao <Kusumit.Ghoderao@silabs.com>
2023-06-06 15:05:41 +05:30
Kusumit Ghoderao
a4346cdc50
Add pbkdf2_generate_block function
...
Signed-off-by: Kusumit Ghoderao <Kusumit.Ghoderao@silabs.com>
2023-06-06 15:05:39 +05:30
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
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
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
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
Gilles Peskine
5c3d6e277c
Merge pull request #7575 from AndrzejKurek/URI-SAN-verification
...
Add partial support for URI SubjectAltNames verification
2023-06-05 16:46:47 +02:00
Gilles Peskine
b21f32eba6
Merge pull request #6257 from Laserdance100/development
...
Change macros in mps_common.h
2023-06-05 15:51:59 +02:00
Gilles Peskine
b47fb4cdd8
Merge pull request #7676 from valeriosetti/issue7485
...
PK: add support for check_pair() with "opaque" EC keys
2023-06-05 15:51:03 +02:00
Gilles Peskine
763c19afcb
Merge pull request #7639 from Taowyoo/yx/fix-time-tls13-client-server
...
Fix: correct calling to time function in tls13 client&server
2023-06-05 15:50:32 +02:00
Gilles Peskine
975d9c0faf
Merge pull request #7530 from AndrzejKurek/misc-subjectaltname-fixes
...
Miscellaneous fixes for SubjectAltName code / docs
2023-06-05 15:38:53 +02:00
Gilles Peskine
84b547b5ee
Merge pull request #7400 from AndrzejKurek/cert-write-sans
...
Add a possibility to generate certificates with a Subject Alternative Name
2023-06-05 15:38:38 +02:00
Valerio Setti
ede0c4676e
pk_internal: minor rearrangement in mbedtls_pk_get_group_id()
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-06-05 11:08:28 +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
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
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
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
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
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
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
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
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
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