diff options
Diffstat (limited to 'src/lib/libcrypto/ec/ec_ameth.c')
-rw-r--r-- | src/lib/libcrypto/ec/ec_ameth.c | 44 |
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); | |||
75 | static int ecdh_cms_encrypt(CMS_RecipientInfo *ri); | 75 | static int ecdh_cms_encrypt(CMS_RecipientInfo *ri); |
76 | #endif | 76 | #endif |
77 | 77 | ||
78 | static int | 78 | static int |
79 | eckey_param2type(int *pptype, void **ppval, EC_KEY * ec_key) | 79 | eckey_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 | ||
110 | static int | 110 | static int |
111 | eckey_pub_encode(X509_PUBKEY * pk, const EVP_PKEY * pkey) | 111 | eckey_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 | ||
193 | static int | 193 | static int |
194 | eckey_pub_decode(EVP_PKEY * pkey, X509_PUBKEY * pubkey) | 194 | eckey_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 | ||
226 | static int | 226 | static int |
227 | eckey_pub_cmp(const EVP_PKEY * a, const EVP_PKEY * b) | 227 | eckey_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 | ||
241 | static int | 241 | static int |
242 | eckey_priv_decode(EVP_PKEY * pkey, const PKCS8_PRIV_KEY_INFO * p8) | 242 | eckey_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 | ||
308 | static int | 308 | static int |
309 | eckey_priv_encode(PKCS8_PRIV_KEY_INFO * p8, const EVP_PKEY * pkey) | 309 | eckey_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 | ||
361 | static int | 361 | static int |
362 | int_ec_size(const EVP_PKEY * pkey) | 362 | int_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 | ||
367 | static int | 367 | static int |
368 | ec_bits(const EVP_PKEY * pkey) | 368 | ec_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 | ||
408 | static int | 408 | static int |
409 | ec_missing_parameters(const EVP_PKEY * pkey) | 409 | ec_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 | ||
416 | static int | 416 | static int |
417 | ec_copy_parameters(EVP_PKEY * to, const EVP_PKEY * from) | 417 | ec_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 | ||
422 | static int | 422 | static int |
423 | ec_cmp_parameters(const EVP_PKEY * a, const EVP_PKEY * b) | 423 | ec_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 | ||
432 | static void | 432 | static void |
433 | int_ec_free(EVP_PKEY * pkey) | 433 | int_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 | ||
438 | static int | 438 | static int |
439 | do_EC_KEY_print(BIO * bp, const EC_KEY * x, int off, int ktype) | 439 | do_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 | ||
522 | static int | 522 | static int |
523 | eckey_param_decode(EVP_PKEY * pkey, | 523 | eckey_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 | ||
535 | static int | 535 | static int |
536 | eckey_param_encode(const EVP_PKEY * pkey, unsigned char **pder) | 536 | eckey_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 | ||
541 | static int | 541 | static int |
542 | eckey_param_print(BIO * bp, const EVP_PKEY * pkey, int indent, | 542 | eckey_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 | ||
548 | static int | 548 | static int |
549 | eckey_pub_print(BIO * bp, const EVP_PKEY * pkey, int indent, | 549 | eckey_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 | ||
556 | static int | 556 | static int |
557 | eckey_priv_print(BIO * bp, const EVP_PKEY * pkey, int indent, | 557 | eckey_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 | ||
563 | static int | 563 | static int |
564 | old_ec_priv_decode(EVP_PKEY * pkey, | 564 | old_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 | ||
576 | static int | 576 | static int |
577 | old_ec_priv_encode(const EVP_PKEY * pkey, unsigned char **pder) | 577 | old_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 | ||
582 | static int | 582 | static int |
583 | ec_pkey_ctrl(EVP_PKEY * pkey, int op, long arg1, void *arg2) | 583 | ec_pkey_ctrl(EVP_PKEY * pkey, int op, long arg1, void *arg2) |
584 | { | 584 | { |
585 | switch (op) { | 585 | switch (op) { |