63 #ifndef OPENSSL_NO_CMS
68 static int eckey_param2type(
int *pptype,
void **ppval,
EC_KEY *ec_key)
108 unsigned char *penc = NULL, *
p;
111 if (!eckey_param2type(&ptype, &pval, ec_key))
127 ptype, pval, penc, penclen))
139 static EC_KEY *eckey_type2param(
int ptype,
void *pval)
145 const unsigned char *pm = NULL;
192 const unsigned char *p = NULL;
202 eckey = eckey_type2param(ptype, pval);
242 const unsigned char *p = NULL;
252 eckey = eckey_type2param(ptype, pval);
286 if (!
EC_POINT_mul(group, pub_key, priv_key, NULL, NULL, NULL))
315 unsigned char *ep, *
p;
318 unsigned int tmp_flags, old_flags;
322 if (!eckey_param2type(&ptype, &pval, ec_key))
360 ptype, pval, ep, eplen))
366 static int int_ec_size(
const EVP_PKEY *pkey)
371 static int ec_bits(
const EVP_PKEY *pkey)
394 static int ec_missing_parameters(
const EVP_PKEY *pkey)
422 static void int_ec_free(
EVP_PKEY *pkey)
427 static int do_EC_KEY_print(
BIO *
bp,
const EC_KEY *x,
int off,
int ktype)
429 unsigned char *buffer=NULL;
433 BIGNUM *pub_key=NULL, *order=NULL;
468 if (priv_key && (i = (
size_t)
BN_num_bytes(priv_key)) > buf_len)
484 ecstr =
"Private-Key";
486 ecstr =
"Public-Key";
488 ecstr =
"ECDSA-Parameters";
492 if ((order =
BN_new()) == NULL)
499 if ((priv_key != NULL) && !
ASN1_bn_print(bp,
"priv:", priv_key,
502 if ((pub_key != NULL) && !
ASN1_bn_print(bp,
"pub: ", pub_key,
522 static int eckey_param_decode(
EVP_PKEY *pkey,
523 const unsigned char **pder,
int derlen)
535 static int eckey_param_encode(
const EVP_PKEY *pkey,
unsigned char **pder)
540 static int eckey_param_print(
BIO *bp,
const EVP_PKEY *pkey,
int indent,
543 return do_EC_KEY_print(bp, pkey->
pkey.
ec, indent, 0);
546 static int eckey_pub_print(
BIO *bp,
const EVP_PKEY *pkey,
int indent,
549 return do_EC_KEY_print(bp, pkey->
pkey.
ec, indent, 1);
553 static int eckey_priv_print(
BIO *bp,
const EVP_PKEY *pkey,
int indent,
556 return do_EC_KEY_print(bp, pkey->
pkey.
ec, indent, 2);
559 static int old_ec_priv_decode(
EVP_PKEY *pkey,
560 const unsigned char **pder,
int derlen)
572 static int old_ec_priv_encode(
const EVP_PKEY *pkey,
unsigned char **pder)
577 static int ec_pkey_ctrl(
EVP_PKEY *pkey,
int op,
long arg1,
void *arg2)
587 if (alg1 == NULL || alg1->
algorithm == NULL)
597 #ifndef OPENSSL_NO_CMS
605 if (alg1 == NULL || alg1->
algorithm == NULL)
634 "OpenSSL EC algorithm",
650 ec_missing_parameters,