summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortb <>2023-07-07 06:41:59 +0000
committertb <>2023-07-07 06:41:59 +0000
commit3e9606d3676b918eec4f58130ce87818363373b2 (patch)
treef83a848f83b46113f718636c661c66a198780074 /src
parent6f0f65f517189bb788e292b7f76f0774835c82ce (diff)
downloadopenbsd-3e9606d3676b918eec4f58130ce87818363373b2.tar.gz
openbsd-3e9606d3676b918eec4f58130ce87818363373b2.tar.bz2
openbsd-3e9606d3676b918eec4f58130ce87818363373b2.zip
Insert leading octet if high bit of first nibble is 1
The reason the function this replaces is called ASN1_bn_print() is that it actually prints a representation of the ASN.1 encoding. ok jsing
Diffstat (limited to 'src')
-rw-r--r--src/lib/libcrypto/bn/bn_print.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/lib/libcrypto/bn/bn_print.c b/src/lib/libcrypto/bn/bn_print.c
index 466aeb3d64..18984d7d4f 100644
--- a/src/lib/libcrypto/bn/bn_print.c
+++ b/src/lib/libcrypto/bn/bn_print.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: bn_print.c,v 1.40 2023/07/06 14:37:39 tb Exp $ */ 1/* $OpenBSD: bn_print.c,v 1.41 2023/07/07 06:41:59 tb Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2023 Theo Buehler <tb@openbsd.org> 4 * Copyright (c) 2023 Theo Buehler <tb@openbsd.org>
@@ -102,6 +102,12 @@ bn_print_bignum(BIO *bio, const BIGNUM *bn, int indent)
102 if (BIO_printf(bio, "\n%*s", indent, "") <= 0) 102 if (BIO_printf(bio, "\n%*s", indent, "") <= 0)
103 goto err; 103 goto err;
104 } 104 }
105 /* First nibble has the high bit set. Insert leading 0 octet. */
106 if (octets == 1 && hi >= '8') {
107 if (BIO_printf(bio, "00:") <= 0)
108 goto err;
109 octets++;
110 }
105 if (CBS_len(&cbs) == 0) 111 if (CBS_len(&cbs) == 0)
106 sep = ""; 112 sep = "";
107 if (BIO_printf(bio, "%c%c%s", tolower(hi), tolower(lo), sep) <= 0) 113 if (BIO_printf(bio, "%c%c%s", tolower(hi), tolower(lo), sep) <= 0)