diff options
author | Theo Buehler <tb@cvs.openbsd.org> | 2023-07-09 18:35:53 +0000 |
---|---|---|
committer | Theo Buehler <tb@cvs.openbsd.org> | 2023-07-09 18:35:53 +0000 |
commit | acb359cc9a912ee1cb109bb207ea1116aa2bcbe8 (patch) | |
tree | 6f59768922c732d664e81d3c88baa4ccec29faf7 /lib | |
parent | e54d0049594d30c820aa52dc3ba3c976f0c7d3a5 (diff) |
Simplify bn_print()
We no longer need to do weird things as taking the length of the hex
string and jumping over a sign we didn't need.
ok jsing
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libcrypto/bn/bn_print.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/lib/libcrypto/bn/bn_print.c b/lib/libcrypto/bn/bn_print.c index 84b82039683..c76d077324d 100644 --- a/lib/libcrypto/bn/bn_print.c +++ b/lib/libcrypto/bn/bn_print.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bn_print.c,v 1.42 2023/07/07 07:04:24 tb Exp $ */ +/* $OpenBSD: bn_print.c,v 1.43 2023/07/09 18:35:52 tb Exp $ */ /* * Copyright (c) 2023 Theo Buehler <tb@openbsd.org> @@ -26,6 +26,7 @@ #include <openssl/bio.h> #include <openssl/bn.h> +#include "bn_local.h" #include "bytestring.h" static int @@ -80,17 +81,14 @@ bn_print_bignum(BIO *bio, const BIGNUM *bn, int indent) if (indent < 0) indent = 0; - if ((hex = BN_bn2hex(bn)) == NULL) + if (!bn_bn2hex_nosign(bn, &hex, &hex_len)) goto err; - hex_len = strlen(hex); CBS_init(&cbs, hex, hex_len); if (BN_is_negative(bn)) { if (BIO_printf(bio, " (Negative)") <= 0) goto err; - if (!CBS_skip(&cbs, 1)) - goto err; } while (CBS_len(&cbs) > 0) { |