Commit graph

7990 commits

Author SHA1 Message Date
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
mohammad1603
f58aa6ade6 use memset instead of mbedtils_zeroize 2018-09-05 12:41:51 +03:00
mohammad1603
554faad260 return NOT_SUPPORTED instead of INVLID_ARGUMENT 2018-09-05 12:41:51 +03:00
mohammad1603
95893f834d remove usless cast 2018-09-05 12:41:51 +03:00
mohammad1603
f08a550e68 set output length to zero to cover output length in error case 2018-09-05 12:41:51 +03:00
mohammad1603
f4f0d612ba change mbedtls_cipher_info_from_psa to provide cipher_id also 2018-09-05 12:41:51 +03:00
mohammad1603
22898ba0bd remove duplicated definition 2018-09-05 12:41:51 +03:00
mohammad1603
9375f8403a fix code offsets after rebase 2018-09-05 12:41:51 +03:00
Gilles Peskine
ee652a344c Fix psa_aead_decrypt to read the tag at the end of the ciphertext 2018-09-05 12:41:51 +03:00
Gilles Peskine
36a74b71a0 Fix Doxygen comments to pass clang -Wdocumentation 2018-09-05 12:41:51 +03:00
Gilles Peskine
1e7d8f1b09 Document AEAD functions
Write documentation for psa_aead_encrypt and psa_aead_decrypt. Define
macros PSA_AEAD_ENCRYPT_OUTPUT_SIZE and PSA_AEAD_DECRYPT_OUTPUT_SIZE
(untested).
2018-09-05 12:41:51 +03:00
Gilles Peskine
a40d77477d Whitespace fixes
Changed indentation to match Mbed TLS style. Wrapped some lines to 80 columns.
2018-09-05 12:41:51 +03:00
mohammad1603
20399393a5 add psa_crypto to test suites 2018-09-05 12:41:49 +03:00
mohammad1603
e797945ea9 initialize length variables and process decrypt only when encrypts passes 2018-09-05 12:38:18 +03:00
mohammad1603
39574652ae add else for not supported algorithm 2018-09-05 12:38:18 +03:00
mohammad1603
9b07132591 remove compilation warnings 2018-09-05 12:38:18 +03:00
mohammad1603
f07db2e919 Add more test scenario for GCM and failure cases 2018-09-05 12:38:18 +03:00
mohammad1603
5c8845f563 return invalid argument for unsupported algorithms 2018-09-05 12:38:18 +03:00
mohammad1603
d973472a37 Fix loop index and output size parameter value 2018-09-05 12:38:18 +03:00