diff options
author | Rich Salz <rsalz@openssl.org> | 2015-04-29 14:15:50 -0400 |
---|---|---|
committer | Rich Salz <rsalz@openssl.org> | 2015-04-29 14:15:50 -0400 |
commit | 2fa45e6ee722078bc55311c66bdba1ca2fc69c28 (patch) | |
tree | 5e5b00a8d117bcb9e4acee3ce614ff98100f8430 /apps/enc.c | |
parent | ecf3a1fb181c08540342cceb6549e0408b32d135 (diff) |
use isxdigit and apps_tohex
Replace ad-hoc ascii->hex with isxdigit and new app_tohex.
Reviewed-by: Andy Polyakov <appro@openssl.org>
Diffstat (limited to 'apps/enc.c')
-rw-r--r-- | apps/enc.c | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/apps/enc.c b/apps/enc.c index 794fce1f3d..c6b8d2bbf2 100644 --- a/apps/enc.c +++ b/apps/enc.c @@ -617,16 +617,11 @@ static int set_hex(char *in, unsigned char *out, int size) *(in++) = '\0'; if (j == 0) break; - if ((j >= '0') && (j <= '9')) - j -= '0'; - else if ((j >= 'A') && (j <= 'F')) - j = j - 'A' + 10; - else if ((j >= 'a') && (j <= 'f')) - j = j - 'a' + 10; - else { + if (!isxdigit(j)) { BIO_printf(bio_err, "non-hex digit\n"); return (0); } + j = (unsigned char)app_hex(j); if (i & 1) out[i / 2] |= j; else |