correy
a15b4851d4
Fix MSVC error C4703 about possibly uninitialized variable in pkwrite.c
...
Signed-off-by: correy <112426112@qq.com>
2023-09-21 20:18:52 +08:00
Dave Rodgman
1a404e8f34
Use mbedtls_ct_error for CT error selection
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-09-21 13:12:28 +01:00
Dave Rodgman
e50b537266
Add mbedtls_ct_error_if
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-09-21 11:29:58 +01:00
Dave Rodgman
ef6795d2a9
Reduce size of mbedtls_asn1_get_len
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-09-21 10:35:33 +01:00
Dave Rodgman
584a08f91d
Add cast for MSVC
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-09-20 20:15:52 +01:00
Gilles Peskine
efaee9a299
Give a production-sounding name to the p256m option
...
Now that p256-m is officially a production feature and not just an example,
give it a more suitable name.
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-09-20 20:49:47 +02:00
Waleed Elmelegy
1db5cdaf57
Add tests to test pkcs8 parsing of encrypted keys
...
Signed-off-by: Waleed Elmelegy <waleed.elmelegy@arm.com>
2023-09-20 19:29:02 +01:00
Waleed Elmelegy
5e48cad7f0
Fix codestyle issues in pkcs12.h & pkparse.c
...
Signed-off-by: Waleed Elmelegy <waleed.elmelegy@arm.com>
2023-09-20 19:29:02 +01:00
Waleed Elmelegy
d527896b7e
Switch pkparse to use new mbedtls_pkcs12_pbe_ext function
...
Switch pkparse to use new mbedtls_pkcs12_pbe_ext function
and deprecate mbedtls_pkcs12_pbe function.
Signed-off-by: Waleed Elmelegy <waleed.elmelegy@arm.com>
2023-09-20 19:29:02 +01:00
Waleed Elmelegy
c9f4040f7f
Switch pkparse to use new mbedtls_pkcs5_pbes2_ext function
...
Switch pkparse to use new mbedtls_pkcs5_pbes2_ext function
and deprecate mbedtls_pkcs5_pbes2 function.
Signed-off-by: Waleed Elmelegy <waleed.elmelegy@arm.com>
2023-09-20 19:28:28 +01:00
Dave Rodgman
1cf181fd46
Reinstate more robust return value handling
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-09-20 19:10:17 +01:00
Dave Rodgman
c43a0a4adb
rename dont_ignore to in_padding
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-09-20 19:09:51 +01:00
Dave Rodgman
e834d6c9f2
Move declaration for robustness against future edits
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-09-20 19:09:51 +01:00
Dave Rodgman
c62f7fcce9
Use more meaningful variable name in mbedtls_rsa_rsaes_oaep_decrypt
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-09-20 19:09:51 +01:00
Dave Rodgman
e94cd0b99b
Correct use of mbedtls_ct_mpi_uint_if_else_0
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-09-20 19:09:51 +01:00
Gilles Peskine
eda1b1f744
Merge pull request #7921 from valeriosetti/issue7613
...
TLS: Clean up ECDSA dependencies
2023-09-20 12:47:55 +00:00
Dave Rodgman
ee5464fab9
Simplify unnecessarily complex error code handling
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-09-20 09:13:12 +01:00
Dave Rodgman
fd96579ecd
Use properly typed versions of mbedtls_ct_xxx_if
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-09-19 21:52:13 +01:00
Dave Rodgman
143f5f7c68
Add mbedtls_ct_bool_if and mbedtls_ct_bool_if_else_0
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-09-19 21:52:13 +01:00
Dave Rodgman
437500c5b1
Fix MSVC type complaint
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-09-19 21:52:13 +01:00
Dave Rodgman
814d096420
Fix error in handling of return value from mbedtls_nist_kw_unwrap
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-09-19 20:48:51 +01:00
Dave Rodgman
6be4bcff16
code style
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-09-19 19:47:51 +01:00
Dave Rodgman
4fc14cc4ae
Fix error in handling of return value from mbedtls_nist_kw_unwrap
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-09-19 19:45:54 +01:00
Dave Rodgman
f8182d91a7
Simplify add_zeros_padding
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-09-19 18:39:33 +01:00
Dave Rodgman
d8c68a948a
Use CT interface in get_zeros_padding
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-09-19 18:39:33 +01:00
Dave Rodgman
1cfc43c77b
Rename mbedtls_ct_bool_xor to mbedtls_ct_bool_ne
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-09-19 18:39:33 +01:00
Dave Rodgman
89a9bd5887
Use CT interface in get_one_and_zeros_padding
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-09-19 18:39:33 +01:00
Dave Rodgman
6cec41c3bb
use CT interface in add_zeros_and_len_padding()
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-09-19 18:34:06 +01:00
Dave Rodgman
6b7e2a5809
Use CT interface in get_pkcs_padding
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-09-19 18:34:06 +01:00
Dave Rodgman
b4e6b41aa0
Use const-time interface throughout mbedtls_rsa_rsaes_oaep_decrypt
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-09-19 18:34:06 +01:00
Dave Rodgman
51c15309f2
Make padlen check const-time
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-09-19 17:22:18 +01:00
Dave Rodgman
c2630fac52
Simplify mbedtls_ct_memcmp_partial
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-09-19 17:21:50 +01:00
Dave Rodgman
66d6ac92e6
Use mbedtls_ct_memcmp in mbedtls_rsa_rsaes_oaep_decrypt
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-09-19 09:10:59 +01:00
Dave Rodgman
d337bd9bfe
Improve const-timeness of mbedtls_nist_kw_unwrap
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-09-19 09:10:59 +01:00
Dave Rodgman
9c14007ac3
Add mbedtls_ct_memcmp_partial
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-09-19 09:10:59 +01:00
Dave Rodgman
d26a3d6da7
Eliminate duplicate ct memcmp
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-09-18 19:09:45 +01:00
Gilles Peskine
faf0b8604a
mbedtls_ssl_decrypt_buf(): fix buffer overread with stream cipher
...
With stream ciphers, add a check that there's enough room to read a MAC in
the record. Without this check, subtracting the MAC length from the data
length resulted in an integer underflow, causing the MAC calculation to try
reading (SIZE_MAX + 1 - maclen) bytes of input, which is a buffer overread.
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-09-18 19:07:50 +02:00
Gilles Peskine
bd50d5baec
Merge pull request #8177 from gilles-peskine-arm/generated-files-off-in-release
...
Generated files off in release
2023-09-18 14:11:58 +00:00
Dave Rodgman
25c271a035
Merge pull request #8182 from daverodgman/asn1write-size
...
Reduce code size in mbedtls_asn1_write_len
2023-09-18 10:27:23 +00:00
Manuel Pégourié-Gonnard
275afe187f
Fix preset shared between 1.2 and 1.3
...
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2023-09-18 11:19:20 +02:00
Gilles Peskine
67c86e626b
Merge pull request #7961 from gilles-peskine-arm/psa_crypto_config-in-full
...
Enable MBEDTLS_PSA_CRYPTO_CONFIG in the full config
2023-09-18 08:13:12 +00:00
Dave Rodgman
0c9516ea89
code style
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-09-15 18:30:09 +01:00
Dave Rodgman
127f35d5e5
Merge remote-tracking branch 'origin/development' into asn1write-size
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-09-15 18:02:59 +01:00
Dave Rodgman
ecdfc1c94f
Fix poorly named function
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-09-15 18:00:37 +01:00
Gilles Peskine
8a7fb2d799
Merge pull request #1055 from waleed-elmelegy-arm/add-new-pkcs12-pbe2-ext-fun
...
Add new pkcs12 pbe2 ext fun
2023-09-15 18:43:03 +02:00
Gilles Peskine
170be457bd
Merge pull request #8207 from mcagriaksoy/branch_old_try
...
Fixes log level for got supported group message
2023-09-15 05:53:00 +00:00
Dave Rodgman
a11eac4292
code style
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-09-14 16:16:04 +01:00
Dave Rodgman
e99b24dd9f
Fix some clang-18 warnings
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-09-14 15:52:02 +01:00
Yanray Wang
7732ced037
cipher_wrap: remove 192- and 256-bit for AES_ONLY_128_BIT_KEY_LENGTH
...
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-09-14 14:35:44 +08:00
mcagriaksoy
d9f22804ea
Fixes log level for got supported group message
...
Signed-off-by: mcagriaksoy <mcagriaksoy@yandex.com>
2023-09-13 22:43:38 +02:00
Gilles Peskine
0ddffb6de2
Merge pull request #7210 from sergio-nsk/patch-2
...
Fix llvm error: variable 'default_iv_length' and other may be used uninitialized
2023-09-13 16:38:55 +02:00
Gilles Peskine
9b5d7d7801
Merge pull request #8195 from daverodgman/improve_sslmsg
...
Improve use of ct interface in mbedtls_ssl_decrypt_buf
2023-09-13 12:32:12 +00:00
Gilles Peskine
3cea3efc25
Merge pull request #8025 from AgathiyanB/accept-numericoid-hexstring-x509
...
Accept numericoid hexstring x509
2023-09-13 08:54:33 +00:00
Gilles Peskine
f22999e99f
Merge pull request #8093 from yuhaoth/pr/add-target-architecture-macros
...
Add architecture detection macros
2023-09-13 08:53:47 +00:00
Dave Rodgman
da0bb9fae8
Merge pull request #8034 from gilles-peskine-arm/bump_version-doc_mainpage
...
Update capitalization of "Mbed" and fix bump_version.sh
2023-09-13 08:41:20 +00:00
Dave Rodgman
7d52f2a0d9
Improve use of ct interface in mbedtls_ssl_decrypt_buf
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-09-13 09:30:03 +01:00
Gilles Peskine
e820c0abc8
Update spelling "mbed TLS" to "Mbed TLS"
...
The official spelling of the trade mark changed from all-lowercase "mbed"
to normal proper noun capitalization "Mbed" a few years ago. We've been
using the new spelling in new text but still have the old spelling in a
lot of text. This commit updates most occurrences of "mbed TLS":
```
sed -i -e 's/mbed TLS/Mbed TLS/g' $(git ls-files ':!ChangeLog' ':!tests/data_files/**' ':!tests/suites/*.data' ':!programs/x509/*' ':!configs/tfm*')
```
Justification for the omissions:
* `ChangeLog`: historical text.
* `test/data_files/**`, `tests/suites/*.data`, `programs/x509/*`: many
occurrences are significant names in certificates and such. Changing
the spelling would invalidate many signatures and tests.
* `configs/tfm*`: this is an imported file. We'll follow the upstream
updates.
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-09-12 19:18:17 +02:00
Agathiyan Bragadeesh
a72ea814d8
Remove double blank line in x509_create.c
...
Signed-off-by: Agathiyan Bragadeesh <agathiyan.bragadeesh2@arm.com>
2023-09-12 17:57:09 +01:00
Agathiyan Bragadeesh
c7959b22c6
Remove magic number in x509.c
...
Signed-off-by: Agathiyan Bragadeesh <agathiyan.bragadeesh2@arm.com>
2023-09-12 17:56:58 +01:00
Tom Cosgrove
9d8a7d62f5
Use the correct variable when tracking padding length
...
Fixes an error introduced in a81373f80
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
2023-09-12 16:01:52 +01:00
Waleed Elmelegy
57d09b72ef
Return back to modifying input parameters in pkcs12_parse_pbe_params
...
Return back to modifying input parameters in pkcs12_parse_pbe_params
to avoid change in behaviour.
Signed-off-by: Waleed Elmelegy <waleed.elmelegy@arm.com>
2023-09-12 14:05:10 +01:00
Waleed Elmelegy
a7d206fce6
Check set_padding has been called in mbedtls_cipher_finish
...
Check set_padding has been called in mbedtls_cipher_finish
in modes that require padding.
Signed-off-by: Waleed Elmelegy <waleed.elmelegy@arm.com>
2023-09-12 13:39:36 +01:00
Dave Rodgman
bd58944252
Avoid implementation defined behaviour
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-09-12 12:38:53 +01:00
Dave Rodgman
2b0d53a2a8
Merge pull request #7590 from daverodgman/ct-x86-asm
...
Constant time asm for x86 and x86-64
2023-09-12 09:58:44 +00:00
Dave Rodgman
50b0a35494
Test INT_MAX rather than UINT_MAX
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-09-12 09:30:44 +01:00
Dave Rodgman
98926d5fb1
Update comment, and replace bit-twiddling with #error
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-09-12 09:29:33 +01:00
Ronald Cron
ad2f351c6b
Merge pull request #8171 from ronald-cron-arm/misc-minor-fixes
...
One minor fix
2023-09-12 06:00:48 +00:00
Dave Rodgman
4f26770291
Ensure mbedtls_ct_memcpy behaves correctly with 16-bit int
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-09-11 19:10:09 +01:00
Dave Rodgman
dc669a1944
Fix type error
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-09-11 18:39:57 +01:00
Dave Rodgman
5265c318a0
Fix type-conversion error
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-09-11 18:04:13 +01:00
Dave Rodgman
49352832c9
Eliminate duplicate of mbedtls_asn1_find_named_data
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-09-11 17:10:43 +01:00
Dave Rodgman
33287ae134
Tidy up mbedtls_asn1_write_len
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-09-11 17:10:43 +01:00
Dave Rodgman
cf5f746a8c
Refactor out some common code
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-09-11 16:27:34 +01:00
Dave Rodgman
7fda906a68
Merge pull request #8161 from gilles-peskine-arm/config-boolean-options-wrong-section-202309
...
Fix module configuration options in mbedtls_config.h
2023-09-11 15:08:56 +00:00
Dave Rodgman
3bbedf6ba0
code style
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-09-11 16:06:28 +01:00
Dave Rodgman
9f366b07ea
Reduce code size in mbedtls_asn1_write_len
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-09-11 16:00:03 +01:00
Dave Rodgman
82fe0828b2
Merge pull request #8180 from daverodgman/sha2-zeroize
...
Ensure all md_<hash>_finish functions perform zeroization
2023-09-11 15:13:27 +01:00
Dave Rodgman
aafd1e0924
Ensure all md_<hash>_finish functions perform zeroization
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-09-11 12:59:36 +01:00
Tom Cosgrove
876346e451
Remove always-false null pointer check in sha3.c that Coverity complains about
...
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
2023-09-11 09:03:01 +01:00
Dave Rodgman
3f8e483eed
Mark y as modified in x86 asm for mbedtls_ct_uint_lt
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-09-08 17:57:40 +01:00
Dave Rodgman
4a97e73661
Eliminate a redundant not from x86 asm
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-09-08 17:26:18 +01:00
Dave Rodgman
b6b8f6c68d
Make variable name consistent in x86_64 asm
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-09-08 17:19:32 +01:00
Dave Rodgman
5f249852a5
Better register allocation for x86_64 asm
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-09-08 17:18:29 +01:00
Dave Rodgman
99f0cdc0e0
Remove not-needed mov in x86_64 asm
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-09-08 17:18:04 +01:00
Waleed Elmelegy
e1cb35b719
Add new mbedtls_pkcs12_pbe_ext function to replace old function
...
Add new mbedtls_pkcs12_pbe_ext function to replace
old mbedtls_pkcs12_pbe function that have security
issues.
Signed-off-by: Waleed Elmelegy <waleed.elmelegy@arm.com>
2023-09-08 16:51:26 +01:00
Gilles Peskine
0b62b7a21f
Allow turning off re-generation of files with make
...
In make builds, when GEN_FILES is false (empty), don't try to re-generate
configuration-independent source files, regardless of whether they seem
out of date. This is useful, for example, if you have a source tree where
`make generated_files` has already run and file timestamps reflect the
time the files were copied or extracted, and you are now in an environment
that lacks some of the necessary tools to re-generate the files.
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-09-08 16:19:13 +02:00
Gilles Peskine
31d49cd57f
Merge pull request #1053 from waleed-elmelegy-arm/Improve-and-test-mbedtls_pkcs12_pbe
...
Improve & test legacy mbedtls_pkcs12_pbe
2023-09-08 13:08:05 +02:00
Agathiyan Bragadeesh
706a1c3c3f
Fix code style
...
Signed-off-by: Agathiyan Bragadeesh <agathiyan.bragadeesh2@arm.com>
2023-09-08 12:04:41 +01:00
Agathiyan Bragadeesh
c34804dea2
Fix bug with checking max dn length with hexpairs
...
Signed-off-by: Agathiyan Bragadeesh <agathiyan.bragadeesh2@arm.com>
2023-09-08 11:32:19 +01:00
Ronald Cron
b9c7953442
pkwrite: Fix defined but not used warning
...
Fix defined but not used warning when
MBEDTLS_USE_PSA_CRYPTO, MBEDTLS_PK_HAVE_RFC8410_CURVES
and MBEDTLS_PK_HAVE_ECC_KEYS are defined but not
MBEDTLS_PEM_WRITE_C.
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2023-09-07 14:20:49 +02:00
Gilles Peskine
58590983c5
Merge pull request #8160 from daverodgman/warn-unreachable
...
Fix clang warnings about unreachable code
2023-09-06 09:47:03 +00:00
Dave Rodgman
85061b97b5
Improve sanity checking of MBEDTLS_HAVE_INTxx
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-09-06 08:41:05 +01:00
Dave Rodgman
b7b8c09c81
Update bignum_core.c
...
Co-authored-by: Gilles Peskine <gilles.peskine@arm.com>
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-09-05 20:35:19 +01:00
Gilles Peskine
ff2558a470
Fix unused variable in some TLS 1.3 builds
...
Fix unused variable when MBEDTLS_SSL_PROTO_TLS1_3 and
MBEDTLS_SSL_SESSION_TICKETS are enabled but not MBEDTLS_DEBUG_C.
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-09-05 21:10:39 +02:00
Dave Rodgman
7e1e7be8fc
Simplify fixes for unreachable code
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-09-05 18:15:31 +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
Dave Rodgman
0364c8a773
Introduce MBEDTLS_IGNORE_UNREACHABLE_BEGIN
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-09-05 16:20:19 +01:00
Waleed Elmelegy
255db80910
Improve & test legacy mbedtls_pkcs12_pbe
...
* Prevent pkcs12_pbe 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.
* Document new behaviour, known limitations and possible
security concerns.
* Add tests to check these scenarios. Test data has been
generated by the below code using OpenSSL as a reference:
#include <openssl/pkcs12.h>
#include <openssl/evp.h>
#include <openssl/des.h>
#include <openssl/asn1.h>
#include "crypto/asn1.h"
#include <string.h>
int main()
{
char pass[] = "\xBB\xBB\xBB\xBB\xBB\xBB\xBB\xBB\xBB";
unsigned char salt[] = "\xCC\xCC\xCC\xCC\xCC\xCC\xCC\xCC\xCC";
unsigned char plaintext[] = "\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA";
unsigned char *ciphertext = NULL;
int iter = 10;
X509_ALGOR *alg = X509_ALGOR_new();
int ciphertext_len = 0;
int alg_nid = NID_pbe_WithSHA1And3_Key_TripleDES_CBC;
alg->parameter = ASN1_TYPE_new();
struct asn1_object_st * aobj;
PKCS5_pbe_set0_algor(alg, alg_nid, iter,
salt, sizeof(salt)-1);
aobj = alg->algorithm;
printf("\"30%.2X", 2 + aobj->length + alg->parameter->value.asn1_string->length);
printf("06%.2X", aobj->length);
for (int i = 0; i < aobj->length; i++) {
printf("%.2X", aobj->data[i]);
}
for (int i = 0; i < alg->parameter->value.asn1_string->length; i++) {
printf("%.2X", alg->parameter->value.asn1_string->data[i]);
}
printf("\":\"");
for (int i = 0; i < sizeof(pass)-1; i++) {
printf("%.2X", pass[i] & 0xFF);
}
printf("\":\"");
for (int i = 0; i < sizeof(plaintext)-1; i++) {
printf("%.2X", plaintext[i]);
}
printf("\":");
printf("0");
printf(":\"");
unsigned char * res = PKCS12_pbe_crypt(alg, pass, sizeof(pass)-1, plaintext, sizeof(plaintext)-1, &ciphertext, &ciphertext_len, 1);
if (res == NULL)
printf("Encryption failed!\n");
for (int i = 0; i < ciphertext_len; i++) {
printf("%.2X", res[i]);
}
printf("\"\n");
return 0;
}
Signed-off-by: Waleed Elmelegy <waleed.elmelegy@arm.com>
#
2023-09-05 15:45:55 +01:00
Paul Elliott
945d674c8d
Merge pull request #8157 from actonlang/fix-include-psa-utils-internals
...
Use quotes include of psa_util_internal.h
2023-09-05 12:52:19 +00:00
Tom Cosgrove
8bd8a462d2
Merge pull request #8141 from tom-cosgrove-arm/define-psa-macros-to-1
...
Define all PSA_xxx macros to 1 rather than have them empty, for consistency
2023-09-04 21:27:01 +00:00
Agathiyan Bragadeesh
fca0861e8e
Add asn1 get tag and len to x509 create config
...
Signed-off-by: Agathiyan Bragadeesh <agathiyan.bragadeesh2@arm.com>
2023-09-04 15:45:37 +01:00
Agathiyan Bragadeesh
86dc08599b
Add asn1 write tag and len to x509 use c config
...
Signed-off-by: Agathiyan Bragadeesh <agathiyan.bragadeesh2@arm.com>
2023-09-04 15:40:41 +01:00
Gilles Peskine
1a7d387072
Merge pull request #1041 from waleed-elmelegy-arm/add-new-pkcs5-pbe2-ext-fun
...
Add new pkcs5 pbe2 ext fun
2023-09-04 15:33:42 +02:00
Kristian Larsson
a1aeff4124
Use quotes include of psa_util_internal.h
...
psa_utils_internal.h was broken out of mbedtls/psa_utils.h, which in
some places were included as <mbedtls/psa_utils.h>. But since
psa_utils_internals.h should be internal, we should not rely on the
system include paths. I suspect a regexp replace gone slightly wrong.
Signed-off-by: Kristian Larsson <kristian@spritelink.net>
2023-09-04 10:36:37 +02:00
Dave Rodgman
4f69668558
Merge pull request #8082 from daverodgman/misc-code-size
...
Misc code size improvements
2023-09-02 11:44:31 +00:00
Dave Rodgman
662c497395
Merge pull request #8144 from daverodgman/zeroize-stronger
...
Add more protection to mbedtls_platform_zeroize
2023-09-02 10:59:12 +01:00
Dave Rodgman
1dab445804
Update guard for ecp
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-09-02 10:56:44 +01:00
Dave Rodgman
16a76721b6
Merge pull request #8068 from paul-elliott-arm/fix_tls_zeroization
...
Fix TLS pad buffer zeroization
2023-09-01 23:35:23 +00:00
Waleed-Ziad Maamoun-Elmelegy
c5fef82c52
Fix typo in pkcs5.c
...
Co-authored-by: Janos Follath <janos.follath@arm.com>
Signed-off-by: Waleed Elmelegy <waleed.elmelegy@arm.com>
2023-09-01 11:45:39 +01:00
Dave Rodgman
fe55320b5c
Avoid error from old gcc version
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-09-01 11:15:28 +01:00
Dave Rodgman
5f6060a1f3
Code style
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-09-01 11:00:58 +01:00
Dave Rodgman
ba67451562
Fix gcc compile warnings
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-09-01 10:14:46 +01:00
Dave Rodgman
ac3cf7c20b
Add more protection to mbedtls_platform_zeroize
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-09-01 10:09:31 +01:00
Paul Elliott
6ebe7d2e3a
Merge pull request #8095 from davidhorstmann-arm/initialize-struct-get-other-name
...
Coverity fix: Set `type_id` in `x509_get_other_name()`
2023-08-31 16:26:00 +00:00
Tom Cosgrove
c43c3aaf02
Define all PSA_xxx macros to 1 rather than have them empty, for consistency
...
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
2023-08-31 17:06:58 +01:00
Dave Rodgman
4f47f3dac8
Covert PSA guards to MBEDTLS
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-08-31 12:10:00 +01:00
Dave Rodgman
a9a53a05f0
Merge remote-tracking branch 'origin/development' into misc-code-size
2023-08-31 11:53:46 +01:00
Dave Rodgman
dea266f3f5
Use MBEDTLS_MD_LIGHT instead of MBEDTLS_MD_C
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-08-31 11:52:43 +01:00
Dave Rodgman
8d706f6b59
Simplify camellia error conversion macros
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-08-31 11:48:44 +01:00
Dave Rodgman
09a9e589c1
Add missing error conversion case
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-08-31 11:05:22 +01:00
Dave Rodgman
68efcf56ed
Remove not-needed #include
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-08-31 10:09:05 +01:00
Dave Rodgman
984309c2c3
Call mbedtls_platform_zeroize via mbedtls_sha3_free
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-08-30 19:22:28 +01:00
Dave Rodgman
dbddb00158
Ensure mbedtls_sha3_finish zeroizes the context
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-08-30 18:43:23 +01:00
Gilles Peskine
03e9dea30b
Merge remote-tracking branch 'development' into psa_crypto_config-in-full
...
Conflicts:
* `include/psa/crypto_sizes.h`: the addition of the `u` suffix in this branch
conflicts with the rework of the calculation of `PSA_HASH_MAX_SIZE` and
`PSA_HMAC_MAX_HASH_BLOCK_SIZE` in `development`. Use the new definitions
from `development`, and add the `u` suffix to the relevant constants.
2023-08-30 18:32:57 +02:00
Agathiyan Bragadeesh
a2423debcc
Fix code style
...
Signed-off-by: Agathiyan Bragadeesh <agathiyan.bragadeesh2@arm.com>
2023-08-30 16:24:31 +01:00
Agathiyan Bragadeesh
de02ee268e
Refactor parse_attribute_value_string
...
Signed-off-by: Agathiyan Bragadeesh <agathiyan.bragadeesh2@arm.com>
2023-08-30 16:12:57 +01:00
Agathiyan Bragadeesh
1aece47e8c
Make hexpair_to_int take a char pointer
...
Signed-off-by: Agathiyan Bragadeesh <agathiyan.bragadeesh2@arm.com>
2023-08-30 16:05:24 +01:00
Agathiyan Bragadeesh
e9d1c8e1eb
Reword and reformat comments
...
Signed-off-by: Agathiyan Bragadeesh <agathiyan.bragadeesh2@arm.com>
2023-08-30 15:55:31 +01:00
Agathiyan Bragadeesh
ef6abd4062
Add blank lines after variable declarations
...
Signed-off-by: Agathiyan Bragadeesh <agathiyan.bragadeesh2@arm.com>
2023-08-30 15:55:12 +01:00
Dave Rodgman
730bbee226
Merge remote-tracking branch 'origin/development' into update-restricted-2023-08-30
2023-08-30 11:22:00 +01:00
Dave Rodgman
29bf911058
Merge pull request #7839 from daverodgman/psa-sha3
...
SHA-3 via PSA
2023-08-30 08:51:36 +00:00
Waleed Elmelegy
79b6e26b1b
Improve mbedtls_pkcs5_pbes2_ext function test data
...
Signed-off-by: Waleed Elmelegy <waleed.elmelegy@arm.com>
2023-08-29 14:55:03 +01:00
Dave Rodgman
787011542b
Fully replace mbedtls_psa_safer_memcmp
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-08-29 14:20:18 +01:00
Dave Rodgman
e97de40e7b
Typo fix
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-08-29 09:47:35 +01:00
Dave Rodgman
6d5261e38f
Fix typo in doxygen for mbedtls_ct_memcpy_offset
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-08-29 09:42:14 +01:00
Dave Rodgman
b69239c604
Improve docs in mbedtls_mpi_lt_mpi_ct
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-08-29 09:42:14 +01:00
Dave Rodgman
d44dd96132
Improve docs re duplicate declarations
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-08-29 09:42:14 +01:00
Dave Rodgman
0cf9dd1056
Whitespace - tidy up asm and make it more consistent
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-08-29 09:42:14 +01:00
Dave Rodgman
81673bba77
Add x86 const-time assembly
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-08-29 09:42:14 +01:00
Dave Rodgman
664fea481c
Add x86-64 const-time assembly
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-08-29 09:42:14 +01:00
Dave Rodgman
d395590597
Merge pull request #7579 from daverodgman/safer-ct-asm
...
Arm assembly implementation of constant time primitives
2023-08-28 08:26:29 +00:00
Jerry Yu
f65f71eef3
improve various issues
...
- duplicate definition
- wrong comments
- redundant include statement
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-08-28 10:58:24 +08:00
Gilles Peskine
2a296729d0
Merge pull request #8084 from AgathiyanB/remove-type-qualifier-in-assignment-casts
...
Remove type qualifier in assignment casts
2023-08-24 18:02:11 +00:00
Agathiyan Bragadeesh
457ac84f01
Refactor previous fix
...
Signed-off-by: Agathiyan Bragadeesh <agathiyan.bragadeesh2@arm.com>
2023-08-23 11:35:26 +01:00
Agathiyan Bragadeesh
4c7d7bf583
Add guard for empty AttributeValue
...
Signed-off-by: Agathiyan Bragadeesh <agathiyan.bragadeesh2@arm.com>
2023-08-23 11:28:30 +01:00
Jerry Yu
782b966666
replace target arch macros in padlock
...
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-08-23 17:15:35 +08:00
Jerry Yu
d6e312dde4
replace aesni target detection macros
...
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-08-23 17:15:34 +08:00
Jerry Yu
72fd0bdc71
replace arm64 macro and aesce enable flag
...
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-08-23 17:15:34 +08:00
Agathiyan Bragadeesh
15df01240d
Fix code style
...
Signed-off-by: Agathiyan Bragadeesh <agathiyan.bragadeesh2@arm.com>
2023-08-22 17:50:00 +01:00
Agathiyan Bragadeesh
4606bf3f38
Refactor reading AttributeValue in dn gets
...
Signed-off-by: Agathiyan Bragadeesh <agathiyan.bragadeesh2@arm.com>
2023-08-22 17:29:18 +01:00