summaryrefslogtreecommitdiff
path: root/lib/libcrypto/x509/x509_trs.c
diff options
context:
space:
mode:
authorBob Beck <beck@cvs.openbsd.org>2000-04-15 06:18:52 +0000
committerBob Beck <beck@cvs.openbsd.org>2000-04-15 06:18:52 +0000
commit8023a8fe50e4963b4fba8c86d9623b97c27ce784 (patch)
tree970860d25d50d5f71198db33bd8bcfb6cf5a9864 /lib/libcrypto/x509/x509_trs.c
parentd6d4194cda8ed05473dc616aad0ba6818e9fa3a5 (diff)
OpenSSL 0.9.5a merge
Diffstat (limited to 'lib/libcrypto/x509/x509_trs.c')
-rw-r--r--lib/libcrypto/x509/x509_trs.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/lib/libcrypto/x509/x509_trs.c b/lib/libcrypto/x509/x509_trs.c
index 9f7d67952db..c779aaf94d6 100644
--- a/lib/libcrypto/x509/x509_trs.c
+++ b/lib/libcrypto/x509/x509_trs.c
@@ -65,7 +65,7 @@ static int tr_cmp(X509_TRUST **a, X509_TRUST **b);
static void trtable_free(X509_TRUST *p);
static int trust_1oidany(X509_TRUST *trust, X509 *x, int flags);
-static int trust_any(X509_TRUST *trust, X509 *x, int flags);
+static int trust_compat(X509_TRUST *trust, X509 *x, int flags);
static int obj_trust(int id, X509 *x, int flags);
static int (*default_trust)(int id, X509 *x, int flags) = obj_trust;
@@ -76,7 +76,7 @@ static int (*default_trust)(int id, X509 *x, int flags) = obj_trust;
*/
static X509_TRUST trstandard[] = {
-{X509_TRUST_ANY, 0, trust_any, "Any", 0, NULL},
+{X509_TRUST_COMPAT, 0, trust_compat, "compatible", 0, NULL},
{X509_TRUST_SSL_CLIENT, 0, trust_1oidany, "SSL Client", NID_client_auth, NULL},
{X509_TRUST_SSL_SERVER, 0, trust_1oidany, "SSL Client", NID_server_auth, NULL},
{X509_TRUST_EMAIL, 0, trust_1oidany, "S/MIME email", NID_email_protect, NULL},
@@ -107,8 +107,8 @@ int X509_check_trust(X509 *x, int id, int flags)
X509_TRUST *pt;
int idx;
if(id == -1) return 1;
- if(!(idx = X509_TRUST_get_by_id(id)))
- return default_trust(id, x, flags);
+ idx = X509_TRUST_get_by_id(id);
+ if(idx == -1) return default_trust(id, x, flags);
pt = X509_TRUST_get0(idx);
return pt->check_trust(pt, x, flags);
}
@@ -230,6 +230,11 @@ static int trust_1oidany(X509_TRUST *trust, X509 *x, int flags)
/* we don't have any trust settings: for compatibility
* we return trusted if it is self signed
*/
+ return trust_compat(trust, x, flags);
+}
+
+static int trust_compat(X509_TRUST *trust, X509 *x, int flags)
+{
X509_check_purpose(x, -1, 0);
if(x->ex_flags & EXFLAG_SS) return X509_TRUST_TRUSTED;
else return X509_TRUST_UNTRUSTED;
@@ -257,7 +262,3 @@ static int obj_trust(int id, X509 *x, int flags)
return X509_TRUST_UNTRUSTED;
}
-static int trust_any(X509_TRUST *trust, X509 *x, int flags)
-{
- return X509_TRUST_TRUSTED;
-}