OpenSSL 1.1.1-pre2
This commit is contained in:
+49
-1
@@ -520,6 +520,48 @@ static int ec_pkey_ctrl(EVP_PKEY *pkey, int op, long arg1, void *arg2)
|
||||
|
||||
}
|
||||
|
||||
static int ec_pkey_check(const EVP_PKEY *pkey)
|
||||
{
|
||||
EC_KEY *eckey = pkey->pkey.ec;
|
||||
|
||||
/* stay consistent to what EVP_PKEY_check demands */
|
||||
if (eckey->priv_key == NULL) {
|
||||
ECerr(EC_F_EC_PKEY_CHECK, EC_R_MISSING_PRIVATE_KEY);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return EC_KEY_check_key(eckey);
|
||||
}
|
||||
|
||||
static int ec_pkey_public_check(const EVP_PKEY *pkey)
|
||||
{
|
||||
EC_KEY *eckey = pkey->pkey.ec;
|
||||
|
||||
/*
|
||||
* Note: it unnecessary to check eckey->pub_key here since
|
||||
* it will be checked in EC_KEY_check_key(). In fact, the
|
||||
* EC_KEY_check_key() mainly checks the public key, and checks
|
||||
* the private key optionally (only if there is one). So if
|
||||
* someone passes a whole EC key (public + private), this
|
||||
* will also work...
|
||||
*/
|
||||
|
||||
return EC_KEY_check_key(eckey);
|
||||
}
|
||||
|
||||
static int ec_pkey_param_check(const EVP_PKEY *pkey)
|
||||
{
|
||||
EC_KEY *eckey = pkey->pkey.ec;
|
||||
|
||||
/* stay consistent to what EVP_PKEY_check demands */
|
||||
if (eckey->group == NULL) {
|
||||
ECerr(EC_F_EC_PKEY_PARAM_CHECK, EC_R_MISSING_PARAMETERS);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return EC_GROUP_check(eckey->group, NULL);
|
||||
}
|
||||
|
||||
const EVP_PKEY_ASN1_METHOD eckey_asn1_meth = {
|
||||
EVP_PKEY_EC,
|
||||
EVP_PKEY_EC,
|
||||
@@ -551,7 +593,13 @@ const EVP_PKEY_ASN1_METHOD eckey_asn1_meth = {
|
||||
int_ec_free,
|
||||
ec_pkey_ctrl,
|
||||
old_ec_priv_decode,
|
||||
old_ec_priv_encode
|
||||
old_ec_priv_encode,
|
||||
|
||||
0, 0, 0,
|
||||
|
||||
ec_pkey_check,
|
||||
ec_pkey_public_check,
|
||||
ec_pkey_param_check
|
||||
};
|
||||
|
||||
int EC_KEY_print(BIO *bp, const EC_KEY *x, int off)
|
||||
|
||||
Reference in New Issue
Block a user