summaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
authorShane Lontis <shane.lontis@oracle.com>2021-05-28 11:42:41 +1000
committerShane Lontis <shane.lontis@oracle.com>2021-05-31 08:45:58 +1000
commitf505161e62d558b3f8442b264ccbf8112ebd58ef (patch)
tree9f75545656de64a5fb0fe47a1f497450d19ba214 /crypto
parent43dbe3b72de0ba4ebd20e9e6a2c526ef747326ab (diff)
Fix PKCS7_verify to not have an error stack if it succeeds.
Revert a change in behavior to BIO_write(). If a NULL BIO is passed, no error is raised and the return value is 0. There are many places where the return code from the write was not checked, resulting in an error stack with no error status being returned. Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/15493)
Diffstat (limited to 'crypto')
-rw-r--r--crypto/bio/bio_lib.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/crypto/bio/bio_lib.c b/crypto/bio/bio_lib.c
index 91db2290c4..80b81db5c4 100644
--- a/crypto/bio/bio_lib.c
+++ b/crypto/bio/bio_lib.c
@@ -334,10 +334,13 @@ static int bio_write_intern(BIO *b, const void *data, size_t dlen,
{
int ret;
- if (b == NULL) {
- ERR_raise(ERR_LIB_BIO, ERR_R_PASSED_NULL_PARAMETER);
- return -1;
- }
+ /*
+ * b == NULL is not an error but just means that zero bytes are written.
+ * Do not raise an error here.
+ */
+ if (b == NULL)
+ return 0;
+
if (b->method == NULL || b->method->bwrite == NULL) {
ERR_raise(ERR_LIB_BIO, BIO_R_UNSUPPORTED_METHOD);
return -2;