mark all block comments that need format preserving so that
[openssl.git] / crypto / asn1 / asn1.h
index 33a41d79b12777d4bfdf3e3915d14e74f40d4c24..fc87e0ca7d9f52e3e31e191b0f43620f4a16d79d 100644 (file)
@@ -70,7 +70,7 @@
 #include <openssl/symhacks.h>
 
 #include <openssl/ossl_typ.h>
-#ifndef OPENSSL_NO_DEPRECATED
+#ifdef OPENSSL_USE_DEPRECATED
 #include <openssl/bn.h>
 #endif
 
@@ -208,14 +208,14 @@ typedef struct asn1_const_ctx_st
 #define ASN1_OBJECT_FLAG_CRITICAL       0x02   /* critical x509v3 object id */
 #define ASN1_OBJECT_FLAG_DYNAMIC_STRINGS 0x04  /* internal use */
 #define ASN1_OBJECT_FLAG_DYNAMIC_DATA   0x08   /* internal use */
-typedef struct asn1_object_st
+struct asn1_object_st
        {
        const char *sn,*ln;
        int nid;
        int length;
        const unsigned char *data;      /* data remains const after init */
        int flags;      /* Should we free this one */
-       } ASN1_OBJECT;
+       };
 
 #define ASN1_STRING_FLAG_BITS_LEFT 0x08 /* Set if 0x07 has bits left value */
 /* This indicates that the ASN1_STRING is not a real value but just a place
@@ -263,6 +263,12 @@ typedef struct ASN1_ENCODING_st
 #define ASN1_LONG_UNDEF        0x7fffffffL
 
 #define STABLE_FLAGS_MALLOC    0x01
+/* A zero passed to ASN1_STRING_TABLE_new_add for the flags is 
+ * interpreted as "don't change" and STABLE_FLAGS_MALLOC is always
+ * set. By setting STABLE_FLAGS_MALLOC only we can clear the existing
+ * value. Use the alias STABLE_FLAGS_CLEAR to reflect this.
+ */
+#define STABLE_FLAGS_CLEAR     STABLE_FLAGS_MALLOC
 #define STABLE_NO_MASK         0x02
 #define DIRSTRING_TYPE \
  (B_ASN1_PRINTABLESTRING|B_ASN1_T61STRING|B_ASN1_BMPSTRING|B_ASN1_UTF8STRING)
@@ -361,7 +367,8 @@ typedef struct ASN1_VALUE_st ASN1_VALUE;
 
 TYPEDEF_D2I2D_OF(void);
 
-/* The following macros and typedefs allow an ASN1_ITEM
+/*-
+ * The following macros and typedefs allow an ASN1_ITEM
  * to be embedded in a structure and referenced. Since
  * the ASN1_ITEM pointers need to be globally accessible
  * (possibly from shared libraries) they may exist in
@@ -813,9 +820,9 @@ ASN1_BIT_STRING *c2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a,const unsigned char **p
 int            ASN1_BIT_STRING_set(ASN1_BIT_STRING *a, unsigned char *d,
                        int length );
 int            ASN1_BIT_STRING_set_bit(ASN1_BIT_STRING *a, int n, int value);
-int            ASN1_BIT_STRING_get_bit(ASN1_BIT_STRING *a, int n);
-int            ASN1_BIT_STRING_check(ASN1_BIT_STRING *a,
-                                     unsigned char *flags, int flags_len);
+int            ASN1_BIT_STRING_get_bit(const ASN1_BIT_STRING *a, int n);
+int            ASN1_BIT_STRING_check(const ASN1_BIT_STRING *a,
+                                     const unsigned char *flags, int flags_len);
 
 #ifndef OPENSSL_NO_BIO
 int ASN1_BIT_STRING_name_print(BIO *out, ASN1_BIT_STRING *bs,
@@ -854,6 +861,8 @@ ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_set(ASN1_GENERALIZEDTIME *s,time_t t)
 ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_adj(ASN1_GENERALIZEDTIME *s,
             time_t t, int offset_day, long offset_sec);
 int ASN1_GENERALIZEDTIME_set_string(ASN1_GENERALIZEDTIME *s, const char *str);
+int ASN1_TIME_diff(int *pday, int *psec,
+                       const ASN1_TIME *from, const ASN1_TIME *to);
 
 DECLARE_ASN1_FUNCTIONS(ASN1_OCTET_STRING)
 ASN1_OCTET_STRING *    ASN1_OCTET_STRING_dup(const ASN1_OCTET_STRING *a);
@@ -1090,9 +1099,11 @@ int ASN1_item_i2d(ASN1_VALUE *val, unsigned char **out, const ASN1_ITEM *it);
 int ASN1_item_ndef_i2d(ASN1_VALUE *val, unsigned char **out, const ASN1_ITEM *it);
 
 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);
+int ASN1_str2mask(const char *str, unsigned long *pmask);
 
 /* ASN1 Print flags */
 
@@ -1260,6 +1271,7 @@ void ERR_load_ASN1_strings(void);
 #define ASN1_F_D2I_X509                                         156
 #define ASN1_F_D2I_X509_CINF                            157
 #define ASN1_F_D2I_X509_PKEY                            159
+#define ASN1_F_DO_TCREATE                               222
 #define ASN1_F_I2D_ASN1_BIO_STREAM                      211
 #define ASN1_F_I2D_ASN1_SET                             188
 #define ASN1_F_I2D_ASN1_TIME                            160
@@ -1278,6 +1290,7 @@ void ERR_load_ASN1_strings(void);
 #define ASN1_F_PKCS5_PBKDF2_SET                                 219
 #define ASN1_F_SMIME_READ_ASN1                          212
 #define ASN1_F_SMIME_TEXT                               213
+#define ASN1_F_STBL_MODULE_INIT                                 223
 #define ASN1_F_X509_CINF_NEW                            168
 #define ASN1_F_X509_CRL_ADD0_REVOKED                    169
 #define ASN1_F_X509_INFO_NEW                            170
@@ -1338,6 +1351,7 @@ void ERR_load_ASN1_strings(void);
 #define ASN1_R_ILLEGAL_TIME_VALUE                       184
 #define ASN1_R_INTEGER_NOT_ASCII_FORMAT                         185
 #define ASN1_R_INTEGER_TOO_LARGE_FOR_LONG               128
+#define ASN1_R_INVALID_BIT_STRING_BITS_LEFT             220
 #define ASN1_R_INVALID_BMPSTRING_LENGTH                         129
 #define ASN1_R_INVALID_DIGIT                            130
 #define ASN1_R_INVALID_MIME_TYPE                        205
@@ -1345,9 +1359,11 @@ void ERR_load_ASN1_strings(void);
 #define ASN1_R_INVALID_NUMBER                           187
 #define ASN1_R_INVALID_OBJECT_ENCODING                  216
 #define ASN1_R_INVALID_SEPARATOR                        131
+#define ASN1_R_INVALID_STRING_TABLE_VALUE               218
 #define ASN1_R_INVALID_TIME_FORMAT                      132
 #define ASN1_R_INVALID_UNIVERSALSTRING_LENGTH           133
 #define ASN1_R_INVALID_UTF8STRING                       134
+#define ASN1_R_INVALID_VALUE                            219
 #define ASN1_R_IV_TOO_LARGE                             135
 #define ASN1_R_LENGTH_ERROR                             136
 #define ASN1_R_LIST_ERROR                               188
@@ -1387,6 +1403,7 @@ void ERR_load_ASN1_strings(void);
 #define ASN1_R_TIME_NOT_ASCII_FORMAT                    193
 #define ASN1_R_TOO_LONG                                         155
 #define ASN1_R_TYPE_NOT_CONSTRUCTED                     156
+#define ASN1_R_TYPE_NOT_PRIMITIVE                       195
 #define ASN1_R_UNABLE_TO_DECODE_RSA_KEY                         157
 #define ASN1_R_UNABLE_TO_DECODE_RSA_PRIVATE_KEY                 158
 #define ASN1_R_UNEXPECTED_EOC                           159
@@ -1397,7 +1414,6 @@ void ERR_load_ASN1_strings(void);
 #define ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE                  163
 #define ASN1_R_UNKNOWN_SIGNATURE_ALGORITHM              199
 #define ASN1_R_UNKNOWN_TAG                              194
-#define ASN1_R_UNKOWN_FORMAT                            195
 #define ASN1_R_UNSUPPORTED_ANY_DEFINED_BY_TYPE          164
 #define ASN1_R_UNSUPPORTED_CIPHER                       165
 #define ASN1_R_UNSUPPORTED_ENCRYPTION_ALGORITHM                 166