From 49445f21da5ad436a117d0d4cc6220c4bbbbf8a7 Mon Sep 17 00:00:00 2001 From: Rich Salz Date: Thu, 12 May 2016 15:52:58 -0400 Subject: Use OPENSSL_hexchar2int Reviewed-by: Richard Levitte --- crypto/pem/pem_lib.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'crypto/pem') diff --git a/crypto/pem/pem_lib.c b/crypto/pem/pem_lib.c index 4ca61875ee..fce8a3adf2 100644 --- a/crypto/pem/pem_lib.c +++ b/crypto/pem/pem_lib.c @@ -558,13 +558,8 @@ static int load_iv(char **fromp, unsigned char *to, int num) to[i] = 0; num *= 2; for (i = 0; i < num; i++) { - if ((*from >= '0') && (*from <= '9')) - v = *from - '0'; - else if ((*from >= 'A') && (*from <= 'F')) - v = *from - 'A' + 10; - else if ((*from >= 'a') && (*from <= 'f')) - v = *from - 'a' + 10; - else { + v = OPENSSL_hexchar2int(*from); + if (v < 0) { PEMerr(PEM_F_LOAD_IV, PEM_R_BAD_IV_CHARS); return (0); } -- cgit v1.2.3