Fix ec keygen so that it passes the library context to SSL_SELF_TEST_get_callback().

This was written before the ec key contained a library context,
now that it contains a libctx it can be passed correctly to the callback.

Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/12877)
This commit is contained in:
Shane Lontis 2020-09-15 14:45:49 +10:00
parent f8e747471e
commit 7889e7aef8
2 changed files with 3 additions and 4 deletions

View File

@ -256,7 +256,7 @@ int ossl_ec_key_gen(EC_KEY *eckey)
* fails then the keypair is not generated,
* Returns 1 if the keypair was generated or 0 otherwise.
*/
int ec_generate_key(OPENSSL_CTX *libctx, EC_KEY *eckey, int pairwise_test)
static int ec_generate_key(EC_KEY *eckey, int pairwise_test)
{
int ok = 0;
BIGNUM *priv_key = NULL;
@ -325,7 +325,7 @@ int ec_generate_key(OPENSSL_CTX *libctx, EC_KEY *eckey, int pairwise_test)
OSSL_CALLBACK *cb = NULL;
void *cbarg = NULL;
OSSL_SELF_TEST_get_callback(libctx, &cb, &cbarg);
OSSL_SELF_TEST_get_callback(eckey->libctx, &cb, &cbarg);
ok = ecdsa_keygen_pairwise_test(eckey, cb, cbarg);
}
err:
@ -345,7 +345,7 @@ err:
int ec_key_simple_generate_key(EC_KEY *eckey)
{
return ec_generate_key(NULL, eckey, 0);
return ec_generate_key(eckey, 0);
}
int ec_key_simple_generate_public_key(EC_KEY *eckey)

View File

@ -49,7 +49,6 @@ int ecdh_KDF_X9_63(unsigned char *out, size_t outlen,
const unsigned char *sinfo, size_t sinfolen,
const EVP_MD *md, OPENSSL_CTX *libctx, const char *propq);
int ec_generate_key(OPENSSL_CTX *libctx, EC_KEY *eckey, int pairwise_test);
int ec_key_public_check(const EC_KEY *eckey, BN_CTX *ctx);
int ec_key_private_check(const EC_KEY *eckey);
int ec_key_pairwise_check(const EC_KEY *eckey, BN_CTX *ctx);