Type-checked (and modern C compliant) OBJ_bsearch.
[openssl.git] / crypto / x509v3 / v3_crld.c
index 4d06ea664e7468825126c35d0b38566370e779dc..c5e616caccb736b265581daa977a5302179be8c2 100644 (file)
 #include <openssl/asn1t.h>
 #include <openssl/x509v3.h>
 
-static void *v2i_crld(X509V3_EXT_METHOD *method,
-                               X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *nval);
-static int i2r_crldp(X509V3_EXT_METHOD *method, void *pcrldp, BIO *out,
-                                                               int indent);
+static void *v2i_crld(const X509V3_EXT_METHOD *method,
+                     X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *nval);
+static int i2r_crldp(const X509V3_EXT_METHOD *method, void *pcrldp, BIO *out,
+                    int indent);
 
 const X509V3_EXT_METHOD v3_crld =
        {
@@ -79,6 +79,17 @@ const X509V3_EXT_METHOD v3_crld =
        NULL
        };
 
+const X509V3_EXT_METHOD v3_freshest_crl =
+       {
+       NID_freshest_crl, 0, ASN1_ITEM_ref(CRL_DIST_POINTS),
+       0,0,0,0,
+       0,0,
+       0,
+       v2i_crld,
+       i2r_crldp,0,
+       NULL
+       };
+
 static STACK_OF(GENERAL_NAME) *gnames_from_sectname(X509V3_CTX *ctx, char *sect)
        {
        STACK_OF(CONF_VALUE) *gnsect;
@@ -180,6 +191,7 @@ static int set_dist_point_name(DIST_POINT_NAME **pdp, X509V3_CTX *ctx,
        }
 
 static const BIT_STRING_BITNAME reason_flags[] = {
+{0, "Unused", "unused"},
 {1, "Key Compromise", "keyCompromise"},
 {2, "CA Compromise", "CACompromise"},
 {3, "Affiliation Changed", "affiliationChanged"},
@@ -296,8 +308,8 @@ static DIST_POINT *crldp_from_section(X509V3_CTX *ctx,
        return NULL;
        }
 
-static void *v2i_crld(X509V3_EXT_METHOD *method,
-                               X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *nval)
+static void *v2i_crld(const X509V3_EXT_METHOD *method,
+                     X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *nval)
        {
        STACK_OF(DIST_POINT) *crld = NULL;
        GENERAL_NAMES *gens = NULL;
@@ -414,10 +426,10 @@ ASN1_SEQUENCE(ISSUING_DIST_POINT) = {
 
 IMPLEMENT_ASN1_FUNCTIONS(ISSUING_DIST_POINT)
 
-static int i2r_idp(X509V3_EXT_METHOD *method,
-            void *pidp, BIO *out, int indent);
-static void *v2i_idp(X509V3_EXT_METHOD *method,
-                               X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *nval);
+static int i2r_idp(const X509V3_EXT_METHOD *method, void *pidp, BIO *out,
+                  int indent);
+static void *v2i_idp(const X509V3_EXT_METHOD *method, X509V3_CTX *ctx,
+                    STACK_OF(CONF_VALUE) *nval);
 
 const X509V3_EXT_METHOD v3_idp =
        {
@@ -431,8 +443,8 @@ const X509V3_EXT_METHOD v3_idp =
        NULL
        };
 
-static void *v2i_idp(X509V3_EXT_METHOD *method,
-                               X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *nval)
+static void *v2i_idp(const X509V3_EXT_METHOD *method, X509V3_CTX *ctx,
+                    STACK_OF(CONF_VALUE) *nval)
        {
        ISSUING_DIST_POINT *idp = NULL;
        CONF_VALUE *cnf;
@@ -523,7 +535,8 @@ static int print_distpoint(BIO *out, DIST_POINT_NAME *dpn, int indent)
        return 1;
        }
 
-static int i2r_idp(X509V3_EXT_METHOD *method, void *pidp, BIO *out, int indent)
+static int i2r_idp(const X509V3_EXT_METHOD *method, void *pidp, BIO *out,
+                  int indent)
        {
        ISSUING_DIST_POINT *idp = pidp;
        if (idp->distpoint)
@@ -547,8 +560,8 @@ static int i2r_idp(X509V3_EXT_METHOD *method, void *pidp, BIO *out, int indent)
        return 1;
        }
 
-static int i2r_crldp(X509V3_EXT_METHOD *method, void *pcrldp, BIO *out,
-                                                               int indent)
+static int i2r_crldp(const X509V3_EXT_METHOD *method, void *pcrldp, BIO *out,
+                    int indent)
        {
        STACK_OF(DIST_POINT) *crld = pcrldp;
        DIST_POINT *point;