1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-08-07 06:42:56 +03:00
Commit Graph

18895 Commits

Author SHA1 Message Date
Manuel Pégourié-Gonnard
779cceb1ed SSL programs: group options processing in 1 place
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2023-08-23 20:32:14 +02:00
Gilles Peskine
8d77ec2f7d PSA_CRYPTO_DRIVER_TEST_ALL is incompatible with MBEDTLS_PSA_CRYPTO_CONFIG
Explain how PSA_CRYPTO_DRIVER_TEST_ALL works and why we have it. Note that
it is incompatible with MBEDTLS_PSA_CRYPTO_CONFIG.

MBEDTLS_PSA_CRYPTO_BUILTIN_KEYS is in the full config, so there's no need to
add it explicitly.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-08-23 18:23:20 +02:00
Tomás González
14b36ef54a Make non-executed tests that are not in the allow list an error
* Turn the warnings produced when finding non-executed tests that
   are not in the allow list into errors.

Signed-off-by: Tomás González <tomasagustin.gonzalezorlando@arm.com>
2023-08-23 16:52:44 +01:00
Tomás González
c895733349 Add EdDSA and XTS to the allow list
As specified in
https://github.com/Mbed-TLS/mbedtls/issues/5390#issuecomment-1669585707
EdDSA and XTS tests are legitimately never executed, so add them to
the allow list.

Signed-off-by: Tomás González <tomasagustin.gonzalezorlando@arm.com>
2023-08-23 16:52:44 +01:00
Tomás González
45d49595b7 Add a flag for requiring full coverage in coverage tests
Introduce the --require-full-coverage in analyze_outcomes.py so that
when analyze_outcomes.py --require-full-coverage is called, those
tests that are not executed and are not in the allowed list issue an
error instead of a warning.

Note that it is useful to run analyze_outcomes.py on incomplete test
results, so this error mode needs to remain optional in the long
term.

Signed-off-by: Tomás González <tomasagustin.gonzalezorlando@arm.com>
2023-08-23 16:52:44 +01:00
Tomás González
2fdd503c4e Add allow list for non-executed test cases
The allow list explicits which test cases are allowed to not be
executed when testing. This may be, for example, because a feature
is yet to be developed but the test for that feature is already in
our code base.

Signed-off-by: Tomás González <tomasagustin.gonzalezorlando@arm.com>
2023-08-23 16:52:44 +01:00
Tom Cosgrove
31d5bbe2d1 Merge pull request #7986 from tom-cosgrove-arm/single-source-of-truth-for-licensing-2.28
Backport 2.28: Single source of truth for licensing
2023-08-23 11:40:43 +00:00
Gilles Peskine
56081de779 Simplify the logic in a test
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-08-22 17:45:39 +02:00
Gilles Peskine
168be01a78 Correct some msg messages in full config
When MBEDTLS_USE_PSA_CRYPTO is disabled on a base of full, mention it.

Don't explicitly mention MBEDTLS_PSA_CRYPTO_CONFIG when also mentioning
PSA_WANT_xxx, since PSA_WANT symbols are only meaningful when
MBEDTLS_PSA_CRYPTO_CONFIG is enabled.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-08-22 17:44:25 +02:00
Gilles Peskine
2e70f1c952 Make malloc-0-null a user config file
Having a wrapper made it harder to use: incompatible with setting
MBEDTLS_CONFIG_FILE, harder to combine with other settings. It was also
surprising since it was the only test config that was structured in that
way.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-08-22 17:37:42 +02:00
Agathiyan Bragadeesh
0aab8a878f Add changelog entry for 2.28 IAR warning fixes
Signed-off-by: Agathiyan Bragadeesh <agathiyan.bragadeesh2@arm.com>
2023-08-22 15:29:02 +01:00
Gilles Peskine
d4c85af9ce Fix inconsistencies in no-chachapoly test
The original goal (https://github.com/Mbed-TLS/mbedtls/pull/5072) was to run
a test with ChaChaPoly disabled in PSA. It was actually implemented with GCM
also partially disabled (legacy GCM enabled but PSA GCM disabled), which
distracted from the objective. It's actually useful to test both with and
without GCM, so test both. Don't test inconsistencies between legacy and PSA
support because that's not a common case and not one we have particular
reasons to test.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-08-22 16:24:14 +02:00
Gilles Peskine
2d04ce2a88 Remove comments that duplicate the 'msg' call just below
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-08-22 16:21:20 +02:00
Gilles Peskine
9471815dd3 Merge pull request #7828 from davidhorstmann-arm/2.28-reword-net-free-description-2544
[Backport 2.28] Reword the description of `mbedtls_net_free()`
2023-08-21 21:17:14 +00:00
Gilles Peskine
27adfd8d33 Merge pull request #7487 from AndrzejKurek/calloc-also-zeroizes-2-28
[Backport 2.28] Document mbedtls_calloc zeroization
2023-08-21 19:54:16 +00:00
David Horstmann
d81f75bbbf Fixup incorrectly-formatted ChangeLog entry
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-08-21 17:36:02 +01:00
Tom Cosgrove
2bda812130 Merge pull request #8085 from gilles-peskine-arm/mpi_exp_mod-remove_initial_copy-2.28
Backport 2.28: mbedtls_mpi_exp_mod: remove spurious copy of the output variable
2023-08-21 15:50:30 +00:00
Gilles Peskine
7fbbb61238 Merge remote-tracking branch 'mbedtls-2.28' into calloc-also-zeroizes-2-28 2023-08-21 17:25:47 +02:00
Tom Cosgrove
f9f183c107 Merge pull request #8089 from ivq/8017-backport
Backport 2.28: Fix a few unchecked return values
2023-08-21 13:03:01 +00:00
David Horstmann
869609f228 Add ChangeLog entry for otherName SAN fixes
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-08-18 19:51:45 +01:00
David Horstmann
dcf73265ba Fix incorrect detection of HardwareModuleName
The hardware module name otherName SAN contains 2 OIDs:

 OtherName ::= SEQUENCE {
      type-id    OBJECT IDENTIFIER,
      value      [0] EXPLICIT ANY DEFINED BY type-id }

 HardwareModuleName ::= SEQUENCE {
                           hwType OBJECT IDENTIFIER,
                           hwSerialNum OCTET STRING }

The first, type-id, is the one that identifies the otherName as a
HardwareModuleName. The second, hwType, identifies the type of hardware.

This change fixes 2 issues:

1. We were erroneously trying to identify HardwareModuleNames by looking
at hwType, not type-id.
2. We accidentally inverted the check so that we were checking that
hwType did NOT match HardwareModuleName.

This fix ensures that type-id is correctly checked to make sure that it
matches the OID for HardwareModuleName.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-08-18 19:51:06 +01:00
David Horstmann
4a46d23a36 Fix: Set type_id in x509_get_other_name()
When parsing a subject alternative name of type otherName, retain the
type-id field of the otherName. Previously this was not copied to the
mbedtls_x509_san_other_name struct when it should have been.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-08-18 19:46:13 +01:00
Gilles Peskine
2545b401de Merge pull request #8081 from adeaarm/backport_IAR_fix
Backport 2.28: Small fixes for IAR support
2023-08-17 19:54:44 +00:00
Gilles Peskine
64dbdc06fa Merge pull request #7768 from lpy4105/backport-2.28/issue/renew_cert_2027-01-01
Backport 2.28: Updating crt/crl files due to expiry before 2027-01-01
2023-08-17 18:55:42 +00:00
Antonio de Angelis
431e5c4199 Remove workaround for non-zero shared_secret array
PSA_KEY_AGREEMENT_MAX_SHARED_SECRET_SIZE is always greater
than 1 so no need for the workaround on the original patch

Signed-off-by: Antonio de Angelis <antonio.deangelis@arm.com>
2023-08-17 15:36:21 +01:00
Chien Wong
0118a1d712 Fix a few unchecked return values
Signed-off-by: Chien Wong <m@xv97.com>
2023-08-17 22:13:11 +08:00
Gilles Peskine
20d54e3115 mbedtls_mpi_exp_mod: remove spurious copy of the output variable
Clear some confusion between `X` as the output variable and "X" as a name
given to the accumulator. Previous iterations of the code used the variable
`X` as the accumulator, but now that the accumulator is `W[x_index]`, some
of the comments didn't make sense.

Remove the copy of the initial value of `X` into `W[x_index]`, which was
meaningless: the initial value of an output variable should not, and did
not, matter. `W[x_index]` is later overridden unconditionally to take the
value `RR`.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-08-17 14:39:25 +02:00
Pengyu Lv
e453f9df10 Add description for invalid commands
Signed-off-by: Pengyu Lv <pengyu.lv@arm.com>
2023-08-17 16:32:34 +08:00
Antonio de Angelis
1505d3232d Fix error strings without quotes
Some of the error strings that should be printed with the
error preprocessor directive are missing quotes

Signed-off-by: Antonio de Angelis <antonio.deangelis@arm.com>
2023-08-16 16:28:42 +01:00
TTornblom
ac9e3402ab BUILD: Update For IAR support
Applied the same change as in mbed-crypto for using this as a sub
project with the IAR toolchain. Use __asm generic ,and avoid empty
enum. Avoid declaration of array with null size. This is a porting
of the original patch contributed to trusted-firmware-m.

Signed-off-by: TTornblom <thomas.tornblom@iar.com>
Signed-off-by: Michel Jaouen <michel.jaouen@st.com>
Signed-off-by: Antonio de Angelis <antonio.deangelis@arm.com>
2023-08-16 16:25:47 +01:00
Pengyu Lv
96d0ef4f08 Fix invalid generation commands
`serial_hex` option is not supported by `cert_write` in 2.28,
use `serial` option instead.

Signed-off-by: Pengyu Lv <pengyu.lv@arm.com>
2023-08-16 11:43:51 +08:00
Gilles Peskine
7740eaf32f Merge pull request #7940 from AgathiyanB/backport-assert-false-macro
[Backport 2.28] Add TEST_FAIL macro for tests
2023-08-10 13:03:44 +00:00
Manuel Pégourié-Gonnard
a35283ca44 Merge pull request #8046 from ivq/6999-backport
Backport 2.28: Doc: Add note on special use of A in ecp group structure
2023-08-10 08:24:08 +00:00
Chien Wong
8aa8d78ed9 Add potential missing inline definition
Signed-off-by: Chien Wong <m@xv97.com>
2023-08-10 12:24:43 +08:00
Chien Wong
12f6f28e15 Improve doc on special use of A in ecp group structure
Signed-off-by: Chien Wong <m@xv97.com>
2023-08-09 22:15:14 +08:00
Janos Follath
226f9eab48 Merge pull request #1048 from waleed-elmelegy-arm/improve-and-test-legacy-pkcs5-pbe2
Backport 2.28: Improve & test legacy mbedtls_pkcs5_pbe2
2023-08-09 09:43:05 +01:00
Waleed Elmelegy
a55ffe5f37 Remove test helper functions not backported
Signed-off-by: Waleed Elmelegy <waleed.elmelegy@arm.com>
2023-08-08 17:07:04 +01:00
Waleed Elmelegy
3229cf9507 Replace MBEDTLS_MD_CAN_SHA1 config with old MBEDTLS_SHA1_C config
Signed-off-by: Waleed Elmelegy <waleed.elmelegy@arm.com>
2023-08-08 16:58:16 +01:00
Waleed Elmelegy
01b6df76db Improve mbedtls_pkcs5_pbes2 function signature comments
Signed-off-by: Waleed Elmelegy <waleed.elmelegy@arm.com>
2023-08-08 15:37:28 +01:00
Waleed Elmelegy
a230735d2f Fix CI errors related pkcs5_pbe changes
Signed-off-by: Waleed Elmelegy <waleed.elmelegy@arm.com>
2023-08-08 15:36:49 +01:00
Waleed Elmelegy
412629c815 Improve & test legacy mbedtls_pkcs5_pbe2
* Prevent pkcs5_pbe2 encryption when PKCS7 padding has been
  disabled since this not part of the specs.
* Allow decryption when PKCS7 padding is disabled for legacy
  reasons, However, invalid padding is not checked.
* Add tests to check these scenarios. Test data has been
  reused but with changing padding data in last block to
  check for valid/invalid padding.
* Document new behaviour, known limitations and possible
  security concerns.

Signed-off-by: Waleed Elmelegy <waleed.elmelegy@arm.com>
2023-08-08 15:36:05 +01:00
Gilles Peskine
64a81357c3 Merge pull request #8037 from tom-cosgrove-arm/fix-rijndael-and-drbg-pdf-links-2.28
Backport 2.28: Update links to Rijndael paper and NIST SP 800-90 DRBGs
2023-08-07 19:16:01 +00:00
Gilles Peskine
b438348774 Merge pull request #8010 from marekjansta/fix-x509-ec-algorithm-identifier-2.28
Backport 2.28: Fixed x509 certificate generation to conform to RFCs when using ECC key
2023-08-07 19:14:52 +00:00
Dave Rodgman
1484a53429 Merge pull request #8024 from daverodgman/changelog-warning-fixes-2.28
Backport 2.28: Clarify changelog not needed for compiler warnings
2023-08-07 10:55:56 +01:00
Tom Cosgrove
aaec13793a 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 15:08:48 +01:00
Dave Rodgman
f97832a5ec Merge pull request #8015 from AgathiyanB/fix-unnecessary-type-quantifier
Fix IAR warning about unnecessary type quantifier
2023-08-03 15:57:01 +00:00
Dave Rodgman
aeb97a1891 Merge pull request #1045 from Mbed-TLS/cert-changelog-2.28.4
Update Changelog to cover certificate updates
mbedtls-2.28.4 v2.28.4
2023-08-03 13:59:19 +01:00
Dave Rodgman
b0eedb4017 Update Changelog to cover certificate updates
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-08-03 13:31:07 +01:00
Dave Rodgman
8fd5eefe9b Merge pull request #1042 from daverodgman/mbedtls-2.28.4rc0-pr
Mbedtls 2.28.4rc0 pr
2023-08-02 17:45:58 +01:00
Dave Rodgman
8abc2e6112 Update BRANCHES.md
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-08-02 15:36:46 +01:00