diff options
| author | tb <> | 2023-12-29 18:48:25 +0000 |
|---|---|---|
| committer | tb <> | 2023-12-29 18:48:25 +0000 |
| commit | 3262e60f08c7a7c0605da1f73e684c0ff6a43c4c (patch) | |
| tree | 53ce55d71dcb4df35ef85a3d51414edc41914052 /src/lib/libc | |
| parent | 3b9ef26e3354193b8139f526e3350d30b751d1f9 (diff) | |
| download | openbsd-3262e60f08c7a7c0605da1f73e684c0ff6a43c4c.tar.gz openbsd-3262e60f08c7a7c0605da1f73e684c0ff6a43c4c.tar.bz2 openbsd-3262e60f08c7a7c0605da1f73e684c0ff6a43c4c.zip | |
Clean up old_ec_priv_decode()
As per usual. Stylistic adjustments and missing error check.
ok jsing
Diffstat (limited to '')
| -rw-r--r-- | src/lib/libcrypto/ec/ec_ameth.c | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/src/lib/libcrypto/ec/ec_ameth.c b/src/lib/libcrypto/ec/ec_ameth.c index e6fe8bd370..660e5bffd1 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.48 2023/12/29 18:47:47 tb Exp $ */ | 1 | /* $OpenBSD: ec_ameth.c,v 1.49 2023/12/29 18:48:25 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 | */ |
| @@ -599,16 +599,23 @@ eckey_priv_print(BIO *bp, const EVP_PKEY *pkey, int indent, | |||
| 599 | } | 599 | } |
| 600 | 600 | ||
| 601 | static int | 601 | static int |
| 602 | old_ec_priv_decode(EVP_PKEY *pkey, | 602 | old_ec_priv_decode(EVP_PKEY *pkey, const unsigned char **priv, int priv_len) |
| 603 | const unsigned char **pder, int derlen) | ||
| 604 | { | 603 | { |
| 605 | EC_KEY *ec; | 604 | EC_KEY *eckey; |
| 606 | if (!(ec = d2i_ECPrivateKey(NULL, pder, derlen))) { | 605 | int ret = 0; |
| 607 | ECerror(EC_R_DECODE_ERROR); | 606 | |
| 608 | return 0; | 607 | if ((eckey = d2i_ECPrivateKey(NULL, priv, priv_len)) == NULL) |
| 609 | } | 608 | goto err; |
| 610 | EVP_PKEY_assign_EC_KEY(pkey, ec); | 609 | if (!EVP_PKEY_assign_EC_KEY(pkey, eckey)) |
| 611 | return 1; | 610 | goto err; |
| 611 | eckey = NULL; | ||
| 612 | |||
| 613 | ret = 1; | ||
| 614 | |||
| 615 | err: | ||
| 616 | EC_KEY_free(eckey); | ||
| 617 | |||
| 618 | return ret; | ||
| 612 | } | 619 | } |
| 613 | 620 | ||
| 614 | static int | 621 | static int |
