提交 ea3675b5 编写于 作者: D Dr. Stephen Henson

New ASN1 macros to just implement and declare the new and free functions

and changes to mkdef.pl so it recognises them.

Use these in policyMappings extension.
上级 c554155b
...@@ -264,14 +264,15 @@ typedef struct ASN1_VALUE_st ASN1_VALUE; ...@@ -264,14 +264,15 @@ typedef struct ASN1_VALUE_st ASN1_VALUE;
#define DECLARE_ASN1_FUNCTIONS(type) DECLARE_ASN1_FUNCTIONS_name(type, type) #define DECLARE_ASN1_FUNCTIONS(type) DECLARE_ASN1_FUNCTIONS_name(type, type)
#define DECLARE_ASN1_ALLOC_FUNCTIONS(type) \
DECLARE_ASN1_ALLOC_FUNCTIONS_name(type, type)
#define DECLARE_ASN1_FUNCTIONS_name(type, name) \ #define DECLARE_ASN1_FUNCTIONS_name(type, name) \
type *name##_new(void); \ DECLARE_ASN1_ALLOC_FUNCTIONS_name(type, name) \
void name##_free(type *a); \
DECLARE_ASN1_ENCODE_FUNCTIONS(type, name, name) DECLARE_ASN1_ENCODE_FUNCTIONS(type, name, name)
#define DECLARE_ASN1_FUNCTIONS_fname(type, itname, name) \ #define DECLARE_ASN1_FUNCTIONS_fname(type, itname, name) \
type *name##_new(void); \ DECLARE_ASN1_ALLOC_FUNCTIONS_name(type, name) \
void name##_free(type *a); \
DECLARE_ASN1_ENCODE_FUNCTIONS(type, itname, name) DECLARE_ASN1_ENCODE_FUNCTIONS(type, itname, name)
#define DECLARE_ASN1_ENCODE_FUNCTIONS(type, itname, name) \ #define DECLARE_ASN1_ENCODE_FUNCTIONS(type, itname, name) \
...@@ -291,6 +292,9 @@ typedef struct ASN1_VALUE_st ASN1_VALUE; ...@@ -291,6 +292,9 @@ typedef struct ASN1_VALUE_st ASN1_VALUE;
name *name##_new(void); \ name *name##_new(void); \
void name##_free(name *a); void name##_free(name *a);
#define DECLARE_ASN1_ALLOC_FUNCTIONS_name(type, name) \
type *name##_new(void); \
void name##_free(type *a);
/* 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 * to be embedded in a structure and referenced. Since
......
...@@ -775,6 +775,9 @@ typedef struct ASN1_AUX_st { ...@@ -775,6 +775,9 @@ typedef struct ASN1_AUX_st {
#define IMPLEMENT_ASN1_FUNCTIONS_ENCODE_name(stname, itname) \ #define IMPLEMENT_ASN1_FUNCTIONS_ENCODE_name(stname, itname) \
IMPLEMENT_ASN1_FUNCTIONS_ENCODE_fname(stname, itname, itname) IMPLEMENT_ASN1_FUNCTIONS_ENCODE_fname(stname, itname, itname)
#define IMPLEMENT_ASN1_ALLOC_FUNCTIONS(stname) \
IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, stname, stname)
#define IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, itname, fname) \ #define IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, itname, fname) \
stname *fname##_new(void) \ stname *fname##_new(void) \
{ \ { \
......
...@@ -89,7 +89,7 @@ ASN1_ITEM_TEMPLATE(POLICY_MAPPINGS) = ...@@ -89,7 +89,7 @@ ASN1_ITEM_TEMPLATE(POLICY_MAPPINGS) =
POLICY_MAPPING) POLICY_MAPPING)
ASN1_ITEM_TEMPLATE_END(POLICY_MAPPINGS) ASN1_ITEM_TEMPLATE_END(POLICY_MAPPINGS)
IMPLEMENT_ASN1_FUNCTIONS(POLICY_MAPPING) IMPLEMENT_ASN1_ALLOC_FUNCTIONS(POLICY_MAPPING)
static STACK_OF(CONF_VALUE) *i2v_POLICY_MAPPINGS(X509V3_EXT_METHOD *method, static STACK_OF(CONF_VALUE) *i2v_POLICY_MAPPINGS(X509V3_EXT_METHOD *method,
......
...@@ -465,6 +465,7 @@ DECLARE_ASN1_FUNCTIONS(ACCESS_DESCRIPTION) ...@@ -465,6 +465,7 @@ DECLARE_ASN1_FUNCTIONS(ACCESS_DESCRIPTION)
DECLARE_ASN1_FUNCTIONS(AUTHORITY_INFO_ACCESS) DECLARE_ASN1_FUNCTIONS(AUTHORITY_INFO_ACCESS)
DECLARE_ASN1_ITEM(POLICY_MAPPING) DECLARE_ASN1_ITEM(POLICY_MAPPING)
DECLARE_ASN1_ALLOC_FUNCTIONS(POLICY_MAPPING)
DECLARE_ASN1_ITEM(POLICY_MAPPINGS) DECLARE_ASN1_ITEM(POLICY_MAPPINGS)
#ifdef HEADER_CONF_H #ifdef HEADER_CONF_H
......
...@@ -3000,3 +3000,9 @@ a2i_IPADDRESS 3434 EXIST::FUNCTION: ...@@ -3000,3 +3000,9 @@ a2i_IPADDRESS 3434 EXIST::FUNCTION:
ENGINE_setup_bsd_cryptodev 3435 EXIST:__FreeBSD__:FUNCTION:ENGINE ENGINE_setup_bsd_cryptodev 3435 EXIST:__FreeBSD__:FUNCTION:ENGINE
EC_GROUP_have_precompute_mult 3436 EXIST::FUNCTION:EC EC_GROUP_have_precompute_mult 3436 EXIST::FUNCTION:EC
X509V3_NAME_from_section 3437 EXIST::FUNCTION: X509V3_NAME_from_section 3437 EXIST::FUNCTION:
POLICY_MAPPING_it 3438 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
POLICY_MAPPING_it 3438 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
POLICY_MAPPINGS_it 3439 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
POLICY_MAPPINGS_it 3439 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
POLICY_MAPPING_new 3440 EXIST::FUNCTION:
POLICY_MAPPING_free 3441 EXIST::FUNCTION:
...@@ -673,6 +673,10 @@ sub do_defs ...@@ -673,6 +673,10 @@ sub do_defs
"EXPORT_VAR_AS_FUNCTION", "EXPORT_VAR_AS_FUNCTION",
"FUNCTION"); "FUNCTION");
next; next;
} elsif (/^\s*DECLARE_ASN1_ALLOC_FUNCTIONS\s*\(\s*(\w*)\s*\)/) {
$def .= "int $1_free(void);";
$def .= "int $1_new(void);";
next;
} elsif (/^\s*DECLARE_ASN1_FUNCTIONS_name\s*\(\s*(\w*)\s*,\s*(\w*)\s*\)/) { } elsif (/^\s*DECLARE_ASN1_FUNCTIONS_name\s*\(\s*(\w*)\s*,\s*(\w*)\s*\)/) {
$def .= "int d2i_$2(void);"; $def .= "int d2i_$2(void);";
$def .= "int i2d_$2(void);"; $def .= "int i2d_$2(void);";
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册