summaryrefslogtreecommitdiffstats
path: root/lib/libcrypto/evp/encode.c
diff options
context:
space:
mode:
authorinoguchi <inoguchi@openbsd.org>2020-03-04 11:53:21 +0000
committerinoguchi <inoguchi@openbsd.org>2020-03-04 11:53:21 +0000
commit345f71f9e075f6cc91d3b0ee9acdf1e6be1d3c05 (patch)
treec9d0b8da2c710f1b4231907b6b822b53ca5f32d8 /lib/libcrypto/evp/encode.c
parentGrab a reference for the shared memory segment before calling uvm_map() (diff)
downloadwireguard-openbsd-345f71f9e075f6cc91d3b0ee9acdf1e6be1d3c05.tar.xz
wireguard-openbsd-345f71f9e075f6cc91d3b0ee9acdf1e6be1d3c05.zip
Check high bit for base64 decode
Referred to this OpenSSL commit and adopted to the codebase. b785504a10310cb2872270eb409b70971be5e76e suggest and ok tb@
Diffstat (limited to 'lib/libcrypto/evp/encode.c')
-rw-r--r--lib/libcrypto/evp/encode.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/libcrypto/evp/encode.c b/lib/libcrypto/evp/encode.c
index 95dc79d70d7..2f942a032f0 100644
--- a/lib/libcrypto/evp/encode.c
+++ b/lib/libcrypto/evp/encode.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: encode.c,v 1.27 2020/03/03 15:03:14 inoguchi Exp $ */
+/* $OpenBSD: encode.c,v 1.28 2020/03/04 11:53:21 inoguchi Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -62,8 +62,8 @@
#include <openssl/evp.h>
+static unsigned char conv_ascii2bin(unsigned char a);
#define conv_bin2ascii(a) (data_bin2ascii[(a)&0x3f])
-#define conv_ascii2bin(a) (data_ascii2bin[(a)&0x7f])
/* 64 char lines
* pad input with 0
@@ -113,6 +113,14 @@ static const unsigned char data_ascii2bin[128] = {
0x31, 0x32, 0x33, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
};
+static unsigned char
+conv_ascii2bin(unsigned char a)
+{
+ if (a & 0x80)
+ return B64_ERROR;
+ return data_ascii2bin[a];
+}
+
EVP_ENCODE_CTX *
EVP_ENCODE_CTX_new(void)
{