[openssl] master update

shane.lontis at oracle.com shane.lontis at oracle.com
Mon Dec 7 07:35:50 UTC 2020


The branch master has been updated
       via  c1131e6a0e4a9a9734559f7a58b278c027d76711 (commit)
       via  abdd3fa04f3401c4a542257fdd803ff4c4daf8ef (commit)
      from  ac093b3fe6ba3f21e874a25ddecc7c1b4dff2765 (commit)


- Log -----------------------------------------------------------------
commit c1131e6a0e4a9a9734559f7a58b278c027d76711
Author: Shane Lontis <shane.lontis at oracle.com>
Date:   Mon Nov 2 12:46:38 2020 +1000

    Deprecate EC_POINT_bn2point and EC_POINT_point2bn.
    
    Fixes #10366
    
    The one place that actually used was in the legacy printing of ecparams.
    This has been replaced by the pointtobuf variant.
    
    The ecparam app was using one of these functions - this line has just been
    removed as another PR will remove all the code generated lines..
    
    Reviewed-by: Tomas Mraz <tmraz at fedoraproject.org>
    (Merged from https://github.com/openssl/openssl/pull/13294)

commit abdd3fa04f3401c4a542257fdd803ff4c4daf8ef
Author: Shane Lontis <shane.lontis at oracle.com>
Date:   Mon Nov 2 12:41:23 2020 +1000

    Change OPENSSL_hexstr2buf_ex() & OPENSSL_buf2hexstr_ex() to pass the separator
    
    Reviewed-by: Tomas Mraz <tmraz at fedoraproject.org>
    (Merged from https://github.com/openssl/openssl/pull/13294)

-----------------------------------------------------------------------

Summary of changes:
 apps/ecparam.c                                     |   1 -
 crypto/ec/build.info                               |   2 +-
 crypto/ec/{ec_print.c => ec_deprecated.c}          |  63 ++-----------
 crypto/ec/ec_print.c                               | 102 ++++++---------------
 crypto/ec/eck_prn.c                                |  37 ++++----
 crypto/o_str.c                                     |   9 +-
 crypto/params_from_text.c                          |   2 +-
 doc/man3/EC_POINT_new.pod                          |  14 +--
 doc/man3/OPENSSL_hexchar2int.pod                   |  14 ++-
 include/openssl/crypto.h.in                        |   5 +-
 include/openssl/ec.h                               |  14 ++-
 .../encode_decode/encode_key2text.c                |  20 ++--
 test/hexstr_test.c                                 |   5 +-
 util/libcrypto.num                                 |   4 +-
 14 files changed, 111 insertions(+), 181 deletions(-)
 copy crypto/ec/{ec_print.c => ec_deprecated.c} (55%)

diff --git a/apps/ecparam.c b/apps/ecparam.c
index b51a61adc0..3e20be24b2 100644
--- a/apps/ecparam.c
+++ b/apps/ecparam.c
@@ -294,7 +294,6 @@ int ecparam_main(int argc, char **argv)
             goto end;
         }
         BIO_printf(bio_err, "ok\n");
-
     }
 
     if (outformat == FORMAT_ASN1 && genkey)
diff --git a/crypto/ec/build.info b/crypto/ec/build.info
index 496a932e4c..63512565ba 100644
--- a/crypto/ec/build.info
+++ b/crypto/ec/build.info
@@ -45,7 +45,7 @@ ENDIF
 
 $COMMON=ec_lib.c ecp_smpl.c ecp_mont.c ecp_nist.c ec_cvt.c ec_mult.c \
         ec_curve.c ec_check.c ec_print.c ec_key.c ecx_key.c ec_asn1.c \
-        ec2_smpl.c \
+        ec2_smpl.c ec_deprecated.c \
         ecp_oct.c ec2_oct.c ec_oct.c ec_kmeth.c ecdh_ossl.c \
         ecdsa_ossl.c ecdsa_sign.c ecdsa_vrf.c curve25519.c \
         curve448/arch_32/f_impl.c curve448/f_generic.c curve448/scalar.c \
diff --git a/crypto/ec/ec_print.c b/crypto/ec/ec_deprecated.c
similarity index 55%
copy from crypto/ec/ec_print.c
copy to crypto/ec/ec_deprecated.c
index 4fb76fe74e..cd2eec80b7 100644
--- a/crypto/ec/ec_print.c
+++ b/crypto/ec/ec_deprecated.c
@@ -8,15 +8,16 @@
  */
 
 /*
- * ECDSA low level APIs are deprecated for public use, but still ok for
- * internal use.
+ * Suppress deprecation warnings for EC low level implementations that are
+ * kept until removal.
  */
-#include "internal/deprecated.h"
+#define OPENSSL_SUPPRESS_DEPRECATED
 
 #include <openssl/crypto.h>
 #include <openssl/err.h>
-#include "ec_local.h"
+#include <openssl/ec.h>
 
+#ifndef OPENSSL_NO_DEPRECATED_3_0
 BIGNUM *EC_POINT_point2bn(const EC_GROUP *group,
                           const EC_POINT *point,
                           point_conversion_form_t form,
@@ -47,7 +48,7 @@ EC_POINT *EC_POINT_bn2point(const EC_GROUP *group,
     if ((buf_len = BN_num_bytes(bn)) == 0)
         buf_len = 1;
     if ((buf = OPENSSL_malloc(buf_len)) == NULL) {
-        ERR_raise(ERR_LIB_EC, ERR_R_MALLOC_FAILURE);
+        ECerr(EC_F_EC_POINT_BN2POINT, ERR_R_MALLOC_FAILURE);
         return NULL;
     }
 
@@ -74,54 +75,4 @@ EC_POINT *EC_POINT_bn2point(const EC_GROUP *group,
     OPENSSL_free(buf);
     return ret;
 }
-
-static const char *HEX_DIGITS = "0123456789ABCDEF";
-
-/* the return value must be freed (using OPENSSL_free()) */
-char *EC_POINT_point2hex(const EC_GROUP *group,
-                         const EC_POINT *point,
-                         point_conversion_form_t form, BN_CTX *ctx)
-{
-    char *ret, *p;
-    size_t buf_len = 0, i;
-    unsigned char *buf = NULL, *pbuf;
-
-    buf_len = EC_POINT_point2buf(group, point, form, &buf, ctx);
-
-    if (buf_len == 0)
-        return NULL;
-
-    ret = OPENSSL_malloc(buf_len * 2 + 2);
-    if (ret == NULL) {
-        OPENSSL_free(buf);
-        return NULL;
-    }
-    p = ret;
-    pbuf = buf;
-    for (i = buf_len; i > 0; i--) {
-        int v = (int)*(pbuf++);
-        *(p++) = HEX_DIGITS[v >> 4];
-        *(p++) = HEX_DIGITS[v & 0x0F];
-    }
-    *p = '\0';
-
-    OPENSSL_free(buf);
-
-    return ret;
-}
-
-EC_POINT *EC_POINT_hex2point(const EC_GROUP *group,
-                             const char *buf, EC_POINT *point, BN_CTX *ctx)
-{
-    EC_POINT *ret = NULL;
-    BIGNUM *tmp_bn = NULL;
-
-    if (!BN_hex2bn(&tmp_bn, buf))
-        return NULL;
-
-    ret = EC_POINT_bn2point(group, tmp_bn, point, ctx);
-
-    BN_clear_free(tmp_bn);
-
-    return ret;
-}
+#endif /* OPENSSL_NO_DEPRECATED_3_0 */
diff --git a/crypto/ec/ec_print.c b/crypto/ec/ec_print.c
index 4fb76fe74e..d791e15b48 100644
--- a/crypto/ec/ec_print.c
+++ b/crypto/ec/ec_print.c
@@ -7,74 +7,10 @@
  * https://www.openssl.org/source/license.html
  */
 
-/*
- * ECDSA low level APIs are deprecated for public use, but still ok for
- * internal use.
- */
-#include "internal/deprecated.h"
-
+#include <string.h> /* strlen */
 #include <openssl/crypto.h>
-#include <openssl/err.h>
 #include "ec_local.h"
 
-BIGNUM *EC_POINT_point2bn(const EC_GROUP *group,
-                          const EC_POINT *point,
-                          point_conversion_form_t form,
-                          BIGNUM *ret, BN_CTX *ctx)
-{
-    size_t buf_len = 0;
-    unsigned char *buf;
-
-    buf_len = EC_POINT_point2buf(group, point, form, &buf, ctx);
-
-    if (buf_len == 0)
-        return NULL;
-
-    ret = BN_bin2bn(buf, buf_len, ret);
-
-    OPENSSL_free(buf);
-
-    return ret;
-}
-
-EC_POINT *EC_POINT_bn2point(const EC_GROUP *group,
-                            const BIGNUM *bn, EC_POINT *point, BN_CTX *ctx)
-{
-    size_t buf_len = 0;
-    unsigned char *buf;
-    EC_POINT *ret;
-
-    if ((buf_len = BN_num_bytes(bn)) == 0)
-        buf_len = 1;
-    if ((buf = OPENSSL_malloc(buf_len)) == NULL) {
-        ERR_raise(ERR_LIB_EC, ERR_R_MALLOC_FAILURE);
-        return NULL;
-    }
-
-    if (!BN_bn2binpad(bn, buf, buf_len)) {
-        OPENSSL_free(buf);
-        return NULL;
-    }
-
-    if (point == NULL) {
-        if ((ret = EC_POINT_new(group)) == NULL) {
-            OPENSSL_free(buf);
-            return NULL;
-        }
-    } else
-        ret = point;
-
-    if (!EC_POINT_oct2point(group, ret, buf, buf_len, ctx)) {
-        if (ret != point)
-            EC_POINT_clear_free(ret);
-        OPENSSL_free(buf);
-        return NULL;
-    }
-
-    OPENSSL_free(buf);
-    return ret;
-}
-
 static const char *HEX_DIGITS = "0123456789ABCDEF";
 
 /* the return value must be freed (using OPENSSL_free()) */
@@ -111,17 +47,39 @@ char *EC_POINT_point2hex(const EC_GROUP *group,
 }
 
 EC_POINT *EC_POINT_hex2point(const EC_GROUP *group,
-                             const char *buf, EC_POINT *point, BN_CTX *ctx)
+                             const char *hex, EC_POINT *point, BN_CTX *ctx)
 {
-    EC_POINT *ret = NULL;
-    BIGNUM *tmp_bn = NULL;
+    int ok = 0;
+    unsigned char *oct_buf = NULL;
+    size_t len, oct_buf_len = 0;
+    EC_POINT *pt = NULL;
 
-    if (!BN_hex2bn(&tmp_bn, buf))
+    if (group == NULL || hex == NULL)
         return NULL;
 
-    ret = EC_POINT_bn2point(group, tmp_bn, point, ctx);
+    if (point == NULL) {
+        pt = EC_POINT_new(group);
+        if (pt == NULL)
+            goto err;
+    } else {
+        pt = point;
+    }
 
-    BN_clear_free(tmp_bn);
+    len = strlen(hex) / 2;
+    oct_buf = OPENSSL_malloc(len);
+    if (oct_buf == NULL)
+        return NULL;
 
-    return ret;
+    if (!OPENSSL_hexstr2buf_ex(oct_buf, len, &oct_buf_len, hex, '\0')
+        || !EC_POINT_oct2point(group, pt, oct_buf, oct_buf_len, ctx))
+        goto err;
+    ok = 1;
+err:
+    OPENSSL_clear_free(oct_buf, oct_buf_len);
+    if (!ok) {
+        if (pt != point)
+            EC_POINT_clear_free(pt);
+        pt = NULL;
+    }
+    return pt;
 }
diff --git a/crypto/ec/eck_prn.c b/crypto/ec/eck_prn.c
index 7b892ae403..20c6065a31 100644
--- a/crypto/ec/eck_prn.c
+++ b/crypto/ec/eck_prn.c
@@ -69,10 +69,11 @@ int ECPKParameters_print(BIO *bp, const EC_GROUP *x, int off)
     int ret = 0, reason = ERR_R_BIO_LIB;
     BN_CTX *ctx = NULL;
     const EC_POINT *point = NULL;
-    BIGNUM *p = NULL, *a = NULL, *b = NULL, *gen = NULL;
+    BIGNUM *p = NULL, *a = NULL, *b = NULL;
+    unsigned char *gen_buf = NULL;
     const BIGNUM *order = NULL, *cofactor = NULL;
     const unsigned char *seed;
-    size_t seed_len = 0;
+    size_t seed_len = 0, gen_buf_len = 0;
 
     static const char *gen_compressed = "Generator (compressed):";
     static const char *gen_uncompressed = "Generator (uncompressed):";
@@ -112,6 +113,7 @@ int ECPKParameters_print(BIO *bp, const EC_GROUP *x, int off)
                 goto err;
         }
     } else {
+        const char *form_str;
         /* explicit parameters */
         int is_char_two = 0;
         point_conversion_form_t form;
@@ -144,7 +146,8 @@ int ECPKParameters_print(BIO *bp, const EC_GROUP *x, int off)
 
         form = EC_GROUP_get_point_conversion_form(x);
 
-        if ((gen = EC_POINT_point2bn(x, point, form, NULL, ctx)) == NULL) {
+        gen_buf_len = EC_POINT_point2buf(x, point, form, &gen_buf, ctx);
+        if (gen_buf_len == 0) {
             reason = ERR_R_EC_LIB;
             goto err;
         }
@@ -185,22 +188,18 @@ int ECPKParameters_print(BIO *bp, const EC_GROUP *x, int off)
             goto err;
         if ((b != NULL) && !ASN1_bn_print(bp, "B:   ", b, NULL, off))
             goto err;
-        if (form == POINT_CONVERSION_COMPRESSED) {
-            if ((gen != NULL) && !ASN1_bn_print(bp, gen_compressed, gen,
-                                                NULL, off))
-                goto err;
-        } else if (form == POINT_CONVERSION_UNCOMPRESSED) {
-            if ((gen != NULL) && !ASN1_bn_print(bp, gen_uncompressed, gen,
-                                                NULL, off))
-                goto err;
-        } else {                /* form == POINT_CONVERSION_HYBRID */
 
-            if ((gen != NULL) && !ASN1_bn_print(bp, gen_hybrid, gen,
-                                                NULL, off))
-                goto err;
-        }
-        if ((order != NULL) && !ASN1_bn_print(bp, "Order: ", order,
-                                              NULL, off))
+        if (form == POINT_CONVERSION_COMPRESSED)
+            form_str = gen_compressed;
+        else if (form == POINT_CONVERSION_UNCOMPRESSED)
+            form_str = gen_uncompressed;
+        else
+            form_str = gen_hybrid;
+        if (gen_buf != NULL
+            && !print_bin(bp, form_str, gen_buf, gen_buf_len, off))
+            goto err;
+
+        if ((order != NULL) && !ASN1_bn_print(bp, "Order: ", order, NULL, off))
             goto err;
         if ((cofactor != NULL) && !ASN1_bn_print(bp, "Cofactor: ", cofactor,
                                                  NULL, off))
@@ -215,7 +214,7 @@ int ECPKParameters_print(BIO *bp, const EC_GROUP *x, int off)
     BN_free(p);
     BN_free(a);
     BN_free(b);
-    BN_free(gen);
+    OPENSSL_clear_free(gen_buf, gen_buf_len);
     BN_CTX_free(ctx);
     return ret;
 }
diff --git a/crypto/o_str.c b/crypto/o_str.c
index 933133a05c..142ac4ba44 100644
--- a/crypto/o_str.c
+++ b/crypto/o_str.c
@@ -176,9 +176,9 @@ static int hexstr2buf_sep(unsigned char *buf, size_t buf_n, size_t *buflen,
  * Given a string of hex digits convert to a buffer
  */
 int OPENSSL_hexstr2buf_ex(unsigned char *buf, size_t buf_n, size_t *buflen,
-                          const char *str)
+                          const char *str, const char sep)
 {
-    return hexstr2buf_sep(buf, buf_n, buflen, str, DEFAULT_SEPARATOR);
+    return hexstr2buf_sep(buf, buf_n, buflen, str, sep);
 }
 
 unsigned char *openssl_hexstr2buf_sep(const char *str, long *buflen,
@@ -249,9 +249,10 @@ static int buf2hexstr_sep(char *str, size_t str_n, size_t *strlen,
 }
 
 int OPENSSL_buf2hexstr_ex(char *str, size_t str_n, size_t *strlen,
-                          const unsigned char *buf, size_t buflen)
+                          const unsigned char *buf, size_t buflen,
+                          const char sep)
 {
-    return buf2hexstr_sep(str, str_n, strlen, buf, buflen, DEFAULT_SEPARATOR);
+    return buf2hexstr_sep(str, str_n, strlen, buf, buflen, sep);
 }
 
 char *openssl_buf2hexstr_sep(const unsigned char *buf, long buflen, char sep)
diff --git a/crypto/params_from_text.c b/crypto/params_from_text.c
index 9f74dc1075..d458d31b2e 100644
--- a/crypto/params_from_text.c
+++ b/crypto/params_from_text.c
@@ -145,7 +145,7 @@ static int construct_from_text(OSSL_PARAM *to, const OSSL_PARAM *paramdef,
             if (ishex) {
                 size_t l = 0;
 
-                if (!OPENSSL_hexstr2buf_ex(buf, buf_n, &l, value))
+                if (!OPENSSL_hexstr2buf_ex(buf, buf_n, &l, value, ':'))
                     return 0;
             } else {
                 memcpy(buf, value, buf_n);
diff --git a/doc/man3/EC_POINT_new.pod b/doc/man3/EC_POINT_new.pod
index 83b61feb7f..fb247507e5 100644
--- a/doc/man3/EC_POINT_new.pod
+++ b/doc/man3/EC_POINT_new.pod
@@ -55,11 +55,6 @@ EC_POINT_hex2point
                            unsigned char **pbuf, BN_CTX *ctx);
  int EC_POINT_oct2point(const EC_GROUP *group, EC_POINT *p,
                         const unsigned char *buf, size_t len, BN_CTX *ctx);
- BIGNUM *EC_POINT_point2bn(const EC_GROUP *group, const EC_POINT *p,
-                           point_conversion_form_t form, BIGNUM *bn,
-                           BN_CTX *ctx);
- EC_POINT *EC_POINT_bn2point(const EC_GROUP *group, const BIGNUM *bn,
-                             EC_POINT *p, BN_CTX *ctx);
  char *EC_POINT_point2hex(const EC_GROUP *group, const EC_POINT *p,
                           point_conversion_form_t form, BN_CTX *ctx);
  EC_POINT *EC_POINT_hex2point(const EC_GROUP *group, const char *hex,
@@ -96,6 +91,11 @@ Deprecated since OpenSSL 3.0:
                                               EC_POINT *p,
                                               const BIGNUM *x, int y_bit,
                                               BN_CTX *ctx);
+ BIGNUM *EC_POINT_point2bn(const EC_GROUP *group, const EC_POINT *p,
+                           point_conversion_form_t form, BIGNUM *bn,
+                           BN_CTX *ctx);
+ EC_POINT *EC_POINT_bn2point(const EC_GROUP *group, const BIGNUM *bn,
+                             EC_POINT *p, BN_CTX *ctx);
 
 =head1 DESCRIPTION
 
@@ -257,7 +257,9 @@ EC_POINT_get_Jprojective_coordinates_GFp(),
 EC_POINT_set_affine_coordinates_GFp(), EC_POINT_get_affine_coordinates_GFp(),
 EC_POINT_set_compressed_coordinates_GFp(),
 EC_POINT_set_affine_coordinates_GF2m(), EC_POINT_get_affine_coordinates_GF2m(),
-EC_POINT_set_compressed_coordinates_GF2m() were deprecated in OpenSSL 3.0.
+EC_POINT_set_compressed_coordinates_GF2m(),
+EC_POINT_point2bn(), and EC_POINT_bn2point() were deprecated in OpenSSL 3.0.
+
 
 B<EC_POINT_set_affine_coordinates>, B<EC_POINT_get_affine_coordinates>,
 and B<EC_POINT_set_compressed_coordinates> were
diff --git a/doc/man3/OPENSSL_hexchar2int.pod b/doc/man3/OPENSSL_hexchar2int.pod
index 930b32b61f..a112815127 100644
--- a/doc/man3/OPENSSL_hexchar2int.pod
+++ b/doc/man3/OPENSSL_hexchar2int.pod
@@ -13,10 +13,10 @@ OPENSSL_buf2hexstr_ex, OPENSSL_buf2hexstr
 
  int OPENSSL_hexchar2int(unsigned char c);
  int OPENSSL_hexstr2buf_ex(unsigned char *buf, size_t buf_n, long *buflen,
-                           const char *str);
+                           const char *str, const char sep);
  unsigned char *OPENSSL_hexstr2buf(const char *str, long *len);
  int OPENSSL_buf2hexstr_ex(char *str, size_t str_n, size_t *strlen,
-                           const unsigned char *buf, long buflen);
+                           const unsigned char *buf, long buflen, const char sep);
  char *OPENSSL_buf2hexstr(const unsigned char *buf, long buflen);
 
 =head1 DESCRIPTION
@@ -26,6 +26,8 @@ equivalent.
 
 OPENSSL_hexstr2buf_ex() decodes the hex string B<str> and places the
 resulting string of bytes in the given I<buf>.
+The character I<sep> is the separator between the bytes, setting this to '\0'
+means that there is no separator.
 I<buf_n> gives the size of the buffer.
 If I<buflen> is not NULL, it is filled in with the result length.
 To find out how large the result will be, call this function with NULL
@@ -34,20 +36,24 @@ Colons between two-character hex "bytes" are accepted and ignored.
 An odd number of hex digits is an error.
 
 OPENSSL_hexstr2buf() does the same thing as OPENSSL_hexstr2buf_ex(),
-but allocates the space for the result, and returns the result.
+but allocates the space for the result, and returns the result. It uses a
+default separator of ':'.
 The memory is allocated by calling OPENSSL_malloc() and should be
 released by calling OPENSSL_free().
 
 OPENSSL_buf2hexstr_ex() encodes the contents of the given I<buf> with
 length I<buflen> and places the resulting hexadecimal character string
 in the given I<str>.
+The character I<sep> is the separator between the bytes, setting this to '\0'
+means that there is no separator.
 I<str_n> gives the size of the of the string buffer.
 If I<strlen> is not NULL, it is filled in with the result length.
 To find out how large the result will be, call this function with NULL
 for I<str>.
 
 OPENSSL_buf2hexstr() does the same thing as OPENSSL_buf2hexstr_ex(),
-but allocates the space for the result, and returns the result.
+but allocates the space for the result, and returns the result. It uses a
+default separator of ':'.
 The memory is allocated by calling OPENSSL_malloc() and should be
 released by calling OPENSSL_free().
 
diff --git a/include/openssl/crypto.h.in b/include/openssl/crypto.h.in
index f4f098b72e..0641db3a44 100644
--- a/include/openssl/crypto.h.in
+++ b/include/openssl/crypto.h.in
@@ -123,10 +123,11 @@ size_t OPENSSL_strlcpy(char *dst, const char *src, size_t siz);
 size_t OPENSSL_strlcat(char *dst, const char *src, size_t siz);
 size_t OPENSSL_strnlen(const char *str, size_t maxlen);
 int OPENSSL_buf2hexstr_ex(char *str, size_t str_n, size_t *strlen,
-                          const unsigned char *buf, size_t buflen);
+                          const unsigned char *buf, size_t buflen,
+                          const char sep);
 char *OPENSSL_buf2hexstr(const unsigned char *buf, long buflen);
 int OPENSSL_hexstr2buf_ex(unsigned char *buf, size_t buf_n, size_t *buflen,
-                          const char *str);
+                          const char *str, const char sep);
 unsigned char *OPENSSL_hexstr2buf(const char *str, long *buflen);
 int OPENSSL_hexchar2int(unsigned char c);
 
diff --git a/include/openssl/ec.h b/include/openssl/ec.h
index 0d41ef8297..2933d7503a 100644
--- a/include/openssl/ec.h
+++ b/include/openssl/ec.h
@@ -708,10 +708,16 @@ size_t EC_POINT_point2buf(const EC_GROUP *group, const EC_POINT *point,
                           unsigned char **pbuf, BN_CTX *ctx);
 
 /* other interfaces to point2oct/oct2point: */
-BIGNUM *EC_POINT_point2bn(const EC_GROUP *, const EC_POINT *,
-                          point_conversion_form_t form, BIGNUM *, BN_CTX *);
-EC_POINT *EC_POINT_bn2point(const EC_GROUP *, const BIGNUM *,
-                            EC_POINT *, BN_CTX *);
+#  ifndef OPENSSL_NO_DEPRECATED_3_0
+OSSL_DEPRECATEDIN_3_0 BIGNUM *EC_POINT_point2bn(const EC_GROUP *,
+                                                const EC_POINT *,
+                                                point_conversion_form_t form,
+                                                BIGNUM *, BN_CTX *);
+OSSL_DEPRECATEDIN_3_0 EC_POINT *EC_POINT_bn2point(const EC_GROUP *,
+                                                  const BIGNUM *,
+                                                  EC_POINT *, BN_CTX *);
+#  endif /* OPENSSL_NO_DEPRECATED_3_0 */
+
 char *EC_POINT_point2hex(const EC_GROUP *, const EC_POINT *,
                          point_conversion_form_t form, BN_CTX *);
 EC_POINT *EC_POINT_hex2point(const EC_GROUP *, const char *,
diff --git a/providers/implementations/encode_decode/encode_key2text.c b/providers/implementations/encode_decode/encode_key2text.c
index 4d33d869ed..2ac5046bf3 100644
--- a/providers/implementations/encode_decode/encode_key2text.c
+++ b/providers/implementations/encode_decode/encode_key2text.c
@@ -378,18 +378,17 @@ static int ec_param_explicit_curve_to_text(BIO *out, const EC_GROUP *group,
 static int ec_param_explicit_gen_to_text(BIO *out, const EC_GROUP *group,
                                          BN_CTX *ctx)
 {
+    int ret;
+    size_t buflen;
+    point_conversion_form_t form;
     const EC_POINT *point = NULL;
-    BIGNUM *gen = NULL;
     const char *glabel = NULL;
-    point_conversion_form_t form;
+    unsigned char *buf = NULL;
 
     form = EC_GROUP_get_point_conversion_form(group);
     point = EC_GROUP_get0_generator(group);
-    gen = BN_CTX_get(ctx);
 
-    if (gen == NULL
-        || point == NULL
-        || EC_POINT_point2bn(group, point, form, gen, ctx) == NULL)
+    if (point == NULL)
         return 0;
 
     switch (form) {
@@ -405,7 +404,14 @@ static int ec_param_explicit_gen_to_text(BIO *out, const EC_GROUP *group,
     default:
         return 0;
     }
-    return print_labeled_bignum(out, glabel, gen);
+
+    buflen = EC_POINT_point2buf(group, point, form, &buf, ctx);
+    if (buflen == 0)
+        return 0;
+
+    ret = print_labeled_buf(out, glabel, buf, buflen);
+    OPENSSL_clear_free(buf, buflen);
+    return ret;
 }
 
 /* Print explicit parameters */
diff --git a/test/hexstr_test.c b/test/hexstr_test.c
index c4f13b6d53..c03b58ef03 100644
--- a/test/hexstr_test.c
+++ b/test/hexstr_test.c
@@ -118,9 +118,10 @@ static int test_hexstr_ex_to_from(int test_index)
     unsigned char buf[64];
     struct testdata *test = &tbl_testdata[test_index];
 
-    return TEST_true(OPENSSL_hexstr2buf_ex(buf, sizeof(buf), &len, test->in))
+    return TEST_true(OPENSSL_hexstr2buf_ex(buf, sizeof(buf), &len, test->in, ':'))
            && TEST_mem_eq(buf, len, test->expected, test->expected_len)
-           && TEST_true(OPENSSL_buf2hexstr_ex(out, sizeof(out), NULL, buf, len))
+           && TEST_true(OPENSSL_buf2hexstr_ex(out, sizeof(out), NULL, buf, len,
+                        ':'))
            && TEST_str_eq(out, test->in);
 }
 
diff --git a/util/libcrypto.num b/util/libcrypto.num
index 1c6b17c629..e25e52442d 100644
--- a/util/libcrypto.num
+++ b/util/libcrypto.num
@@ -2953,7 +2953,7 @@ BIO_dgram_non_fatal_error               3016	3_0_0	EXIST::FUNCTION:DGRAM
 OCSP_request_is_signed                  3017	3_0_0	EXIST::FUNCTION:OCSP
 i2d_BASIC_CONSTRAINTS                   3018	3_0_0	EXIST::FUNCTION:
 EC_KEY_get_method                       3019	3_0_0	EXIST::FUNCTION:EC
-EC_POINT_bn2point                       3021	3_0_0	EXIST::FUNCTION:EC
+EC_POINT_bn2point                       3021	3_0_0	EXIST::FUNCTION:DEPRECATEDIN_3_0,EC
 PBE2PARAM_it                            3022	3_0_0	EXIST::FUNCTION:
 BN_rand                                 3023	3_0_0	EXIST::FUNCTION:
 ASN1_TYPE_unpack_sequence               3024	3_0_0	EXIST::FUNCTION:
@@ -3381,7 +3381,7 @@ BIO_method_type                         3451	3_0_0	EXIST::FUNCTION:
 ECPKParameters_print                    3452	3_0_0	EXIST::FUNCTION:EC
 EVP_rc4                                 3453	3_0_0	EXIST::FUNCTION:RC4
 CMS_data_create                         3454	3_0_0	EXIST::FUNCTION:CMS
-EC_POINT_point2bn                       3455	3_0_0	EXIST::FUNCTION:EC
+EC_POINT_point2bn                       3455	3_0_0	EXIST::FUNCTION:DEPRECATEDIN_3_0,EC
 CMS_unsigned_get0_data_by_OBJ           3456	3_0_0	EXIST::FUNCTION:CMS
 ASN1_OCTET_STRING_cmp                   3457	3_0_0	EXIST::FUNCTION:
 X509_NAME_print_ex                      3458	3_0_0	EXIST::FUNCTION:


More information about the openssl-commits mailing list