summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authortb <>2024-10-30 17:51:35 +0000
committertb <>2024-10-30 17:51:35 +0000
commit3e6214259165b7da17edee3f76bb95cfafe0c5a4 (patch)
tree9893edf2e254a2e186bec9dc14c31d7c6319365c /src/lib
parent5178da8bac39346f24655279edfd7f58c1646b41 (diff)
downloadopenbsd-3e6214259165b7da17edee3f76bb95cfafe0c5a4.tar.gz
openbsd-3e6214259165b7da17edee3f76bb95cfafe0c5a4.tar.bz2
openbsd-3e6214259165b7da17edee3f76bb95cfafe0c5a4.zip
Rewrite BN_hex2point()
This can do the reverse dance: chain BN_hex2bn() with EC_POINT_bn2point(). ok jsing
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/libcrypto/ec/ec_print.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/src/lib/libcrypto/ec/ec_print.c b/src/lib/libcrypto/ec/ec_print.c
index 698d2be484..be5f845423 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.17 2024/10/30 17:49:27 tb Exp $ */ 1/* $OpenBSD: ec_print.c,v 1.18 2024/10/30 17:51:35 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 *
@@ -137,19 +137,20 @@ EC_POINT_point2hex(const EC_GROUP *group, const EC_POINT *point,
137LCRYPTO_ALIAS(EC_POINT_point2hex); 137LCRYPTO_ALIAS(EC_POINT_point2hex);
138 138
139EC_POINT * 139EC_POINT *
140EC_POINT_hex2point(const EC_GROUP *group, const char *buf, 140EC_POINT_hex2point(const EC_GROUP *group, const char *hex,
141 EC_POINT *point, BN_CTX *ctx) 141 EC_POINT *in_point, BN_CTX *ctx)
142{ 142{
143 EC_POINT *ret = NULL; 143 EC_POINT *point = NULL;
144 BIGNUM *tmp_bn = NULL; 144 BIGNUM *bn = NULL;
145
146 if (BN_hex2bn(&tmp_bn, buf) == 0)
147 return NULL;
148 145
149 ret = EC_POINT_bn2point(group, tmp_bn, point, ctx); 146 if (BN_hex2bn(&bn, hex) == 0)
147 goto err;
148 if ((point = EC_POINT_bn2point(group, bn, in_point, ctx)) == NULL)
149 goto err;
150 150
151 BN_free(tmp_bn); 151 err:
152 BN_free(bn);
152 153
153 return ret; 154 return point;
154} 155}
155LCRYPTO_ALIAS(EC_POINT_hex2point); 156LCRYPTO_ALIAS(EC_POINT_hex2point);