Gilles Peskine
4abf741e6a
Hygiene improvements in PSA crypto test code
...
Get rid of many redundant casts. In particular, it is not useful to
cast uint32_t values to size_t before performing arithmetic or
comparisons on them.
Rewrap a number of function calls, many of which now have narrower
arguments thanks to the removed casts. When a function call doesn't
fit on a single line, avoid grouping unrelated parameters together,
but do try to group a buffer pointer and the associated size.
Define more auxiliary variables xxx of a particular integer
type (psa_algorithm_t, psa_key_usage_t, etc.) corresponding to a test
function xxx_arg which has the type int. This avoids the need to cast
xxx_arg to an unsigned type sometimes in the code.
2018-09-12 16:18:04 +03:00
Gilles Peskine
7bcfc0a9ae
Be more consistent about blank lines
2018-09-12 16:18:04 +03:00
Gilles Peskine
c1bb6c8dcc
Formatting improvements
...
Avoid lines longer than 80 columns.
Remove some redundant parentheses, e.g. change
if( ( a == b ) && ( c == d ) )
to
if( a == b && c == d )
which makes lines less long and makes the remaining parentheses more
relevant.
Add missing parentheses around return statements.
There should be no semantic change in this commit.
2018-09-12 16:18:02 +03:00
Gilles Peskine
2d2778650b
Normalize whitespace
...
Normalize whitespace to Mbed TLS standards. There are only whitespace
changes in this commit.
2018-09-12 16:15:52 +03:00
itayzafrir
27fbaf7781
Fixed test sign_deterministic, macro PSA_ASYMMETRIC_SIGN_OUTPUT_SIZE
...
Arguments in the wrong order
2018-09-12 16:13:49 +03:00
itayzafrir
3e02b3b280
On target testing tests adaptation
...
Updated all psa crypto tests to use the new test format
2018-09-12 16:13:39 +03:00
Gilles Peskine
8605428dcf
Merge remote-tracking branch 'psa/pr/27' into feature-psa
2018-09-05 12:46:19 +03:00
Gilles Peskine
eebd7381bb
Rename asymmetric_encrypt to clarify what it does
...
Renamed to asymmetric_encrypt_decrypt
2018-09-05 12:44:18 +03:00
Gilles Peskine
61b91d4476
Normalize whitespace to Mbed TLS standards
...
Only whitespace changes in this commit.
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
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
Gilles Peskine
5b051bc608
Remove trailing whitespace
...
Only horizontal whitespace changes in this commit.
2018-09-05 12:44:12 +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
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
84861a95ca
Merge remote-tracking branch 'psa/psa-wrapper-apis-aead' into feature-psa
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
f7f72da769
add invalid signature test case
2018-09-05 12:41:52 +03:00
mohammad1603
371a6e4067
add decrypt tests for CCM
2018-09-05 12:41:52 +03:00
mohammad1603
f14394b25f
add policy checks
2018-09-05 12:41:52 +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
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
mohammad1603
e797945ea9
initialize length variables and process decrypt only when encrypts passes
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
d973472a37
Fix loop index and output size parameter value
2018-09-05 12:38:18 +03:00
mohammad1603
bdd892aef5
Add test scenario
2018-09-05 12:38:18 +03:00
mohammad1603
091e73b22b
Fix usage of TEST_ASSERT
...
Add missing == PSA_SUCCESS in TEST_ASSERT usage
2018-09-05 12:38:18 +03:00
mohammad1603
9112693930
aead test scenario
2018-09-05 12:38:18 +03:00
Gilles Peskine
3aa8efb230
Merge remote-tracking branch 'psa/psa-wrapper-apis-march-12' into feature-psa
2018-09-05 12:38:17 +03:00
Gilles Peskine
a7ec95f1ea
Cipher tests: calculate and verify the actual output size
2018-09-05 12:38:17 +03:00
Gilles Peskine
50e586b691
We don't need _test_ in test function names
...
Also fix typo multpart -> multipart
2018-09-05 12:38:17 +03:00
Gilles Peskine
048b7f0802
Rename some variables to make the code easier to read
...
In cipher_test_verify_output_multpart, tweak the ways chunk sizes are
added in order to get rid of the variable temp. In other functions,
this commit does not change the logic at all.
2018-09-05 12:38:17 +03:00
Moran Peker
a9c3a658be
tests fix + max_output_size
2018-09-05 12:38:17 +03:00
Moran Peker
9e3aa62c13
change variable naming
2018-09-05 12:38:17 +03:00
Gilles Peskine
4ca9c3f9a1
Fix whitespace issues
...
Only whitespace changes.
* Remove tabs.
* Remove trailing whitespace.
* Correct some misindented lines.
* Normalize whitespace around some punctuation.
* Split some lines to avoid going over 80 columns.
2018-09-05 12:38:17 +03:00
Moran Peker
7f87850fc4
fix and add tests case + fix for padding mode
2018-09-05 12:38:17 +03:00
Moran Peker
ded844092e
fix and add tests case + fix for padding mode
2018-09-05 12:38:17 +03:00
Gilles Peskine
7268afc29e
Reordered cipher tests to be just after MAC tests
2018-09-05 12:38:15 +03:00
Gilles Peskine
691dfb3e3a
Whitespce normalization
...
No semantic change.
2018-09-05 12:14:29 +03:00
Gilles Peskine
d8100245d8
Remove cipher_test_positive, duplicated as cipher_test_encrypt
...
cipher_test_positive was never compiled due to a syntax error in the
BEGIN_CASE magic comment. It has now been duplicated as
cipher_test_encrypt. Remove the copy that was never compiled.
2018-09-05 12:14:29 +03:00
Moran Peker
7691fb7b6b
add new test scenario (cipher_test_encrypt_multipart)
2018-09-05 12:14:29 +03:00
Moran Peker
96cc00a857
add missing tests function
2018-09-05 12:14:28 +03:00
Moran Peker
f55e804e07
adjust indentation per Mbed TLS standards
2018-09-05 12:14:28 +03:00
Moran Peker
0071b873a3
add missing parameter output_size on psa_cipher_finish
2018-09-05 12:14:28 +03:00
mohammad1603
b152d4d8b6
add test scenarios to decrypt and encrypt input and compare with given output
2018-09-05 12:14:28 +03:00
Moran Peker
e1210dcac3
remove unused parameter in psa_cipher_finish.
2018-09-05 12:14:28 +03:00
Moran Peker
3205a6592b
tests fix
2018-09-05 12:14:28 +03:00
mohammad1603
8481e74ecc
CR fixes
...
more fixes
Compilation fixes
Compilation fixes for PSA crypto code and tests
2018-09-05 12:14:28 +03:00