Janos Follath
aadbadbf42
mpi_exp_mod: move X next to the precomputed values
...
With small exponents (for example, when doing RSA-1024 with CRT, each
prime is 512 bits and we'll use wsize = 5 which may be smaller that the
maximum - or even worse when doing public RSA operations which typically
have a 16-bit exponent so we'll use wsize = 1) the usage of W will have
pre-computed values, then empty space, then the accumulator at the very
end.
Move X next to the precomputed values to make accesses more efficient
and intuitive.
Signed-off-by: Janos Follath <janos.follath@arm.com>
2022-11-21 14:55:05 +00:00
Janos Follath
6632383993
mpi_exp_mod: rename local variables
...
Signed-off-by: Janos Follath <janos.follath@arm.com>
2022-11-21 14:48:02 +00:00
Janos Follath
f0ceb1cae1
mpi_exp_mod: remove memory ownership confusion
...
Elements of W didn't all have the same owner: all were owned by this
function, except W[x_index]. It is more robust if we make a proper copy
of X.
Signed-off-by: Janos Follath <janos.follath@arm.com>
2022-11-21 14:31:22 +00:00
Janos Follath
3a3c50ca0a
mpi_exp_mod: improve documentation
...
Signed-off-by: Janos Follath <janos.follath@arm.com>
2022-11-11 15:56:38 +00:00
Janos Follath
9e4ea3a8a8
Add ChangeLog entry
...
Signed-off-by: Janos Follath <janos.follath@arm.com>
2022-11-08 09:09:14 +00:00
Janos Follath
95655a2ba0
mpi_exp_mod: protect out of window zeroes
...
Out of window zeroes were doing squaring on the output variable
directly. This leaks the position of windows and the out of window
zeroes.
Loading the output variable from the table in constant time removes this
leakage.
Signed-off-by: Janos Follath <janos.follath@arm.com>
2022-11-08 09:09:14 +00:00
Janos Follath
91c0286917
mpi_exp_mod: load the output variable to the table
...
This is done in preparation for constant time loading that will be added
in a later commit.
Signed-off-by: Janos Follath <janos.follath@arm.com>
2022-11-08 09:09:14 +00:00
Gilles Peskine
c4698502d6
Merge pull request #6491 from davidhorstmann-arm/2.28-fix-unusual-macros-0
...
[Backport-ish 2.28] Fix unusual macros
2022-11-03 10:29:06 +01:00
Dave Rodgman
e9e0eeccec
Merge pull request #6525 from daverodgman/fix-duplicate-header-2.28
...
Remove duplicate function prototype - 2.28 backport
2022-11-02 13:06:04 +00:00
Dave Rodgman
e43caca4ab
Merge pull request #6527 from daverodgman/update_pr_template-2.28
...
Update pr template - 2.28 backport
2022-11-02 13:05:03 +00:00
Dave Rodgman
a4f10bec28
Merge pull request #6526 from daverodgman/psalinks-2.28
...
Update PSA links in README.md - 2.28 backport
2022-11-02 10:02:03 +00:00
Dave Rodgman
490f804555
Improve documentation for psa_crypto_cipher.h
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2022-11-02 09:29:35 +00:00
Dave Rodgman
8e322b1e99
Move declaration of mbedtls_cipher_info_from_psa into psa_crypto_cipher.h
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2022-11-02 09:27:01 +00:00
Dave Rodgman
d39cf1e07c
Align CONTRIBUTING.md with development
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2022-11-01 20:58:30 +00:00
Dave Rodgman
bc1e670fb7
Improve list formatting
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2022-11-01 20:56:49 +00:00
Dave Rodgman
9a1c38a3c1
Reinstate note about all PRs receiving review
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2022-11-01 20:56:45 +00:00
Dave Rodgman
53b65f65ff
Update CONTRIBUTING.md, and refer to this from the template
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2022-11-01 20:55:32 +00:00
Dave Rodgman
f1d74acb18
Update PR template
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2022-11-01 20:55:20 +00:00
Dave Rodgman
35e2b2b2bd
Merge pull request #6523 from daverodgman/fix_ssl_zeroize-2.28
...
Fix zeroization at NULL pointer - 2.28 backport
2022-11-01 20:50:33 +00:00
Dave Rodgman
428ef795e6
Update PSA links in README.md
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2022-11-01 20:43:24 +00:00
Dave Rodgman
e222637cfe
Remove duplicate function prototype
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2022-11-01 16:41:48 +00:00
Dave Rodgman
febe14e6e0
Add Changelog
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2022-11-01 16:28:20 +00:00
Dave Rodgman
369f495afc
Fix zeroization at NULL pointer
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2022-11-01 16:11:47 +00:00
Dave Rodgman
a1ea28fc40
Merge pull request #6513 from daverodgman/allsh-redundancies-2.28
...
All.sh redundancies 2.28
2022-10-31 15:03:48 +00:00
Gilles Peskine
83264bed63
Group cpp_dummy_build test into an existing component
...
No need to do yet another build just to compile an additional trivial program.
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2022-10-31 11:45:17 +00:00
Gilles Peskine
e86cdcb7bf
Remove redundant build-only driver interface component
...
component_build_psa_accel_alg_ecdsa is subsumed by
component_test_psa_crypto_config_accel_ecdsa, which has the same
configuration and additionally runs the unit tests.
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2022-10-31 11:41:47 +00:00
Dave Rodgman
0bbe75838e
Merge pull request #6191 from daverodgman/invalid-ecdsa-pubkey-backport-2.28
...
Improve ECDSA verify validation - 2.28 backport
2022-10-31 09:37:38 +00:00
Dave Rodgman
6d61d83f29
Build fix - remove line of dead code
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2022-10-28 09:23:09 +01:00
Dave Rodgman
23b79b6c9c
Credit Cryptofuzz in the changelog
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2022-10-27 20:36:47 +01:00
Dave Rodgman
a66e7edf09
Improve changelog for ECDSA verify fix
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2022-10-27 20:34:59 +01:00
Dave Rodgman
584200cf4e
Update tests/suites/test_suite_ecdsa.function
...
Co-authored-by: Gilles Peskine <gilles.peskine@arm.com>
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2022-10-27 20:34:56 +01:00
Gilles Peskine
e0917c0346
Merge pull request #6492 from daverodgman/ecp_mul_mxz-timing-leak-2.28
...
Fix a timing leak in ecp_mul_mxz() - 2.28 backport
2022-10-27 19:46:44 +02:00
David Horstmann
b5b1ed2969
Fix unused warning in ssl_tls.c
...
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2022-10-27 13:21:49 +01:00
Aurelien Jarno
edc110d15a
Fix a timing leak in ecp_mul_mxz()
...
The bit length of m is leaked through through timing in ecp_mul_mxz().
Initially found by Manuel Pégourié-Gonnard on ecp_mul_edxyz(), which has
been inspired from ecp_mul_mxz(), during initial review of the EdDSA PR.
See: https://github.com/Mbed-TLS/mbedtls/pull/3245#discussion_r490827996
Fix that by using grp->nbits + 1 instead, which anyway is very close to
the length of m, which means there is no significant performance impact.
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2022-10-27 11:58:15 +01:00
David Horstmann
ab6175130b
Fix macro-spanning if in x509_crt.c
...
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2022-10-27 11:45:01 +01:00
David Horstmann
04020abfae
Fix macro-spanning ifs in ssl_ticket.c
...
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2022-10-27 11:39:03 +01:00
David Horstmann
d4f22083ba
Fix macro-spanning ifs in ssl_tls.c
...
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2022-10-27 11:39:03 +01:00
David Horstmann
197b240089
Fix macro-spanning if in ssl_msg.c
...
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2022-10-27 11:39:03 +01:00
David Horstmann
ef661c531f
Fix macro-spanning ifs in ecp.c
...
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2022-10-27 11:38:53 +01:00
David Horstmann
74ace59dc6
Fix macro-spanning ifs in ssl_srv.c
...
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2022-10-27 11:38:15 +01:00
Gilles Peskine
d654171087
Merge pull request #6477 from AndrzejKurek/fix-cipher-deps-2-28
...
[Backport 2.28] Fix PSA dependencies in test_suite_cipher.[aes|gcm|ccm]
2022-10-26 18:31:39 +02:00
Ronald Cron
2e0a11556e
Merge pull request #6483 from gilles-peskine-arm/psa-pkparse-pkwrite-2.28
...
Backport 2.28: PSA with RSA requires PK_WRITE and PK_PARSE
2022-10-26 14:57:41 +02:00
Ronald Cron
c527796ecb
Merge pull request #6392 from davidhorstmann-arm/2.28-fix-x509-get-name-cleanup
...
[Backport 2.28] Fix `mbedtls_x509_get_name()` cleanup
2022-10-26 14:28:04 +02:00
Gilles Peskine
031c8c2815
Add build with a typical configuration for a PSA crypto service
...
Disable non-crypto features that can't be called through the PSA API, as
well as algorithms that have no PSA interface.
This serves as a non-regression test for #6408 and #6409 .
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2022-10-25 21:09:49 +02:00
Gilles Peskine
c037ba9c3e
Add some missing dependencies on PKCS12 for encrypted keys
...
This is a PKCS#8 test case using a PKCS#12 algorithm.
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2022-10-25 21:08:39 +02:00
Gilles Peskine
8df2748432
Improve test component name
...
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2022-10-25 20:32:35 +02:00
Gilles Peskine
21503df752
Add build with a typical configuration for a PSA crypto service
...
Disable non-crypto features that can't be called through the PSA API, as
well as algorithms that have no PSA interface.
This serves as a non-regression test for #6408 and #6409 .
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2022-10-25 20:32:20 +02:00
Gilles Peskine
8fb928f642
Fix PSA+RSA dependencies on PK
...
The PSA code needs pk_parse as well as pk_write for RSA keys. Fix #6409 .
This is independent of PKCS#1v1.5 support. Fix #6408 .
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2022-10-25 20:32:02 +02:00
Gilles Peskine
bfcf2d129d
test_suite_pk: Add missing dependencies on MBEDTLS_PEM_PARSE_C
...
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2022-10-25 20:08:38 +02:00
Gilles Peskine
8f3577a53d
test_suite_dhm: Add missing dependencies on MBEDTLS_PEM_PARSE_C
...
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2022-10-25 20:08:29 +02:00