New functions to retrieve certificate signatures and signature OID NID.
[oweals/openssl.git] / crypto / x509 / x509_trs.c
index 9c84a59d523c639dbf59f7353eabc614d4928d60..3d7e06815c8e04eee3bc2d50e958ec3a493ce57f 100644 (file)
@@ -1,5 +1,5 @@
 /* x509_trs.c */
-/* Written by Dr Stephen N Henson (shenson@bigfoot.com) for the OpenSSL
+/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
  * project 1999.
  */
 /* ====================================================================
@@ -84,7 +84,8 @@ static X509_TRUST trstandard[] = {
 {X509_TRUST_EMAIL, 0, trust_1oidany, "S/MIME email", NID_email_protect, NULL},
 {X509_TRUST_OBJECT_SIGN, 0, trust_1oidany, "Object Signer", NID_code_sign, NULL},
 {X509_TRUST_OCSP_SIGN, 0, trust_1oid, "OCSP responder", NID_OCSP_sign, NULL},
-{X509_TRUST_OCSP_REQUEST, 0, trust_1oid, "OCSP request", NID_ad_OCSP, NULL}
+{X509_TRUST_OCSP_REQUEST, 0, trust_1oid, "OCSP request", NID_ad_OCSP, NULL},
+{X509_TRUST_TSA, 0, trust_1oidany, "TSA server", NID_time_stamp, NULL}
 };
 
 #define X509_TRUST_COUNT       (sizeof(trstandard)/sizeof(X509_TRUST))
@@ -113,6 +114,15 @@ int X509_check_trust(X509 *x, int id, int flags)
        X509_TRUST *pt;
        int idx;
        if(id == -1) return 1;
+       /* We get this as a default value */
+       if (id == 0)
+               {
+               int rv;
+               rv = obj_trust(NID_anyExtendedKeyUsage, x, 0);
+               if (rv != X509_TRUST_UNTRUSTED)
+                       return rv;
+               return trust_compat(NULL, x, 0);
+               }
        idx = X509_TRUST_get_by_id(id);
        if(idx == -1) return default_trust(id, x, flags);
        pt = X509_TRUST_get0(idx);