aboutsummaryrefslogtreecommitdiff
path: root/crypto/asn1/f_int.c
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/asn1/f_int.c')
-rw-r--r--crypto/asn1/f_int.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/crypto/asn1/f_int.c b/crypto/asn1/f_int.c
index d41e0069af63..5b5dda4ce120 100644
--- a/crypto/asn1/f_int.c
+++ b/crypto/asn1/f_int.c
@@ -1,5 +1,5 @@
/*
- * Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 1995-2024 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
@@ -16,7 +16,6 @@
int i2a_ASN1_INTEGER(BIO *bp, const ASN1_INTEGER *a)
{
int i, n = 0;
- static const char *h = "0123456789ABCDEF";
char buf[2];
if (a == NULL)
@@ -39,8 +38,7 @@ int i2a_ASN1_INTEGER(BIO *bp, const ASN1_INTEGER *a)
goto err;
n += 2;
}
- buf[0] = h[((unsigned char)a->data[i] >> 4) & 0x0f];
- buf[1] = h[((unsigned char)a->data[i]) & 0x0f];
+ ossl_to_hex(buf, a->data[i]);
if (BIO_write(bp, buf, 2) != 2)
goto err;
n += 2;
@@ -76,8 +74,7 @@ int a2i_ASN1_INTEGER(BIO *bp, ASN1_INTEGER *bs, char *buf, int size)
again = (buf[i - 1] == '\\');
for (j = 0; j < i; j++) {
- if (!ossl_isxdigit(buf[j]))
- {
+ if (!ossl_isxdigit(buf[j])) {
i = j;
break;
}
@@ -108,7 +105,6 @@ int a2i_ASN1_INTEGER(BIO *bp, ASN1_INTEGER *bs, char *buf, int size)
if (num + i > slen) {
sp = OPENSSL_clear_realloc(s, slen, num + i * 2);
if (sp == NULL) {
- ERR_raise(ERR_LIB_ASN1, ERR_R_MALLOC_FAILURE);
OPENSSL_free(s);
return 0;
}