Skip to content

Commit f420c66

Browse files
Fix aes_siv_negative_test unit test style for skoll
1 parent 5bc5251 commit f420c66

1 file changed

Lines changed: 21 additions & 17 deletions

File tree

wolfcrypt/test/test.c

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -74784,44 +74784,48 @@ static wc_test_ret_t aes_siv_oneassoc_test(const AesSivTestVector* testVectors,
7478474784
return 0;
7478574785
}
7478674786

74787-
static wc_test_ret_t aes_siv_negative_test(const AesSivTestVector* testVectors, size_t n_vectors)
74787+
static wc_test_ret_t aes_siv_negative_test(const AesSivTestVector* testVectors,
74788+
int n_vectors)
7478874789
{
7478974790
byte computedCiphertext[82];
7479074791
byte computedPlaintext[82];
7479174792
byte siv[WC_AES_BLOCK_SIZE];
7479274793
word32 j;
7479374794
wc_test_ret_t ret;
74794-
size_t vector_idx;
74795+
int vector_idx;
7479574796

7479674797
/* Find a test vector that has a non-empty plaintext size */
74797-
for (vector_idx = 0U; vector_idx < n_vectors; vector_idx++)
74798-
{
74798+
for (vector_idx = 0; vector_idx < n_vectors; vector_idx++) {
7479974799
if (testVectors[vector_idx].plaintextSz > 0U)
7480074800
break;
7480174801
}
74802-
if (vector_idx == n_vectors)
74803-
{
74802+
if (vector_idx == n_vectors) {
7480474803
return WC_TEST_RET_ENC_NC;
7480574804
}
7480674805

7480774806
/* Negative test: corrupted SIV must be rejected with AES_SIV_AUTH_E. */
74808-
ret = wc_AesSivEncrypt(testVectors[vector_idx].key, testVectors[vector_idx].keySz,
74809-
testVectors[vector_idx].assoc1, testVectors[vector_idx].assoc1Sz,
74810-
testVectors[vector_idx].nonce, testVectors[vector_idx].nonceSz,
74811-
testVectors[vector_idx].plaintext,
74812-
testVectors[vector_idx].plaintextSz, siv,
74813-
computedCiphertext);
74807+
ret = wc_AesSivEncrypt(
74808+
testVectors[vector_idx].key,
74809+
testVectors[vector_idx].keySz,
74810+
testVectors[vector_idx].assoc1,
74811+
testVectors[vector_idx].assoc1Sz,
74812+
testVectors[vector_idx].nonce,
74813+
testVectors[vector_idx].nonceSz,
74814+
testVectors[vector_idx].plaintext,
74815+
testVectors[vector_idx].plaintextSz,
74816+
siv, computedCiphertext);
7481474817
if (ret != 0) {
7481574818
return WC_TEST_RET_ENC_EC(ret);
7481674819
}
7481774820
XMEMSET(computedPlaintext, 0xFF, sizeof(computedPlaintext));
7481874821
/* Corrupt one byte of the SIV tag. */
7481974822
siv[0] ^= 0x01;
74820-
ret = wc_AesSivDecrypt(testVectors[vector_idx].key, testVectors[vector_idx].keySz,
74821-
testVectors[vector_idx].assoc1, testVectors[vector_idx].assoc1Sz,
74822-
testVectors[vector_idx].nonce, testVectors[vector_idx].nonceSz,
74823-
computedCiphertext, testVectors[vector_idx].plaintextSz,
74824-
siv, computedPlaintext);
74823+
ret = wc_AesSivDecrypt(
74824+
testVectors[vector_idx].key, testVectors[vector_idx].keySz,
74825+
testVectors[vector_idx].assoc1, testVectors[vector_idx].assoc1Sz,
74826+
testVectors[vector_idx].nonce, testVectors[vector_idx].nonceSz,
74827+
computedCiphertext, testVectors[vector_idx].plaintextSz,
74828+
siv, computedPlaintext);
7482574829
if (ret != WC_NO_ERR_TRACE(AES_SIV_AUTH_E)) {
7482674830
return WC_TEST_RET_ENC_EC(ret);
7482774831
}

0 commit comments

Comments
 (0)