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

7617 Commits

Author SHA1 Message Date
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
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
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
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
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
0118a1d712 Fix a few unchecked return values
Signed-off-by: Chien Wong <m@xv97.com>
2023-08-17 22:13:11 +08:00
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
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
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
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
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
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
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
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
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
403ce0a6cc Bump version numbers
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-08-02 15:35:45 +01:00
06d5e10989 Fix IAR warning about unnecessary type quantifier
Signed-off-by: Agathiyan Bragadeesh <agathiyan.bragadeesh2@arm.com>
2023-08-01 14:23:01 +01:00
0a6743b2de Fixed AlgorithmIdentifier parameters when used with ECDSA signature algorithm in x509 certificate
Signed-off-by: Marek Jansta <jansta@2n.cz>
2023-07-31 17:33:23 +02:00
f5257c06d1 Cherry picked required prerequisites from dev branch, git hash 0167244b
Signed-off-by: Marek Jansta <jansta@2n.cz>
2023-07-31 17:33:16 +02:00
e7eb8052be Seperate declarations from function body
Signed-off-by: Agathiyan Bragadeesh <agathiyan.bragadeesh2@arm.com>
2023-07-31 16:20:27 +01:00
5521b4ce37 Assign have_rng in declaration of ecp_mul_mxz
Signed-off-by: Agathiyan Bragadeesh <agathiyan.bragadeesh2@arm.com>
2023-07-31 16:15:56 +01:00
7b0ee1e655 Fix control bypass warnings
Declarations have been moved to the top of functions to fix this

Signed-off-by: Agathiyan Bragadeesh <agathiyan.bragadeesh2@arm.com>
2023-07-27 15:51:46 +01:00
9a9d5eea53 Fix a build error when MBEDTLS_PSA_INJECT_ENTROPY is enabled
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-07-20 18:07:47 +02:00
dc1244d135 Merge pull request #6974 from davidhorstmann-arm/2.28-cmake-pass-through-config-defines
[Backport 2.28] Pass `MBEDTLS_CONFIG_FILE` defines through cmake
2023-07-07 17:01:24 +01:00
f788a45d47 Merge pull request #7213 from sergio-nsk/patch-5
mbedtls-2.28: Fix error: comparison of integers of different signs: 'SOCKET' and 'int'
2023-07-07 16:46:03 +01:00
58dda6713c 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 18:12:09 +01:00
1a30cf70cc Pass config file options to mbedtls_test(_helpers)
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-07-05 14:35:08 +01:00
e31e287109 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:33:11 +01:00
08efc3d768 Merge pull request #7854 from daverodgman/fix-unused-aes-2.28
Fix AES dependencies - build TF-M config cleanly - backport 2.28
2023-07-03 16:48:39 +01:00
a3fc295559 Merge pull request #7823 from SlugFiller/mbedtls-2.28
Support compilation using CLang on Windows
2023-07-03 09:52:03 +01:00
f72b8375d0 Fix order of endif comments
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-29 16:33:03 +01:00
1d0033e1ac Improve #endif comments
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-29 12:13:26 +01:00
1ce92e4887 Correct #endif comments
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-29 12:13:15 +01:00
a4a337360d Correct comments on #endif's
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-29 12:13:08 +01:00
94210b13eb Compile fixes
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-28 14:08:07 +01:00
bae79fa16e Add missing sha header includes to entropy.c
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-28 11:54:53 +01:00
1262315a1a Fix warnings re: unused variables in pkparse and pkwrite
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-28 11:54:25 +01:00
f488c2ca79 Add missing include for INT_MAX definition
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-28 11:35:25 +01:00
584b62f89e code style
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-28 11:31:29 +01:00
9d3b63396b Fix comment
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-28 11:31:29 +01:00
5c047d9672 More dependency fixes
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-28 11:31:29 +01:00
36c8e581d6 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-28 11:31:29 +01:00
dbae184ceb 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-28 11:31:29 +01:00
9b20aeaa17 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-28 11:31:29 +01:00
1e6f7708f2 Fix unused function when MBEDTLS_AES_SETKEY_ENC_ALT set
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-28 11:31:29 +01:00
abaea614d2 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 17:34:58 +01:00
e2d0614571 Support compilation using CLang on Windows
Signed-off-by: SlugFiller <5435495+SlugFiller@users.noreply.github.com>
2023-06-26 19:19:56 +03:00
63b50b56cd Merge pull request #7753 from lpy4105/backport-2.28/issue/renew_cert_2024-01-01
Backport 2.28: Updating crt/crl files due to expiry before 2024-01-01
2023-06-21 12:29:12 +02:00
0e2074133a 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:45:26 -04:00
41bb446d12 Update TEST_CA_CRT_EC_PEM and TEST_CA_CRT_EC_DER
To retain the ABI compatibility, we need the DER
data to be in the exact size of 520 bytes. So,
these data are regenerated by unsetting the
'critical' flag of 'basic_constraints' extension,
though the extension should be critical for this
CA according to RFC5280 section 4.2.1.9.

Signed-off-by: Pengyu Lv <pengyu.lv@arm.com>
2023-06-15 15:41:30 +08:00