提交 f50c11ca 编写于 作者: D Dr. Stephen Henson

Ugh, BIO_find_type() cannot be passed a NULL.

Fix doc example, and fix BIO_find_type().

Fix PKCS7_verify(). It was using 'i' for both the
loop variable and the verify return value.
上级 cfd3bb17
...@@ -4,6 +4,10 @@ ...@@ -4,6 +4,10 @@
Changes between 0.9.5a and 0.9.6 [xx XXX 2000] Changes between 0.9.5a and 0.9.6 [xx XXX 2000]
*) Fix bug in PKCS7_verify() which caused an infinite loop
if there was more than one signature.
[Sven Uszpelkat <su@celocom.de>]
*) Major change in util/mkdef.pl to include extra information *) Major change in util/mkdef.pl to include extra information
about each symbol, as well as presentig variables as well about each symbol, as well as presentig variables as well
as functions. This change means that there's n more need as functions. This change means that there's n more need
......
...@@ -418,6 +418,7 @@ BIO *BIO_find_type(BIO *bio, int type) ...@@ -418,6 +418,7 @@ BIO *BIO_find_type(BIO *bio, int type)
{ {
int mt,mask; int mt,mask;
if(!bio) return NULL;
mask=type&0xff; mask=type&0xff;
do { do {
if (bio->method != NULL) if (bio->method != NULL)
......
...@@ -153,7 +153,7 @@ int PKCS7_verify(PKCS7 *p7, STACK_OF(X509) *certs, X509_STORE *store, ...@@ -153,7 +153,7 @@ int PKCS7_verify(PKCS7 *p7, STACK_OF(X509) *certs, X509_STORE *store,
PKCS7_SIGNER_INFO *si; PKCS7_SIGNER_INFO *si;
X509_STORE_CTX cert_ctx; X509_STORE_CTX cert_ctx;
char buf[4096]; char buf[4096];
int i, j=0; int i, j=0, k;
BIO *p7bio; BIO *p7bio;
BIO *tmpout; BIO *tmpout;
...@@ -193,8 +193,8 @@ int PKCS7_verify(PKCS7 *p7, STACK_OF(X509) *certs, X509_STORE *store, ...@@ -193,8 +193,8 @@ int PKCS7_verify(PKCS7 *p7, STACK_OF(X509) *certs, X509_STORE *store,
/* Now verify the certificates */ /* Now verify the certificates */
if (!(flags & PKCS7_NOVERIFY)) for (i = 0; i < sk_X509_num(signers); i++) { if (!(flags & PKCS7_NOVERIFY)) for (k = 0; k < sk_X509_num(signers); k++) {
signer = sk_X509_value (signers, i); signer = sk_X509_value (signers, k);
if (!(flags & PKCS7_NOCHAIN)) { if (!(flags & PKCS7_NOCHAIN)) {
X509_STORE_CTX_init(&cert_ctx, store, signer, X509_STORE_CTX_init(&cert_ctx, store, signer,
p7->d.sign->cert); p7->d.sign->cert);
......
...@@ -71,6 +71,11 @@ use: ...@@ -71,6 +71,11 @@ use:
next = bio->next_bio; next = bio->next_bio;
=head1 BUGS
BIO_find_type() in OpenSSL 0.9.5a and earlier could not be safely passed a
NULL pointer for the B<b> argument.
=head1 EXAMPLE =head1 EXAMPLE
Traverse a chain looking for digest BIOs: Traverse a chain looking for digest BIOs:
...@@ -78,14 +83,14 @@ Traverse a chain looking for digest BIOs: ...@@ -78,14 +83,14 @@ Traverse a chain looking for digest BIOs:
BIO *btmp; BIO *btmp;
btmp = in_bio; /* in_bio is chain to search through */ btmp = in_bio; /* in_bio is chain to search through */
for(;;) { do {
btmp = BIO_find_type(btmp, BIO_TYPE_MD); btmp = BIO_find_type(btmp, BIO_TYPE_MD);
if(btmp == NULL) break; /* Not found */ if(btmp == NULL) break; /* Not found */
/* btmp is a digest BIO, do something with it ...*/ /* btmp is a digest BIO, do something with it ...*/
... ...
btmp = BIO_next(btmp); btmp = BIO_next(btmp);
} } while(btmp);
=head1 SEE ALSO =head1 SEE ALSO
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册