Flush b64 BIO.
diff --git a/crypto/pkcs7/pk7_mime.c b/crypto/pkcs7/pk7_mime.c
index ae556d0..e01e936 100644
--- a/crypto/pkcs7/pk7_mime.c
+++ b/crypto/pkcs7/pk7_mime.c
@@ -158,6 +158,7 @@
 	 */
 	out = BIO_push(b64, out);
 	r = i2d_PKCS7_bio_stream(out, p7, in, flags);
+	BIO_flush(out);
 	BIO_pop(out);
 	BIO_free(b64);
 	return r;