17040 Commits

Author SHA1 Message Date
Andrzej Kurek
a39170bbed Add a changelog entry for the cookie parsing bounds bug
Co-authored-by: Gilles Peskine <Gilles.Peskine@arm.com>
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2022-06-17 07:36:50 -04:00
Andrzej Kurek
862acb8403 Add cookie parsing tests to test_suite_ssl
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2022-06-17 07:36:42 -04:00
Andrzej Kurek
e5af9fabf7 Add missing sid_len in calculations of cookie sizes
This could lead to a potential buffer overread with small
MBEDTLS_SSL_IN_CONTENT_LEN.
Change the bound calculations so that it is apparent
what lengths and sizes are used.

Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2022-06-17 07:36:35 -04:00
Gilles Peskine
f333dfab4a More SSL debug messages for ClientHello parsing
In particular, be verbose when checking the ClientHello cookie in a possible
DTLS reconnection.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2022-06-17 07:36:26 -04:00
Werner Lewis
02c9d3b9c2 Fix parsing of special chars in X509 DN values
Use escape mechanism defined in RFC 1779 when parsing commas and other
special characters in X509 DN values. Resolves failures when generating
a certificate with a CSR containing a comma in subject value.
Fixes #769.

Signed-off-by: Werner Lewis <werner.lewis@arm.com>
2022-06-08 14:38:38 +01:00
Paul Elliott
7e163d796c
Merge pull request #5893 from AndrzejKurek/ssl-opt-client-kill-fix-2.28
[Backport 2.28] Fix a bug with executing ssl-client2 in ssl-opt.sh in a subshell
2022-06-08 14:26:42 +01:00
Dave Rodgman
ce02537b0c
Merge pull request #5828 from wernerlewis/time_utc_2.28
[Backport 2.28] Use ASN1 UTC tags for dates before 2000
2022-06-08 13:55:38 +01:00
Andrzej Kurek
d27cdcc16f Fix a bug with executing ssl-client2 in ssl-opt.sh in a subshell
When executing eval in the background, the next "$!" gives the
eval PID, not the ssl-client2 pid. This causes problems when
a client times out and the script tries to kill it. Instead, it
kills the parent eval call.
This caused problems with subsequent proxy tests receiving
old packets from a client from a previous test.
Moving the "&" to inside the eval call fixes the problem.
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2022-06-06 15:12:55 -04:00
Werner Lewis
1b54a05f77 Use ASN1 UTC tags for dates before 2000
Signed-off-by: Werner Lewis <werner.lewis@arm.com>
2022-06-01 16:28:10 +01:00
Gilles Peskine
7bda291427
Merge pull request #5859 from paul-elliott-arm/fix_ct_uninit_memory_access_2.28
Backport 2.28: Fix uninitialised memory access in constant time functions
2022-06-01 11:42:47 +02:00
Gilles Peskine
adf225dfd6
Merge pull request #5848 from tom-daubney-arm/2-28_x25519_program
[2.28] Rewrite x25519 example program
2022-05-31 11:26:27 +02:00
Thomas Daubney
c227ea5942 Adds Changelog entry
Adds change log entry.

Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
2022-05-30 14:12:24 +01:00
Thomas Daubney
d99f8b2897 Rewrite x25519 example program
Rewrite x25519 example program to fix fatal bug and show
current best practices with the ECDH API.

Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
2022-05-30 14:09:02 +01:00
Dave Rodgman
5bc9a26e31
Merge pull request #5877 from tom-cosgrove-arm/fix-typos-220526-2.28
Backport 2.28: Fix spelling and typographical errors found by cspell
2022-05-30 11:35:59 +01:00
Janos Follath
b16280cef5
Merge pull request #5885 from Summer-ARM/mbedtls-2.28
Backport 2.28: Remove duplicated PSA_WANT_ALG_CMAC in crypto_config.h
2022-05-30 09:41:34 +01:00
Summer Qin
fd8aa65d3d Remove duplicated PSA_WANT_ALG_CMAC in crypto_config.h
Signed-off-by: Summer Qin <summer.qin@arm.com>
2022-05-30 10:43:53 +08:00
Tom Cosgrove
2b1507574c Fix spelling and typographical errors found by cspell
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
2022-05-26 11:55:43 +01:00
Paul Elliott
b830028314 Fix uninitialised memory access in constant time functions
Fix an issue reported by Coverity whereby some constant time functions
called from the ssl decrypt code could potentially access uninitialised
memory.

Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2022-05-19 18:31:35 +01:00
Dave Rodgman
bdd6905a5c
Merge pull request #5850 from bootstrap-prime/mbedtls-2.28
Fix typos in documentation and constants with typo finding tool
2022-05-19 16:53:37 +01:00
Paul Elliott
d03d6d4ca0
Merge pull request #5849 from gilles-peskine-arm/psa-raw_key_agreement-buffer_too_small-2.28
Backport 2.28: Make psa_raw_key_agreement return BUFFER_TOO_SMALL
2022-05-19 16:05:27 +01:00
bootstrap-prime
7ef96ea856
Fix typos in documentation and constants with typo finding tool
Signed-off-by: bootstrap-prime <bootstrap.prime@gmail.com>
2022-05-18 14:08:33 -04:00
Gilles Peskine
3afb7c33d5 Update PSA compliance test branch
Update to a branch with a fix for the test case
"expected error for psa_raw_key_agreement - Small buffer size"
since we just fixed the corresponding bug.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2022-05-18 16:25:39 +02:00
Gilles Peskine
42313fbfcc psa_raw_key_agreement: return BUFFER_TOO_SMALL when warranted
psa_raw_key_agreement() returned PSA_ERROR_INVALID_ARGUMENT instead of
PSA_ERROR_BUFFER_TOO_SMALL when the output buffer was too small for ECDH,
the only algorithm that is currently implemented. Make it return the correct
error code.

The reason for the wrong error code is that ecdh.c returns
MBEDTLS_ERR_ECP_BAD_INPUT_DATA, presumably for similarith with dhm.c. It
might make sense to change ecdh.c to use MBEDTLS_ERR_ECP_BUFFER_TOO_SMALL,
but dhm.c doesn't have an existing BUFFER_TOO_SMALL error. To minimize the
impact of the fix, handle this in the PSA layer.

Fixes #5735.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2022-05-17 16:29:55 +02:00
Gilles Peskine
47cfdfd452 Use TEST_LE_U in some places where it applies
Systematically replace "TEST_ASSERT( $x <= $y )" by "TEST_LE_U( $x, $y )" in
test_suite_psa_crypto. In this file, all occurrences of this pattern are
size_t so unsigned.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2022-05-17 16:29:50 +02:00
Gilles Peskine
063700d612 New test helper macros TEST_LE_U, TEST_LE_S
Test assertions for integer comparisons that display the compared values on
failure. Similar to TEST_EQUAL.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2022-05-17 16:26:29 +02:00
Gilles Peskine
d0d777e6bc Separate the validation of the size macros and of the function
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2022-05-17 16:26:29 +02:00
Gilles Peskine
d48874f657 Improve PSA_RAW_KEY_AGREEMENT_OUTPUT_SIZE validation
We want to check:
1. actual output <= PSA_RAW_KEY_AGREEMENT_OUTPUT_SIZE (the output fits
   if the caller uses the key-specific buffer size macro)
2. actual output <= PSA_RAW_KEY_AGREEMENT_OUTPUT_MAX_SIZE (the output fits
   if the caller uses the generic buffer size macro)
3. PSA_RAW_KEY_AGREEMENT_OUTPUT_SIZE <= PSA_RAW_KEY_AGREEMENT_OUTPUT_MAX_SIZE
   (consistency in the calculation)

We were only testing (1) and (2). Test (3) as well. (1) and (3) together
imply (2) so there's no need to test (2).

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2022-05-17 16:26:29 +02:00
Gilles Peskine
7d1502939a Test psa_raw_key_agreement with a larger/smaller buffer
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2022-05-17 16:26:29 +02:00
Manuel Pégourié-Gonnard
529bf9d95d
Merge pull request #5619 from mprse/backport_sig_ver_tests
Backport RSA signature/verification tests
2022-05-12 12:13:02 +02:00
Dave Rodgman
a0026604a2
Merge pull request #5733 from daverodgman/warmsocks_spellingfixes_2.28
Backport 2.28: Fixed spelling and typographical errors found by CodeSpell
2022-05-12 09:26:43 +01:00
Pol Henarejos
c46a2f6c61
Remove spaces.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2022-05-09 11:03:26 +02:00
Pol Henarejos
679d1a085a
Added fix for x448 bug to changelog.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2022-05-09 10:14:48 +02:00
Pol Henarejos
a93442e884
Fix for order value for curve448.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
2022-05-09 10:08:46 +02:00
Paul Elliott
bd7e048844
Merge pull request #5816 from paul-elliott-arm/travis_project_2.28
Backport 2.28: Revert Coverity project name change in Travis
2022-05-06 19:11:01 +01:00
Paul Elliott
211c69dab8 Revert Coverity project name change
Although Coverity have now changed their URL to point at the new
project, they did not change the project name, it would seem.

Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2022-05-06 14:10:42 +01:00
Paul Elliott
9c4f159f75
Merge pull request #5805 from paul-elliott-arm/travis_coverity_fix_2.28
Backport 2.28: Rotate coverity secret token in travis
2022-05-05 18:10:52 +01:00
Paul Elliott
9a0c8ed030
Merge pull request #5802 from wernerlewis/asn1_memcpy_null_2.28
[Backport 2.28] Fix memcpy() UB in mbedtls_asn1_named_data()
2022-05-04 23:20:34 +01:00
Werner Lewis
6342debc72 Add ChangeLog entry
Signed-off-by: Werner Lewis <werner.lewis@arm.com>
2022-05-04 16:27:54 +01:00
Paul Elliott
08f803f9e9 Change coverity secret token in travis
Travis stopped being able to push builds to coverity due to the token
apparently being no longer valid. Rotating the token to see if that
fixes things.

Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2022-05-04 14:19:44 +01:00
Werner Lewis
12ddae870c Fix memcpy() UB in mbedtls_asn1_named_data()
Removes a case in mbedtls_asn1_named_data() where memcpy() could be
called with a null pointer and zero length. A test case is added for
this code path, to catch the undefined behavior when running tests with
UBSan.

Signed-off-by: Werner Lewis <werner.lewis@arm.com>
2022-05-04 12:23:26 +01:00
Dave Rodgman
beb5ad7751 Minor spelling / grammar improvements
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2022-04-28 18:23:12 +01:00
Andrzej Kurek
293e452e83 Fix additional misspellings found by codespell
Remaining hits seem to be hex data, certificates,
and other miscellaneous exceptions.
List generated by running codespell -w -L
keypair,Keypair,KeyPair,keyPair,ciph,nd

Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2022-04-28 18:22:24 +01:00
Dave Rodgman
6caaa1c927 Revert spelling fixes to ChangeLog
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2022-04-28 18:22:23 +01:00
Shaun Case
0e7791ff07 Redo of PR#5345. Fixed spelling and typographical errors found by CodeSpell.
Signed-off-by: Shaun Case <warmsocks@gmail.com>
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2022-04-28 18:22:20 +01:00
Gilles Peskine
585a412129
Merge pull request #5760 from tom-daubney-arm/2-28_correct_x509_flag_parse_tests
[Backport 2.28] Set flag to proper value in x509 parse tests
2022-04-28 18:27:41 +02:00
Gilles Peskine
9aa892b833
Merge pull request #5754 from gilles-peskine-arm/psa-storage-format-test-exercise-2.28
Backport 2.28: PSA storage format: exercise key
2022-04-28 18:20:09 +02:00
Gilles Peskine
f87d84361c
Merge pull request #5740 from gilles-peskine-arm/psa-crypto-config-file-2.28
Backport 2.28: Support alternative MBEDTLS_PSA_CRYPTO_CONFIG_FILE
2022-04-28 18:17:45 +02:00
Gilles Peskine
4d6070ca6d
Merge pull request #5778 from mpg/doc-allowed-pks-2.28
[Backport 2.28] Fix documentation of allowed_pks field in mbedtls_x509_crt_profile
2022-04-28 18:13:52 +02:00
Gilles Peskine
238f976ad1 Note that MBEDTLS_CONFIG_FILE can't be defined inside the config file
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2022-04-26 18:13:01 +02:00
Gilles Peskine
8290976801 Fix references to mbedtls_config.h
These were a mistake when backporting the change from the development
branch, where mbedtls/config.h has been renamed to mbedtls/mbedtls_config.h.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2022-04-26 18:10:11 +02:00