Skip to content

Commit

Permalink
OQS Cleanup
Browse files Browse the repository at this point in the history
1. Fixed used of a local variable whose name had changed and wasn't
   updated.
2. Added typecast to a 64-bit value that is added to a 32-bit value and
   stored as a 32-bit value for the kem size.
  • Loading branch information
ejohnstown committed Aug 25, 2023
1 parent 6ff7022 commit 1a82574
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/internal.c
Original file line number Diff line number Diff line change
Expand Up @@ -4191,7 +4191,7 @@ static int DoKexDhReply(WOLFSSH* ssh, byte* buf, word32 len, word32* idx)
/* Replace the concatenated shared secrets with the hash. That
* will become the new shared secret. */
if (ret == 0) {
sharedSecretHashSz = wc_HashGetDigestSize(enmhashId);
sharedSecretHashSz = wc_HashGetDigestSize(hashId);
sharedSecretHash = (byte *)WMALLOC(sharedSecretHashSz,
ssh->ctx->heap,
DYNTYPE_PRIVKEY);
Expand All @@ -4201,7 +4201,7 @@ static int DoKexDhReply(WOLFSSH* ssh, byte* buf, word32 len, word32* idx)
}

if (ret == 0) {
ret = wc_Hash(enmhashId, ssh->k, ssh->kSz, sharedSecretHash,
ret = wc_Hash(hashId, ssh->k, ssh->kSz, sharedSecretHash,
sharedSecretHashSz);
}

Expand Down Expand Up @@ -9279,7 +9279,7 @@ int SendKexDhReply(WOLFSSH* ssh)
ret = wc_ecc_shared_secret(privKey, pubKey,
ssh->k + kem->length_shared_secret, &tmp_kSz);
PRIVATE_KEY_LOCK();
ssh->kSz = kem->length_shared_secret + tmp_kSz;
ssh->kSz = (word32)kem->length_shared_secret + tmp_kSz;
}
wc_ecc_free(privKey);
wc_ecc_free(pubKey);
Expand Down

0 comments on commit 1a82574

Please sign in to comment.