summaryrefslogtreecommitdiffstats
path: root/crypto/x509/x509_trs.c
diff options
context:
space:
mode:
authorViktor Dukhovni <openssl-users@dukhovni.org>2016-01-15 09:49:11 +0100
committerViktor Dukhovni <openssl-users@dukhovni.org>2016-01-21 01:03:36 +0100
commit3342dcea7a633e579e1971dfd16ff3fc14dc3936 (patch)
tree6724238186c3e0cf27177a769b52c370576948d5 /crypto/x509/x509_trs.c
parentCommit pre-generated test_verify certs (diff)
downloadopenssl-3342dcea7a633e579e1971dfd16ff3fc14dc3936.tar.xz
openssl-3342dcea7a633e579e1971dfd16ff3fc14dc3936.zip
Reject when explicit trust EKU are set and none match.
Returning untrusted is enough for for full chains that end in self-signed roots, because when explicit trust is specified it suppresses the default blanket trust of self-signed objects. But for partial chains, this is not enough, because absent a similar trust-self-signed policy, non matching EKUs are indistinguishable from lack of EKU constraints. Therefore, failure to match any trusted purpose must trigger an explicit reject. Reviewed-by: Richard Levitte <levitte@openssl.org>
Diffstat (limited to 'crypto/x509/x509_trs.c')
-rw-r--r--crypto/x509/x509_trs.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/crypto/x509/x509_trs.c b/crypto/x509/x509_trs.c
index 8f2ff8321e..851e745220 100644
--- a/crypto/x509/x509_trs.c
+++ b/crypto/x509/x509_trs.c
@@ -312,6 +312,21 @@ static int obj_trust(int id, X509 *x, int flags)
if (OBJ_obj2nid(obj) == id)
return X509_TRUST_TRUSTED;
}
+ /*
+ * Reject when explicit trust EKU are set and none match.
+ *
+ * Returning untrusted is enough for for full chains that end in
+ * self-signed roots, because when explicit trust is specified it
+ * suppresses the default blanket trust of self-signed objects.
+ *
+ * But for partial chains, this is not enough, because absent a similar
+ * trust-self-signed policy, non matching EKUs are indistinguishable
+ * from lack of EKU constraints.
+ *
+ * Therefore, failure to match any trusted purpose must trigger an
+ * explicit reject.
+ */
+ return X509_TRUST_REJECTED;
}
return X509_TRUST_UNTRUSTED;
}