Commit graph

11713 commits

Author SHA1 Message Date
Yanray Wang
45ad306fbf pkwrite.c: save stack usage for pk_write_pubkey_pem
mbedtls_pk_write_pubkey_pem would allocate 2086 bytes in writing a DER
encoded RSA public key. To save stack usage significantly, we use
heap memory instead.

Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-08-11 16:30:29 +08:00
Manuel Pégourié-Gonnard
54da1a69a2
Merge pull request #7578 from daverodgman/safer-ct5
Improve constant-time interface
2023-08-10 16:57:39 +00:00
Dave Rodgman
48fb8a3448 Fix some renames that were missed
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-08-10 14:01:51 +01:00
Dave Rodgman
b364a22adf
Fix mbedtls_ct_size_if_else_0 docs
Co-authored-by: Tom Cosgrove <tom.cosgrove@arm.com>
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-08-10 12:25:25 +01:00
Dave Rodgman
38b227c16b Improve docs
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-08-10 12:18:27 +01:00
Dave Rodgman
ac69b45486 Document and test mbedtls_ct_size_if_else_0
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-08-10 12:18:13 +01:00
Dave Rodgman
065f912465 Fix comment typo
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-08-10 12:11:58 +01:00
Dave Rodgman
98ddc01a7c Rename ...if0 to ...else_0
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-08-10 12:11:31 +01:00
Dave Rodgman
b7825ceb3e Rename uint->bool operators to reflect input types
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-08-10 11:58:18 +01:00
Manuel Pégourié-Gonnard
6beec7ca5e
Merge pull request #7989 from valeriosetti/issue7754
driver-only ECC: BN.PK testing
2023-08-10 09:43:56 +00:00
Manuel Pégourié-Gonnard
d170419eab
Merge pull request #7999 from valeriosetti/issue7759
Driver-only ECC: TLS: rm uses of mbedtls_debug_print_mpi
2023-08-10 08:34:57 +00:00
Manuel Pégourié-Gonnard
91c8372c01
Merge pull request #6999 from ivq/ecp_doc
Doc: Add note on special use of A in ecp group structure
2023-08-10 08:24:05 +00:00
Dave Rodgman
e5fbd93eaf
Merge pull request #8049 from daverodgman/bignum_codesize_misc
Bignum codesize misc
2023-08-10 10:58:13 +01:00
Valerio Setti
e1d7c9dabd pkwrite: fix internal buffer size in pk_write_ec_pubkey()
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-08-10 07:40:18 +02:00
Valerio Setti
a7c9e09dd0 pkwrite: add new internal symbol to properly size DER buffer
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-08-10 06:43:23 +02:00
Valerio Setti
97b28f81d8 pkparse: remove unnecessary header
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-08-10 06:43:23 +02:00
Manuel Pégourié-Gonnard
7dccb66d49 test: disable RSA support on the test ecc_no_bignum component
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-08-10 06:43:23 +02:00
Valerio Setti
ca4c15dd25 debug: remove redundant variable assignments
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-08-10 06:41:31 +02:00
Dave Rodgman
960eca997d code style
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-08-09 20:43:18 +01:00
Dave Rodgman
4883f109a0 Reduce code size for exp_mod_get_window_size
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-08-09 20:42:54 +01:00
Dave Rodgman
ebcd78561c Remove redundant code in mbedtls_mpi_cmp_abs
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-08-09 18:57:22 +01:00
Dave Rodgman
fa703e38a2 Use __builtin_ctz to count trailing zeros
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-08-09 18:56:07 +01:00
Dave Rodgman
f3df105b37 Generate smaller code for picking a sign value
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-08-09 18:55:41 +01:00
Paul Elliott
2f12a29cdd
Merge pull request #7896 from AgathiyanB/gitignore-generated-files-toggle
Add script to toggle ignoring generated files
2023-08-09 14:54:32 +00:00
Gilles Peskine
444d1e7608
Merge pull request #8036 from tom-cosgrove-arm/fix-rijndael-and-drbg-pdf-links
Update links to Rijndael paper and NIST SP 800-90 DRBGs
2023-08-07 19:15:58 +00:00
Gilles Peskine
a79256472c
Merge pull request #7788 from marekjansta/fix-x509-ec-algorithm-identifier
Fixed x509 certificate generation to conform to RFCs when using ECC key
2023-08-07 19:14:54 +00:00
Chien Wong
153ae464db
Improve doc on special use of A in ecp group structure
Signed-off-by: Chien Wong <m@xv97.com>
2023-08-07 23:02:31 +08:00
Dave Rodgman
c98f8d996a
Merge branch 'development' into safer-ct5
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-08-07 11:47:35 +01:00
Tom Cosgrove
ce37c5e1ce Update links to Rijndael paper and NIST SP 800-90 DRBGs
The link to the DRBG paper points to the March 2007 version, the same as the
original link (rather than the latest version).

The amended Rijndael paper has a two-page "Note on naming" prefix.

Fixes #7193

Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
2023-08-04 13:55:03 +01:00
Janos Follath
73568397a5
Merge pull request #8020 from yanesca/de-duplicate_ecp
De duplicate the ECP module
2023-08-04 08:27:09 +00:00
Dave Rodgman
003a5e1ca7
Merge pull request #1046 from Mbed-TLS/merge_3.4.1
Merge 3.4.1
2023-08-03 18:23:37 +01:00
Dave Rodgman
a0fc9987da Merge branch 'development' into merge_3.4.1
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-08-03 15:56:59 +01:00
Dave Rodgman
6f80ac4979
Merge pull request #7864 from waleed-elmelegy-arm/enforce-min-RSA-key-size
Enforce minimum key size when generating RSA key size
2023-08-03 12:57:52 +00:00
Dave Rodgman
1d4d944e19
Merge pull request #7933 from tom-cosgrove-arm/add-mbedtls_zeroize_and_free
Provide and use internal function mbedtls_zeroize_and_free()
2023-08-03 12:56:21 +00:00
Gilles Peskine
ce64156f6d
Merge pull request #8021 from daverodgman/master-update
Sync development with accidental merge directly onto master
2023-08-02 13:30:35 +00:00
Janos Follath
d8cb3d7fa4 De-duplicate ecp.c
We duplicated ecp.c in the anticipation of heavy refactoring there. This
work has been suspended and the duplication is not useful anymore but
imposes an overhead.

Signed-off-by: Janos Follath <janos.follath@arm.com>
2023-08-02 12:33:01 +01:00
Gilles Peskine
550d147078 Bump version to 3.4.1
```
./scripts/bump_version.sh --version 3.4.1
```

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-08-02 12:50:23 +02:00
Gilles Peskine
267bee9be8
Merge pull request #7903 from valeriosetti/issue7773
Define PSA_WANT_xxx_KEY_PAIR_yyy step 2/DH
2023-08-02 10:16:44 +00:00
Dave Rodgman
7f17bd09cc Merge remote-tracking branch 'origin/master' into master-update 2023-08-02 10:57:07 +01:00
Janos Follath
b388ed737d Fix missing check in mbedtls_ecp_read_key
In ecp_new.c mbedtls_ecp_read_key did only check Weierstrass keys. The
behaviour in ecp.c was correct.

This bug has no immediate security impact. (The code with the missing
check wasn't released and we are checking keys at later point.)

After this change ecp.c and ecp_new.c will have a single remaining
difference and unifying them will be more straightforward.

Signed-off-by: Janos Follath <janos.follath@arm.com>
2023-08-02 10:32:27 +01:00
Janos Follath
c25567af23 Move variant test to ecp_curves
We would like to de-duplicate ecp.c, but ecp_curves.c remains duplicated
and we still want to test for the active variant.

Signed-off-by: Janos Follath <janos.follath@arm.com>
2023-08-02 10:32:21 +01:00
Bence Szépkúti
9661f8ab0d
Merge pull request #7968 from gowthamsk-arm/use_earliest_latest_compilers
Use earliest latest compilers
2023-08-02 05:58:02 +00:00
Dave Rodgman
205295c576 Tidy-up: move GCC warning fix to constant_time_impl.h
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-08-01 14:10:56 +01:00
Gilles Peskine
d55e451b3e
Merge pull request #7997 from yanesca/fix_new_bignum_tests
Fix new bignum tests
2023-08-01 12:09:39 +00:00
Dave Rodgman
1f39f037bf Improve variable name in mbedtls_mpi_lt_mpi_ct
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-08-01 09:19:16 +01:00
Tom Cosgrove
52f7e18042 Use mbedtls_zeroize_and_free() in psa_remove_key_data_from_memory()
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
2023-08-01 09:08:48 +01:00
Manuel Pégourié-Gonnard
de8f56e936
Merge pull request #7884 from valeriosetti/issue7612
TLS: Clean up (EC)DH dependencies
2023-08-01 07:13:36 +00:00
Dave Rodgman
3d574da6fc Revert to not enabling asm under Memsan
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-07-31 17:22:58 +01:00
Dave Rodgman
378280e57f Revert "Move constant_flow.h into the main library"
This reverts commit fd78c34e23.

Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-07-31 17:22:55 +01:00
Dave Rodgman
3d1bb9be06 Revert "Fix doxygen error"
This reverts commit d175d52433.

Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-07-31 17:22:49 +01:00