diff options
Diffstat (limited to 'src/lib/libcrypto/ec')
| -rw-r--r-- | src/lib/libcrypto/ec/ec_print.c | 28 |
1 files changed, 11 insertions, 17 deletions
diff --git a/src/lib/libcrypto/ec/ec_print.c b/src/lib/libcrypto/ec/ec_print.c index d0c9585007..d8261a94f5 100644 --- a/src/lib/libcrypto/ec/ec_print.c +++ b/src/lib/libcrypto/ec/ec_print.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ec_print.c,v 1.15 2024/10/28 17:00:51 tb Exp $ */ | 1 | /* $OpenBSD: ec_print.c,v 1.16 2024/10/30 17:36:22 tb Exp $ */ |
| 2 | /* ==================================================================== | 2 | /* ==================================================================== |
| 3 | * Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved. |
| 4 | * | 4 | * |
| @@ -62,27 +62,21 @@ | |||
| 62 | 62 | ||
| 63 | BIGNUM * | 63 | BIGNUM * |
| 64 | EC_POINT_point2bn(const EC_GROUP *group, const EC_POINT *point, | 64 | EC_POINT_point2bn(const EC_GROUP *group, const EC_POINT *point, |
| 65 | point_conversion_form_t form, BIGNUM *ret, BN_CTX *ctx) | 65 | point_conversion_form_t form, BIGNUM *in_bn, BN_CTX *ctx) |
| 66 | { | 66 | { |
| 67 | BIGNUM *bn = NULL; | ||
| 68 | unsigned char *buf = NULL; | ||
| 67 | size_t buf_len = 0; | 69 | size_t buf_len = 0; |
| 68 | unsigned char *buf; | ||
| 69 | |||
| 70 | buf_len = EC_POINT_point2oct(group, point, form, NULL, 0, ctx); | ||
| 71 | if (buf_len == 0) | ||
| 72 | return NULL; | ||
| 73 | |||
| 74 | if ((buf = malloc(buf_len)) == NULL) | ||
| 75 | return NULL; | ||
| 76 | 70 | ||
| 77 | if (!EC_POINT_point2oct(group, point, form, buf, buf_len, ctx)) { | 71 | if (!ec_point_to_octets(group, point, form, &buf, &buf_len, ctx)) |
| 78 | free(buf); | 72 | goto err; |
| 79 | return NULL; | 73 | if ((bn = BN_bin2bn(buf, buf_len, in_bn)) == NULL) |
| 80 | } | 74 | goto err; |
| 81 | ret = BN_bin2bn(buf, buf_len, ret); | ||
| 82 | 75 | ||
| 83 | free(buf); | 76 | err: |
| 77 | freezero(buf, buf_len); | ||
| 84 | 78 | ||
| 85 | return ret; | 79 | return bn; |
| 86 | } | 80 | } |
| 87 | LCRYPTO_ALIAS(EC_POINT_point2bn); | 81 | LCRYPTO_ALIAS(EC_POINT_point2bn); |
| 88 | 82 | ||
