summaryrefslogtreecommitdiff
path: root/Cryptlib/OpenSSL/crypto/pkcs7
diff options
context:
space:
mode:
authorSteve Langasek <steve.langasek@canonical.com>2014-10-06 17:17:33 -0700
committerSteve Langasek <steve.langasek@canonical.com>2014-10-06 17:17:33 -0700
commit59945b252e76a601fc6bbf43fb49f8a8f0d0c9a9 (patch)
tree70e8a684bf6b3480abf1504e7befb1f8f955d962 /Cryptlib/OpenSSL/crypto/pkcs7
parent5fc0e7f624b64f40d5d4694e35f8c967a7317902 (diff)
parent72bb39c0237f8bcc3afa8b623e8b097eec6d69cd (diff)
downloadefi-boot-shim-59945b252e76a601fc6bbf43fb49f8a8f0d0c9a9.tar.gz
efi-boot-shim-59945b252e76a601fc6bbf43fb49f8a8f0d0c9a9.zip
Merge upstream version 0.7
Diffstat (limited to 'Cryptlib/OpenSSL/crypto/pkcs7')
-rwxr-xr-xCryptlib/OpenSSL/crypto/pkcs7/pk7_smime.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/Cryptlib/OpenSSL/crypto/pkcs7/pk7_smime.c b/Cryptlib/OpenSSL/crypto/pkcs7/pk7_smime.c
index d6db27c6..b0ff89aa 100755
--- a/Cryptlib/OpenSSL/crypto/pkcs7/pk7_smime.c
+++ b/Cryptlib/OpenSSL/crypto/pkcs7/pk7_smime.c
@@ -176,7 +176,8 @@ int PKCS7_verify(PKCS7 *p7, STACK_OF(X509) *certs, X509_STORE *store,
STACK_OF(PKCS7_SIGNER_INFO) *sinfos;
PKCS7_SIGNER_INFO *si;
X509_STORE_CTX cert_ctx;
- char buf[4096];
+ char *buf = NULL;
+ int bufsiz;
int i, j=0, k, ret = 0;
BIO *p7bio;
BIO *tmpin, *tmpout;
@@ -287,10 +288,16 @@ int PKCS7_verify(PKCS7 *p7, STACK_OF(X509) *certs, X509_STORE *store,
BIO_set_mem_eof_return(tmpout, 0);
} else tmpout = out;
+ bufsiz = 4096;
+ buf = OPENSSL_malloc (bufsiz);
+ if (buf == NULL) {
+ goto err;
+ }
+
/* We now have to 'read' from p7bio to calculate digests etc. */
for (;;)
{
- i=BIO_read(p7bio,buf,sizeof(buf));
+ i=BIO_read(p7bio,buf,bufsiz);
if (i <= 0) break;
if (tmpout) BIO_write(tmpout, buf, i);
}
@@ -329,6 +336,10 @@ int PKCS7_verify(PKCS7 *p7, STACK_OF(X509) *certs, X509_STORE *store,
sk_X509_free(signers);
+ if (buf != NULL) {
+ OPENSSL_free (buf);
+ }
+
return ret;
}