summaryrefslogtreecommitdiffstats
path: root/test/danetest.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/danetest.c')
-rw-r--r--test/danetest.c13
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;