Loading apps/pkcs12.c +13 −7 Original line number Original line Diff line number Diff line Loading @@ -528,8 +528,11 @@ int MAIN(int argc, char **argv) X509_free(sk_X509_value(chain2, 0)); X509_free(sk_X509_value(chain2, 0)); sk_X509_free(chain2); sk_X509_free(chain2); } else { } else { if (vret >= 0) BIO_printf (bio_err, "Error %s getting chain.\n", BIO_printf (bio_err, "Error %s getting chain.\n", X509_verify_cert_error_string(vret)); X509_verify_cert_error_string(vret)); else ERR_print_errors(bio_err); goto export_end; goto export_end; } } } } Loading Loading @@ -813,7 +816,7 @@ int get_cert_chain (X509 *cert, X509_STORE *store, STACK_OF(X509) **chain) { { X509_STORE_CTX store_ctx; X509_STORE_CTX store_ctx; STACK_OF(X509) *chn; STACK_OF(X509) *chn; int i; int i = 0; /* FIXME: Should really check the return status of X509_STORE_CTX_init /* FIXME: Should really check the return status of X509_STORE_CTX_init * for an error, but how that fits into the return value of this * for an error, but how that fits into the return value of this Loading @@ -821,14 +824,17 @@ int get_cert_chain (X509 *cert, X509_STORE *store, STACK_OF(X509) **chain) X509_STORE_CTX_init(&store_ctx, store, cert, NULL); X509_STORE_CTX_init(&store_ctx, store, cert, NULL); if (X509_verify_cert(&store_ctx) <= 0) { if (X509_verify_cert(&store_ctx) <= 0) { i = X509_STORE_CTX_get_error (&store_ctx); i = X509_STORE_CTX_get_error (&store_ctx); if (i == 0) /* avoid returning 0 if X509_verify_cert() did not * set an appropriate error value in the context */ i = -1; chn = NULL; goto err; goto err; } } else chn = X509_STORE_CTX_get1_chain(&store_ctx); chn = X509_STORE_CTX_get1_chain(&store_ctx); i = 0; *chain = chn; err: err: X509_STORE_CTX_cleanup(&store_ctx); X509_STORE_CTX_cleanup(&store_ctx); *chain = NULL; *chain = chn; return i; return i; } } Loading Loading
apps/pkcs12.c +13 −7 Original line number Original line Diff line number Diff line Loading @@ -528,8 +528,11 @@ int MAIN(int argc, char **argv) X509_free(sk_X509_value(chain2, 0)); X509_free(sk_X509_value(chain2, 0)); sk_X509_free(chain2); sk_X509_free(chain2); } else { } else { if (vret >= 0) BIO_printf (bio_err, "Error %s getting chain.\n", BIO_printf (bio_err, "Error %s getting chain.\n", X509_verify_cert_error_string(vret)); X509_verify_cert_error_string(vret)); else ERR_print_errors(bio_err); goto export_end; goto export_end; } } } } Loading Loading @@ -813,7 +816,7 @@ int get_cert_chain (X509 *cert, X509_STORE *store, STACK_OF(X509) **chain) { { X509_STORE_CTX store_ctx; X509_STORE_CTX store_ctx; STACK_OF(X509) *chn; STACK_OF(X509) *chn; int i; int i = 0; /* FIXME: Should really check the return status of X509_STORE_CTX_init /* FIXME: Should really check the return status of X509_STORE_CTX_init * for an error, but how that fits into the return value of this * for an error, but how that fits into the return value of this Loading @@ -821,14 +824,17 @@ int get_cert_chain (X509 *cert, X509_STORE *store, STACK_OF(X509) **chain) X509_STORE_CTX_init(&store_ctx, store, cert, NULL); X509_STORE_CTX_init(&store_ctx, store, cert, NULL); if (X509_verify_cert(&store_ctx) <= 0) { if (X509_verify_cert(&store_ctx) <= 0) { i = X509_STORE_CTX_get_error (&store_ctx); i = X509_STORE_CTX_get_error (&store_ctx); if (i == 0) /* avoid returning 0 if X509_verify_cert() did not * set an appropriate error value in the context */ i = -1; chn = NULL; goto err; goto err; } } else chn = X509_STORE_CTX_get1_chain(&store_ctx); chn = X509_STORE_CTX_get1_chain(&store_ctx); i = 0; *chain = chn; err: err: X509_STORE_CTX_cleanup(&store_ctx); X509_STORE_CTX_cleanup(&store_ctx); *chain = NULL; *chain = chn; return i; return i; } } Loading