?? asn1.h
字號:
#define DECLARE_ASN1_NDEF_FUNCTION(name) \ int i2d_##name##_NDEF(name *a, unsigned char **out);#define DECLARE_ASN1_FUNCTIONS_const(name) \ name *name##_new(void); \ void name##_free(name *a);#define DECLARE_ASN1_ALLOC_FUNCTIONS_name(type, name) \ type *name##_new(void); \ void name##_free(type *a);#define D2I_OF(type) type *(*)(type **,const unsigned char **,long)#define I2D_OF(type) int (*)(type *,unsigned char **)#define I2D_OF_const(type) int (*)(const type *,unsigned char **)#define TYPEDEF_D2I_OF(type) typedef type *d2i_of_##type(type **,const unsigned char **,long)#define TYPEDEF_I2D_OF(type) typedef int i2d_of_##type(type *,unsigned char **)#define TYPEDEF_D2I2D_OF(type) TYPEDEF_D2I_OF(type); TYPEDEF_I2D_OF(type)TYPEDEF_D2I2D_OF(void);/* 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 * different forms. On platforms that support it the * ASN1_ITEM structure itself will be globally exported. * Other platforms will export a function that returns * an ASN1_ITEM pointer. * * To handle both cases transparently the macros below * should be used instead of hard coding an ASN1_ITEM * pointer in a structure. * * The structure will look like this: * * typedef struct SOMETHING_st { * ... * ASN1_ITEM_EXP *iptr; * ... * } SOMETHING; * * It would be initialised as e.g.: * * SOMETHING somevar = {...,ASN1_ITEM_ref(X509),...}; * * and the actual pointer extracted with: * * const ASN1_ITEM *it = ASN1_ITEM_ptr(somevar.iptr); * * Finally an ASN1_ITEM pointer can be extracted from an * appropriate reference with: ASN1_ITEM_rptr(X509). This * would be used when a function takes an ASN1_ITEM * argument. * */#ifndef OPENSSL_EXPORT_VAR_AS_FUNCTION/* ASN1_ITEM pointer exported type */typedef const ASN1_ITEM ASN1_ITEM_EXP;/* Macro to obtain ASN1_ITEM pointer from exported type */#define ASN1_ITEM_ptr(iptr) (iptr)/* Macro to include ASN1_ITEM pointer from base type */#define ASN1_ITEM_ref(iptr) (&(iptr##_it))#define ASN1_ITEM_rptr(ref) (&(ref##_it))#define DECLARE_ASN1_ITEM(name) \ OPENSSL_EXTERN const ASN1_ITEM name##_it;#else/* Platforms that can't easily handle shared global variables are declared * as functions returning ASN1_ITEM pointers. *//* ASN1_ITEM pointer exported type */typedef const ASN1_ITEM * ASN1_ITEM_EXP(void);/* Macro to obtain ASN1_ITEM pointer from exported type */#define ASN1_ITEM_ptr(iptr) (iptr())/* Macro to include ASN1_ITEM pointer from base type */#define ASN1_ITEM_ref(iptr) (iptr##_it)#define ASN1_ITEM_rptr(ref) (ref##_it())#define DECLARE_ASN1_ITEM(name) \ const ASN1_ITEM * name##_it(void);#endif/* Parameters used by ASN1_STRING_print_ex() *//* These determine which characters to escape: * RFC2253 special characters, control characters and * MSB set characters */#define ASN1_STRFLGS_ESC_2253 1#define ASN1_STRFLGS_ESC_CTRL 2#define ASN1_STRFLGS_ESC_MSB 4/* This flag determines how we do escaping: normally * RC2253 backslash only, set this to use backslash and * quote. */#define ASN1_STRFLGS_ESC_QUOTE 8/* These three flags are internal use only. *//* Character is a valid PrintableString character */#define CHARTYPE_PRINTABLESTRING 0x10/* Character needs escaping if it is the first character */#define CHARTYPE_FIRST_ESC_2253 0x20/* Character needs escaping if it is the last character */#define CHARTYPE_LAST_ESC_2253 0x40/* NB the internal flags are safely reused below by flags * handled at the top level. *//* If this is set we convert all character strings * to UTF8 first */#define ASN1_STRFLGS_UTF8_CONVERT 0x10/* If this is set we don't attempt to interpret content: * just assume all strings are 1 byte per character. This * will produce some pretty odd looking output! */#define ASN1_STRFLGS_IGNORE_TYPE 0x20/* If this is set we include the string type in the output */#define ASN1_STRFLGS_SHOW_TYPE 0x40/* This determines which strings to display and which to * 'dump' (hex dump of content octets or DER encoding). We can * only dump non character strings or everything. If we * don't dump 'unknown' they are interpreted as character * strings with 1 octet per character and are subject to * the usual escaping options. */#define ASN1_STRFLGS_DUMP_ALL 0x80#define ASN1_STRFLGS_DUMP_UNKNOWN 0x100/* These determine what 'dumping' does, we can dump the * content octets or the DER encoding: both use the * RFC2253 #XXXXX notation. */#define ASN1_STRFLGS_DUMP_DER 0x200/* All the string flags consistent with RFC2253, * escaping control characters isn't essential in * RFC2253 but it is advisable anyway. */#define ASN1_STRFLGS_RFC2253 (ASN1_STRFLGS_ESC_2253 | \ ASN1_STRFLGS_ESC_CTRL | \ ASN1_STRFLGS_ESC_MSB | \ ASN1_STRFLGS_UTF8_CONVERT | \ ASN1_STRFLGS_DUMP_UNKNOWN | \ ASN1_STRFLGS_DUMP_DER)DECLARE_STACK_OF(ASN1_INTEGER)DECLARE_ASN1_SET_OF(ASN1_INTEGER)DECLARE_STACK_OF(ASN1_GENERALSTRING)typedef struct asn1_type_st { int type; union { char *ptr; ASN1_BOOLEAN boolean; ASN1_STRING * asn1_string; ASN1_OBJECT * object; ASN1_INTEGER * integer; ASN1_ENUMERATED * enumerated; ASN1_BIT_STRING * bit_string; ASN1_OCTET_STRING * octet_string; ASN1_PRINTABLESTRING * printablestring; ASN1_T61STRING * t61string; ASN1_IA5STRING * ia5string; ASN1_GENERALSTRING * generalstring; ASN1_BMPSTRING * bmpstring; ASN1_UNIVERSALSTRING * universalstring; ASN1_UTCTIME * utctime; ASN1_GENERALIZEDTIME * generalizedtime; ASN1_VISIBLESTRING * visiblestring; ASN1_UTF8STRING * utf8string; /* set and sequence are left complete and still * contain the set or sequence bytes */ ASN1_STRING * set; ASN1_STRING * sequence; } value; } ASN1_TYPE;DECLARE_STACK_OF(ASN1_TYPE)DECLARE_ASN1_SET_OF(ASN1_TYPE)typedef struct asn1_method_st { i2d_of_void *i2d; d2i_of_void *d2i; void *(*create)(void); void (*destroy)(void *); } ASN1_METHOD;/* This is used when parsing some Netscape objects */typedef struct asn1_header_st { ASN1_OCTET_STRING *header; void *data; ASN1_METHOD *meth; } ASN1_HEADER;/* This is used to contain a list of bit names */typedef struct BIT_STRING_BITNAME_st { int bitnum; const char *lname; const char *sname;} BIT_STRING_BITNAME;#define M_ASN1_STRING_length(x) ((x)->length)#define M_ASN1_STRING_length_set(x, n) ((x)->length = (n))#define M_ASN1_STRING_type(x) ((x)->type)#define M_ASN1_STRING_data(x) ((x)->data)/* Macros for string operations */#define M_ASN1_BIT_STRING_new() (ASN1_BIT_STRING *)\ ASN1_STRING_type_new(V_ASN1_BIT_STRING)#define M_ASN1_BIT_STRING_free(a) ASN1_STRING_free((ASN1_STRING *)a)#define M_ASN1_BIT_STRING_dup(a) (ASN1_BIT_STRING *)\ ASN1_STRING_dup((ASN1_STRING *)a)#define M_ASN1_BIT_STRING_cmp(a,b) ASN1_STRING_cmp(\ (ASN1_STRING *)a,(ASN1_STRING *)b)#define M_ASN1_BIT_STRING_set(a,b,c) ASN1_STRING_set((ASN1_STRING *)a,b,c)#define M_ASN1_INTEGER_new() (ASN1_INTEGER *)\ ASN1_STRING_type_new(V_ASN1_INTEGER)#define M_ASN1_INTEGER_free(a) ASN1_STRING_free((ASN1_STRING *)a)#define M_ASN1_INTEGER_dup(a) (ASN1_INTEGER *)ASN1_STRING_dup((ASN1_STRING *)a)#define M_ASN1_INTEGER_cmp(a,b) ASN1_STRING_cmp(\ (ASN1_STRING *)a,(ASN1_STRING *)b)#define M_ASN1_ENUMERATED_new() (ASN1_ENUMERATED *)\ ASN1_STRING_type_new(V_ASN1_ENUMERATED)#define M_ASN1_ENUMERATED_free(a) ASN1_STRING_free((ASN1_STRING *)a)#define M_ASN1_ENUMERATED_dup(a) (ASN1_ENUMERATED *)ASN1_STRING_dup((ASN1_STRING *)a)#define M_ASN1_ENUMERATED_cmp(a,b) ASN1_STRING_cmp(\ (ASN1_STRING *)a,(ASN1_STRING *)b)#define M_ASN1_OCTET_STRING_new() (ASN1_OCTET_STRING *)\ ASN1_STRING_type_new(V_ASN1_OCTET_STRING)#define M_ASN1_OCTET_STRING_free(a) ASN1_STRING_free((ASN1_STRING *)a)#define M_ASN1_OCTET_STRING_dup(a) (ASN1_OCTET_STRING *)\ ASN1_STRING_dup((ASN1_STRING *)a)#define M_ASN1_OCTET_STRING_cmp(a,b) ASN1_STRING_cmp(\ (ASN1_STRING *)a,(ASN1_STRING *)b)#define M_ASN1_OCTET_STRING_set(a,b,c) ASN1_STRING_set((ASN1_STRING *)a,b,c)#define M_ASN1_OCTET_STRING_print(a,b) ASN1_STRING_print(a,(ASN1_STRING *)b)#define M_i2d_ASN1_OCTET_STRING(a,pp) \ i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_OCTET_STRING,\ V_ASN1_UNIVERSAL)#define B_ASN1_TIME \ B_ASN1_UTCTIME | \ B_ASN1_GENERALIZEDTIME#define B_ASN1_PRINTABLE \ B_ASN1_PRINTABLESTRING| \ B_ASN1_T61STRING| \ B_ASN1_IA5STRING| \ B_ASN1_BIT_STRING| \ B_ASN1_UNIVERSALSTRING|\ B_ASN1_BMPSTRING|\ B_ASN1_UTF8STRING|\ B_ASN1_UNKNOWN#define B_ASN1_DIRECTORYSTRING \ B_ASN1_PRINTABLESTRING| \ B_ASN1_TELETEXSTRING|\ B_ASN1_BMPSTRING|\ B_ASN1_UNIVERSALSTRING|\ B_ASN1_UTF8STRING#define B_ASN1_DISPLAYTEXT \ B_ASN1_IA5STRING| \ B_ASN1_VISIBLESTRING| \ B_ASN1_BMPSTRING|\ B_ASN1_UTF8STRING#define M_ASN1_PRINTABLE_new() ASN1_STRING_type_new(V_ASN1_T61STRING)#define M_ASN1_PRINTABLE_free(a) ASN1_STRING_free((ASN1_STRING *)a)#define M_i2d_ASN1_PRINTABLE(a,pp) i2d_ASN1_bytes((ASN1_STRING *)a,\ pp,a->type,V_ASN1_UNIVERSAL)#define M_d2i_ASN1_PRINTABLE(a,pp,l) \
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -