Reorganise asn1.h and add comments.
[openssl.git] / include / openssl / asn1.h
index a5961264a77c3efffd55855b65d18156c0634fa2..6994abf0ccff5c26d422467ac200d21a143b4c12 100644 (file)
@@ -46,13 +46,11 @@ extern "C" {
 # define V_ASN1_OTHER                    -3/* used in ASN1_TYPE */
 # define V_ASN1_ANY                      -4/* used in ASN1 template code */
 
-# define V_ASN1_NEG                      0x100/* negative flag */
-
 # define V_ASN1_UNDEF                    -1
+/* ASN.1 tag values */
 # define V_ASN1_EOC                      0
 # define V_ASN1_BOOLEAN                  1 /**/
 # define V_ASN1_INTEGER                  2
-# define V_ASN1_NEG_INTEGER              (2 | V_ASN1_NEG)
 # define V_ASN1_BIT_STRING               3
 # define V_ASN1_OCTET_STRING             4
 # define V_ASN1_NULL                     5
@@ -61,7 +59,6 @@ extern "C" {
 # define V_ASN1_EXTERNAL                 8
 # define V_ASN1_REAL                     9
 # define V_ASN1_ENUMERATED               10
-# define V_ASN1_NEG_ENUMERATED           (10 | V_ASN1_NEG)
 # define V_ASN1_UTF8STRING               12
 # define V_ASN1_SEQUENCE                 16
 # define V_ASN1_SET                      17
@@ -79,6 +76,17 @@ extern "C" {
 # define V_ASN1_GENERALSTRING            27 /**/
 # define V_ASN1_UNIVERSALSTRING          28 /**/
 # define V_ASN1_BMPSTRING                30
+
+/*
+ * NB the constants below are used internally by ASN1_INTEGER
+ * and ASN1_ENUMERATED to indicate the sign. They are *not* on
+ * the wire tag values.
+ */
+
+# define V_ASN1_NEG                      0x100
+# define V_ASN1_NEG_INTEGER              (2 | V_ASN1_NEG)
+# define V_ASN1_NEG_ENUMERATED           (10 | V_ASN1_NEG)
+
 /* For use with d2i_ASN1_type_bytes() */
 # define B_ASN1_NUMERICSTRING    0x0001
 # define B_ASN1_PRINTABLESTRING  0x0002
@@ -553,8 +561,8 @@ int ASN1_BIT_STRING_check(const ASN1_BIT_STRING *a,
 
 int ASN1_BIT_STRING_name_print(BIO *out, ASN1_BIT_STRING *bs,
                                BIT_STRING_BITNAME *tbl, int indent);
-int ASN1_BIT_STRING_num_asc(char *name, BIT_STRING_BITNAME *tbl);
-int ASN1_BIT_STRING_set_asc(ASN1_BIT_STRING *bs, char *name, int value,
+int ASN1_BIT_STRING_num_asc(const char *name, BIT_STRING_BITNAME *tbl);
+int ASN1_BIT_STRING_set_asc(ASN1_BIT_STRING *bs, const char *name, int value,
                             BIT_STRING_BITNAME *tbl);
 
 DECLARE_ASN1_FUNCTIONS(ASN1_INTEGER)
@@ -752,7 +760,7 @@ int ASN1_parse_dump(BIO *bp, const unsigned char *pp, long len, int indent,
                     int dump);
 const char *ASN1_tag2str(int tag);
 
-/* Used to load and write netscape format cert */
+/* Used to load and write Netscape format cert */
 
 int ASN1_UNIVERSALSTRING_to_string(ASN1_UNIVERSALSTRING *s);
 
@@ -798,8 +806,8 @@ int ASN1_item_ndef_i2d(ASN1_VALUE *val, unsigned char **out,
 void ASN1_add_oid_module(void);
 void ASN1_add_stable_module(void);
 
-ASN1_TYPE *ASN1_generate_nconf(char *str, CONF *nconf);
-ASN1_TYPE *ASN1_generate_v3(char *str, X509V3_CTX *cnf);
+ASN1_TYPE *ASN1_generate_nconf(const char *str, CONF *nconf);
+ASN1_TYPE *ASN1_generate_v3(const char *str, X509V3_CTX *cnf);
 int ASN1_str2mask(const char *str, unsigned long *pmask);
 
 /* ASN1 Print flags */
@@ -885,6 +893,7 @@ void ERR_load_ASN1_strings(void);
 # define ASN1_F_ASN1_D2I_READ_BIO                         107
 # define ASN1_F_ASN1_DIGEST                               184
 # define ASN1_F_ASN1_DO_ADB                               110
+# define ASN1_F_ASN1_DO_LOCK                              233
 # define ASN1_F_ASN1_DUP                                  111
 # define ASN1_F_ASN1_EX_C2I                               204
 # define ASN1_F_ASN1_FIND_END                             190