Skip to content

Commit

Permalink
Report more usable errors from failed asserts
Browse files Browse the repository at this point in the history
  • Loading branch information
Jakuje authored and aveenismail committed Dec 20, 2024
1 parent d7979e7 commit 68b7c7b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/tests/aes.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ encryption(uint8_t *key, uint8_t counter, uint8_t *plaintext, uint32_t plaintext
uint32_t e_len = sizeof(e);
ykpiv_rc rc = scp11_encrypt_data(key, counter, plaintext, plaintext_len, e, &e_len);

ck_assert(rc == YKPIV_OK);
ck_assert(e_len == enc_len);
ck_assert_int_eq(rc, YKPIV_OK);
ck_assert_int_eq(e_len, enc_len);
ck_assert(memcmp(e, enc, enc_len) == 0);
return EXIT_SUCCESS;
}
Expand All @@ -103,8 +103,8 @@ static int decryption(uint8_t *key, uint8_t counter, uint8_t *enc, uint32_t enc_
uint32_t d_len = sizeof(d);
ykpiv_rc rc = scp11_decrypt_data(key, counter, enc, enc_len, d, &d_len);

ck_assert(rc == YKPIV_OK);
ck_assert(d_len == dec_len);
ck_assert_int_eq(rc, YKPIV_OK);
ck_assert_int_eq(d_len, dec_len);
ck_assert(memcmp(d, dec, dec_len) == 0);
return EXIT_SUCCESS;
}
Expand Down

0 comments on commit 68b7c7b

Please sign in to comment.