Skip to content

Commit d7fe3d1

Browse files
golowanowmmahadevan108
authored andcommitted
tests: crypto: tinycrypt: Fix premature Ztest end
Don't use TC_END_RESULT() to report Ztest's result prematurely. Signed-off-by: Dmitrii Golovanov <[email protected]>
1 parent e8cf960 commit d7fe3d1

File tree

3 files changed

+2
-8
lines changed

3 files changed

+2
-8
lines changed

tests/crypto/tinycrypt/src/cbc_mode.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ ZTEST(tinycrypt, test_cbc_sp_800_38a_encrypt_decrypt)
128128

129129
result = check_result(1, ciphertext, sizeof(encrypted),
130130
encrypted, sizeof(encrypted), 1);
131-
TC_END_RESULT(result);
131+
zassert_false(result, "CBC test #1 failed.");
132132

133133
TC_PRINT("CBC test #2 (decryption SP 800-38a tests):\n");
134134
(void)tc_aes128_set_decrypt_key(&a, key);
@@ -145,5 +145,5 @@ ZTEST(tinycrypt, test_cbc_sp_800_38a_encrypt_decrypt)
145145
decrypted, sizeof(decrypted), 1);
146146

147147
/**TESTPOINT: Check result*/
148-
zassert_false(result, "CBC test #1 failed.");
148+
zassert_false(result, "CBC test #2 failed.");
149149
}

tests/crypto/tinycrypt/src/ccm_mode.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,6 @@ ZTEST(tinycrypt, test_ccm_vector_8)
464464
}
465465

466466
result = TC_PASS;
467-
TC_END_RESULT(result);
468467

469468
/**TESTPOINT: Check result*/
470469
zassert_false(result, "CCM test #8 (no payload data) failed.");

tests/crypto/tinycrypt/src/cmac_mode.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,6 @@ static uint32_t verify_gf_2_128_double(uint8_t *K1, uint8_t *K2, struct tc_cmac_
111111
return TC_FAIL;
112112
}
113113

114-
TC_END_RESULT(result);
115114
return result;
116115
}
117116

@@ -138,7 +137,6 @@ static uint32_t verify_cmac_null_msg(TCCmacState_t s)
138137
return TC_FAIL;
139138
}
140139

141-
TC_END_RESULT(result);
142140
return result;
143141
}
144142

@@ -170,7 +168,6 @@ static uint32_t verify_cmac_1_block_msg(TCCmacState_t s)
170168
return TC_FAIL;
171169
}
172170

173-
TC_END_RESULT(result);
174171
return result;
175172
}
176173

@@ -205,7 +202,6 @@ static uint32_t verify_cmac_320_bit_msg(TCCmacState_t s)
205202
return TC_FAIL;
206203
}
207204

208-
TC_END_RESULT(result);
209205
return result;
210206
}
211207

@@ -243,7 +239,6 @@ static uint32_t verify_cmac_512_bit_msg(TCCmacState_t s)
243239
return TC_FAIL;
244240
}
245241

246-
TC_END_RESULT(result);
247242
return result;
248243
}
249244

0 commit comments

Comments
 (0)