summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/ec/ec_ameth.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/ec/ec_ameth.c')
-rw-r--r--src/lib/libcrypto/ec/ec_ameth.c44
1 files changed, 22 insertions, 22 deletions
diff --git a/src/lib/libcrypto/ec/ec_ameth.c b/src/lib/libcrypto/ec/ec_ameth.c
index 5c9a76c8be..ee931a93c6 100644
--- a/src/lib/libcrypto/ec/ec_ameth.c
+++ b/src/lib/libcrypto/ec/ec_ameth.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ec_ameth.c,v 1.33 2022/06/27 12:36:05 tb Exp $ */ 1/* $OpenBSD: ec_ameth.c,v 1.34 2022/11/19 07:00:57 tb Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 2006. 3 * project 2006.
4 */ 4 */
@@ -75,7 +75,7 @@ static int ecdh_cms_decrypt(CMS_RecipientInfo *ri);
75static int ecdh_cms_encrypt(CMS_RecipientInfo *ri); 75static int ecdh_cms_encrypt(CMS_RecipientInfo *ri);
76#endif 76#endif
77 77
78static int 78static int
79eckey_param2type(int *pptype, void **ppval, EC_KEY * ec_key) 79eckey_param2type(int *pptype, void **ppval, EC_KEY * ec_key)
80{ 80{
81 const EC_GROUP *group; 81 const EC_GROUP *group;
@@ -107,7 +107,7 @@ eckey_param2type(int *pptype, void **ppval, EC_KEY * ec_key)
107 return 1; 107 return 1;
108} 108}
109 109
110static int 110static int
111eckey_pub_encode(X509_PUBKEY * pk, const EVP_PKEY * pkey) 111eckey_pub_encode(X509_PUBKEY * pk, const EVP_PKEY * pkey)
112{ 112{
113 EC_KEY *ec_key = pkey->pkey.ec; 113 EC_KEY *ec_key = pkey->pkey.ec;
@@ -190,7 +190,7 @@ eckey_type2param(int ptype, const void *pval)
190 return NULL; 190 return NULL;
191} 191}
192 192
193static int 193static int
194eckey_pub_decode(EVP_PKEY * pkey, X509_PUBKEY * pubkey) 194eckey_pub_decode(EVP_PKEY * pkey, X509_PUBKEY * pubkey)
195{ 195{
196 const unsigned char *p = NULL; 196 const unsigned char *p = NULL;
@@ -223,7 +223,7 @@ eckey_pub_decode(EVP_PKEY * pkey, X509_PUBKEY * pubkey)
223 return 0; 223 return 0;
224} 224}
225 225
226static int 226static int
227eckey_pub_cmp(const EVP_PKEY * a, const EVP_PKEY * b) 227eckey_pub_cmp(const EVP_PKEY * a, const EVP_PKEY * b)
228{ 228{
229 int r; 229 int r;
@@ -238,7 +238,7 @@ eckey_pub_cmp(const EVP_PKEY * a, const EVP_PKEY * b)
238 return -2; 238 return -2;
239} 239}
240 240
241static int 241static int
242eckey_priv_decode(EVP_PKEY * pkey, const PKCS8_PRIV_KEY_INFO * p8) 242eckey_priv_decode(EVP_PKEY * pkey, const PKCS8_PRIV_KEY_INFO * p8)
243{ 243{
244 const unsigned char *p = NULL; 244 const unsigned char *p = NULL;
@@ -305,7 +305,7 @@ eckey_priv_decode(EVP_PKEY * pkey, const PKCS8_PRIV_KEY_INFO * p8)
305 return 0; 305 return 0;
306} 306}
307 307
308static int 308static int
309eckey_priv_encode(PKCS8_PRIV_KEY_INFO * p8, const EVP_PKEY * pkey) 309eckey_priv_encode(PKCS8_PRIV_KEY_INFO * p8, const EVP_PKEY * pkey)
310{ 310{
311 EC_KEY *ec_key; 311 EC_KEY *ec_key;
@@ -358,13 +358,13 @@ eckey_priv_encode(PKCS8_PRIV_KEY_INFO * p8, const EVP_PKEY * pkey)
358 return 1; 358 return 1;
359} 359}
360 360
361static int 361static int
362int_ec_size(const EVP_PKEY * pkey) 362int_ec_size(const EVP_PKEY * pkey)
363{ 363{
364 return ECDSA_size(pkey->pkey.ec); 364 return ECDSA_size(pkey->pkey.ec);
365} 365}
366 366
367static int 367static int
368ec_bits(const EVP_PKEY * pkey) 368ec_bits(const EVP_PKEY * pkey)
369{ 369{
370 BIGNUM *order = BN_new(); 370 BIGNUM *order = BN_new();
@@ -405,7 +405,7 @@ ec_security_bits(const EVP_PKEY *pkey)
405 return ecbits / 2; 405 return ecbits / 2;
406} 406}
407 407
408static int 408static int
409ec_missing_parameters(const EVP_PKEY * pkey) 409ec_missing_parameters(const EVP_PKEY * pkey)
410{ 410{
411 if (EC_KEY_get0_group(pkey->pkey.ec) == NULL) 411 if (EC_KEY_get0_group(pkey->pkey.ec) == NULL)
@@ -413,13 +413,13 @@ ec_missing_parameters(const EVP_PKEY * pkey)
413 return 0; 413 return 0;
414} 414}
415 415
416static int 416static int
417ec_copy_parameters(EVP_PKEY * to, const EVP_PKEY * from) 417ec_copy_parameters(EVP_PKEY * to, const EVP_PKEY * from)
418{ 418{
419 return EC_KEY_set_group(to->pkey.ec, EC_KEY_get0_group(from->pkey.ec)); 419 return EC_KEY_set_group(to->pkey.ec, EC_KEY_get0_group(from->pkey.ec));
420} 420}
421 421
422static int 422static int
423ec_cmp_parameters(const EVP_PKEY * a, const EVP_PKEY * b) 423ec_cmp_parameters(const EVP_PKEY * a, const EVP_PKEY * b)
424{ 424{
425 const EC_GROUP *group_a = EC_KEY_get0_group(a->pkey.ec), *group_b = EC_KEY_get0_group(b->pkey.ec); 425 const EC_GROUP *group_a = EC_KEY_get0_group(a->pkey.ec), *group_b = EC_KEY_get0_group(b->pkey.ec);
@@ -429,13 +429,13 @@ ec_cmp_parameters(const EVP_PKEY * a, const EVP_PKEY * b)
429 return 1; 429 return 1;
430} 430}
431 431
432static void 432static void
433int_ec_free(EVP_PKEY * pkey) 433int_ec_free(EVP_PKEY * pkey)
434{ 434{
435 EC_KEY_free(pkey->pkey.ec); 435 EC_KEY_free(pkey->pkey.ec);
436} 436}
437 437
438static int 438static int
439do_EC_KEY_print(BIO * bp, const EC_KEY * x, int off, int ktype) 439do_EC_KEY_print(BIO * bp, const EC_KEY * x, int off, int ktype)
440{ 440{
441 unsigned char *buffer = NULL; 441 unsigned char *buffer = NULL;
@@ -519,7 +519,7 @@ do_EC_KEY_print(BIO * bp, const EC_KEY * x, int off, int ktype)
519 return (ret); 519 return (ret);
520} 520}
521 521
522static int 522static int
523eckey_param_decode(EVP_PKEY * pkey, 523eckey_param_decode(EVP_PKEY * pkey,
524 const unsigned char **pder, int derlen) 524 const unsigned char **pder, int derlen)
525{ 525{
@@ -532,20 +532,20 @@ eckey_param_decode(EVP_PKEY * pkey,
532 return 1; 532 return 1;
533} 533}
534 534
535static int 535static int
536eckey_param_encode(const EVP_PKEY * pkey, unsigned char **pder) 536eckey_param_encode(const EVP_PKEY * pkey, unsigned char **pder)
537{ 537{
538 return i2d_ECParameters(pkey->pkey.ec, pder); 538 return i2d_ECParameters(pkey->pkey.ec, pder);
539} 539}
540 540
541static int 541static int
542eckey_param_print(BIO * bp, const EVP_PKEY * pkey, int indent, 542eckey_param_print(BIO * bp, const EVP_PKEY * pkey, int indent,
543 ASN1_PCTX * ctx) 543 ASN1_PCTX * ctx)
544{ 544{
545 return do_EC_KEY_print(bp, pkey->pkey.ec, indent, 0); 545 return do_EC_KEY_print(bp, pkey->pkey.ec, indent, 0);
546} 546}
547 547
548static int 548static int
549eckey_pub_print(BIO * bp, const EVP_PKEY * pkey, int indent, 549eckey_pub_print(BIO * bp, const EVP_PKEY * pkey, int indent,
550 ASN1_PCTX * ctx) 550 ASN1_PCTX * ctx)
551{ 551{
@@ -553,14 +553,14 @@ eckey_pub_print(BIO * bp, const EVP_PKEY * pkey, int indent,
553} 553}
554 554
555 555
556static int 556static int
557eckey_priv_print(BIO * bp, const EVP_PKEY * pkey, int indent, 557eckey_priv_print(BIO * bp, const EVP_PKEY * pkey, int indent,
558 ASN1_PCTX * ctx) 558 ASN1_PCTX * ctx)
559{ 559{
560 return do_EC_KEY_print(bp, pkey->pkey.ec, indent, 2); 560 return do_EC_KEY_print(bp, pkey->pkey.ec, indent, 2);
561} 561}
562 562
563static int 563static int
564old_ec_priv_decode(EVP_PKEY * pkey, 564old_ec_priv_decode(EVP_PKEY * pkey,
565 const unsigned char **pder, int derlen) 565 const unsigned char **pder, int derlen)
566{ 566{
@@ -573,13 +573,13 @@ old_ec_priv_decode(EVP_PKEY * pkey,
573 return 1; 573 return 1;
574} 574}
575 575
576static int 576static int
577old_ec_priv_encode(const EVP_PKEY * pkey, unsigned char **pder) 577old_ec_priv_encode(const EVP_PKEY * pkey, unsigned char **pder)
578{ 578{
579 return i2d_ECPrivateKey(pkey->pkey.ec, pder); 579 return i2d_ECPrivateKey(pkey->pkey.ec, pder);
580} 580}
581 581
582static int 582static int
583ec_pkey_ctrl(EVP_PKEY * pkey, int op, long arg1, void *arg2) 583ec_pkey_ctrl(EVP_PKEY * pkey, int op, long arg1, void *arg2)
584{ 584{
585 switch (op) { 585 switch (op) {