diff options
author | tb <> | 2023-06-25 19:33:39 +0000 |
---|---|---|
committer | tb <> | 2023-06-25 19:33:39 +0000 |
commit | f9b83075010aefbd7b3db67c575c77e1a95f508a (patch) | |
tree | 55c4136825cbab3bbbf8d2441631d43d270f75d5 /src/lib/libcrypto/ecdsa/ecs_ossl.c | |
parent | cf1c8770e1d3c36b47d2247e3815b5409c4316e5 (diff) | |
download | openbsd-f9b83075010aefbd7b3db67c575c77e1a95f508a.tar.gz openbsd-f9b83075010aefbd7b3db67c575c77e1a95f508a.tar.bz2 openbsd-f9b83075010aefbd7b3db67c575c77e1a95f508a.zip |
Move ECDSA_size() to ecs_ossl.c to match what was done in ecdh
Diffstat (limited to 'src/lib/libcrypto/ecdsa/ecs_ossl.c')
-rw-r--r-- | src/lib/libcrypto/ecdsa/ecs_ossl.c | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/src/lib/libcrypto/ecdsa/ecs_ossl.c b/src/lib/libcrypto/ecdsa/ecs_ossl.c index 547d3b59e1..251a938e2d 100644 --- a/src/lib/libcrypto/ecdsa/ecs_ossl.c +++ b/src/lib/libcrypto/ecdsa/ecs_ossl.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ecs_ossl.c,v 1.36 2023/06/25 19:04:35 tb Exp $ */ | 1 | /* $OpenBSD: ecs_ossl.c,v 1.37 2023/06/25 19:33:39 tb Exp $ */ |
2 | /* | 2 | /* |
3 | * Written by Nils Larsch for the OpenSSL project | 3 | * Written by Nils Larsch for the OpenSSL project |
4 | */ | 4 | */ |
@@ -580,3 +580,35 @@ ECDSA_verify(int type, const unsigned char *dgst, int dgst_len, | |||
580 | ECDSAerror(EVP_R_METHOD_NOT_SUPPORTED); | 580 | ECDSAerror(EVP_R_METHOD_NOT_SUPPORTED); |
581 | return 0; | 581 | return 0; |
582 | } | 582 | } |
583 | |||
584 | int | ||
585 | ECDSA_size(const EC_KEY *r) | ||
586 | { | ||
587 | BIGNUM *order = NULL; | ||
588 | const EC_GROUP *group; | ||
589 | ECDSA_SIG signature; | ||
590 | int ret = 0; | ||
591 | |||
592 | if (r == NULL) | ||
593 | goto err; | ||
594 | |||
595 | if ((group = EC_KEY_get0_group(r)) == NULL) | ||
596 | goto err; | ||
597 | |||
598 | if ((order = BN_new()) == NULL) | ||
599 | goto err; | ||
600 | |||
601 | if (!EC_GROUP_get_order(group, order, NULL)) | ||
602 | goto err; | ||
603 | |||
604 | signature.r = order; | ||
605 | signature.s = order; | ||
606 | |||
607 | if ((ret = i2d_ECDSA_SIG(&signature, NULL)) < 0) | ||
608 | ret = 0; | ||
609 | |||
610 | err: | ||
611 | BN_free(order); | ||
612 | |||
613 | return ret; | ||
614 | } | ||