Change the trust and purpose code so it doesn't need init
[openssl.git] / crypto / x509v3 / x509v3.h
index 988cdb8d95cb7d5715a184cb34789aa05463fa5e..5e988a98b89adb980e3e701dd266d885b92d6138 100644 (file)
@@ -329,17 +329,26 @@ DECLARE_ASN1_SET_OF(POLICYINFO)
 #define X509_PURPOSE_DYNAMIC_NAME      0x2
 
 typedef struct x509_purpose_st {
-       int purpose_id;
-       int purpose_flags;
+       int purpose;
+       int trust;              /* Default trust ID */
+       int flags;
        int (*check_purpose)(struct x509_purpose_st *, X509 *, int);
-       char *purpose_name;
-       /* void *usr_data; */ /* if we enable this it needs a free function */
+       char *name;
+       char *sname;
+       void *usr_data;
 } X509_PURPOSE;
 
-DECLARE_STACK_OF(X509_PURPOSE)
-
+#define X509_PURPOSE_SSL_CLIENT                1
+#define X509_PURPOSE_SSL_SERVER                2
+#define X509_PURPOSE_NS_SSL_SERVER     3
+#define X509_PURPOSE_SMIME_SIGN                4
+#define X509_PURPOSE_SMIME_ENCRYPT     5
+#define X509_PURPOSE_CRL_SIGN          6
 
+#define X509_PURPOSE_MIN               1
+#define X509_PURPOSE_MAX               6
 
+DECLARE_STACK_OF(X509_PURPOSE)
 
 void ERR_load_X509V3_strings(void);
 int i2d_BASIC_CONSTRAINTS(BASIC_CONSTRAINTS *a, unsigned char **pp);
@@ -522,12 +531,19 @@ int X509V3_EXT_print(BIO *out, X509_EXTENSION *ext, int flag, int indent);
 int X509V3_EXT_print_fp(FILE *out, X509_EXTENSION *ext, int flag, int indent);
 
 int X509_check_purpose(X509 *x, int id, int ca);
-int X509_PURPOSE_add(X509_PURPOSE *xp);
+int X509_PURPOSE_get_count(void);
+X509_PURPOSE * X509_PURPOSE_iget(int idx);
+int X509_PURPOSE_get_by_sname(char *sname);
+int X509_PURPOSE_get_by_id(int id);
+int X509_PURPOSE_add(int id, int trust, int flags,
+                       int (*ck)(X509_PURPOSE *, X509 *, int),
+                               char *name, char *sname, void *arg);
+char *X509_PURPOSE_iget_name(X509_PURPOSE *xp);
+char *X509_PURPOSE_iget_sname(X509_PURPOSE *xp);
+int X509_PURPOSE_get_trust(X509_PURPOSE *xp);
 void X509_PURPOSE_cleanup(void);
 void X509_PURPOSE_add_standard(void);
-int X509_PURPOSE_enum(int (*efunc)(X509_PURPOSE *, void *), void *usr);
 int X509_PURPOSE_get_id(X509_PURPOSE *);
-char * X509_PURPOSE_get_name(X509_PURPOSE *);
 
 /* BEGIN ERROR CODES */
 /* The following lines are auto generated by the script mkerr.pl. Any changes