Commit graph

7958 commits

Author SHA1 Message Date
Nir Sonnenschein
1c2a7ea4e2 Allow psa_asymmetric_verify and psa_asymmetric_encrypt to use public key only. 2018-09-05 12:44:17 +03:00
Nir Sonnenschein
d708260de4 add key policy enforcement implementation
add checks that keys have been set for the correct usage for asymmetric
functions.
2018-09-05 12:44:17 +03:00
Nir Sonnenschein
ca466c89b0 Set output length to safe value 2018-09-05 12:44:17 +03:00
Nir Sonnenschein
c460291714 Re-Add ECC verification code which was not properly merged in re-base. 2018-09-05 12:44:17 +03:00
Nir Sonnenschein
4db79eb36b Extract common code
Make code easier to maintain.
2018-09-05 12:44:17 +03:00
Nir Sonnenschein
717a040df5 Remove duplicate / unneeded code
1. remove duplicate function introduced by re-base
2. remove unneeded code
2018-09-05 12:44:17 +03:00
Nir Sonnenschein
d70bc48630 Fix test output size
1. set output size to safe value
2. set output size correctly
3. check correct length of actual output
2018-09-05 12:44:17 +03:00
Nir Sonnenschein
553b8f39e9 Fix test data
test data used incorrect clear-text length.
2018-09-05 12:44:17 +03:00
Nir Sonnenschein
72eca16afe Fix scenario test names
1. make all names unique
2. fix spacing issue in names
2018-09-05 12:44:17 +03:00
Gilles Peskine
723feffe15 Fix some errors in PSA_ASYMMETRIC_DECRYPT_OUTPUT_SIZE
A call to PSA_ASYMMETRIC_DECRYPT_OUTPUT_SIZE wouldn't even have
compiled. Fix some obvious errors. This is still untested.
2018-09-05 12:44:17 +03:00
Gilles Peskine
5b051bc608 Remove trailing whitespace
Only horizontal whitespace changes in this commit.
2018-09-05 12:44:12 +03:00
Gilles Peskine
ad44f11257 Merge remote-tracking branch 'psa/pr/54' into feature-psa 2018-09-05 12:41:53 +03:00
Gilles Peskine
6afe789d4c Finish renaming around PSA_ALG_IS_RSA_PKCS1V15
Now the code compiles. Some OAEP and PSS macros may still need to be fixed.
2018-09-05 12:41:53 +03:00
Gilles Peskine
d6125ca63b Merge remote-tracking branch 'psa/pr/24' into feature-psa 2018-09-05 12:41:53 +03:00
Gilles Peskine
a1cac84e83 Move AEAD tests just after cipher
Always adding things at the end tends to create merge conflicts.
Adding in the middle in this way makes the order more logical in
addition to avoiding conflicts.
2018-09-05 12:41:53 +03:00
Nir Sonnenschein
4f594eca40 remove check for key pair (public key should be enough for verification) 2018-09-05 12:41:53 +03:00
Nir Sonnenschein
7f5a31915b code fixes for internal code review:
1. change to correct error code
2. removed unneeded comment
2018-09-05 12:41:53 +03:00
Nir Sonnenschein
0f3bdbddee change RSA encryption tests compensate for random component in encryption. 2018-09-05 12:41:53 +03:00
Nir Sonnenschein
39e59144f6 added support for PKCSv1.5 signature verification and encryption/decryption and very basic tests. 2018-09-05 12:41:53 +03:00
Gilles Peskine
bb1072f642 Fix use of mbedtls_cipher_info_from_psa
One branch added an extra argument, the other branch added a call of
this function. Pass the extra argument on the code from the other
branch.
2018-09-05 12:41:52 +03:00
Gilles Peskine
3585596aec Document a few more macros 2018-09-05 12:41:52 +03:00
Gilles Peskine
84861a95ca Merge remote-tracking branch 'psa/psa-wrapper-apis-aead' into feature-psa 2018-09-05 12:41:52 +03:00
Gilles Peskine
154bd95131 psa_destroy_key: return SUCCESS on an empty slot
Do wipe the slot even if it doesn't contain a key, to erase any metadata.
2018-09-05 12:41:52 +03:00
Gilles Peskine
5e39dc96e0 New macro PSA_AEAD_TAG_SIZE, use it for PSA_AEAD_xxx_OUTPUT_SIZE 2018-09-05 12:41:52 +03:00
Gilles Peskine
71bb7b77f0 Switch PSA_HASH_FINAL_SIZE to PSA_HASH_SIZE
Make this macro work on derived algorithms as well (HMAC,
hash-and-sign, etc.).
2018-09-05 12:41:52 +03:00
Gilles Peskine
212e4d8f7c Improve documentation of PSA_AEAD_xxx_OUTPUT_SIZE 2018-09-05 12:41:52 +03:00
Gilles Peskine
65eb8588fe Expand the description of error codes 2018-09-05 12:41:52 +03:00
mohammad1603
3158564f08 add nonce as argument to the test function of encrypt/decrypt 2018-09-05 12:41:52 +03:00
mohammad1603
fc614b1e0e fix parentheses 2018-09-05 12:41:52 +03:00
mohammad1603
1347a73fbe fix macros documentation style. 2018-09-05 12:41:52 +03:00
mohammad1603
e109f21638 remove unnecessary check for block size 2018-09-05 12:41:52 +03:00
mohammad1603
a1d9801683 add slot validation 2018-09-05 12:41:52 +03:00
mohammad1603
e3cb8a8d8b return PSA_ERROR_BUFFER_TOO_SMALL intead of PSA_ERROR_INVALID_ARGUMENT 2018-09-05 12:41:52 +03:00
mohammad1603
fb5b9cbb8d add missing documentations 2018-09-05 12:41:52 +03:00
mohammad1603
8ffd764e23 re-group test vectors and change vectors' names 2018-09-05 12:41:52 +03:00
mohammad1603
6b4d98cf78 remove trailing spaces 2018-09-05 12:41:52 +03:00
mohammad1603
5ed0621dd4 aligned with coding standards - line length 2018-09-05 12:41:52 +03:00
mohammad1603
f7f72da769 add invalid signature test case 2018-09-05 12:41:52 +03:00
mohammad1603
c1ee32e1f4 add GCM test vectors encrypt/decrypt 2018-09-05 12:41:52 +03:00
mohammad1603
371a6e4067 add decrypt tests for CCM 2018-09-05 12:41:52 +03:00
mohammad1603
ed8dbeb434 add and fix data vectors 2018-09-05 12:41:52 +03:00
mohammad1603
f14394b25f add policy checks 2018-09-05 12:41:52 +03:00
mohammad1603
96910d807e fix block size depending on algorithm 2018-09-05 12:41:51 +03:00
mohammad1603
0317945a37 disable uncompleted tests 2018-09-05 12:41:51 +03:00
mohammad1603
f2525ebda7 add encryption only test case 2018-09-05 12:41:51 +03:00
mohammad1603
4b26850a15 fix tests according to the code changes in error value 2018-09-05 12:41:51 +03:00
mohammad1603
60a64d079a remove unnecessary argument to the psa_aead_unpadded_locate_tag function 2018-09-05 12:41:51 +03:00
mohammad1603
15223a8b89 write the tag directly on the ciphertext buffer. 2018-09-05 12:41:51 +03:00
mohammad1603
4fc744f8af change the check of block size for all supported algorithms 2018-09-05 12:41:51 +03:00
mohammad1603
0f21465175 use mbedtls_cipher_info_from_psa to get cipher ID 2018-09-05 12:41:51 +03:00