Ben Taylor
8b3b7e5cac
Update further type mismatches
...
Signed-off-by: Ben Taylor <ben.taylor@linaro.org >
2025-08-07 08:25:52 +01:00
Ben Taylor
6816fd781e
Adjust for change in mbedtls_pk_verify_new function prototype
...
Signed-off-by: Ben Taylor <ben.taylor@linaro.org >
2025-08-07 08:25:52 +01:00
Ben Taylor
7573321f61
Fix style issues
...
Signed-off-by: Ben Taylor <ben.taylor@linaro.org >
2025-08-07 08:25:52 +01:00
Ben Taylor
8e832b6594
Add sigalg types to x509_crt.c
...
Signed-off-by: Ben Taylor <ben.taylor@linaro.org >
2025-08-07 08:25:52 +01:00
Ben Taylor
1c118a564d
reverted enum in pk_verify_new
...
Signed-off-by: Ben Taylor <ben.taylor@linaro.org >
2025-08-07 08:25:52 +01:00
Ben Taylor
b2eecc621d
switch to mbedtls_pk_sigalg_t
...
Signed-off-by: Ben Taylor <ben.taylor@linaro.org >
2025-08-07 08:25:52 +01:00
Ben Taylor
500e497c05
Fix code style issues
...
Signed-off-by: Ben Taylor <ben.taylor@linaro.org >
2025-08-07 08:25:52 +01:00
Ben Taylor
adf5d537b2
Fix code style
...
Signed-off-by: Ben Taylor <ben.taylor@linaro.org >
2025-08-07 08:25:52 +01:00
Ben Taylor
d95ea27e8c
Create new enum mbedtls_pk_sigalg_t
...
Signed-off-by: Ben Taylor <ben.taylor@linaro.org >
2025-08-07 08:25:52 +01:00
Gilles Peskine
1819a915bc
Include limits.h where needed
...
This will be needed when TF-PSA-Crypto's `build_info.h` stops including
`limits.h`, which it currently does by accident because it includes
`check_config.h` which wants `limits.h` to check `CHAR_BIT`.
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com >
2025-07-28 15:45:12 +02:00
Ben Taylor
306ffd3a36
Switch to mbedtls_pk_verify_new
...
Signed-off-by: Ben Taylor <ben.taylor@linaro.org >
2025-07-21 07:53:15 +01:00
Valerio Setti
eaf578978e
library: remove ECDSA_C dependency from ECP_RESTARTABLE
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no >
2025-06-12 06:37:29 +02:00
Gilles Peskine
cd4c0d7b00
Move OID string definitions back to mbedtls/oid.h
...
Some code that parses or writes X.509 needs to know OID values. We provide a
convenient list. Don't remove this list from the public interface of the
library.
For user convenience, expose these values in the same header as before and
with the same name as before: `MBEDTLS_OID_xxx` in `<mbedtls/oid.h>`.
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com >
2025-06-03 15:51:34 +02:00
Gilles Peskine
32a1112e88
Remove MBEDTLS_OID_X509_EXT_xxx constants
...
They're just aliases for the corresponding MBEDTLS_X509_EXT_xxx. We don't
need separate names.
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com >
2025-06-03 15:51:34 +02:00
Gilles Peskine
532e3ee104
Switch library and tests to the x509_oid module
...
```
git grep -l -P 'mbedtls_oid_get_(?!numeric_string\b)' | xargs perl -i -pe 's/\bmbedtls_oid_get_(?!numeric_string\b)/mbedtls_x509_oid_get_/'
./framework/scripts/code_style.py --since HEAD~1 --fix
```
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com >
2025-06-03 15:51:34 +02:00
Gilles Peskine
86a47f85fa
Switch to "x509_oid.h" in code that uses OID functions
...
Keep "mbedtls/oid.h" in code that only uses OID macros.
```
git grep -l mbedtls_oid_ '**/*.[hc]' tests/suites/*.function | xargs perl -i -pe 's!["<]mbedtls/oid\.h[">]!"x509_oid.h"!g'
```
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com >
2025-06-03 15:51:34 +02:00
Valerio Setti
7f6f4e6907
library: pass NULL options parameter to mbedtls_pk_verify_ext()
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no >
2025-05-07 09:06:52 +02:00
Valerio Setti
d24dfad7af
library: x509: remove sig_opts from mbedtls_x509_sig_alg_gets()
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no >
2025-05-07 09:06:52 +02:00
Valerio Setti
68878ccdd0
library: x509: simplify RSA-PSS management
...
- Do not store RSA-PSS signature options in CRL/CRT/CSR structures;
- During the parsing phase, just ensure that MGF1 hash alg is the same
as the one used for the message.
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no >
2025-05-07 09:06:52 +02:00
Stefan Gloor
b5c079b13c
fix: rename BEFORE_COLON and BC to avoid conflicts
...
Namespace BEFORE_COLON and BC defines by prepending MBEDTLS_
and expanding BC to BEFORE_COLON_STR. This is to avoid naming
conflicts with third-party code. No functional change.
Signed-off-by: Stefan Gloor <stefan.gloor@siemens.com >
2025-02-21 10:33:51 +01:00
Manuel Pégourié-Gonnard
f60b09b019
Rm dead !USE_PSA code: X.509
...
unifdef -m -DMBEDTLS_USE_PSA_CRYPTO library/x509*.c
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com >
2025-01-28 16:14:38 +01:00
Gilles Peskine
8085f51108
Use MBEDTLS_ERROR_ADD instead of explicit addition: enforcement
...
Reject direct additions of error constants (regex-based approximation).
Fix the lone straggler.
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com >
2024-10-16 11:52:27 +02:00
Harry Ramsey
0f6bc41a22
Update includes for each library file
...
Signed-off-by: Harry Ramsey <harry.ramsey@arm.com >
2024-10-09 11:18:50 +01:00
Sergey Markelov
4ed0fded12
Fix Mbed-TLS build when WIN32_LEAN_AND_MEAN macro is defined globally
...
Signed-off-by: Sergey Markelov <sergey@solidstatenetworks.com >
2024-08-14 15:15:14 -07:00
Elena Uziunaite
8dde3b3dec
Replace MBEDTLS_PK_HAVE_ECC_KEYS with PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY
...
Signed-off-by: Elena Uziunaite <elena.uziunaite@arm.com >
2024-08-05 15:41:58 +01:00
Minos Galanakis
2abbac74dc
x509: Added mbedtls_x509_crt_get_ca_istrue()
API accessor.
...
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com >
2024-03-04 02:22:01 +00:00
Manuel Pégourié-Gonnard
32c28cebb4
Merge pull request #8715 from valeriosetti/issue7964
...
Remove all internal functions from public headers
2024-02-05 15:09:15 +00:00
Valerio Setti
25b282ebfe
x509: move internal functions declarations to a private header
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no >
2024-01-19 09:07:35 +01:00
Valerio Setti
384fbde49a
library/tests: replace md_psa.h with psa_util.h as include file for MD conversion
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no >
2024-01-02 13:27:32 +01:00
Manuel Pégourié-Gonnard
a4b38f24fd
Merge pull request #8579 from valeriosetti/issue7995
...
PK: clean up pkwrite
2023-12-20 08:20:10 +00:00
Valerio Setti
f9362b7324
pk_internal: small renaming for mbedtls_pk_get_group_id()
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no >
2023-11-29 08:42:27 +01:00
Dave Rodgman
e4a6f5a7ec
Use size_t cast for pointer subtractions
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com >
2023-11-21 17:09:46 +00:00
Dave Rodgman
16799db69a
update headers
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com >
2023-11-02 19:47:20 +00:00
Minos Galanakis
21087754a5
x509_crt: Removed unused intsafe.h
...
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com >
2023-09-25 15:17:38 +01:00
Minos Galanakis
a9bb34cd73
x509_crt: Removed length_as_int intermediate variable
...
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com >
2023-09-25 14:42:41 +01:00
Minos Galanakis
59108d3f4d
x509_crt: Adjusted the len of lpMultiByteStr arg in WideCharToMultiByte
...
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com >
2023-09-25 14:12:23 +01:00
Minos Galanakis
08a67ccefd
x509_crt: Set WideCharToMultiByte to use -1 for length.
...
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com >
WideCharToMultiByte
2023-09-25 14:12:23 +01:00
Minos Galanakis
40995e1390
x509_crt: Removed checks for windows versions < WINXP
...
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com >
2023-09-25 14:12:22 +01:00
Minos Galanakis
4952f705ee
Removed unsupported Visual Studio related code in entropy_poll.c and x509_crt.c.
...
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com >
2023-09-25 14:12:22 +01:00
Minos Galanakis
12b493f4dc
entropy_poll/x509_crt: Added MBEDTLS_POP_TARGET_PRAGMA define guards.
...
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com >
2023-09-25 14:12:21 +01:00
Minos Galanakis
a277b210ff
Code style fixes
...
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com >
2023-09-25 14:12:21 +01:00
Simon Butcher
de573f56e5
Fix coding style of length_as_int var in x509_crt.c
...
Variable had the very Windows name of lengthAsInt, which is fine for C# but
doesn't match the Mbed TLS coding standards.
Signed-off-by: Simon Butcher <simon.butcher@arm.com >
2023-09-25 14:12:21 +01:00
Simon Butcher
35e5dad865
Add clarifying comment on use of MultiByteToWideChar() and CP_ACP
...
Signed-off-by: Simon Butcher <simon.butcher@arm.com >
2023-09-25 14:12:21 +01:00
Simon Butcher
def90f4966
Fix formatting and detail of comments in PR #730
...
Signed-off-by: Simon Butcher <simon.butcher@arm.com >
2023-09-25 14:12:20 +01:00
Simon Butcher
e068aa7ad5
Fix the build for mingw and CMake + VStudio
...
Changes to the build to add the new Win32 Crypto API's inadvertently broke
the build for mingw and Visual Studio builds when generated by CMake.
Signed-off-by: Simon Butcher <simon.butcher@arm.com >
2023-09-25 14:12:20 +01:00
Kevin Kane
0ec1e68548
Replace Windows APIs that are banned in Windows Store apps
...
CryptGenRandom and lstrlenW are not permitted in Windows Store apps,
meaning apps that use mbedTLS can't ship in the Windows Store.
Instead, use BCryptGenRandom and wcslen, respectively, which are
permitted.
Also make sure conversions between size_t, ULONG, and int are
always done safely; on a 64-bit platform, these types are different
sizes.
Also suppress macro redefinition warning for intsafe.h:
Visual Studio 2010 and earlier generates C4005 when including both
<intsafe.h> and <stdint.h> because a number of <TYPE>_MAX constants
are redefined. This is fixed in later versions of Visual Studio.
The constants are guaranteed to be the same between both files,
however, so we can safely suppress the warning when including
intsafe.h.
Signed-off-by: Kevin Kane <kkane@microsoft.com >
2023-09-25 14:12:20 +01:00
Dave Rodgman
cfa722324c
Fix warnings about unreachable code
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com >
2023-09-05 16:53:33 +01:00
Antonio de Angelis
1ee4d1228c
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 12:48:33 +01:00
Tom Cosgrove
ca8c61b815
Provide and use internal function mbedtls_zeroize_and_free()
...
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com >
2023-07-17 15:17:40 +01:00
Dave Rodgman
8f6094ce47
Merge pull request #7792 from robUx4/win32_winnt
2023-07-13 19:34:24 +01:00