From c679fb298ea8a94764a594d07b97823c4615ea4e Mon Sep 17 00:00:00 2001 From: "Dr. Stephen Henson" Date: Sun, 18 Oct 2009 14:42:27 +0000 Subject: [PATCH] Add new function X509_STORE_set_verify_cb and use it in apps --- apps/cms.c | 2 +- apps/smime.c | 2 +- apps/ts.c | 2 +- apps/verify.c | 2 +- apps/x509.c | 2 +- crypto/x509/x509_lu.c | 6 ++++++ crypto/x509/x509_vfy.h | 3 +++ 7 files changed, 14 insertions(+), 5 deletions(-) diff --git a/apps/cms.c b/apps/cms.c index 3adcd78a9d..d29a884902 100644 --- a/apps/cms.c +++ b/apps/cms.c @@ -880,7 +880,7 @@ int MAIN(int argc, char **argv) { if (!(store = setup_verify(bio_err, CAfile, CApath))) goto end; - X509_STORE_set_verify_cb_func(store, cms_cb); + X509_STORE_set_verify_cb(store, cms_cb); if (vpm) X509_STORE_set1_param(store, vpm); } diff --git a/apps/smime.c b/apps/smime.c index 67df0667b6..c583f8a0e1 100644 --- a/apps/smime.c +++ b/apps/smime.c @@ -671,7 +671,7 @@ int MAIN(int argc, char **argv) { if (!(store = setup_verify(bio_err, CAfile, CApath))) goto end; - X509_STORE_set_verify_cb_func(store, smime_cb); + X509_STORE_set_verify_cb(store, smime_cb); if (vpm) X509_STORE_set1_param(store, vpm); } diff --git a/apps/ts.c b/apps/ts.c index bedb602fd5..5fa9f7fda0 100644 --- a/apps/ts.c +++ b/apps/ts.c @@ -1083,7 +1083,7 @@ static X509_STORE *create_cert_store(char *ca_path, char *ca_file) cert_ctx = X509_STORE_new(); /* Setting the callback for certificate chain verification. */ - X509_STORE_set_verify_cb_func(cert_ctx, verify_cb); + X509_STORE_set_verify_cb(cert_ctx, verify_cb); /* Adding a trusted certificate directory source. */ if (ca_path) diff --git a/apps/verify.c b/apps/verify.c index 838ac46827..96fcfb429d 100644 --- a/apps/verify.c +++ b/apps/verify.c @@ -93,7 +93,7 @@ int MAIN(int argc, char **argv) cert_ctx=X509_STORE_new(); if (cert_ctx == NULL) goto end; - X509_STORE_set_verify_cb_func(cert_ctx,cb); + X509_STORE_set_verify_cb(cert_ctx,cb); ERR_load_crypto_strings(); diff --git a/apps/x509.c b/apps/x509.c index 72d104bf09..0be3414d34 100644 --- a/apps/x509.c +++ b/apps/x509.c @@ -225,7 +225,7 @@ int MAIN(int argc, char **argv) ctx=X509_STORE_new(); if (ctx == NULL) goto end; - X509_STORE_set_verify_cb_func(ctx,callb); + X509_STORE_set_verify_cb(ctx,callb); argc--; argv++; diff --git a/crypto/x509/x509_lu.c b/crypto/x509/x509_lu.c index e29c35c861..fb7d23bbd0 100644 --- a/crypto/x509/x509_lu.c +++ b/crypto/x509/x509_lu.c @@ -695,5 +695,11 @@ int X509_STORE_set1_param(X509_STORE *ctx, X509_VERIFY_PARAM *param) return X509_VERIFY_PARAM_set1(ctx->param, param); } +void X509_STORE_set_verify_cb(X509_STORE *ctx, + int (*verify_cb)(int, X509_STORE_CTX *)) + { + ctx->verify_cb = verify_cb; + } + IMPLEMENT_STACK_OF(X509_LOOKUP) IMPLEMENT_STACK_OF(X509_OBJECT) diff --git a/crypto/x509/x509_vfy.h b/crypto/x509/x509_vfy.h index 4e73806adc..acb713a6e5 100644 --- a/crypto/x509/x509_vfy.h +++ b/crypto/x509/x509_vfy.h @@ -419,6 +419,9 @@ int X509_STORE_set_purpose(X509_STORE *ctx, int purpose); int X509_STORE_set_trust(X509_STORE *ctx, int trust); int X509_STORE_set1_param(X509_STORE *ctx, X509_VERIFY_PARAM *pm); +void X509_STORE_set_verify_cb(X509_STORE *ctx, + int (*verify_cb)(int, X509_STORE_CTX *)); + X509_STORE_CTX *X509_STORE_CTX_new(void); int X509_STORE_CTX_get1_issuer(X509 **issuer, X509_STORE_CTX *ctx, X509 *x); -- 2.25.1