Valerio Setti
c5d85e5ead
test: remove BIGNUM dependencies from pk[parse/write] suites
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-08-10 06:43:23 +02:00
Tom Cosgrove
0540fe74e3
Fix code style
...
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
2023-07-27 14:17:27 +01:00
Tom Cosgrove
e4e9e7da58
For tests, rename TEST_BUFFERS_EQUAL() to TEST_MEMORY_COMPARE()
...
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
2023-07-21 11:45:25 +01:00
Tom Cosgrove
05b2a87ea0
For tests, rename TEST_CALLOC_OR_FAIL() to just TEST_CALLOC()
...
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
2023-07-21 11:32:25 +01:00
Tom Cosgrove
f9ffd11e7a
For tests, rename ASSERT_ALLOC() to TEST_CALLOC_OR_FAIL()
...
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
2023-07-20 16:51:21 +01:00
Tom Cosgrove
65cd8519f7
For tests, rename ASSERT_COMPARE() to TEST_BUFFERS_EQUAL()
...
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
2023-07-20 16:51:15 +01:00
valerio
f6853a8751
test: optimizing test_suite_pkwrite code
...
Signed-off-by: valerio <valerio.setti@nordicsemi.no>
2023-06-01 11:06:40 +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
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
14bfdbf908
test: update guards also for pkwrite and pkparse
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-04-24 13:53:21 +02:00
Valerio Setti
bf974b9b1c
test_suite_pkwrite: replace memcpy with memmove
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-04-24 10:26:24 +02:00
Valerio Setti
547b3a4ab5
fix typos
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-04-24 10:24:37 +02:00
Valerio Setti
7bacaf859a
fix new line difference in Windows
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-04-24 08:53:00 +02:00
Valerio Setti
2280895784
test: properly check written PEM buffer len
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-04-18 12:59:06 +02:00
Valerio Setti
15cac17da5
test: fix dependencies in DER and PEM tests
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-04-18 11:32:58 +02:00
Valerio Setti
c9cb5324b7
test: specify input file type through enum
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-04-18 11:20:36 +02:00
Valerio Setti
3401b306ab
test: use proper macros for checks
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-04-18 10:42:53 +02:00
Valerio Setti
c60bc5e700
test: add support for DER format in pkwrite tests
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-04-17 18:43:06 +02:00
Valerio Setti
8959095e87
test: memory footprint optimization for pkwrite tests
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-04-17 17:34:42 +02:00
Gilles Peskine
449bd8303e
Switch to the new code style
...
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-01-11 14:50:10 +01:00
Manuel Pégourié-Gonnard
84dea01f36
Add RNG params to private key parsing
...
This is necessary for the case where the public part of an EC keypair
needs to be computed from the private part - either because it was not
included (it's an optional component) or because it was compressed (a
format we can't parse).
This changes the API of two public functions: mbedtls_pk_parse_key() and
mbedtls_pk_parse_keyfile().
Tests and programs have been adapted. Some programs use a non-secure RNG
(from the test library) just to get things to compile and run; in a
future commit this should be improved in order to demonstrate best
practice.
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2021-06-17 09:38:38 +02:00
Paul Elliott
557b8d663a
Remove Extraneous bytes from buffer post pem write
...
In order to remove large buffers from the stack, the der data is written
into the same buffer that the pem is eventually written into, however
although the pem data is zero terminated, there is now data left in the
buffer after the zero termination, which can cause
mbedtls_x509_crt_parse to fail to parse the same buffer if passed back
in. Patches also applied to mbedtls_pk_write_pubkey_pem, and
mbedtls_pk_write_key_pem, which use similar methods of writing der data
to the same buffer, and tests modified to hopefully catch any future
regression on this.
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2020-12-07 17:29:42 +00:00
Hanno Becker
19d858e8e6
Add dependency of pkwrite test suite on pkparse module
2018-10-16 13:46:25 +01:00
Azim Khan
f1aaec9888
Intermediate hexify out change
2018-08-06 11:40:57 +01:00
Manuel Pégourié-Gonnard
38db006e0c
Finish test in pkwrite
2015-08-19 10:24:34 +02:00
Manuel Pégourié-Gonnard
04b7eec539
Fix pkwrite test that were failing on mingw32
...
Apparently fread() writes some junk after the contents of the file. Don't look
at it.
2015-08-18 19:49:40 +02:00
Manuel Pégourié-Gonnard
2cf5a7c98e
The Great Renaming
...
A simple execution of tmp/invoke-rename.pl
2015-04-08 13:25:31 +02:00
Manuel Pégourié-Gonnard
7f8099773e
Rename include directory to mbedtls
2015-03-10 11:23:56 +00:00
Rich Evans
ce2f237697
change test function includes to use one convention
2015-02-10 11:28:46 +00:00
Paul Bakker
bd51b262d1
Add 'exit' label and variable initialization to relevant test suite functions
2014-07-10 16:37:50 +02:00
Manuel Pégourié-Gonnard
f9378d8f11
Fix dependencies on PEM in tests and programs
2014-06-24 13:11:25 +02:00
Paul Bakker
8a0c0a9ed9
Check additional return values in some test cases
2014-04-17 17:24:23 +02:00
Paul Bakker
4606c7317b
Added POLARSSL_PK_PARSE_C and POLARSSL_PK_WRITE_C
2013-09-15 17:04:23 +02:00
Paul Bakker
428b9ba3b7
Moved POLARSSL_FS_IO check to .function from .data
2013-09-15 15:20:37 +02:00
Paul Bakker
c7bb02be77
Moved PK key writing from X509 module to PK module
2013-09-15 14:54:56 +02:00