diff options
author | inoguchi <> | 2020-03-04 11:53:21 +0000 |
---|---|---|
committer | inoguchi <> | 2020-03-04 11:53:21 +0000 |
commit | 26ef5580166bc8d9119f867542fa40e12a4b18a4 (patch) | |
tree | 869e9fe49cd7347775fb86387b04af0e3226f33e | |
parent | dad60cb9f024c77a6bb02993f7d77da011b245a1 (diff) | |
download | openbsd-26ef5580166bc8d9119f867542fa40e12a4b18a4.tar.gz openbsd-26ef5580166bc8d9119f867542fa40e12a4b18a4.tar.bz2 openbsd-26ef5580166bc8d9119f867542fa40e12a4b18a4.zip |
Check high bit for base64 decode
Referred to this OpenSSL commit and adopted to the codebase.
b785504a10310cb2872270eb409b70971be5e76e
suggest and ok tb@
-rw-r--r-- | src/lib/libcrypto/evp/encode.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/lib/libcrypto/evp/encode.c b/src/lib/libcrypto/evp/encode.c index 95dc79d70d..2f942a032f 100644 --- a/src/lib/libcrypto/evp/encode.c +++ b/src/lib/libcrypto/evp/encode.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: encode.c,v 1.27 2020/03/03 15:03:14 inoguchi Exp $ */ | 1 | /* $OpenBSD: encode.c,v 1.28 2020/03/04 11:53:21 inoguchi Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -62,8 +62,8 @@ | |||
62 | 62 | ||
63 | #include <openssl/evp.h> | 63 | #include <openssl/evp.h> |
64 | 64 | ||
65 | static unsigned char conv_ascii2bin(unsigned char a); | ||
65 | #define conv_bin2ascii(a) (data_bin2ascii[(a)&0x3f]) | 66 | #define conv_bin2ascii(a) (data_bin2ascii[(a)&0x3f]) |
66 | #define conv_ascii2bin(a) (data_ascii2bin[(a)&0x7f]) | ||
67 | 67 | ||
68 | /* 64 char lines | 68 | /* 64 char lines |
69 | * pad input with 0 | 69 | * pad input with 0 |
@@ -113,6 +113,14 @@ static const unsigned char data_ascii2bin[128] = { | |||
113 | 0x31, 0x32, 0x33, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, | 113 | 0x31, 0x32, 0x33, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, |
114 | }; | 114 | }; |
115 | 115 | ||
116 | static unsigned char | ||
117 | conv_ascii2bin(unsigned char a) | ||
118 | { | ||
119 | if (a & 0x80) | ||
120 | return B64_ERROR; | ||
121 | return data_ascii2bin[a]; | ||
122 | } | ||
123 | |||
116 | EVP_ENCODE_CTX * | 124 | EVP_ENCODE_CTX * |
117 | EVP_ENCODE_CTX_new(void) | 125 | EVP_ENCODE_CTX_new(void) |
118 | { | 126 | { |