diff options
Diffstat (limited to 'security/nss/lib/util/secasn1t.h')
-rw-r--r-- | security/nss/lib/util/secasn1t.h | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/security/nss/lib/util/secasn1t.h b/security/nss/lib/util/secasn1t.h index 1e87ed12c..711b9eae1 100644 --- a/security/nss/lib/util/secasn1t.h +++ b/security/nss/lib/util/secasn1t.h @@ -184,13 +184,34 @@ typedef struct sec_ASN1Template_struct { #define SEC_ASN1_SET_OF (SEC_ASN1_GROUP | SEC_ASN1_SET) #define SEC_ASN1_ANY_CONTENTS (SEC_ASN1_ANY | SEC_ASN1_INNER) + /* ** Function used for SEC_ASN1_DYNAMIC. ** "arg" is a pointer to the structure being encoded/decoded ** "enc", when true, means that we are encoding (false means decoding) */ -typedef const SEC_ASN1Template * (* SEC_ChooseASN1TemplateFunc)(void *arg, - PRBool enc); +typedef const SEC_ASN1Template * SEC_ASN1TemplateChooser(void *arg, PRBool enc); +typedef SEC_ASN1TemplateChooser * SEC_ASN1TemplateChooserPtr; + +#if defined(_WIN32) +#define SEC_ASN1_GET(x) NSS_Get_##x(NULL, PR_FALSE) +#define SEC_ASN1_SUB(x) &p_NSS_Get_##x +#define SEC_ASN1_XTRN SEC_ASN1_DYNAMIC +#define SEC_ASN1_MKSUB(x) \ +static const SEC_ASN1TemplateChooserPtr p_NSS_Get_##x = &NSS_Get_##x; +#else +#define SEC_ASN1_GET(x) x +#define SEC_ASN1_SUB(x) x +#define SEC_ASN1_XTRN 0 +#define SEC_ASN1_MKSUB(x) +#endif + +#define SEC_ASN1_CHOOSER_DECLARE(x) \ +extern SEC_ASN1TemplateChooser NSS_Get_##x; + +#define SEC_ASN1_CHOOSER_IMPLEMENT(x) \ +const SEC_ASN1Template * NSS_Get_##x(void * arg, PRBool enc) \ +{ return x; } /* ** Opaque object used by the decoder to store state. |