Added AESCTR_DRBG implementation (beta).
This commit is contained in:
parent
491a45337d
commit
cfbc702d3d
6 changed files with 366 additions and 0 deletions
|
|
@ -1074,6 +1074,41 @@ test_HMAC_DRBG(void)
|
|||
fflush(stdout);
|
||||
}
|
||||
|
||||
static void
|
||||
test_AESCTR_DRBG(void)
|
||||
{
|
||||
br_aesctr_drbg_context ctx;
|
||||
const br_block_ctr_class *ictr;
|
||||
unsigned char tmp1[64], tmp2[64];
|
||||
|
||||
printf("Test AESCTR_DRBG: ");
|
||||
fflush(stdout);
|
||||
|
||||
ictr = br_aes_x86ni_ctr_get_vtable();
|
||||
if (ictr == NULL) {
|
||||
ictr = br_aes_pwr8_ctr_get_vtable();
|
||||
if (ictr == NULL) {
|
||||
#if BR_64
|
||||
ictr = &br_aes_ct64_ctr_vtable;
|
||||
#else
|
||||
ictr = &br_aes_ct_ctr_vtable;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
br_aesctr_drbg_init(&ctx, ictr, NULL, 0);
|
||||
ctx.vtable->generate(&ctx.vtable, tmp1, sizeof tmp1);
|
||||
ctx.vtable->update(&ctx.vtable, "new seed", 8);
|
||||
ctx.vtable->generate(&ctx.vtable, tmp2, sizeof tmp2);
|
||||
|
||||
if (memcmp(tmp1, tmp2, sizeof tmp1) == 0) {
|
||||
fprintf(stderr, "AESCTR_DRBG failure\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
printf("done.\n");
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
static void
|
||||
do_KAT_PRF(br_tls_prf_impl prf,
|
||||
const char *ssecret, const char *label, const char *sseed,
|
||||
|
|
@ -7965,6 +8000,7 @@ static const struct {
|
|||
STU(multihash),
|
||||
STU(HMAC),
|
||||
STU(HMAC_DRBG),
|
||||
STU(AESCTR_DRBG),
|
||||
STU(PRF),
|
||||
STU(AES_big),
|
||||
STU(AES_small),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue