diff options
author | jsing <> | 2014-08-06 16:01:44 +0000 |
---|---|---|
committer | jsing <> | 2014-08-06 16:01:44 +0000 |
commit | 0678ffa46b351725550d70c2d443a0c9ea5583f0 (patch) | |
tree | b5de7b70d2a758be5eef8d3dd5b059e6831021ee | |
parent | f86d186e644fa5e36cc86ef4f3ffd187ba66c9ff (diff) | |
download | openbsd-0678ffa46b351725550d70c2d443a0c9ea5583f0.tar.gz openbsd-0678ffa46b351725550d70c2d443a0c9ea5583f0.tar.bz2 openbsd-0678ffa46b351725550d70c2d443a0c9ea5583f0.zip |
Allow B64_EOF to follow a base64 padding character. This restores previous
behaviour that allows a PEM block to be fed through the base64 decoder.
Reported by Dmitry Eremin-Solenikov on tech@
ok deraadt@ tedu@
-rw-r--r-- | src/lib/libcrypto/evp/encode.c | 5 | ||||
-rw-r--r-- | src/lib/libssl/src/crypto/evp/encode.c | 5 |
2 files changed, 6 insertions, 4 deletions
diff --git a/src/lib/libcrypto/evp/encode.c b/src/lib/libcrypto/evp/encode.c index f33afb03d3..067e62dfe9 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.18 2014/07/11 08:44:48 jsing Exp $ */ | 1 | /* $OpenBSD: encode.c,v 1.19 2014/08/06 16:01:44 jsing 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 | * |
@@ -261,7 +261,8 @@ EVP_DecodeUpdate(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl, | |||
261 | } | 261 | } |
262 | 262 | ||
263 | /* There should not be base64 data after padding. */ | 263 | /* There should not be base64 data after padding. */ |
264 | if (eof && tmp != '=' && tmp != '\r' && tmp != '\n') { | 264 | if (eof && tmp != '=' && tmp != '\r' && tmp != '\n' && |
265 | v != B64_EOF) { | ||
265 | rv = -1; | 266 | rv = -1; |
266 | goto end; | 267 | goto end; |
267 | } | 268 | } |
diff --git a/src/lib/libssl/src/crypto/evp/encode.c b/src/lib/libssl/src/crypto/evp/encode.c index f33afb03d3..067e62dfe9 100644 --- a/src/lib/libssl/src/crypto/evp/encode.c +++ b/src/lib/libssl/src/crypto/evp/encode.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: encode.c,v 1.18 2014/07/11 08:44:48 jsing Exp $ */ | 1 | /* $OpenBSD: encode.c,v 1.19 2014/08/06 16:01:44 jsing 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 | * |
@@ -261,7 +261,8 @@ EVP_DecodeUpdate(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl, | |||
261 | } | 261 | } |
262 | 262 | ||
263 | /* There should not be base64 data after padding. */ | 263 | /* There should not be base64 data after padding. */ |
264 | if (eof && tmp != '=' && tmp != '\r' && tmp != '\n') { | 264 | if (eof && tmp != '=' && tmp != '\r' && tmp != '\n' && |
265 | v != B64_EOF) { | ||
265 | rv = -1; | 266 | rv = -1; |
266 | goto end; | 267 | goto end; |
267 | } | 268 | } |