Skip to content
Permalink
Browse files
Make return value of X509_verify_cert be consistent with the error code,
with the caveat that we force V_OK when a user provided callback has
us returning success.
ok inoguchi@ jsing@
  • Loading branch information
beck committed Jan 21, 2017
1 parent ee82470 commit ddd98f8ea741a122952185a36c1396c14c2fda74
Showing 1 changed file with 10 additions and 2 deletions.
@@ -1,4 +1,4 @@
/* $OpenBSD: x509_vfy.c,v 1.57 2017/01/20 00:37:40 beck Exp $ */
/* $OpenBSD: x509_vfy.c,v 1.58 2017/01/21 01:07:25 beck Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -546,7 +546,15 @@ X509_verify_cert(X509_STORE_CTX *ctx)
/* Safety net, error returns must set ctx->error */
if (ok <= 0 && ctx->error == X509_V_OK)
ctx->error = X509_V_ERR_UNSPECIFIED;
return ok;

/*
* Safety net, if user provided verify callback indicates sucess
* make sure they have set error to X509_V_OK
*/
if (ctx->verify_cb != null_callback && ok == 1)
ctx->error = X509_V_OK;

return(ctx->error == X509_V_OK);
}

/* Given a STACK_OF(X509) find the issuer of cert (if any)

1 comment on commit ddd98f8

@avar
Copy link

@avar avar commented on ddd98f8 May 5, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Referenced from CVE-2017-8301.

Please sign in to comment.