summaryrefslogtreecommitdiffstats
path: root/lib/libcrypto/evp/encode.c
diff options
context:
space:
mode:
authorbeck <beck@openbsd.org>2000-12-15 02:56:47 +0000
committerbeck <beck@openbsd.org>2000-12-15 02:56:47 +0000
commitc109e39817e8a1f78064639800aed6d6d86a84c0 (patch)
tree71e7f91e52cf77279251ad187cba7df277fbeac5 /lib/libcrypto/evp/encode.c
parentremove section talking about photuris limitations (diff)
downloadwireguard-openbsd-c109e39817e8a1f78064639800aed6d6d86a84c0.tar.xz
wireguard-openbsd-c109e39817e8a1f78064639800aed6d6d86a84c0.zip
openssl-engine-0.9.6 merge
Diffstat (limited to 'lib/libcrypto/evp/encode.c')
-rw-r--r--lib/libcrypto/evp/encode.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/libcrypto/evp/encode.c b/lib/libcrypto/evp/encode.c
index 14a4cb11f6c..6ff9c1783cf 100644
--- a/lib/libcrypto/evp/encode.c
+++ b/lib/libcrypto/evp/encode.c
@@ -292,7 +292,17 @@ int EVP_DecodeUpdate(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl,
/* If we are at the end of input and it looks like a
* line, process it. */
if (((i+1) == inl) && (((n&3) == 0) || eof))
+ {
v=B64_EOF;
+ /* In case things were given us in really small
+ records (so two '=' were given in separate
+ updates), eof may contain the incorrect number
+ of ending bytes to skip, so let's redo the count */
+ eof = 0;
+ if (d[n-1] == '=') eof++;
+ if (d[n-2] == '=') eof++;
+ /* There will never be more than two '=' */
+ }
if ((v == B64_EOF) || (n >= 64))
{