-/* $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>
#include <openssl/bio.h>
#include <openssl/bn.h>
+#include "bn_local.h"
#include "bytestring.h"
static int
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) {