Skip to content

Instantly share code, notes, and snippets.

@indutny
Last active August 29, 2015 14:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save indutny/554cb6637dadda84460a to your computer and use it in GitHub Desktop.
Save indutny/554cb6637dadda84460a to your computer and use it in GitHub Desktop.
diff --git a/deps/openssl/openssl/crypto/x509/x509_vfy.c b/deps/openssl/openssl/crypto/x509/x509_vfy.c
index 920066a..c313024 100644
--- a/deps/openssl/openssl/crypto/x509/x509_vfy.c
+++ b/deps/openssl/openssl/crypto/x509/x509_vfy.c
@@ -238,6 +238,7 @@ int X509_verify_cert(X509_STORE_CTX *ctx)
* is self signed.
*/
+retry:
i=sk_X509_num(ctx->chain);
x=sk_X509_value(ctx->chain,i-1);
if (ctx->check_issued(ctx, x, x))
@@ -312,6 +313,11 @@ int X509_verify_cert(X509_STORE_CTX *ctx)
{
if ((chain_ss == NULL) || !ctx->check_issued(ctx, x, chain_ss))
{
+ if (sk_X509_num(ctx->chain) > 1)
+ {
+ X509_free(sk_X509_pop(ctx->chain));
+ goto retry;
+ }
if (ctx->last_untrusted >= num)
ctx->error=X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY;
else
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment