summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/x509
diff options
context:
space:
mode:
authormarkus <>2004-04-08 08:13:24 +0000
committermarkus <>2004-04-08 08:13:24 +0000
commit22079250b28b7e3a6b80b2c87a65ac41433e1e4f (patch)
tree7ef617b8cd485cb8c03c154f81b72290777c27d7 /src/lib/libcrypto/x509
parent40d673554117d24c9f46be721235d3e302c06e04 (diff)
downloadopenbsd-22079250b28b7e3a6b80b2c87a65ac41433e1e4f.tar.gz
openbsd-22079250b28b7e3a6b80b2c87a65ac41433e1e4f.tar.bz2
openbsd-22079250b28b7e3a6b80b2c87a65ac41433e1e4f.zip
backout for now
Diffstat (limited to 'src/lib/libcrypto/x509')
-rw-r--r--src/lib/libcrypto/x509/x509_txt.c8
-rw-r--r--src/lib/libcrypto/x509/x509_vfy.c55
2 files changed, 8 insertions, 55 deletions
diff --git a/src/lib/libcrypto/x509/x509_txt.c b/src/lib/libcrypto/x509/x509_txt.c
index e31ebc6741..9d09ae17e8 100644
--- a/src/lib/libcrypto/x509/x509_txt.c
+++ b/src/lib/libcrypto/x509/x509_txt.c
@@ -147,14 +147,8 @@ const char *X509_verify_cert_error_string(long n)
147 case X509_V_ERR_UNHANDLED_CRITICAL_EXTENSION: 147 case X509_V_ERR_UNHANDLED_CRITICAL_EXTENSION:
148 return("unhandled critical extension"); 148 return("unhandled critical extension");
149 149
150 case X509_V_ERR_KEYUSAGE_NO_CRL_SIGN:
151 return("key usage does not include CRL signing");
152
153 case X509_V_ERR_UNHANDLED_CRITICAL_CRL_EXTENSION:
154 return("unhandled critical CRL extension");
155
156 default: 150 default:
157 BIO_snprintf(buf,sizeof buf,"error number %ld",n); 151 snprintf(buf,sizeof buf,"error number %ld",n);
158 return(buf); 152 return(buf);
159 } 153 }
160 } 154 }
diff --git a/src/lib/libcrypto/x509/x509_vfy.c b/src/lib/libcrypto/x509/x509_vfy.c
index 2e4d0b823a..2bb21b443e 100644
--- a/src/lib/libcrypto/x509/x509_vfy.c
+++ b/src/lib/libcrypto/x509/x509_vfy.c
@@ -383,7 +383,6 @@ static int check_chain_purpose(X509_STORE_CTX *ctx)
383 /* Check all untrusted certificates */ 383 /* Check all untrusted certificates */
384 for (i = 0; i < ctx->last_untrusted; i++) 384 for (i = 0; i < ctx->last_untrusted; i++)
385 { 385 {
386 int ret;
387 x = sk_X509_value(ctx->chain, i); 386 x = sk_X509_value(ctx->chain, i);
388 if (!(ctx->flags & X509_V_FLAG_IGNORE_CRITICAL) 387 if (!(ctx->flags & X509_V_FLAG_IGNORE_CRITICAL)
389 && (x->ex_flags & EXFLAG_CRITICAL)) 388 && (x->ex_flags & EXFLAG_CRITICAL))
@@ -394,10 +393,7 @@ static int check_chain_purpose(X509_STORE_CTX *ctx)
394 ok=cb(0,ctx); 393 ok=cb(0,ctx);
395 if (!ok) goto end; 394 if (!ok) goto end;
396 } 395 }
397 ret = X509_check_purpose(x, ctx->purpose, i); 396 if (!X509_check_purpose(x, ctx->purpose, i))
398 if ((ret == 0)
399 || ((ctx->flags & X509_V_FLAG_X509_STRICT)
400 && (ret != 1)))
401 { 397 {
402 if (i) 398 if (i)
403 ctx->error = X509_V_ERR_INVALID_CA; 399 ctx->error = X509_V_ERR_INVALID_CA;
@@ -541,14 +537,6 @@ static int check_crl(X509_STORE_CTX *ctx, X509_CRL *crl)
541 537
542 if(issuer) 538 if(issuer)
543 { 539 {
544 /* Check for cRLSign bit if keyUsage present */
545 if ((issuer->ex_flags & EXFLAG_KUSAGE) &&
546 !(issuer->ex_kusage & KU_CRL_SIGN))
547 {
548 ctx->error = X509_V_ERR_KEYUSAGE_NO_CRL_SIGN;
549 ok = ctx->verify_cb(0, ctx);
550 if(!ok) goto err;
551 }
552 540
553 /* Attempt to get issuer certificate public key */ 541 /* Attempt to get issuer certificate public key */
554 ikey = X509_get_pubkey(issuer); 542 ikey = X509_get_pubkey(issuer);
@@ -623,46 +611,17 @@ static int cert_crl(X509_STORE_CTX *ctx, X509_CRL *crl, X509 *x)
623 { 611 {
624 int idx, ok; 612 int idx, ok;
625 X509_REVOKED rtmp; 613 X509_REVOKED rtmp;
626 STACK_OF(X509_EXTENSION) *exts;
627 X509_EXTENSION *ext;
628 /* Look for serial number of certificate in CRL */ 614 /* Look for serial number of certificate in CRL */
629 rtmp.serialNumber = X509_get_serialNumber(x); 615 rtmp.serialNumber = X509_get_serialNumber(x);
630 idx = sk_X509_REVOKED_find(crl->crl->revoked, &rtmp); 616 idx = sk_X509_REVOKED_find(crl->crl->revoked, &rtmp);
631 /* If found assume revoked: want something cleverer than 617 /* Not found: OK */
618 if(idx == -1) return 1;
619 /* Otherwise revoked: want something cleverer than
632 * this to handle entry extensions in V2 CRLs. 620 * this to handle entry extensions in V2 CRLs.
633 */ 621 */
634 if(idx >= 0) 622 ctx->error = X509_V_ERR_CERT_REVOKED;
635 { 623 ok = ctx->verify_cb(0, ctx);
636 ctx->error = X509_V_ERR_CERT_REVOKED; 624 return ok;
637 ok = ctx->verify_cb(0, ctx);
638 if (!ok) return 0;
639 }
640
641 if (ctx->flags & X509_V_FLAG_IGNORE_CRITICAL)
642 return 1;
643
644 /* See if we have any critical CRL extensions: since we
645 * currently don't handle any CRL extensions the CRL must be
646 * rejected.
647 * This code accesses the X509_CRL structure directly: applications
648 * shouldn't do this.
649 */
650
651 exts = crl->crl->extensions;
652
653 for (idx = 0; idx < sk_X509_EXTENSION_num(exts); idx++)
654 {
655 ext = sk_X509_EXTENSION_value(exts, idx);
656 if (ext->critical > 0)
657 {
658 ctx->error =
659 X509_V_ERR_UNHANDLED_CRITICAL_CRL_EXTENSION;
660 ok = ctx->verify_cb(0, ctx);
661 if(!ok) return 0;
662 break;
663 }
664 }
665 return 1;
666 } 625 }
667 626
668static int internal_verify(X509_STORE_CTX *ctx) 627static int internal_verify(X509_STORE_CTX *ctx)