summaryrefslogtreecommitdiffstats
path: root/crypto/bn/bn_print.c
diff options
context:
space:
mode:
authorRich Salz <rsalz@openssl.org>2016-05-12 15:52:58 -0400
committerRich Salz <rsalz@openssl.org>2016-05-16 15:21:10 -0400
commit49445f21da5ad436a117d0d4cc6220c4bbbbf8a7 (patch)
treeb8013a1a1dc02e3b721e137a5bd8847c5a2766d3 /crypto/bn/bn_print.c
parent589902b2cbc667564642a0fdedfb2ef176dba0e8 (diff)
Use OPENSSL_hexchar2int
Reviewed-by: Richard Levitte <levitte@openssl.org>
Diffstat (limited to 'crypto/bn/bn_print.c')
-rw-r--r--crypto/bn/bn_print.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/crypto/bn/bn_print.c b/crypto/bn/bn_print.c
index 0c3b214f12..c00b7248ed 100644
--- a/crypto/bn/bn_print.c
+++ b/crypto/bn/bn_print.c
@@ -215,13 +215,8 @@ int BN_hex2bn(BIGNUM **bn, const char *a)
l = 0;
for (;;) {
c = a[j - m];
- if ((c >= '0') && (c <= '9'))
- k = c - '0';
- else if ((c >= 'a') && (c <= 'f'))
- k = c - 'a' + 10;
- else if ((c >= 'A') && (c <= 'F'))
- k = c - 'A' + 10;
- else
+ k = OPENSSL_hexchar2int(c);
+ if (k < 0)
k = 0; /* paranoia */
l = (l << 4) | k;