Skip to content

Commit

Permalink
Fix code duplication (rebase gone wrong)
Browse files Browse the repository at this point in the history
  • Loading branch information
SWilson4 committed Dec 15, 2023
1 parent d2748af commit 5e35f96
Showing 1 changed file with 0 additions and 33 deletions.
33 changes: 0 additions & 33 deletions tests/kat_kem.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,39 +43,6 @@ static void fprintBstr(FILE *fp, const char *S, const uint8_t *A, size_t L) {
fprintf(fp, "\n");
}

/* HQC-specific functions */
static inline bool is_hqc(const char *method_name) {
return (0 == strcmp(method_name, OQS_KEM_alg_hqc_128))
|| (0 == strcmp(method_name, OQS_KEM_alg_hqc_192))
|| (0 == strcmp(method_name, OQS_KEM_alg_hqc_256));
}

static void HQC_randombytes_init(const uint8_t *entropy_input, const uint8_t *personalization_string) {
uint8_t domain = HQC_PRNG_DOMAIN;
if (shake_prng_state.ctx != NULL) {
OQS_SHA3_shake256_inc_ctx_reset(&shake_prng_state);
} else {
OQS_SHA3_shake256_inc_init(&shake_prng_state);
}
OQS_SHA3_shake256_inc_absorb(&shake_prng_state, entropy_input, 48);
if (personalization_string != NULL) {
OQS_SHA3_shake256_inc_absorb(&shake_prng_state, personalization_string, 48);
}
OQS_SHA3_shake256_inc_absorb(&shake_prng_state, &domain, 1);
OQS_SHA3_shake256_inc_finalize(&shake_prng_state);
}

static void HQC_randombytes(uint8_t *random_array, size_t bytes_to_read) {
OQS_SHA3_shake256_inc_squeeze(random_array, bytes_to_read, &shake_prng_state);
}

static void HQC_randombytes_free(void) {
if (shake_prng_state.ctx != NULL) {
OQS_SHA3_shake256_inc_ctx_release(&shake_prng_state);
shake_prng_state.ctx = NULL;
}
}

static int is_mceliece(const char *method_name) {
return ( !strcmp(method_name, OQS_KEM_alg_classic_mceliece_348864)
|| !strcmp(method_name, OQS_KEM_alg_classic_mceliece_348864f)
Expand Down

0 comments on commit 5e35f96

Please sign in to comment.