Skip to content

Commit

Permalink
Corrects use of OpenSSL EVP_PKEY_get_raw_private_key API, providing a…
Browse files Browse the repository at this point in the history
… valid key length as input. (#37)
  • Loading branch information
bhess authored Oct 24, 2021
1 parent f5722df commit 28d557e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions oqsprov/oqsprov_keys.c
Original file line number Diff line number Diff line change
Expand Up @@ -297,9 +297,9 @@ static int oqsx_key_gen_evp_kex(OQSX_EVP_CTX *ctx, unsigned char *pubkey, unsign
memcpy(pubkey, pubkeykex_encoded, pubkeykexlen);

if (ctx->kex_info->raw_key_support) {
size_t privkeykexlen = 0;
size_t privkeykexlen = ctx->kex_info->kex_length_private_key;
ret2 = EVP_PKEY_get_raw_private_key(pkey, privkey, &privkeykexlen);
ON_ERR_SET_GOTO(ret2 <= 0, ret, -1, errhyb);
ON_ERR_SET_GOTO(ret2 <= 0 || privkeykexlen != ctx->kex_info->kex_length_private_key, ret, -1, errhyb);
} else {
unsigned char *pkey_enc = privkey;
int privkeykexlen = i2d_PrivateKey(pkey, &pkey_enc);
Expand Down

0 comments on commit 28d557e

Please sign in to comment.