diff options
author | Rich Salz <rsalz@openssl.org> | 2016-05-12 15:52:58 -0400 |
---|---|---|
committer | Rich Salz <rsalz@openssl.org> | 2016-05-16 15:21:10 -0400 |
commit | 49445f21da5ad436a117d0d4cc6220c4bbbbf8a7 (patch) | |
tree | b8013a1a1dc02e3b721e137a5bd8847c5a2766d3 /test | |
parent | 589902b2cbc667564642a0fdedfb2ef176dba0e8 (diff) |
Use OPENSSL_hexchar2int
Reviewed-by: Richard Levitte <levitte@openssl.org>
Diffstat (limited to 'test')
-rw-r--r-- | test/danetest.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/test/danetest.c b/test/danetest.c index 3bcc02e504..75bcb58f30 100644 --- a/test/danetest.c +++ b/test/danetest.c @@ -198,7 +198,7 @@ static STACK_OF(X509) *load_chain(BIO *fp, int nelem) fprintf(stderr, "error reading: malformed %s\n", errtype); goto err; } - + if (count == nelem) { ERR_clear_error(); return chain; @@ -252,19 +252,16 @@ static ossl_ssize_t hexdecode(const char *in, void *result) return -1; for (byte = 0; *in; ++in) { - char c; + int x; if (isspace(_UC(*in))) continue; - c = tolower(_UC(*in)); - if ('0' <= c && c <= '9') { - byte |= c - '0'; - } else if ('a' <= c && c <= 'f') { - byte |= c - 'a' + 10; - } else { + x = OPENSSL_hexchar2int(*in); + if (x < 0) { OPENSSL_free(ret); return 0; } + byte |= (char)x; if ((nibble ^= 1) == 0) { *cp++ = byte; byte = 0; |