X-Git-Url: https://git.openssl.org/?p=openssl.git;a=blobdiff_plain;f=crypto%2Fpkcs7%2Fverify.c;h=b40f26032ec6f761c874264f2f28886061cf4ffe;hp=0e1c1b26dcb70ef02124933b19a6da2f4f66b79d;hb=237d7b6caee75d64cf8cbbd424afa7627e05be26;hpb=7dfb0b774e6592dcbfe47015168a0ac8b44e2a17 diff --git a/crypto/pkcs7/verify.c b/crypto/pkcs7/verify.c index 0e1c1b26dc..b40f26032e 100644 --- a/crypto/pkcs7/verify.c +++ b/crypto/pkcs7/verify.c @@ -56,41 +56,50 @@ * [including the GNU Public Licence.] */ #include -#include "asn1.h" -#include "bio.h" -#include "x509.h" -#include "pem.h" +#include +#include +#include +#include +#include +#include +#include "example.h" int verify_callback(int ok, X509_STORE_CTX *ctx); BIO *bio_err=NULL; +BIO *bio_out=NULL; -main(argc,argv) +int main(argc,argv) int argc; char *argv[]; { - X509 *x509,*x; PKCS7 *p7; - PKCS7_SIGNED *s; PKCS7_SIGNER_INFO *si; - PKCS7_ISSUER_AND_SERIAL *ias; X509_STORE_CTX cert_ctx; X509_STORE *cert_store=NULL; - X509_LOOKUP *lookup=NULL; BIO *data,*detached=NULL,*p7bio=NULL; char buf[1024*4]; - unsigned char *p,*pp; - int i,j,printit=0; - STACK *sk; + char *pp; + int i,printit=0; + STACK_OF(PKCS7_SIGNER_INFO) *sk; bio_err=BIO_new_fp(stderr,BIO_NOCLOSE); + bio_out=BIO_new_fp(stdout,BIO_NOCLOSE); +#ifndef OPENSSL_NO_MD2 EVP_add_digest(EVP_md2()); +#endif +#ifndef OPENSSL_NO_MD5 EVP_add_digest(EVP_md5()); +#endif +#ifndef OPENSSL_NO_SHA1 EVP_add_digest(EVP_sha1()); +#endif +#ifndef OPENSSL_NO_MDC2 EVP_add_digest(EVP_mdc2()); +#endif data=BIO_new(BIO_s_file()); -again: + pp=NULL; while (argc > 1) { @@ -121,7 +130,7 @@ again: /* Load the PKCS7 object from a file */ - if ((p7=PEM_read_bio_PKCS7(data,NULL,NULL)) == NULL) goto err; + if ((p7=PEM_read_bio_PKCS7(data,NULL,NULL,NULL)) == NULL) goto err; /* This stuff is being setup for certificate verification. * When using SSL, it could be replaced with a @@ -131,10 +140,10 @@ again: X509_STORE_load_locations(cert_store,NULL,"../../certs"); X509_STORE_set_verify_cb_func(cert_store,verify_callback); - ERR_clear_errors(); + ERR_clear_error(); /* We need to process the data */ - if (PKCS7_get_detached(p7)) + if ((PKCS7_get_detached(p7) || detached)) { if (detached == NULL) { @@ -166,12 +175,30 @@ again: } /* Ok, first we need to, for each subject entry, see if we can verify */ - for (i=0; i