Remove EVP_PKEY_CTRL_EC_PARAMGEN_CURVE_NID.
This is never exposed. Change-Id: I332bc45f724eb42d68a0839e72b21593d01005ee Reviewed-on: https://boringssl-review.googlesource.com/6847 Reviewed-by: Adam Langley <alangley@gmail.com>
This commit is contained in:
parent
8ac35f0274
commit
692878a5f4
@ -205,8 +205,6 @@ OPENSSL_EXPORT int EVP_PKEY_CTX_ctrl(EVP_PKEY_CTX *ctx, int keytype, int optype,
|
|||||||
#define EVP_PKEY_CTRL_RSA_OAEP_LABEL (EVP_PKEY_ALG_CTRL + 11)
|
#define EVP_PKEY_CTRL_RSA_OAEP_LABEL (EVP_PKEY_ALG_CTRL + 11)
|
||||||
#define EVP_PKEY_CTRL_GET_RSA_OAEP_LABEL (EVP_PKEY_ALG_CTRL + 12)
|
#define EVP_PKEY_CTRL_GET_RSA_OAEP_LABEL (EVP_PKEY_ALG_CTRL + 12)
|
||||||
|
|
||||||
#define EVP_PKEY_CTRL_EC_PARAMGEN_CURVE_NID (EVP_PKEY_ALG_CTRL + 1)
|
|
||||||
|
|
||||||
struct evp_pkey_ctx_st {
|
struct evp_pkey_ctx_st {
|
||||||
/* Method associated with this operation */
|
/* Method associated with this operation */
|
||||||
const EVP_PKEY_METHOD *pmeth;
|
const EVP_PKEY_METHOD *pmeth;
|
||||||
|
@ -74,8 +74,6 @@
|
|||||||
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
/* Key and paramgen group */
|
|
||||||
EC_GROUP *gen_group;
|
|
||||||
/* message digest */
|
/* message digest */
|
||||||
const EVP_MD *md;
|
const EVP_MD *md;
|
||||||
} EC_PKEY_CTX;
|
} EC_PKEY_CTX;
|
||||||
@ -102,12 +100,6 @@ static int pkey_ec_copy(EVP_PKEY_CTX *dst, EVP_PKEY_CTX *src) {
|
|||||||
sctx = src->data;
|
sctx = src->data;
|
||||||
dctx = dst->data;
|
dctx = dst->data;
|
||||||
|
|
||||||
if (sctx->gen_group) {
|
|
||||||
dctx->gen_group = EC_GROUP_dup(sctx->gen_group);
|
|
||||||
if (!dctx->gen_group) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
dctx->md = sctx->md;
|
dctx->md = sctx->md;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
@ -119,7 +111,6 @@ static void pkey_ec_cleanup(EVP_PKEY_CTX *ctx) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
EC_GROUP_free(dctx->gen_group);
|
|
||||||
OPENSSL_free(dctx);
|
OPENSSL_free(dctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -185,19 +176,8 @@ static int pkey_ec_derive(EVP_PKEY_CTX *ctx, uint8_t *key,
|
|||||||
|
|
||||||
static int pkey_ec_ctrl(EVP_PKEY_CTX *ctx, int type, int p1, void *p2) {
|
static int pkey_ec_ctrl(EVP_PKEY_CTX *ctx, int type, int p1, void *p2) {
|
||||||
EC_PKEY_CTX *dctx = ctx->data;
|
EC_PKEY_CTX *dctx = ctx->data;
|
||||||
EC_GROUP *group;
|
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case EVP_PKEY_CTRL_EC_PARAMGEN_CURVE_NID:
|
|
||||||
group = EC_GROUP_new_by_curve_name(p1);
|
|
||||||
if (group == NULL) {
|
|
||||||
OPENSSL_PUT_ERROR(EVP, EVP_R_INVALID_CURVE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
EC_GROUP_free(dctx->gen_group);
|
|
||||||
dctx->gen_group = group;
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
case EVP_PKEY_CTRL_MD:
|
case EVP_PKEY_CTRL_MD:
|
||||||
if (EVP_MD_type((const EVP_MD *)p2) != NID_sha1 &&
|
if (EVP_MD_type((const EVP_MD *)p2) != NID_sha1 &&
|
||||||
EVP_MD_type((const EVP_MD *)p2) != NID_ecdsa_with_SHA1 &&
|
EVP_MD_type((const EVP_MD *)p2) != NID_ecdsa_with_SHA1 &&
|
||||||
@ -226,28 +206,18 @@ static int pkey_ec_ctrl(EVP_PKEY_CTX *ctx, int type, int p1, void *p2) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int pkey_ec_keygen(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey) {
|
static int pkey_ec_keygen(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey) {
|
||||||
EC_KEY *ec = NULL;
|
if (ctx->pkey == NULL) {
|
||||||
EC_PKEY_CTX *dctx = ctx->data;
|
|
||||||
if (ctx->pkey == NULL && dctx->gen_group == NULL) {
|
|
||||||
OPENSSL_PUT_ERROR(EVP, EVP_R_NO_PARAMETERS_SET);
|
OPENSSL_PUT_ERROR(EVP, EVP_R_NO_PARAMETERS_SET);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
ec = EC_KEY_new();
|
EC_KEY *ec = EC_KEY_new();
|
||||||
if (!ec) {
|
if (!ec) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
EVP_PKEY_assign_EC_KEY(pkey, ec);
|
EVP_PKEY_assign_EC_KEY(pkey, ec);
|
||||||
if (ctx->pkey) {
|
|
||||||
/* Note: if error return, pkey is freed by parent routine */
|
/* Note: if error return, pkey is freed by parent routine */
|
||||||
if (!EVP_PKEY_copy_parameters(pkey, ctx->pkey)) {
|
return EVP_PKEY_copy_parameters(pkey, ctx->pkey) &&
|
||||||
return 0;
|
EC_KEY_generate_key(pkey->pkey.ec);
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (!EC_KEY_set_group(ec, dctx->gen_group)) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return EC_KEY_generate_key(pkey->pkey.ec);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const EVP_PKEY_METHOD ec_pkey_meth = {
|
const EVP_PKEY_METHOD ec_pkey_meth = {
|
||||||
|
Loading…
Reference in New Issue
Block a user