From 2fa45e6ee722078bc55311c66bdba1ca2fc69c28 Mon Sep 17 00:00:00 2001 From: Rich Salz Date: Wed, 29 Apr 2015 14:15:50 -0400 Subject: use isxdigit and apps_tohex Replace ad-hoc ascii->hex with isxdigit and new app_tohex. Reviewed-by: Andy Polyakov --- apps/ca.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'apps/ca.c') diff --git a/apps/ca.c b/apps/ca.c index ba666eef72..9c96417258 100644 --- a/apps/ca.c +++ b/apps/ca.c @@ -778,16 +778,13 @@ end_of_options: i + 1, j); goto end; } - while (*p) { - if (!(((*p >= '0') && (*p <= '9')) || - ((*p >= 'A') && (*p <= 'F')) || - ((*p >= 'a') && (*p <= 'f')))) { + for ( ; *p; p++) { + if (!isxdigit(*p)) { BIO_printf(bio_err, - "entry %d: bad serial number characters, char pos %ld, char is '%c'\n", - i + 1, (long)(p - pp[DB_serial]), *p); + "entry %d: bad char 0%o '%c' in serial number\n", + i + 1, *p, *p); goto end; } - p++; } } if (verbose) { -- cgit v1.2.3