Skip to content

Commit 9dde11f

Browse files
Fix documentation in PSA crypto metadata tests
Fix and improve the documentation of the test_parity() function in PSA crypto metadata tests: . Align the short description of the function with the function name: "Test ..." instead of "Check ..." . Fix the description of the returned value: the returned value is nonzero, not zero, if the parity is even. . Add documentation explaining the needs for parity testing and that the parity is expected to be even. Signed-off-by: Ronald Cron <[email protected]>
1 parent bc6f518 commit 9dde11f

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

tests/suites/test_suite_psa_crypto_metadata.function

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,13 @@
5656
#define TEST_CLASSIFICATION_MACRO( flag, alg, flags ) \
5757
TEST_ASSERT( PSA_##flag( alg ) == !! ( ( flags ) & flag ) )
5858

59-
/* Check the parity of value.
60-
* Return 0 if value has even parity and a nonzero value otherwise. */
59+
/* Test the parity of value.
60+
* Numerical encodings of key types and related values such as EC curves and
61+
* DH groups should all have the same parity. This guarantees that a
62+
* single-bit error will be detected.
63+
* The expected parity is even because this makes all-bits-zero valid.
64+
* The function returns a nonzero value if the parity is even, zero otherwise.
65+
*/
6166
int test_parity( uint32_t value )
6267
{
6368
value ^= value >> 16;

0 commit comments

Comments
 (0)