Gilles Peskine
afb482897b
Merge pull request #5292 from mprse/asym_encrypt
...
Driver dispatch for PSA asymmetric encryption + RSA tests
2022-03-10 20:07:38 +01:00
Przemek Stekiel
b6bdebde5e
asymmetric_encrypt: handle forced output
...
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
2022-03-08 10:32:18 +01:00
Gilles Peskine
c9c967c812
Fix RSA sanity checks for asymmetric_encrypt
...
* Remove expected_output_data: since asymmetric encryption is randomized,
it can't be useful.
* The decryption check needs the private exponent, not the public exponent.
* Use PSA macro for the expected ciphertext buffer size.
* Move RSA sanity checks to their own function for clarity.
* For RSAES-PKCS1-v1_5, check that the result of the private key operation
has the form 0x00 0x02 ... 0x00 M where M is the plaintext.
* For OAEP, check that the result of the private key operation starts with
0x00. The rest is the result of masking which it would be possible to
check here, but not worth the trouble of implementing.
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2022-03-07 21:18:37 +01:00
Przemek Stekiel
72373f3819
WIP: Add asymmetric_encrypt test case
...
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
2022-03-07 16:48:18 +01:00
Przemek Stekiel
7a58208809
Change names rsa->asymmetric_encryption
...
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
2022-03-07 10:49:04 +01:00
Przemek Stekiel
38df86cc6c
Simplyfy asymmetric_decrypt() test function
...
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
2022-03-02 09:11:04 +01:00
Przemyslaw Stekiel
d9fa99917e
Extend test coverage for transparent driver decryption.
...
Encryption is not deterministic and can not be verified by a know-answer test.
Encryption is already verified via encrypt-decrypt test.
Signed-off-by: Przemyslaw Stekiel <przemyslaw.stekiel@mobica.com>
2022-02-22 09:36:35 +01:00
Ronald Cron
6a0b1ef27e
Merge pull request #5282 from AndrzejKurek/import-opaque-driver-wrappers
...
Add tests for an opaque import in the driver wrappers
2022-02-07 11:14:43 +01:00
Andrzej Kurek
ba4cadef14
Test drivers: rename import call source to driver location
...
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2022-02-03 10:27:01 -05:00
Andrzej Kurek
333e0fac1d
Formatting and documentation fixes
...
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2022-02-03 09:42:47 -05:00
Przemyslaw Stekiel
daaf38b178
Remove multipart part from mac_verify test case
...
Signed-off-by: Przemyslaw Stekiel <przemyslaw.stekiel@mobica.com>
2022-01-21 09:37:49 +01:00
Przemyslaw Stekiel
6ec59f817f
Add mac_verify_multipart test case + test data
...
Signed-off-by: Przemyslaw Stekiel <przemyslaw.stekiel@mobica.com>
2022-01-21 09:37:49 +01:00
Przemyslaw Stekiel
1af1983352
Remove multipart part from mac_sign test case
...
Signed-off-by: Przemyslaw Stekiel <przemyslaw.stekiel@mobica.com>
2022-01-21 09:37:49 +01:00
Przemyslaw Stekiel
f47b8d39a4
Add mac_sign_multipart test case + test data
...
Signed-off-by: Przemyslaw Stekiel <przemyslaw.stekiel@mobica.com>
2022-01-21 09:37:49 +01:00
Przemyslaw Stekiel
0a875ef2d7
Add driver PSA_ALG_RSA_OAEP tests for asymmetric encrypt/decrypt
...
Signed-off-by: Przemyslaw Stekiel <przemyslaw.stekiel@mobica.com>
2022-01-10 12:55:06 +01:00
Przemyslaw Stekiel
eed991bf4e
Add driver dispatch tests for RSA message verify
...
Tested algs:
PSA_ALG_RSA_PKCS1V15_SIGN(PSA_ALG_SHA_256)
PSA_ALG_RSA_PSS(PSA_ALG_SHA_256)
PSA_ALG_RSA_PSS_ANY_SALT(PSA_ALG_SHA_256)
Signed-off-by: Przemyslaw Stekiel <przemyslaw.stekiel@mobica.com>
2022-01-10 12:55:06 +01:00
Przemyslaw Stekiel
66ed8d680f
Add driver dispatch tests for RSA message sign
...
Tested algs:
PSA_ALG_RSA_PKCS1V15_SIGN(PSA_ALG_SHA_256)
Signed-off-by: Przemyslaw Stekiel <przemyslaw.stekiel@mobica.com>
2022-01-10 12:55:06 +01:00
Przemyslaw Stekiel
d06e927325
Add driver dispatch tests for RSA hash verify
...
Signed-off-by: Przemyslaw Stekiel <przemyslaw.stekiel@mobica.com>
2022-01-10 12:55:06 +01:00
Przemyslaw Stekiel
9b52a15872
Add driver dispatch tests for RSA hash sign
...
Tested key types:
PSA_ALG_RSA_PKCS1V15_SIGN_RAW
PSA_ALG_RSA_PKCS1V15_SIGN(PSA_ALG_SHA_256)
Signed-off-by: Przemyslaw Stekiel <przemyslaw.stekiel@mobica.com>
2022-01-10 12:55:06 +01:00
Przemyslaw Stekiel
de13365cf6
test_suite_psa_crypto_driver_wrappers.function: trim trailing whitespace
...
Signed-off-by: Przemyslaw Stekiel <przemyslaw.stekiel@mobica.com>
2022-01-10 12:55:06 +01:00
Przemyslaw Stekiel
06a9fee67d
Add driver tests for asymmetric encrypt/decrypt
...
Signed-off-by: Przemyslaw Stekiel <przemyslaw.stekiel@mobica.com>
2022-01-10 12:55:06 +01:00
Andrzej Kurek
dc137252a1
Add tests for an opaque import in the driver wrappers
...
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2022-01-03 14:26:50 +01:00
Ronald Cron
8188d19b0e
Merge branch 'development-restricted' into mbedtls-3.1.0rc-pr
2021-12-14 10:58:18 +01:00
Manuel Pégourié-Gonnard
39c2aba920
Merge pull request #849 from ronald-cron-arm/fix-cipher-iv
...
Avoid using encryption output buffer to pass generated IV to PSA driver
2021-12-08 13:30:06 +01:00
Ronald Cron
40e46cf89c
tests: psa: Remove wrong test function dependencies
...
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2021-12-03 18:55:33 +01:00
Ronald Cron
13ed5c1c05
test: psa driver wrapper: Add non regression test for psa_cipher_encrypt()
...
Add non regression test for invalid usage of
the output buffer in psa_cipher_encrypt().
The output buffer should not be used to pass
the IV to the driver as a local attacker could
be able to control the used IV.
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2021-11-26 15:46:20 +01:00
Ronald Cron
c60772c5d9
test: psa driver wrapper: Add cipher_encrypt negative testing
...
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2021-11-26 15:46:20 +01:00
Ronald Cron
2d75cd72da
test: psa driver wrapper: Add non regression test for psa_cipher_generate_iv()
...
Add non regression test for invalid usage of
the output buffer in psa_cipher_generate_iv().
The output buffer should not be used to pass
the IV to the driver as a local attacker could
be able to control the used IV.
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2021-11-26 15:46:20 +01:00
Paul Elliott
71b0567c87
Merge remote-tracking branch 'upstream/development' into psa-m-aead-merge
...
Also fiixed the following merge problems:
crypto_struct.h : Added MBEDTLS_PRIVATE to psa_aead_operation_s
members (merge conflict)
psa_crypto_aead.c : Added ciphertext_length to mbedtls_gcm_finish
call (change of API during development)
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2021-09-24 11:18:13 +01:00
gabor-mezei-arm
95aad8378c
Unify multipart cipher operation tester functions
...
Signed-off-by: gabor-mezei-arm <gabor.mezei@arm.com>
2021-06-29 19:55:24 +02:00
gabor-mezei-arm
50c86cfe79
Remove duplicated tests
...
Signed-off-by: gabor-mezei-arm <gabor.mezei@arm.com>
2021-06-29 19:49:01 +02:00
gabor-mezei-arm
2b231fc81b
Test struct initialization
...
Modify tests to test mbedtls_psa_cipher_operation_t,
mbedtls_transparent_test_driver_cipher_operation_t and
mbedtls_opaque_test_driver_cipher_operation_t struct initialization macros.
Signed-off-by: gabor-mezei-arm <gabor.mezei@arm.com>
2021-06-29 19:49:00 +02:00
gabor-mezei-arm
93ad276c29
Add test for one-shot cipher driver wrapper functions
...
Signed-off-by: gabor-mezei-arm <gabor.mezei@arm.com>
2021-06-29 19:48:59 +02:00
Paul Elliott
e24f1a1a9d
Fix missed driver wrapper tests
...
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2021-06-24 14:39:05 +01:00
Ronald Cron
fb01081212
psa: mac: Add driver dispatch tests for psa_mac_verify
...
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2021-06-21 09:19:22 +02:00
Ronald Cron
094b06a572
psa: mac: Add driver dispatch tests for psa_mac_compute
...
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2021-06-21 09:19:22 +02:00
gabor-mezei-arm
07a35f68ee
Update key type name
...
Signed-off-by: gabor-mezei-arm <gabor.mezei@arm.com>
2021-05-13 16:27:46 +02:00
gabor-mezei-arm
ce8804fd6e
Update tests dependencies
...
Signed-off-by: gabor-mezei-arm <gabor.mezei@arm.com>
2021-05-13 11:19:00 +02:00
gabor-mezei-arm
4fabc5666b
Use non-deterministic ecdsa algorithm for verify_hash/message tests
...
Signed-off-by: gabor-mezei-arm <gabor.mezei@arm.com>
2021-05-13 11:18:59 +02:00
gabor-mezei-arm
6dcaa3b5a1
Update driver tests for psa_hash/verify_message
...
Signed-off-by: gabor-mezei-arm <gabor.mezei@arm.com>
2021-05-13 11:18:59 +02:00
gabor-mezei-arm
816886c8f3
Add driver tests for sign/verify_message
...
Adopting the tests for sign/verify_hash.
The expected ouput data was created with python-ecdsa.
Signed-off-by: gabor-mezei-arm <gabor.mezei@arm.com>
2021-05-13 11:18:58 +02:00
gabor-mezei-arm
2fcb393ebd
Rename driver test funtions and test cases
...
Modify function and test case names that testing psa_sign_hash and
psa_verify_hash funtions to be less confusing with the newly introduced
function and test case names which tests psa_sign_message and
psa_verify_message functions.
Signed-off-by: gabor-mezei-arm <gabor.mezei@arm.com>
2021-05-13 11:18:57 +02:00
Steven Cooreman
ae3ec52d8d
Apply mbedtls namespacing to MAC driver test hooks
...
Signed-off-by: Steven Cooreman <steven.cooreman@silabs.com>
2021-05-10 11:29:14 +02:00
Steven Cooreman
c7f0a576b6
Add testing of the MAC driver entry points
...
Signed-off-by: Steven Cooreman <steven.cooreman@silabs.com>
2021-05-07 23:33:50 +02:00
Ronald Cron
1153c3d4f3
tests: driver wrappers: Improve test comments
...
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2021-05-04 16:11:06 +02:00
Ronald Cron
3e4d190b4a
tests: driver wrappers: Add hash finish tests
...
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2021-05-01 18:49:21 +02:00
Ronald Cron
1fb49e6ee7
tests: driver wrappers: Add hash update tests
...
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2021-05-01 18:49:21 +02:00
Ronald Cron
6e12b7b50c
tests: driver wrappers: Specialize hash multi-part test on setup only
...
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2021-05-01 18:49:21 +02:00
Ronald Cron
ce1d8d2c4e
tests: Revert test_driver.h name change
...
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2021-05-01 18:49:15 +02:00
Ronald Cron
7f13fa2454
tests: psa: Add mbedtls/MBEDTLS prefix to test driver symbols
...
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2021-05-01 18:33:26 +02:00