Xiaokang Qian
c81272461e
Check all of the limbs of result
...
Signed-off-by: Xiaokang Qian <xiaokang.qian@arm.com>
2023-05-17 10:02:52 +00:00
Xiaokang Qian
1ae7ca435b
Re-order the variable orders and rename them
...
Signed-off-by: Xiaokang Qian <xiaokang.qian@arm.com>
2023-05-17 10:02:52 +00:00
Xiaokang Qian
78b93b1902
Refine error check for mbedtls_ecp_modulus_setup
...
Signed-off-by: Xiaokang Qian <xiaokang.qian@arm.com>
2023-05-17 10:02:52 +00:00
Xiaokang Qian
afdea64b50
Remove the useless modulus validaty
...
Signed-off-by: Xiaokang Qian <xiaokang.qian@arm.com>
2023-05-17 10:02:52 +00:00
Xiaokang Qian
631f63d29d
Remove modulus double free
...
Signed-off-by: Xiaokang Qian <xiaokang.qian@arm.com>
2023-05-17 10:02:52 +00:00
Xiaokang Qian
d3e86a170a
Add back 255 bit test data for SECP224K1 test cases
...
Signed-off-by: Xiaokang Qian <xiaokang.qian@arm.com>
2023-05-17 10:02:52 +00:00
Xiaokang Qian
5b6bedfaf3
Add comments to the data file for the cureve secp224k1
...
Signed-off-by: Xiaokang Qian <xiaokang.qian@arm.com>
2023-05-17 10:02:52 +00:00
Xiaokang Qian
424da8aa36
Revert to 224bit random data no need leading bit "1"
...
Signed-off-by: Xiaokang Qian <xiaokang.qian@arm.com>
2023-05-17 10:02:52 +00:00
Xiaokang Qian
b7f9950234
Increase bit size to 225 for SECP224K1 test cases
...
Signed-off-by: Xiaokang Qian <xiaokang.qian@arm.com>
2023-05-17 10:02:52 +00:00
Xiaokang Qian
86cb08ba27
Add comments about how the mod_inv data is generated
...
Signed-off-by: Xiaokang Qian <xiaokang.qian@arm.com>
2023-05-17 10:02:52 +00:00
Xiaokang Qian
d244c83dfe
Update ecp mul_inv test cases
...
Signed-off-by: Xiaokang Qian <xiaokang.qian@arm.com>
2023-05-17 10:02:52 +00:00
Xiaokang Qian
e4dc798b59
Change coding styles of white space
...
Signed-off-by: Xiaokang Qian <xiaokang.qian@arm.com>
2023-05-17 10:02:52 +00:00
Xiaokang Qian
8ca64374b1
Tidy up ecp mul_inv_test code
...
Signed-off-by: Xiaokang Qian <xiaokang.qian@arm.com>
2023-05-17 10:02:52 +00:00
Xiaokang Qian
3d0c2be8c2
Add ecp test cases for mont mul and inv after named moduli setup
...
Signed-off-by: Xiaokang Qian <xiaokang.qian@arm.com>
2023-05-17 10:02:52 +00:00
Xiaokang Qian
5e25f80d8a
Add ecp test function for mont mul and inv
...
Signed-off-by: Xiaokang Qian <xiaokang.qian@arm.com>
2023-05-17 10:02:52 +00:00
Przemek Stekiel
da97ad9f14
Use valid MD5 dependency for test
...
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
2023-05-17 09:26:42 +02:00
Gilles Peskine
ff7a346201
Merge pull request #7416 from bharsaklemukesh975/update-pkparse-tests-to-use-AES
...
Updating test-ca.key to use AES instead of DES
2023-05-16 19:15:16 +02:00
Gilles Peskine
63df4ec3ca
Merge pull request #7589 from daverodgman/pr4990
...
Replace references to Mbed Crypto (rebase)
2023-05-16 19:14:51 +02:00
Paul Elliott
4fa8334bae
Convert curve 448 to use ecp core functions
...
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2023-05-16 17:51:48 +01:00
Paul Elliott
f0806bee66
Merge pull request #7489 from minosgalanakis/ecp/7246_xtrack_core_shift_l
...
[Bignum]: Introduce left shift from prototype
2023-05-16 17:13:19 +01:00
Gabor Mezei
03558b847e
Add _raw
function to P256K1
...
Modified the testing to use the generic fast reduction test function.
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2023-05-16 17:30:03 +02:00
Gabor Mezei
e42bb6294e
Add _raw
function to P224K1
...
Modified the testing to use the generic fast reduction test function.
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2023-05-16 17:30:03 +02:00
Gabor Mezei
dacfe56370
Add _raw
function to P192K1
...
Modified the testing to use the generic fast reduction test function.
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2023-05-16 17:29:57 +02:00
Przemek Stekiel
69482f9499
Add test to cover memory leak in authorityCertIssuer case
...
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
2023-05-16 10:33:02 +02:00
Paul Elliott
926bcb04fe
Merge pull request #7532 from AndrzejKurek/remove-leading-zeroes-ip-parsing
...
Disallow leading zeroes when parsing IPv4 addresses
2023-05-15 13:59:10 +01:00
Paul Elliott
aba165b58c
Merge pull request #7586 from gilles-peskine-arm/gitignore-objects-at-root
...
Ignore *.o everywhere
2023-05-15 13:57:24 +01:00
Valerio Setti
77a75685ed
pk: align library and tests code to the new internal functions
...
Note = programs are not aligned to this change because:
- the original mbedtls_pk_ec is not ufficially deprecated
- that function is used in tests when ECP_C is defined, so
the legacy version of that function is available in that
case
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-05-15 11:18:46 +02:00
Fredrik Hesse
cc207bc379
Replace references to Mbed Crypto with Mbed TLS through-out documentation and comments.
...
Signed-off-by: Fredrik Hesse <fredrik@hesse.se>
2023-05-12 14:59:01 +01:00
Gilles Peskine
8075f76708
Ignore *.o everywhere
...
We don't commit *.o files anywhere, not even as test data. So ignore them
everywhere.
This resolves *.o files not being ignored under 3rdparty/p256-m.
Also remove a redundant ignore of *.exe in a subdirectory.
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-05-12 13:58:05 +02:00
Mukesh Bharsakle
4823d5ff0e
Merge branch 'Mbed-TLS:development' into update-pkparse-tests-to-use-AES
2023-05-10 12:35:19 +01:00
Manuel Pégourié-Gonnard
1d046fa0dd
Merge pull request #6010 from mprse/ffdh_import_export
...
FFDH 1, 2A, 2B: FFDH add support for import/export key, key agreement, key generation + tests
2023-05-10 11:40:54 +02:00
Pengyu Lv
a57f677474
cert_audit: Fix DER files missed from parsing
...
Signed-off-by: Pengyu Lv <pengyu.lv@arm.com>
2023-05-10 09:41:33 +08:00
Pengyu Lv
ee870a6e83
cert_audit: Remove merge_auditdata
...
We maintain a dict with unique AudiData objects
(AuditData with unique underlying X.509 objects).
We don't need merge_auditdata anymore.
Signed-off-by: Pengyu Lv <pengyu.lv@arm.com>
2023-05-10 09:41:33 +08:00
Pengyu Lv
e09d27e723
cert_audit: Use dictionary to store parsed AuditData
...
Signed-off-by: Pengyu Lv <pengyu.lv@arm.com>
2023-05-10 09:41:33 +08:00
Pengyu Lv
31e3d12be9
cert_audit: Output format improvement
...
We should print all the information for each objects
found every line. This makes it easy to analyze the
output.
Signed-off-by: Pengyu Lv <pengyu.lv@arm.com>
2023-05-10 09:41:33 +08:00
Pengyu Lv
13f2ef4949
cert_audit: Calculate identifier for X.509 objects
...
The identifier is calculated SHA1 hex string from
the DER encoding of each X.509 objects. It's useful
for finding out the identical X.509 objects.
Signed-off-by: Pengyu Lv <pengyu.lv@arm.com>
2023-05-10 09:41:33 +08:00
Pengyu Lv
fd72d9f556
cert_audit: Fix bug in check_cryptography_version
...
check_cryptography_version didn't provide helpful
message with Python < 3.6, because re.Match object
is not subscriptable.
Signed-off-by: Pengyu Lv <pengyu.lv@arm.com>
2023-05-10 09:41:33 +08:00
Pengyu Lv
0b4832bbf5
cert_audit: Sort the outputs by not_valid_after date
...
Signed-off-by: Pengyu Lv <pengyu.lv@arm.com>
2023-05-10 09:41:33 +08:00
Pengyu Lv
fe13bd3d0e
cert_audit: Merge audit_data for identical X.509 objects
...
Signed-off-by: Pengyu Lv <pengyu.lv@arm.com>
2023-05-10 09:41:33 +08:00
Pengyu Lv
e245c0c734
cert_audit: Support parsing file with multiple PEMs
...
Previously, if a file had multiple PEM objects, only
the first one would be parsed. This commit add the
support so that we could parse all the PEM objects
in the file.
Signed-off-by: Pengyu Lv <pengyu.lv@arm.com>
2023-05-10 09:41:33 +08:00
Bence Szépkúti
ddfd0a27df
Merge pull request #7399 from lpy4105/issue/7014/certificate-audit-script
...
cert_audit: Add test certificate date audit script
2023-05-09 13:10:01 +02:00
Gilles Peskine
97edeb4fb8
Merge pull request #6866 from mprse/extract-key-ids
...
Extracting SubjectKeyId and AuthorityKeyId in case of x509 V3 extensions v.2
2023-05-08 20:38:29 +02:00
Przemek Stekiel
67d3f52617
Use int instead uint in test function arguments
...
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
2023-05-08 11:15:59 +02:00
Przemek Stekiel
ed9fb78739
Fix parsing of KeyIdentifier (tag length error case) + test
...
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
2023-05-08 11:15:54 +02:00
Gilles Peskine
fca2d2b78c
Merge pull request #7555 from yuhaoth/pr/remove-delay-milliseconds-test
...
Remove delay milliseconds test to workaround randome platform-suite fail.
2023-05-07 20:34:44 +02:00
Jerry Yu
8beb25041e
fix wrong target detection
...
For mingw with `-std=c99`, WIN32 is not defined.
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-05-06 13:45:12 +08:00
Tom Cosgrove
ef468ea2ba
Merge pull request #6740 from xkqian/tls13_fix_unkown_pk_type
...
Remove useless debug log of pk type from test cases
2023-05-05 16:14:59 +01:00
Jerry Yu
484a9e138f
Remove delay milliseconds
test
...
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-05-05 17:03:29 +08:00
Valerio Setti
4f387ef277
pk: use better naming for the new key ID field
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-05-05 10:59:32 +02:00
Valerio Setti
048cd44f77
pk: fix library code for using the new opaque key solution
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-05-05 10:59:32 +02:00
Jethro Beekman
e3d98fcbf6
Add pkwrite tests for X25519/X448 DER
...
Signed-off-by: Jethro Beekman <jethro@fortanix.com>
2023-05-04 13:01:47 +02:00
Jethro Beekman
abbba5ed43
Add derive public test for X25519/X448
...
Signed-off-by: Jethro Beekman <jethro@fortanix.com>
2023-05-04 13:01:47 +02:00
Jethro Beekman
0167244be4
Read and write X25519 and X448 private keys
...
Signed-off-by: Jethro Beekman <jethro@fortanix.com>
Co-authored-by: Gijs Kwakkel <gijs.kwakkel@fortanix.com>
Signed-off-by: Gijs Kwakkel <gijs.kwakkel@fortanix.com>
2023-05-04 13:01:47 +02:00
Manuel Pégourié-Gonnard
e4072c00c8
Merge pull request #7548 from jethrogb/jb/mbedtls_pem_write_buffer
...
mbedtls_pem_write_buffer: Correctly report needed buffer size for all possible line lengths and counts
2023-05-04 12:54:56 +02:00
Paul Elliott
b6432832d0
Merge pull request #7490 from paul-elliott-arm/test_ecp_mod_p448
...
[Bignum] Add unit tests for ecp_mod_p448
2023-05-04 11:39:44 +01:00
Przemek Stekiel
2488afcd71
Add FFDH alg to test driver extensions
...
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
2023-05-04 10:29:05 +02:00
Gilles Peskine
2eff33cb6f
Merge pull request #6716 from gilles-peskine-arm/test-argument-types-union
...
Support larger integer test arguments
2023-05-04 10:05:20 +02:00
Jethro Beekman
2593ec4bee
Use TEST_EQUAL instead of TEST_ASSERT
...
Signed-off-by: Jethro Beekman <jethro@fortanix.com>
2023-05-03 17:47:29 +02:00
Jethro Beekman
3477a672b9
Fix cross-platform compilation issue
...
Signed-off-by: Jethro Beekman <jethro@fortanix.com>
2023-05-03 17:47:27 +02:00
Przemek Stekiel
8194285cf1
Fix parsing of authorityCertSerialNumber (use valid tags)
...
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
2023-05-03 16:19:16 +02:00
Jethro Beekman
746df88e90
mbedtls_pem_write_buffer: Correctly report needed buffer size for all possible line lengths and counts
...
Signed-off-by: Jethro Beekman <jethro@fortanix.com>
2023-05-03 15:30:49 +02:00
Manuel Pégourié-Gonnard
f57273c817
Merge pull request #7496 from valeriosetti/issue7480
...
Fix test gap in PK write: private (opaque) -> public
2023-05-03 12:39:49 +02:00
Gilles Peskine
d3ca5e5897
Merge pull request #7328 from mprse/ec-jpake-fix1
...
Fix the JPAKE driver interface for user+peer
2023-05-02 20:42:25 +02:00
Gilles Peskine
c70d9eab8a
Merge pull request #7412 from silabs-Kusumit/PBKDF2_implementation
...
PBKDF2: Implement input_integer
2023-05-02 20:41:23 +02:00
Valerio Setti
9a855f21aa
test: check for exact length of returned pub key
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-05-02 15:45:39 +02:00
Valerio Setti
f5451717af
test: optimize code for pk_write_public_from_private()
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-05-02 15:45:39 +02:00
Valerio Setti
84554e9830
test: use better naming for the newly introduced test function
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-05-02 15:45:39 +02:00
Valerio Setti
8820b57b6e
test: fix makefile for ec_pub.[der/pem] generation
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-05-02 15:45:39 +02:00
Valerio Setti
d860a79029
test: fix wrong private key file
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-05-02 15:45:39 +02:00
Valerio Setti
1751341b68
test: add test function for public key derivation starting from private one
...
Data test cases are also included in the commit.
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-05-02 15:45:39 +02:00
Valerio Setti
c8b7865612
test: align ec_pub public keyfile with its ec_prv.sec1 counterpart
...
This change affects:
- both PEM and DER files, since they contain the same public key
only in different formats
- "ec_pub.comp.pem" since it's the same as "ec_pub.pem" but in
compressed format
The makefile was also updated accordingly to reflect these
dependencies.
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-05-02 15:45:39 +02:00
Manuel Pégourié-Gonnard
f317df98ea
Merge pull request #7461 from valeriosetti/issue7460-part1
...
Fixing USE_PSA_INIT/DONE in SSL/X509/PK test suites
2023-05-02 10:44:13 +02:00
Kusumit Ghoderao
d60dfc0e43
Add test for parse_binary_string
...
Signed-off-by: Kusumit Ghoderao <Kusumit.Ghoderao@silabs.com>
2023-05-02 10:47:50 +05:30
Andrzej Kurek
6f400a376e
Disallow leading zeroes when parsing IPv4 addresses
...
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2023-05-01 06:23:42 -04:00
Gilles Peskine
14d6b1124b
Merge pull request #7419 from yuhaoth/test/random-time-test-fail
...
Workaround random `test_suite_platform` fail in time test
2023-04-28 13:17:31 +02:00
Valerio Setti
7c0f91be10
test: use define for initializing ssl_message_queue struct
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-04-28 12:20:34 +02:00
Przemek Stekiel
6d85afa0cc
Fix naming: FFDH key -> DH key and fix guard in psa_validate_key_type_and_size_for_key_generation
...
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
2023-04-28 11:42:17 +02:00
Valerio Setti
00a256f7b2
test: fix USE_PSA_INIT position in test_suite_ssl
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-04-28 09:37:35 +02:00
Kusumit Ghoderao
0f2f996b92
change binary_string_parser for big-endian input
...
Signed-off-by: Kusumit Ghoderao <Kusumit.Ghoderao@silabs.com>
2023-04-28 10:07:10 +05:30
Dave Rodgman
e93c90e881
Merge pull request #7433 from oberon-microsystems/fix-psa-aead-chacha20-test-dependency
2023-04-27 19:13:53 +01:00
Kusumit-Silabs
b6ad6823f0
Update tests/suites/test_suite_psa_crypto.function
...
Co-authored-by: Gilles Peskine <gilles.peskine@arm.com>
Signed-off-by: Kusumit-Silabs <89393006+silabs-Kusumit@users.noreply.github.com>
2023-04-27 22:42:19 +05:30
Kusumit Ghoderao
af0225e4de
change binary_string_parser for big-endian input
...
Signed-off-by: Kusumit Ghoderao <Kusumit.Ghoderao@silabs.com>
2023-04-27 20:06:58 +05:30
Kusumit Ghoderao
c6fdf1b683
Add tests with INPUT_INTEGER as key_type_arg
...
Signed-off-by: Kusumit Ghoderao <Kusumit.Ghoderao@silabs.com>
2023-04-27 17:03:20 +05:30
Kusumit Ghoderao
12e0b4b452
Use key_type_arg for determining input method
...
Remove input_types_arg variable in test function
Signed-off-by: Kusumit Ghoderao <Kusumit.Ghoderao@silabs.com>
2023-04-27 16:58:23 +05:30
Przemek Stekiel
4c0da51ee7
mbedtls_test_psa_exported_key_sanity_check: check for length equality for DH keys
...
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
2023-04-27 13:04:20 +02:00
Przemek Stekiel
2c9fc07cc4
Fix FFDH tests dependencies
...
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
2023-04-27 12:41:32 +02:00
Przemek Stekiel
2e7c33d530
Use import_with_data for testing FFDH invalid key length
...
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
2023-04-27 12:31:42 +02:00
Paul Elliott
16648be171
Add Curve 448 tests
...
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2023-04-26 22:23:27 +01:00
Gilles Peskine
b70c4e07d0
Adjust code style for pointer types and casts
...
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-04-26 19:59:28 +02:00
Gilles Peskine
2986accd20
typo
...
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-04-26 19:57:50 +02:00
Gilles Peskine
578613322a
Add test cases with a question mark
...
The test framework used to treat them specially (but no longer does). Add
these test cases as non-regression for how the test framework allows "?"
and especially "??" (which I think in the very distant path needed special
handling because the test data was embedded in a .c file, and thus ?? could
be interpreted as the prefix of a trigraph).
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-04-26 19:50:57 +02:00
Gilles Peskine
9a75131da1
Fix wrong comment
...
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-04-26 19:40:02 +02:00
Gilles Peskine
5472242b67
Explain the format argument expected by the test functions
...
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-04-26 19:40:02 +02:00
Gilles Peskine
fa83a7ec1e
Fix typos in test descriptions
...
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-04-26 19:40:02 +02:00
Gilles Peskine
8b32d20c50
Test the line number returned by parse_test_data
...
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-04-26 19:40:02 +02:00
Gilles Peskine
7768a8e0a6
Remove string hack for mbedtls_mpi_mod_int testing
...
Now that the test framework can pass arbitrary values of type
mbedtls_mpi_sint, just do that.
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-04-26 19:40:02 +02:00
Gilles Peskine
6f5082bf4d
Allow more signed integer types in test function arguments
...
Now that the C code supports the full range of intmax_t, allow any size of
signed integer type in the .data file parser.
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-04-26 19:40:02 +02:00
Gilles Peskine
872948cc72
Support larger integer test arguments: C part
...
Change the type of signed integer arguments from int32_t to intmax_t.
This allows the C code to work with test function arguments with a range
larger than int32_t. A subsequent commit will change the .datax generator
to support larger types.
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-04-26 19:40:02 +02:00
Gilles Peskine
4ea4ad082b
parse_function_arguments: stricter type parsing
...
Use normalization the equality comparisons instead of loose regular
expressions to determine the type of an argument of a test function.
Now declarations are parsed in a stricter way: there can't be ignored junk
at the beginning or at the end. For example, `long long unsigned int x`
was accepted as a test function argument (but not `long long unsigned x`),
although this was misleading since the value was truncated to the range of
int. Now only recognized types are accepted.
The new code is slightly looser in that it accepts `char const*` as well as
`const char*`.
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-04-26 19:40:02 +02:00
Gilles Peskine
47e2e8817d
Support (void) as an argument list of a test function
...
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-04-26 19:40:02 +02:00