Changes inspired by Feedback from Sean.

Define WOLFSSL_HAVE_KYBER when HAVE_LIBOQS is defined.
Fix some misleading debug output.
Fix benchmarking logic.
This commit is contained in:
Anthony Hu
2022-09-12 13:33:39 -04:00
parent a2635be9e6
commit bcf4dbe697
3 changed files with 11 additions and 6 deletions

View File

@ -8195,7 +8195,7 @@ static int TLSX_KeyShare_ProcessPqc(WOLFSSL* ssl, KeyShareEntry* keyShareEntry)
ret = wc_KyberKey_Decapsulate(kem, sharedSecret + outlen,
keyShareEntry->ke + keyShareEntry->keLen - ctSz, ctSz);
if (ret != 0) {
WOLFSSL_MSG("Kyber decapsulation failure.");
WOLFSSL_MSG("wc_KyberKey decapsulation failure.");
ret = BAD_FUNC_ARG;
}
}
@ -9015,7 +9015,7 @@ static int server_generate_pqc_ciphertext(WOLFSSL* ssl,
ret = wc_KyberKey_Encapsulate(kem, ciphertext + ecc_kse->pubKeyLen,
sharedSecret + outlen, ssl->rng);
if (ret != 0) {
WOLFSSL_MSG("OQS Encapsulation failure.");
WOLFSSL_MSG("wc_KyberKey encapsulation failure.");
}
}

View File

@ -8529,10 +8529,14 @@ int main(int argc, char** argv)
}
#if defined(HAVE_LIBOQS)
/* Both bench_pq_asym_opt and bench_pq_asym_opt2 are looking for
* -pq, so we need to reset optMatched in case it was set to 1 just
* above. */
optMatched = 0;
for (i=0; !optMatched && bench_pq_asym_opt2[i].str != NULL; i++) {
* -pq, so we need to do a special case for -pq since optMatched
* was set to 1 just above. */
if (string_matches(argv[1], bench_pq_asym_opt[0].str)) {
bench_pq_asym_algs2 |= bench_pq_asym_opt2[0].val;
bench_all = 0;
optMatched = 1;
}
for (i=1; !optMatched && bench_pq_asym_opt2[i].str != NULL; i++) {
if (string_matches(argv[1], bench_pq_asym_opt2[i].str)) {
bench_pq_asym_algs2 |= bench_pq_asym_opt2[i].val;
bench_all = 0;

View File

@ -2734,6 +2734,7 @@ extern void uITRON4_free(void *p) ;
#define HAVE_DILITHIUM
#define HAVE_SPHINCS
#define HAVE_KYBER
#define WOLFSSL_HAVE_KYBER
#endif
#ifdef HAVE_PQM4