Skip to content

Commit ac02f74

Browse files
committed
ecc_sign+verify_hash_rfc7518 tests
1 parent b8f2215 commit ac02f74

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

tests/ecc_test.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,19 @@ int ecc_tests (void)
230230
fprintf(stderr, "ecc_verify_hash failed %d, %d, ", stat, stat2);
231231
return 1;
232232
}
233+
/* test sign_hash_rfc7518 */
234+
for (ch = 0; ch < 16; ch++) {
235+
buf[0][ch] = ch;
236+
}
237+
x = sizeof (buf[1]);
238+
DO(ecc_sign_hash_rfc7518(buf[0], 16, buf[1], &x, &yarrow_prng, find_prng ("yarrow"), &privKey));
239+
DO(ecc_verify_hash_rfc7518(buf[1], x, buf[0], 16, &stat, &pubKey));
240+
buf[0][0] ^= 1;
241+
DO(ecc_verify_hash_rfc7518(buf[1], x, buf[0], 16, &stat2, &privKey));
242+
if (!(stat == 1 && stat2 == 0)) {
243+
fprintf(stderr, "ecc_verify_hash_rfc7518 failed %d, %d, ", stat, stat2);
244+
return 1;
245+
}
233246
ecc_free (&usera);
234247
ecc_free (&pubKey);
235248
ecc_free (&privKey);

0 commit comments

Comments
 (0)