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 /apps | |
parent | 589902b2cbc667564642a0fdedfb2ef176dba0e8 (diff) |
Use OPENSSL_hexchar2int
Reviewed-by: Richard Levitte <levitte@openssl.org>
Diffstat (limited to 'apps')
-rw-r--r-- | apps/s_client.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/apps/s_client.c b/apps/s_client.c index fada838b68..d8d55014d7 100644 --- a/apps/s_client.c +++ b/apps/s_client.c @@ -518,19 +518,16 @@ static ossl_ssize_t hexdecode(const char **inptr, 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; |