Gilles Peskine
46476e04f4
Support (void) as an argument list of a test function
...
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-04-28 13:19:30 +02:00
Gilles Peskine
f153c5676b
parse_function_arguments: extract per-argument function
...
Internal refactoring only, no behavior change.
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-04-28 13:19:30 +02:00
Gilles Peskine
3a37f19e31
parse_function_arguments: make local_vars a list
...
Internal refactoring only, no behavior change.
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-04-28 13:19:30 +02:00
Gilles Peskine
9ad7bd3060
Support different types in the parameter store
...
The test framework stores size_t and int32_t values in the parameter store
by converting them all to int. This is ok in practice, since we assume int
covers int32_t and we don't have test data larger than 2GB. But it's
confusing and error-prone. So make the parameter store a union, which allows
size_t values not to be potentially truncated and makes the code a little
clearer.
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-04-28 13:19:30 +02:00
Gilles Peskine
a299043d58
Simplify parsing of integers in .datax files
...
In the .datax parser, since we're calling strtol() anyway, rely on it for
verification. This makes the .datax parser very slightly more
liberal (leading spaces and '+' are now accepted), and changes the
interpretation of numbers with leading zeros to octal.
Before, an argument like :0123: was parsed as decimal, but an argument like
:0123+1: was parsed as a C expression and hence the leading zero marked an
octal representation. Now, a leading zero is always interpreted according to
C syntax, namely indicating octal. There are no nonzero integer constants
with a leading zero in a .data file, so this does not affect existing test
cases.
In the .datax generator, allow negative arguments to be 'int' (before, they
were systematically treated as 'exp' even though they didn't need to be).
In the .datax parser, validate the range of integer constants. They have to
fit in int32_t. In the .datax generator, use 'exp' instead of 'int' for
integer constants that are out of range.
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-04-28 13:19:30 +02:00
Gilles Peskine
242b05b7b6
Exercise string parsing in the test framework
...
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-04-28 13:19:30 +02:00
Gilles Peskine
1780875e9b
Simplify string escapes
...
Treat backslash as a universal escape character: "\n" is a newline,
backslash escapes any non-alphanumeric character.
This affects some test cases that had "\," standing for backslash-comma.
With the new uniform treatment of backslashes, this needs to be "\\,".
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-04-28 13:19:30 +02:00
Gilles Peskine
ab56a6952b
Factor get_function_info out of gen_from_test_data
...
No intended behavior change. This commit is mainly to satisfy pylint, which
complains that gen_from_test_data now has too many variables. But it's a
good thing anyway to make the function a little more readable.
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-04-28 13:19:30 +02:00
Gilles Peskine
f122aedb81
Add line number to a few error messages
...
This is just a quick improvement, not meant to tackle the problem as a
whole.
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-04-28 13:19:30 +02:00
Gilles Peskine
13e836a508
printf testing: exercise integer parsing in the test framework
...
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-04-28 13:19:30 +02:00
Gilles Peskine
af2fc50b76
Remove stdint.h substitute for older MSVC
...
We now require at least Visual Studio 2013, which has stdint.h per
https://learn.microsoft.com/en-us/previous-versions/visualstudio/visual-studio-2013/y4hta57s(v=vs.120)
so the workaround to define C99 types on pre-C99 MSVC is no longer needed.
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-04-28 13:19:30 +02:00
Gilles Peskine
404923e15c
Remove declarations of the nonstandard function strcasecmp
...
It is no longer used.
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-04-28 13:19:27 +02:00
Gilles Peskine
a31c6eb509
Merge pull request #7488 from mprse/psa_init_in_programs_backport
...
Backport 2.28: Init PSA in ssl and x509 programs
2023-04-28 12:49:07 +02:00
Valerio Setti
8388fddfdc
test: use define for initializing ssl_message_queue struct
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-04-28 12:27:14 +02:00
Valerio Setti
89ae9b6c3f
test: fix USE_PSA_INIT position in test_suite_ssl
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-04-28 09:38:55 +02:00
Dave Rodgman
96074b1978
Merge pull request #7510 from daverodgman/fix-psa-aead-chacha20-test-dependency-2.28
2023-04-27 19:14:06 +01:00
Stephan Koch
771552d471
Fix PSA AEAD ChaCha20 test dependency.
...
Signed-off-by: Stephan Koch <koch@oberon.ch>
2023-04-27 15:41:41 +01:00
Valerio Setti
d64e2493e1
test: update guards also for pkwrite and pkparse
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-04-27 12:02:09 +02:00
Valerio Setti
57456b343e
test: fix max value in test_mx32
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-04-27 11:55:05 +02:00
valerio
5346ef5601
test: minor fix for non-initialized variable
...
Signed-off-by: valerio <valerio.setti@nordicsemi.no>
2023-04-27 11:54:48 +02:00
Valerio Setti
44570a5b66
test: fix USE_PSA_INIT/DONE for SSL test suite
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-04-27 11:44:32 +02:00
Valerio Setti
e7373a8a0f
test: fix USE_PSA_INIT/DONE for x509 test suite
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-04-27 11:37:58 +02:00
Valerio Setti
19c8196212
test: fix USE_PSA_INIT/DONE for PK test suite
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-04-27 11:30:37 +02:00
Gilles Peskine
f549d9cb59
Stop supporting non-canonical case in mpi_write_string test data
...
We're using the non-standard function strcasecmp() just so that the case
of digits beyond 9 can be different in the library and in the test data.
Use matching case in the test data, and use a standard function for the
comparison.
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-04-26 22:51:10 +02:00
Gilles Peskine
366e6859e3
Remove mbedtls_ prefix from bignum test cases
...
Align 2.28 with development to make backports easier.
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-04-26 22:51:10 +02:00
Tom Cosgrove
503f487cbe
Merge pull request #7469 from xkqian/2.28/bignumber_update_comments
...
Backport 2.28: Update links of references in bignum code
2023-04-26 16:22:09 +01:00
Przemek Stekiel
44f2694ad7
Fix code-style
...
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
2023-04-25 12:00:18 +02:00
Przemek Stekiel
d4d049b88f
Add guards for mbedtls_psa_crypto_free()
...
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
2023-04-25 12:00:07 +02:00
Przemek Stekiel
8fa17b64f2
Init PSA in fuzz programs
...
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
2023-04-25 11:46:33 +02:00
Przemek Stekiel
9dd2167ea4
Add changelog entry (PSA initialization in sample programs)
...
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
2023-04-25 11:41:16 +02:00
Przemek Stekiel
9c0fc2ddbe
Init PSA in pkey programs
...
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
2023-04-25 11:41:01 +02:00
Przemek Stekiel
c4ddf92986
Free psa crypto at the end of programs when initialized
...
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
2023-04-25 11:37:51 +02:00
Przemek Stekiel
af48f3cf8e
Remove print from mini_client
...
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
2023-04-25 11:37:51 +02:00
Przemek Stekiel
b00688fb14
Move psa_crypto_init() after other init calls
...
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
2023-04-25 11:37:51 +02:00
Przemek Stekiel
0c9d048d26
cert_app: init entropy unconditionally
...
When mbedtls_entropy_free() is called without mbedtls_entropy_init() entropy is uninitialized and contains garbage which may lead to segmentation fault.
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
2023-04-25 11:37:00 +02:00
Przemek Stekiel
d381d2d5fc
Init PSA in ssl and x509 programs
...
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
2023-04-25 11:36:41 +02:00
Janos Follath
b5b0649e77
Merge pull request #7470 from xkqian/2.28/bignumber_ecp_update
...
Backport 2.28: Update gen_prvkey_mx paras to align with comments and c code
2023-04-24 13:44:25 +01:00
Manuel Pégourié-Gonnard
c14776c590
Merge pull request #7456 from valeriosetti/issue7446-backport
...
Backport: Clean up & improve PK write test functions
2023-04-24 13:05:21 +02:00
Valerio Setti
a4d460c99c
test_suite_pkwrite: replace memcpy with memmove
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-04-24 10:47:42 +02:00
Valerio Setti
755582b297
fix typos
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-04-24 10:47:36 +02:00
Valerio Setti
3b608de6f3
fix new line difference in Windows
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-04-24 10:47:31 +02:00
Xiaokang Qian
8738bc46e3
Update gen_prvkey_mx paras to align with comments and c code
...
Signed-off-by: Xiaokang Qian <xiaokang.qian@arm.com>
2023-04-21 10:29:17 +00:00
Xiaokang Qian
0e5a27b640
Update links of references in bignum code
...
Signed-off-by: Xiaokang Qian <xiaokang.qian@arm.com>
2023-04-21 09:58:07 +00:00
Valerio Setti
f1477da185
test: pkwrite: backport of issue 7446
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-04-18 16:58:22 +02:00
Dave Rodgman
e323fb3ab5
Merge pull request #7409 from yanesca/lts-lifetime-clarification-2.28
...
[Backport 2.28] Clarify LTS lifetime
2023-04-17 18:18:25 +01:00
Janos Follath
205c5081d5
Update BRANCHES.md
...
Co-authored-by: Dave Rodgman <dave.rodgman@arm.com>
Signed-off-by: Janos Follath <janos.follath@arm.com>
2023-04-11 15:21:34 +01:00
Janos Follath
f462d20713
BRANCHES.md: improve wording
...
Co-authored-by: Gilles Peskine <gilles.peskine@arm.com>
Signed-off-by: Janos Follath <janos.follath@arm.com>
2023-04-11 10:15:13 +01:00
Gilles Peskine
b76bcfb228
Merge pull request #7332 from yanrayw/2.28_7285-followup-of-PR6500
...
Backport 2.28: 6500 follow-up: enhancements to the new ssl_helpers test module #7287
2023-04-11 09:31:41 +02:00
Janos Follath
36c66a87d7
Clarify LTS lifetime
...
Signed-off-by: Janos Follath <janos.follath@arm.com>
2023-04-05 15:54:10 +01:00
Dave Rodgman
83faeca597
Merge pull request #7386 from daverodgman/timing_alignment-2.28
...
Backport 2.28 - Timing alignment
2023-03-31 19:48:19 +01:00