summaryrefslogtreecommitdiffstats
path: root/crypto/x509v3
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/x509v3
parent589902b2cbc667564642a0fdedfb2ef176dba0e8 (diff)
Use OPENSSL_hexchar2int
Reviewed-by: Richard Levitte <levitte@openssl.org>
Diffstat (limited to 'crypto/x509v3')
-rw-r--r--crypto/x509v3/v3_utl.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/crypto/x509v3/v3_utl.c b/crypto/x509v3/v3_utl.c
index ae9645d687..a5016bad76 100644
--- a/crypto/x509v3/v3_utl.c
+++ b/crypto/x509v3/v3_utl.c
@@ -1177,19 +1177,17 @@ static int ipv6_hex(unsigned char *out, const char *in, int inlen)
{
unsigned char c;
unsigned int num = 0;
+ int x;
+
if (inlen > 4)
return 0;
while (inlen--) {
c = *in++;
num <<= 4;
- if ((c >= '0') && (c <= '9'))
- num |= c - '0';
- else if ((c >= 'A') && (c <= 'F'))
- num |= c - 'A' + 10;
- else if ((c >= 'a') && (c <= 'f'))
- num |= c - 'a' + 10;
- else
+ x = OPENSSL_hexchar2int(c);
+ if (x < 0)
return 0;
+ num |= (char)x;
}
out[0] = num >> 8;
out[1] = num & 0xff;