48a37f01b3
Add cert_cb use to programs/ssl/ssl_server2.c
...
(for use by some tests/)
Signed-off-by: Glenn Strauss <gstrauss@gluelogic.com >
2022-02-25 19:55:53 -05:00
fd222da2e9
Fix the build when MBEDTLS_PLATFORM_C is unset
...
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com >
2022-02-25 15:26:40 +01:00
6d2479516c
Merge pull request #5533 from paul-elliott-arm/fix_fuzz_privkey_null_ctx
...
Fix null context when using dummy_rand with mbedtls_pk_parse_key()
2022-02-16 09:55:01 +01:00
5d7e61fb61
Fix uninitialised return value.
...
Signed-off-by: Paul Elliott <paul.elliott@arm.com >
2022-02-15 16:05:17 +00:00
a1b506996d
Merge pull request #5526 from paul-elliott-arm/fix_fuzzer_null_ref
...
Ensure ctr_drbg is initialised every time in fuzz_server
2022-02-15 10:31:03 +01:00
a1dc3e5a60
Add safety to dummy_random in case of NULL context
...
Signed-off-by: Paul Elliott <paul.elliott@arm.com >
2022-02-14 18:26:21 +00:00
169f115bf0
ssl_client2: init psa crypto for TLS 1.3 build
...
Signed-off-by: Przemyslaw Stekiel <przemyslaw.stekiel@mobica.com >
2022-02-14 17:15:04 +01:00
bb0168144e
Ensure valid context is used in fuzz_dtlsserver
...
A valid ctr_drbg context is now a prerequisite for using dummy_random()
Signed-off-by: Paul Elliott <paul.elliott@arm.com >
2022-02-14 15:57:11 +00:00
51a7679a8e
Ensure context is passed in to dummy_rand
...
In fuzz_privkey, we switched over to using dummy_rand(), which uses
ctr_drbg internally, and thus requires an initialised ctr_drbg_context
to be passed in via p_rng when calling mbedtls_pk_parse_key().
Signed-off-by: Paul Elliott <paul.elliott@arm.com >
2022-02-11 19:10:14 +00:00
00738bf65e
Ensure ctr_drbg is initialised every time
...
ctr_drbg is a local variable and thus needs initialisation every time
LLVMFuzzerTestOneInput() is called, the rest of the variables inside the
if(initialised) block are all static.
Add extra validation to attempt to catch this issue in future.
Signed-off-by: Paul Elliott <paul.elliott@arm.com >
2022-02-10 18:38:53 +00:00
a941b62985
Create public macros for ssl_ticket key,name sizes
...
Signed-off-by: Glenn Strauss <gstrauss@gluelogic.com >
2022-02-09 15:28:28 -05:00
e328245618
Add test case use of mbedtls_ssl_ticket_rotate
...
Signed-off-by: Glenn Strauss <gstrauss@gluelogic.com >
2022-02-09 14:33:16 -05:00
9193f7d836
Merge pull request #5436 from mpg/prog-hmac-cipher-psa
...
PSA: example programs for HMAC and AEAD vs legacy
2022-02-09 10:53:49 +01:00
ae1bae8412
Give a magic constant a name
...
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com >
2022-02-08 11:36:28 +01:00
c82504e22c
Clean up output from cipher_aead_demo
...
Used to print "cipher:" when it was the cipher part of a program that
had both cipher and PSA. Now it doesn't really make sense. Align the
output to match the PSA version of this program.
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com >
2022-02-08 11:31:36 +01:00
5e6c884315
Improve info() function in cipher_aead_demo
...
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com >
2022-02-08 11:29:59 +01:00
64754e1b8d
Wrap long lines
...
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com >
2022-02-08 11:21:14 +01:00
340808ca67
Add comments on error codes
...
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com >
2022-02-08 11:15:26 +01:00
48bae0295c
Avoid hardcoding a size
...
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com >
2022-02-08 11:14:58 +01:00
cf99beb8fe
Improve naming consistency
...
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com >
2022-02-08 10:54:26 +01:00
6f20595b6e
Merge pull request #5462 from gilles-peskine-arm/ssl-test-pkey-message-clarity
...
Clarify key types message from ssl_client2 and ssl_server2
2022-02-03 11:33:03 +01:00
1ab2d6966c
Merge pull request #5385 from AndrzejKurek/use-psa-crypto-reduced-configs
...
Resolve problems with reduced configs using USE_PSA_CRYPTO
2022-02-02 10:20:26 +01:00
f6ea19c66c
Work around bug in PSA_MAC_LENGTH()
...
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com >
2022-02-01 13:08:21 +01:00
12ec5719e7
Fix bug in md_hmac_demo
...
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com >
2022-02-01 09:47:46 +01:00
29088a4146
Avoid duplicate program names
...
Visual Studio and CMake didn't like having targets with the same name,
albeit in different directories.
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com >
2022-02-01 09:38:26 +01:00
6fdc9e8df1
Move aead_non_psa out of the psa/ directory
...
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com >
2022-02-01 09:29:13 +01:00
cc50f1be43
Fix copypasta
...
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com >
2022-01-31 22:53:30 +01:00
69bb3f5332
Move hmac_non_psa out of psa/ directory
...
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com >
2022-01-31 13:09:47 +01:00
248b385f1b
Add comments to AEAD (non-PSA) examples
...
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com >
2022-01-31 12:56:39 +01:00
6349794648
Demonstrate better practices in HMAC examples
...
- avoid hardcoded sizes when there's a macro for that
- avoid mutable global variables
- zeroize potentially-sensitive local buffer on exit
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com >
2022-01-31 12:30:02 +01:00
f392a02c50
Add comments to the HMAC (non-)PSA examples
...
Also clean up / align the structure on existing examples.
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com >
2022-01-31 12:06:07 +01:00
fd1d13c8bd
Avoid requiring too much C99 support
...
MSVC 2013, still supported and used in our CI, did not support that.
aead_psa.c(78): error C2099: initializer is not a constant
aead_psa.c(168): error C2057: expected constant expression
aead_psa.c(168): error C2466: cannot allocate an array of constant size 0
aead_psa.c(168): error C2133: 'out' : unknown size
aead_psa.c(169): warning C4034: sizeof returns 0
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com >
2022-01-28 12:52:35 +01:00
7d5ef1731b
Split aead_cipher_psa
...
Same as previous commit
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com >
2022-01-28 12:49:37 +01:00
edf6e83cbc
Split hmac_md_psa.c
...
Having two programs might make comparison easier, and will make it
easier to people to use just the PSA one as an example.
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com >
2022-01-27 12:36:39 +01:00
1a45c713f0
Fix cleanup code
...
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com >
2022-01-27 12:22:28 +01:00
3aae30c224
Use PSA macros for buffer sizes
...
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com >
2022-01-27 12:11:49 +01:00
beef9c231c
Use better names for dummy data
...
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com >
2022-01-27 12:11:49 +01:00
428a97ed47
Improve option names
...
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com >
2022-01-27 11:36:03 +01:00
0e725c33d4
Improve introductory comments.
...
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com >
2022-01-27 11:35:05 +01:00
05bf89da34
Clarify key types message from ssl_client2 and ssl_server2
...
If no key is loaded in a slot, say "none", not "invalid PK".
When listing two key types, use punctuation that's visibly a sequence
separator (",").
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com >
2022-01-25 17:50:25 +01:00
11f0a9c2c4
fix deprecated-declarations error
...
replace sig_hashes with sig_alg
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com >
2022-01-25 12:46:17 +08:00
fcca7cfa97
Merge pull request #5428 from gstrauss/mbedtls_ssl_ciphersuite
...
Add accessors for ciphersuite info
2022-01-24 11:13:31 +01:00
ff743a7f38
Merge pull request #5425 from gabor-mezei-arm/5181_tls_cipher_extend_testing_of_tickets
...
TLS Cipher 1a: extend testing of tickets
2022-01-24 10:25:29 +01:00
6eef56392a
Add tests for accessors for ciphersuite info
...
Signed-off-by: Glenn Strauss <gstrauss@gluelogic.com >
2022-01-23 08:37:02 -05:00
7a58d5283b
Add missing dependencies on MBEDTLS_KEY_EXCHANGE_SOME_PSK_ENABLED
...
Fix dependencies across test ssl programs.
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com >
2022-01-19 12:34:02 -05:00
aab5258b7a
Avoid using %zu, not supported everywhere yet.
...
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com >
2022-01-19 10:28:32 +01:00
24e82ded79
Fix type of temporary variable
...
Both functions use int. Using size_t results is a warning from MSVC.
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com >
2022-01-18 09:29:41 +01:00
763641a3f5
Rm use of non-standard __func__ in example programs
...
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com >
2022-01-17 11:58:54 +01:00
9efbf53f0e
Declare incompatibility in new programs
...
Existing example programs in this directory are already incompatible
with that option, so this is probably acceptable here too.
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com >
2022-01-17 11:57:44 +01:00
ecffd96910
Silence compiler warning in example program
...
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com >
2022-01-14 13:23:54 +01:00