summaryrefslogtreecommitdiffstats
path: root/crypto/pem
diff options
context:
space:
mode:
authorRich Salz <rsalz@openssl.org>2016-05-12 15:52:58 -0400
committerRich Salz <rsalz@openssl.org>2016-05-16 15:21:10 -0400
commit49445f21da5ad436a117d0d4cc6220c4bbbbf8a7 (patch)
treeb8013a1a1dc02e3b721e137a5bd8847c5a2766d3 /crypto/pem
parent589902b2cbc667564642a0fdedfb2ef176dba0e8 (diff)
Use OPENSSL_hexchar2int
Reviewed-by: Richard Levitte <levitte@openssl.org>
Diffstat (limited to 'crypto/pem')
-rw-r--r--crypto/pem/pem_lib.c9
1 files changed, 2 insertions, 7 deletions
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);
}