summaryrefslogtreecommitdiffstats
path: root/crypto/pem/pem_lib.c
diff options
context:
space:
mode:
authorRich Salz <rsalz@openssl.org>2016-05-12 21:52:58 +0200
committerRich Salz <rsalz@openssl.org>2016-05-16 21:21:10 +0200
commit49445f21da5ad436a117d0d4cc6220c4bbbbf8a7 (patch)
treeb8013a1a1dc02e3b721e137a5bd8847c5a2766d3 /crypto/pem/pem_lib.c
parentUse app_malloc; two missing cases. (diff)
downloadopenssl-49445f21da5ad436a117d0d4cc6220c4bbbbf8a7.tar.xz
openssl-49445f21da5ad436a117d0d4cc6220c4bbbbf8a7.zip
Use OPENSSL_hexchar2int
Reviewed-by: Richard Levitte <levitte@openssl.org>
Diffstat (limited to 'crypto/pem/pem_lib.c')
-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);
}