/*******************************************************************
 *
 * This file was generated by TIS/ASN1COMP Ver. 4.2, an ASN.1 compiler.
 * TIS/ASN1COMP is Copyright (c) 1998, TIS Labs at Network Associates, Inc.
 *
 * This file was AUTOMATICALLY GENERATED on Tue May 18 17:09:44 1999
 *
 ******************************************************************/

#ifndef pgpX509Cert_UTIL_H_
#define pgpX509Cert_UTIL_H_

#include <stdlib.h>
#include <string.h>

#ifndef PGPASN_TRUE
#define PGPASN_FALSE (0)
#define PGPASN_TRUE (1)
#endif

#ifndef NULL
#define NULL  ((void *) 0)
#endif

/*****
*
* Primitive type definitions
*
*****/

/* BOOLEAN */
typedef struct
{
    size_t len;  /* # of bytes in value */
    int    val;  /* the boolean */
} PGPASN_BooleanBlock;

/* NULL */
typedef struct
{
    size_t  len; /* unused */
} PGPASN_NullBlock;

/* Variable Length Entity */
typedef struct
{
    size_t         len;  /* # of bytes in value */
    unsigned char  *val; /* pointer to the bytes of value */
} PGPASN_VariableBlock;

/* Bit String Entity */
typedef struct
{
    size_t        len;   /* # of bytes in value */
    unsigned char *val;  /* pointer to the bytes of value */
    int           nuub;  /* number of unused bits in LSByte */
} PGPASN_BitstringBlock;

typedef PGPASN_NullBlock     PGPASN_NULL;
typedef PGPASN_BooleanBlock   PGPASN_BOOLEAN ;
typedef PGPASN_VariableBlock  PGPASN_OBJECT_ID ;
typedef PGPASN_VariableBlock  PGPASN_GeneralizedTime ;
typedef PGPASN_VariableBlock  PGPASN_IA5String ;
typedef PGPASN_VariableBlock  PGPASN_INTEGER ;
typedef PGPASN_BitstringBlock PGPASN_BIT_STRING ;
typedef PGPASN_VariableBlock  PGPASN_OCTET_STRING ;
typedef PGPASN_VariableBlock  PGPASN_T61String ;
typedef PGPASN_VariableBlock  PGPASN_ANY ;
typedef PGPASN_VariableBlock  PGPASN_UTCTime ;
typedef PGPASN_VariableBlock  PGPASN_NumericString ;
typedef PGPASN_VariableBlock  PGPASN_PrintableString ;
typedef PGPASN_VariableBlock  PGPASN_VisibleString ;

/*
 * #define ID values for defines for asn types.
 */
#define PGPASN_ID_reserved 0x00
#define PGPASN_ID_BOOLEAN 0x01
#define PGPASN_ID_INTEGER 0x02
#define PGPASN_ID_BIT_STRING 0x03
#define PGPASN_ID_OCTET_STRING 0x04
#define PGPASN_ID_NULL 0x05
#define PGPASN_ID_OBJECT_IDENTIFIER 0x06
#define PGPASN_ID_OBJECT_ID 0x06
#define PGPASN_ID_ObjectDescriptor 0x07
#define PGPASN_ID_EXTERNAL 0x08
#define PGPASN_ID_REAL 0x09
#define PGPASN_ID_SEQUENCE 0x10
#define PGPASN_ID_SEQUENCE_OF 0x10
#define PGPASN_ID_SET 0x11
#define PGPASN_ID_SET_OF 0x011
#define PGPASN_ID_NumericString 0x12
#define PGPASN_ID_PrintableString 0x13
#define PGPASN_ID_T61String 0x14
#define PGPASN_ID_TeletexString 0x14
#define PGPASN_ID_VideotexString 0x15
#define PGPASN_ID_IA5String 0x16
#define PGPASN_ID_UTCTime 0x17
#define PGPASN_ID_GeneralizedTime 0x18
#define PGPASN_ID_GraphicString 0x19
#define PGPASN_ID_VisibleString 0x1a
#define PGPASN_ID_ISO646String 0x1a
#define PGPASN_ID_GeneralString 0x1b

#define PGPASN_ID_IMPORTED 0xFA
#define PGPASN_ID_UNIVERSAL 0xFB
#define PGPASN_ID_CHOICE 0xFC
#define PGPASN_ID_SYNONYM 0xFD
#define PGPASN_ID_ANY 0xFE

/*********************************************************************
* Error return codes from pack and unpack (uip).
**********************************************************************/

#define kPGPASNError_ErrPackUnderrun (-1)
#define kPGPASNError_ErrPackOverrun (-2)
#define kPGPASNError_ErrPackSEQOFArrayTooLong   (-3) /* lth > MAX of that type */
#define kPGPASNError_ErrPackNoBlock (-5) /* ASN block ptr is NULL */
#define kPGPASNError_ErrUnpackNoStructure (-6) /* block pointer is NULL */
#define kPGPASNError_ErrUnpackNoBlockPtr (-7) /* ASN block pointer pointer is NULL */
#define kPGPASNError_ErrUnpackNoBlock (-8) /* ASN block pointer is NULL */
#define kPGPASNError_ErrUnpackOverrun (-9)
#define kPGPASNError_ErrUnpackUnderrun (-10)
#define kPGPASNError_ErrUnpackBooleanLth (-11) /* a boolean block with lth != 1 */
#define kPGPASNError_ErrUnpackTaggedLth (-12) /* a context tag lth failed to match 
				    the length of the contents */
#define kPGPASNError_ErrUnpackReqMissing (-13) /* a required substructure is missing */
#define kPGPASNError_ErrUnpackNullLth (-14) /* a NULL block with lth != 0 */
#define kPGPASNError_ErrPackSETOFArrayTooLong   (-15) /* lth > MAX of that type */
#define kPGPASNError_ErrPackSETOFUnsortable   (-16) /* SET OF with identical elements */
#define kPGPASNError_ErrOutOfMemory   (-17) /* Out of memory */
#define kPGPASNError_ErrPackBufferTooShort (-18) /* provided buffer space too short */
#define kPGPASNError_ErrUnpackInvalidEncoding (-19)
#define kPGPASNError_ErrBadContext (-20)
#define kPGPASNError_ErrUnpackSetBadType (-21)
#define kPGPASNError_ErrUnpackDuplicateField (-22)

/*
 * Error code for choice when it has a bad type
 */
#define kPGPASNError_ErrChoiceBadType (-50)

/*
 * Error codes for bad characters in strings
 */
#define kPGPASNError_ErrBadNumericString (-60)
#define kPGPASNError_ErrBadPrintableString (-61)

#define kPGPASNError_ErrNotFoundInDict (-70)

/*********************************************************************
* PGPASN_ERR macro
*
*  This can be re-defined as exit(x) for debugging
**********************************************************************/

#define PGPASN_ERR( x )     { *erret = x; PGPASN_ErrorHalt(x); }

void PGPASN_ErrorHalt ( int x );

/*********************************************************************
* Memory Mgmt Callbacks
**********************************************************************/

typedef struct PGPASN_MemoryMgr PGPASN_MemoryMgr;

extern PGPASN_MemoryMgr PGPASN_defaultMemoryMgrStruct;

typedef void *(*PGPASN_MemoryMgrAllocationProc)(
                        PGPASN_MemoryMgr *mgr,
                        size_t requestSize);

typedef int (*PGPASN_MemoryMgrReallocationProc)(
                        PGPASN_MemoryMgr *mgr,
                        void **allocation,
                        size_t newAllocationSize);

typedef int (*PGPASN_MemoryMgrDeallocationProc)(
                        PGPASN_MemoryMgr *mgr,
                        void *allocation);

/* memory management structure */
struct PGPASN_MemoryMgr {
        void    *customValue;
        PGPASN_MemoryMgrAllocationProc allocProc;
        PGPASN_MemoryMgrReallocationProc reallocProc;
        PGPASN_MemoryMgrDeallocationProc deallocProc;
};

#define PGPASN_Alloc(mgr, size) (*(mgr)->allocProc)(mgr, size)
#define PGPASN_Realloc(mgr, ptr, newsize) \
              (*(mgr)->reallocProc)(mgr, ptr, newsize)
#define PGPASN_Free(mgr, ptr) (*(mgr)->deallocProc)(mgr, ptr)

struct PGPASN_CONTEXT {
    void *customValue;
    PGPASN_MemoryMgr *memMgr;
};
typedef struct PGPASN_CONTEXT PGPASN_CONTEXT;

/*********************************************************************
* Utility routine definitions
**********************************************************************/

size_t PGPASN_LengthSize(size_t x);
size_t PGPASN_Tagged(size_t inner, int seqlike );
size_t PGPASN_PutByte(unsigned char *buf, unsigned char byte );
size_t PGPASN_PutLength(unsigned char *buf, size_t length );
size_t PGPASN_GetByte(const unsigned char *buf, unsigned char *byte);
size_t PGPASN_GetLength(const unsigned char *buf, size_t *length);
size_t PGPASN_PutTag(unsigned char *buf, unsigned char tagbyte, size_t length );
size_t PGPASN_TakeTag(const unsigned char *buf, unsigned char tag, size_t *length);
int PGPASN_CompareElems(const void *a, const void *b);


long pgpasn_GetIntVal (PGPASN_CONTEXT *ctx, PGPASN_INTEGER *b, int *error);
int pgpasn_PutIntVal (PGPASN_CONTEXT *ctx, PGPASN_INTEGER *b, long v);
int pgpasn_PutUIntBytes(PGPASN_CONTEXT *ctx, PGPASN_INTEGER *b,
                   const unsigned char *v, size_t lth);
int pgpasn_PutOctVal(PGPASN_CONTEXT *ctx, PGPASN_VariableBlock *b, const unsigned char *v, size_t lth);
char *pgpasn_GetStrVal(PGPASN_CONTEXT *ctx, PGPASN_VariableBlock *b);
int pgpasn_PutStrVal(PGPASN_CONTEXT *ctx, PGPASN_VariableBlock *b, const char *v);
int pgpasn_PutBitString (PGPASN_CONTEXT *ctx, PGPASN_BIT_STRING *b,
		    const unsigned char *str, size_t len, int nuub);
int pgpasn_GetBoolVal(PGPASN_CONTEXT *ctx, PGPASN_BOOLEAN *b);
int pgpasn_PutBoolVal(PGPASN_CONTEXT *ctx, PGPASN_BOOLEAN *b, int val);

/*********************************************************************
* For tracing ASN.1 processing via compiler-generated routines.
**********************************************************************/

#ifdef PGPASN_TRACE

extern int PGPASN_TRACE_LEVEL;

int PGPASN_TRACE_trval(unsigned char *enc, int len, int lev);

#define PGPASN_TRACE_INCR_LEVEL \
        PGPASN_TRACE_LEVEL++
#define PGPASN_TRACE_DECR_LEVEL \
        PGPASN_TRACE_LEVEL--
#define PGPASN_TRACE_PRINT_LENGTH(n) \
        fprintf(stderr, "<%d>", n)
#define PGPASN_TRACE_PRINT_TAG(tag, rtag) \
        { int j; fprintf(stderr, "\n"); \
	for ( j=0 ; j<PGPASN_TRACE_LEVEL ; j++ ) fprintf(stderr, ".  "); \
	fprintf(stderr, "%02x EXPLICIT [%d] ", tag, rtag); }
#define PGPASN_TRACE_PRINT_FN(tag, rtag, type, name) \
        { int j; fprintf(stderr, "\n"); \
	for ( j=0 ; j<PGPASN_TRACE_LEVEL ; j++ ) fprintf(stderr, ".  "); \
	fprintf(stderr, "%02x ", tag); \
	if ( tag != rtag) fprintf(stderr, "IMPLICIT "); \
	fprintf(stderr, "%s %s ", type, name); }
#define PGPASN_TRACE_PRINT_FM(tag, rtag, type) \
        { int j; fprintf(stderr, "\n"); \
	for ( j=0 ; j<PGPASN_TRACE_LEVEL ; j++ ) fprintf(stderr, ".  "); \
	fprintf(stderr, "%02x ", tag); \
	if ( tag != rtag) fprintf(stderr, "IMPLICIT "); \
	fprintf(stderr, "%s ", type); }
#define PGPASN_TRACE_PRINT_DATA(buf, lth) \
        PGPASN_TRACE_trval( buf, lth, PGPASN_TRACE_LEVEL+1)
#define PGPASN_TRACE_name(name)

#else
#define PGPASN_TRACE_INCR_LEVEL
#define PGPASN_TRACE_DECR_LEVEL
#define PGPASN_TRACE_PRINT_LENGTH(n)
#define PGPASN_TRACE_PRINT_TAG(tag, rtag)
#define PGPASN_TRACE_PRINT_FN(tag, rtag, type, name)
#define PGPASN_TRACE_PRINT_FM(tag, rtag, type)
#define PGPASN_TRACE_PRINT_DATA(buf, lth)
#define PGPASN_TRACE_name(name) (void)name
#endif

/********************************************************************
* Primitive object routines.
**********************************************************************/

void *pgpasn_NewVariableBlock(PGPASN_CONTEXT *ctx);
void pgpasn_FreeVariableBlock (
    PGPASN_CONTEXT *ctx,
    PGPASN_VariableBlock *f);
void pgpasn_DropInPlaceVariableBlock (
    PGPASN_CONTEXT *ctx,
    PGPASN_VariableBlock *f);
size_t pgpasn_SizeofVariableBlockInternal(
    PGPASN_VariableBlock *block,
    int outerSizeFlag,
    int expTaggedFlag);
size_t pgpasn_SizeofVariableBlock(
    PGPASN_CONTEXT *ctx,
    PGPASN_VariableBlock *block,
    int outerSizeFlag);

/********************************************************************
* Base ASN type building, packing and unpacking routines.
**********************************************************************/

#define pgpasn_NewANY pgpasn_NewVariableBlock
#define pgpasn_DropInPlaceANY pgpasn_DropInPlaceVariableBlock
#define pgpasn_FreeANY pgpasn_FreeVariableBlock
size_t pgpasn_SizeofANYInternal(
    PGPASN_ANY *b,
    int outerSizeFlag,
    int expTaggedFlag);
size_t pgpasn_SizeofANY(
    PGPASN_CONTEXT *ctx,
    PGPASN_ANY *b,
    int outerSizeFlag);
size_t pgpasn_PackANYInternal(
    PGPASN_CONTEXT *ctx,
    unsigned char *buf,
    size_t buflen,
    PGPASN_ANY *block,
    unsigned char tag,
    int *erret);
size_t pgpasn_PackANY(
    PGPASN_CONTEXT *ctx,
    unsigned char *buf,
    size_t buflen,
    PGPASN_ANY *block,
    int *erret);
size_t pgpasn_UnpkInPlaceANY(
    PGPASN_CONTEXT *ctx,
    PGPASN_ANY *asnstruct,
    const unsigned char *buf,
    size_t buflen, 
    unsigned char tag,
    int *erret);
size_t pgpasn_UnpackANYInternal(
    PGPASN_CONTEXT *ctx,
    PGPASN_ANY **asnstruct,
    const unsigned char *buf,
    size_t buflen,
    unsigned char tag,
    int        *erret);
size_t pgpasn_UnpackANY(
    PGPASN_CONTEXT *ctx,
    PGPASN_ANY **asnstruct,
    const unsigned char *buf,
    size_t buflen,
    int        *erret);

PGPASN_BIT_STRING *pgpasn_NewBIT_STRING(
    PGPASN_CONTEXT *ctx);
void pgpasn_FreeBIT_STRING(
    PGPASN_CONTEXT *ctx,
    PGPASN_BIT_STRING *f);
void pgpasn_DropInPlaceBIT_STRING(
    PGPASN_CONTEXT *ctx,
    PGPASN_BIT_STRING *f);
size_t pgpasn_SizeofBIT_STRINGInternal(
    PGPASN_BIT_STRING *b,
    int outerSizeFlag,
    int expTaggedFlag);
size_t pgpasn_SizeofBIT_STRING(
    PGPASN_CONTEXT *ctx,
    PGPASN_BIT_STRING *b,
    int outerSizeFlag);
size_t pgpasn_PackBIT_STRINGInternal(
    PGPASN_CONTEXT *ctx,
    unsigned char *buf,
    size_t buflen,
    PGPASN_BIT_STRING *bitblock,
    unsigned char tag,
    int *erret);
size_t pgpasn_PackBIT_STRING(
    PGPASN_CONTEXT *ctx,
    unsigned char *buf,
    size_t buflen,
    PGPASN_BIT_STRING *bitblock,
    int *erret);
size_t pgpasn_UnpkInPlaceBIT_STRING(
    PGPASN_CONTEXT *ctx,
    PGPASN_BIT_STRING *bitstruct,
    const unsigned char *buf,
    size_t buflen, 
    unsigned char tag,
    int *erret);
size_t pgpasn_UnpackBIT_STRINGInternal(
    PGPASN_CONTEXT *ctx,
    PGPASN_BIT_STRING **bitstruct,
    const unsigned char *buf,
    size_t buflen,
    unsigned char  tag,
    int        *erret); /* error return */
size_t pgpasn_UnpackBIT_STRING(
    PGPASN_CONTEXT *ctx,
    PGPASN_BIT_STRING **bitstruct,
    const unsigned char *buf,
    size_t buflen,
    int        *erret);

PGPASN_BOOLEAN *pgpasn_NewBOOLEAN (PGPASN_CONTEXT *ctx);
void pgpasn_FreeBOOLEAN (PGPASN_CONTEXT *ctx, PGPASN_BOOLEAN *f);
void pgpasn_DropInPlaceBOOLEAN (PGPASN_CONTEXT *ctx, PGPASN_BOOLEAN *f);
size_t pgpasn_SizeofBOOLEANInternal(
    PGPASN_BOOLEAN *b,
    int outerSizeFlag,
    int expTaggedFlag);
size_t pgpasn_SizeofBOOLEAN(
    PGPASN_CONTEXT *ctx,
    PGPASN_BOOLEAN *b,
    int outerSizeFlag);
size_t pgpasn_PackBOOLEANInternal(
    PGPASN_CONTEXT *ctx,
    unsigned char *buf,
    size_t buflen,
    PGPASN_BOOLEAN *boolblock,
    unsigned char tag,
    int *erret );
size_t pgpasn_PackBOOLEAN(
    PGPASN_CONTEXT *ctx,
    unsigned char *buf,
    size_t buflen,
    PGPASN_BOOLEAN *boolblock,
    int *erret);
size_t pgpasn_UnpkInPlaceBOOLEAN(
    PGPASN_CONTEXT *ctx,
    PGPASN_BOOLEAN *boolstruct, /* output block */
    const unsigned char *buf,    /* loc of input pointer */
    size_t buflen,         /* max end of my region */
    unsigned char tag,
    int *erret);           /* error return location */
size_t pgpasn_UnpackBOOLEANInternal(
    PGPASN_CONTEXT *ctx,
    PGPASN_BOOLEAN **boolstruct,
    const unsigned char *buf,
    size_t buflen,
    unsigned char tag,
    int        *erret);  /* error return */
size_t pgpasn_UnpackBOOLEAN(
    PGPASN_CONTEXT *ctx,
    PGPASN_BOOLEAN **boolstruct,
    const unsigned char *buf,
    size_t buflen,
    int        *erret);

#define pgpasn_NewGeneralizedTime pgpasn_NewVariableBlock
#define pgpasn_DropInPlaceGeneralizedTime pgpasn_DropInPlaceVariableBlock
#define pgpasn_FreeGeneralizedTime pgpasn_FreeVariableBlock
#define pgpasn_SizeofGeneralizedTimeInternal pgpasn_SizeofVariableBlockInternal
#define pgpasn_SizeofGeneralizedTime pgpasn_SizeofVariableBlock
size_t pgpasn_PackGeneralizedTimeInternal(
    PGPASN_CONTEXT *ctx,
    unsigned char *buf,
    size_t buflen,
    PGPASN_GeneralizedTime *timeblock,
    unsigned char tag,
    int *erret);
size_t pgpasn_PackGeneralizedTime(
    PGPASN_CONTEXT *ctx,
    unsigned char *buf,
    size_t buflen,
    PGPASN_GeneralizedTime *timeblock,
    int *erret);
size_t pgpasn_UnpkInPlaceGeneralizedTime(
    PGPASN_CONTEXT *ctx,
    PGPASN_GeneralizedTime *timestruct,
    const unsigned char *buf,
    size_t buflen,
    unsigned char tag,
    int *erret);
size_t pgpasn_UnpackGeneralizedTimeInternal( 
    PGPASN_CONTEXT *ctx,
    PGPASN_GeneralizedTime **timestruct,
    const unsigned char *buf,
    size_t buflen,
    unsigned char tag,
    int        *erret);  /* error return */
size_t pgpasn_UnpackGeneralizedTime( 
    PGPASN_CONTEXT *ctx,
    PGPASN_GeneralizedTime **timestruct,
    const unsigned char *buf,
    size_t buflen,
    int        *erret);

#define pgpasn_NewIA5String pgpasn_NewVariableBlock
#define pgpasn_DropInPlaceIA5String pgpasn_DropInPlaceVariableBlock
#define pgpasn_FreeIA5String pgpasn_FreeVariableBlock
#define pgpasn_SizeofIA5StringInternal pgpasn_SizeofVariableBlockInternal
#define pgpasn_SizeofIA5String pgpasn_SizeofVariableBlock
size_t pgpasn_PackIA5StringInternal(
    PGPASN_CONTEXT *ctx,
    unsigned char *buf,
    size_t buflen,
    PGPASN_IA5String *strblock,
    unsigned char tag,
    int *erret);
size_t pgpasn_PackIA5String(
    PGPASN_CONTEXT *ctx,
    unsigned char *buf,
    size_t buflen,
    PGPASN_IA5String *strblock,
    int *erret);
size_t pgpasn_UnpkInPlaceIA5String(
    PGPASN_CONTEXT *ctx,
    PGPASN_IA5String *strblock,
    const unsigned char *buf,
    size_t buflen,
    unsigned char tag,
    int *erret);
size_t pgpasn_UnpackIA5StringInternal(
    PGPASN_CONTEXT *ctx,
    PGPASN_IA5String **strblock,
    const unsigned char *buf,
    size_t buflen, 
    unsigned char tag,
    int        *erret);  /* error return */
size_t pgpasn_UnpackIA5String(
    PGPASN_CONTEXT *ctx,
    PGPASN_IA5String **strblock,
    const unsigned char *buf,
    size_t buflen, 
    int        *erret);

#define pgpasn_NewINTEGER pgpasn_NewVariableBlock
#define pgpasn_DropInPlaceINTEGER pgpasn_DropInPlaceVariableBlock
#define pgpasn_FreeINTEGER pgpasn_FreeVariableBlock
size_t pgpasn_SizeofINTEGERInternal(
    PGPASN_INTEGER *b,
    int outerSizeFlag,
    int expTaggedSize);
size_t pgpasn_SizeofINTEGER(
    PGPASN_CONTEXT *ctx,
    PGPASN_INTEGER *b,
    int outerSizeFlag);
size_t pgpasn_PackINTEGERInternal(
    PGPASN_CONTEXT *ctx,
    unsigned char *buf,
    size_t buflen,
    PGPASN_INTEGER *intblock,
    unsigned char tag,
    int *erret);
size_t pgpasn_PackINTEGER(
    PGPASN_CONTEXT *ctx,
    unsigned char *buf,
    size_t buflen,
    PGPASN_INTEGER *intblock,
    int *erret);
size_t pgpasn_UnpkInPlaceINTEGER(
    PGPASN_CONTEXT *ctx,
    PGPASN_INTEGER *intstruct,
    const unsigned char *buf,
    size_t buflen,
    unsigned char tag,
    int *erret);
size_t pgpasn_UnpackINTEGERInternal( 
    PGPASN_CONTEXT *ctx,
    PGPASN_INTEGER **intstruct,
    const unsigned char *buf,
    size_t buflen,
    unsigned char tag,
    int        *erret);  /* error return */
size_t pgpasn_UnpackINTEGER( 
    PGPASN_CONTEXT *ctx,
    PGPASN_INTEGER **intstruct,
    const unsigned char *buf,
    size_t buflen, 
    int        *erret);

#define pgpasn_NewNumericString pgpasn_NewVariableBlock
#define pgpasn_DropInPlaceNumericString pgpasn_DropInPlaceVariableBlock
#define pgpasn_FreeNumericString pgpasn_FreeVariableBlock
#define pgpasn_SizeofNumericStringInternal pgpasn_SizeofVariableBlockInternal
#define pgpasn_SizeofNumericString pgpasn_SizeofVariableBlock
size_t pgpasn_PackNumericStringInternal(
    PGPASN_CONTEXT *ctx,
    unsigned char *buf,
    size_t buflen,
    PGPASN_NumericString *numblock,
    unsigned char tag,
    int *erret );
size_t pgpasn_PackNumericString(
    PGPASN_CONTEXT *ctx,
    unsigned char *buf,
    size_t buflen,
    PGPASN_NumericString *numblock,
    int *erret );
size_t pgpasn_UnpkInPlaceNumericString(
    PGPASN_CONTEXT *ctx,
    PGPASN_NumericString *numstruct,
    const unsigned char *buf,
    size_t buflen,
    unsigned char tag,
    int *erret) ;
size_t pgpasn_UnpackNumericStringInternal(
    PGPASN_CONTEXT *ctx,
    PGPASN_NumericString **numstruct,
    const unsigned char *buf,
    size_t buflen,
    unsigned char  tag,
    int       *erret);  /* error return */
size_t pgpasn_UnpackNumericString(
    PGPASN_CONTEXT *ctx,
    PGPASN_NumericString **numstruct,
    const unsigned char *buf,
    size_t buflen,
    int       *erret);

PGPASN_NULL *pgpasn_NewNULL (PGPASN_CONTEXT *ctx) ;
void pgpasn_FreeNULL (PGPASN_CONTEXT *ctx, PGPASN_NULL *f) ;
void pgpasn_DropInPlaceNULL (PGPASN_CONTEXT *ctx, PGPASN_NULL *f) ;
size_t pgpasn_SizeofNULLInternal(
    PGPASN_NULL *b,
    int outerSizeFlag,
    int expTaggedFlag);
size_t pgpasn_SizeofNULL(
    PGPASN_CONTEXT *ctx,
    PGPASN_NULL *b,
    int outerSizeFlag);
size_t pgpasn_PackNULLInternal(
    PGPASN_CONTEXT *ctx,
    unsigned char *buf,
    size_t buflen,
    PGPASN_NULL *asnblock,
    unsigned char tag,
    int *erret);
size_t pgpasn_PackNULL(
    PGPASN_CONTEXT *ctx,
    unsigned char *buf,
    size_t buflen,
    PGPASN_NULL *asnblock,
    int *erret);
size_t pgpasn_UnpkInPlaceNULL(
    PGPASN_CONTEXT *ctx,
    PGPASN_NULL *nullstruct,
    const unsigned char *buf,
    size_t buflen,
    unsigned char tag,
    int *erret);
size_t pgpasn_UnpackNULLInternal(
    PGPASN_CONTEXT *ctx,
    PGPASN_NULL **nullstruct,
    const unsigned char *buf,
    size_t buflen,
    unsigned char tag,
    int        *erret);  /* error return */
size_t pgpasn_UnpackNULL(
    PGPASN_CONTEXT *ctx,
    PGPASN_NULL **nullstruct,
    const unsigned char *buf,
    size_t buflen,
    int        *erret);

#define pgpasn_NewOBJECT_ID pgpasn_NewVariableBlock
#define pgpasn_DropInPlaceOBJECT_ID pgpasn_DropInPlaceVariableBlock
#define pgpasn_FreeOBJECT_ID pgpasn_FreeVariableBlock
#define pgpasn_SizeofOBJECT_IDInternal pgpasn_SizeofVariableBlockInternal
#define pgpasn_SizeofOBJECT_ID pgpasn_SizeofVariableBlock
size_t pgpasn_PackOBJECT_IDInternal(
    PGPASN_CONTEXT *ctx,
    unsigned char *buf,
    size_t buflen,
    PGPASN_OBJECT_ID *oidblock,
    unsigned char tag,
    int *erret);
size_t pgpasn_PackOBJECT_ID(
    PGPASN_CONTEXT *ctx,
    unsigned char *buf,
    size_t buflen,
    PGPASN_OBJECT_ID *oidblock,
    int *erret);
int pgpasn_UnpkInPlaceOBJECT_ID(
    PGPASN_CONTEXT *ctx,
    PGPASN_OBJECT_ID *oidstruct,
    const unsigned char *buf,
    size_t buflen, 
    unsigned char tag,
    int *erret) ;
size_t pgpasn_UnpackOBJECT_IDInternal(
    PGPASN_CONTEXT *ctx,
    PGPASN_OBJECT_ID **oidstruct,
    const unsigned char *buf,
    size_t buflen,
    unsigned char tag,
    int        *erret);  /* error return */
size_t pgpasn_UnpackOBJECT_ID(
    PGPASN_CONTEXT *ctx,
    PGPASN_OBJECT_ID **oidstruct,
    const unsigned char *buf,
    size_t buflen, 
    int        *erret);

#define pgpasn_NewOCTET_STRING pgpasn_NewVariableBlock
#define pgpasn_DropInPlaceOCTET_STRING pgpasn_DropInPlaceVariableBlock
#define pgpasn_FreeOCTET_STRING pgpasn_FreeVariableBlock
#define pgpasn_SizeofOCTET_STRINGInternal pgpasn_SizeofVariableBlockInternal
#define pgpasn_SizeofOCTET_STRING pgpasn_SizeofVariableBlock
size_t pgpasn_PackOCTET_STRINGInternal(
    PGPASN_CONTEXT *ctx,
    unsigned char *buf,
    size_t buflen,
    PGPASN_OCTET_STRING *octblock,
    unsigned char tag,
    int *erret);
size_t pgpasn_PackOCTET_STRING(
    PGPASN_CONTEXT *ctx,
    unsigned char *buf,
    size_t buflen,
    PGPASN_OCTET_STRING *octblock,
    int *erret);
size_t pgpasn_UnpkInPlaceOCTET_STRING(
    PGPASN_CONTEXT *ctx,
    PGPASN_OCTET_STRING *octstruct,
    const unsigned char *buf,
    size_t buflen,
    unsigned char tag,
    int *erret);
size_t pgpasn_UnpackOCTET_STRINGInternal(
    PGPASN_CONTEXT *ctx,
    PGPASN_OCTET_STRING **octstruct,
    const unsigned char *buf,
    size_t buflen,
    unsigned char tag,
    int        *erret) ; /* error return */
size_t pgpasn_UnpackOCTET_STRING(
    PGPASN_CONTEXT *ctx,
    PGPASN_OCTET_STRING **octstruct,
    const unsigned char *buf,
    size_t buflen, 
    int        *erret);

#define pgpasn_NewPrintableString pgpasn_NewVariableBlock
#define pgpasn_DropInPlacePrintableString pgpasn_DropInPlaceVariableBlock
#define pgpasn_FreePrintableString pgpasn_FreeVariableBlock
#define pgpasn_SizeofPrintableStringInternal pgpasn_SizeofVariableBlockInternal
#define pgpasn_SizeofPrintableString pgpasn_SizeofVariableBlock
size_t pgpasn_PackPrintableStringInternal(
    PGPASN_CONTEXT *ctx,
    unsigned char *buf,
    size_t buflen,
    PGPASN_PrintableString *strblock,
    unsigned char tag,
    int *erret );
size_t pgpasn_PackPrintableString(
    PGPASN_CONTEXT *ctx,
    unsigned char *buf,
    size_t buflen,
    PGPASN_PrintableString *strblock,
    int *erret );
int pgpasn_UnpkInPlacePrintableString(
    PGPASN_CONTEXT *ctx,
    PGPASN_PrintableString *printstruct,
    const unsigned char *buf,
    size_t buflen,
    unsigned char tag,
    int *erret);
size_t pgpasn_UnpackPrintableStringInternal(
    PGPASN_CONTEXT *ctx,
    PGPASN_PrintableString **printstruct,
    const unsigned char *buf,
    size_t buflen,
    unsigned char  tag,
    int       *erret) ;
size_t pgpasn_UnpackPrintableString(
    PGPASN_CONTEXT *ctx,
    PGPASN_PrintableString **printstruct,
    const unsigned char *buf,
    size_t buflen,
    int       *erret);

#define pgpasn_NewT61String pgpasn_NewVariableBlock
#define pgpasn_DropInPlaceT61String pgpasn_DropInPlaceVariableBlock
#define pgpasn_FreeT61String pgpasn_FreeVariableBlock
#define pgpasn_SizeofT61StringInternal pgpasn_SizeofVariableBlockInternal
#define pgpasn_SizeofT61String pgpasn_SizeofVariableBlock
size_t pgpasn_PackT61StringInternal(
    PGPASN_CONTEXT *ctx,
    unsigned char *buf,
    size_t buflen,
    PGPASN_T61String *strblock,
    unsigned char tag,
    int *erret);
size_t pgpasn_PackT61String(
    PGPASN_CONTEXT *ctx,
    unsigned char *buf,
    size_t buflen,
    PGPASN_T61String *strblock,
    int *erret);
size_t pgpasn_UnpkInPlaceT61String(
    PGPASN_CONTEXT *ctx,
    PGPASN_T61String *strstruct,
    const unsigned char *buf,
    size_t buflen,
    unsigned char tag,
    int *erret) ;
size_t pgpasn_UnpackT61StringInternal(
    PGPASN_CONTEXT *ctx,
    PGPASN_T61String **strstruct,
    const unsigned char *buf,
    size_t buflen,
    unsigned char tag,
    int        *erret);
size_t pgpasn_UnpackT61String(
    PGPASN_CONTEXT *ctx,
    PGPASN_T61String **strstruct,
    const unsigned char *buf,
    size_t buflen,
    int        *erret);

#define pgpasn_NewUTCTime pgpasn_NewVariableBlock
#define pgpasn_DropInPlaceUTCTime pgpasn_DropInPlaceVariableBlock
#define pgpasn_FreeUTCTime pgpasn_FreeVariableBlock
#define pgpasn_SizeofUTCTimeInternal pgpasn_SizeofVariableBlockInternal
#define pgpasn_SizeofUTCTime pgpasn_SizeofVariableBlock
size_t pgpasn_PackUTCTimeInternal(
    PGPASN_CONTEXT *ctx,
    unsigned char *buf,
    size_t buflen,
    PGPASN_UTCTime *timeblock,
    unsigned char tag,
    int *erret);
size_t pgpasn_PackUTCTime(
    PGPASN_CONTEXT *ctx,
    unsigned char *buf,
    size_t buflen,
    PGPASN_UTCTime *timeblock,
    int *erret);
size_t pgpasn_UnpkInPlaceUTCTime(
    PGPASN_CONTEXT *ctx,
    PGPASN_UTCTime *timestruct,
    const unsigned char *buf,
    size_t buflen,
    unsigned char tag,
    int *erret);
size_t pgpasn_UnpackUTCTimeInternal(
    PGPASN_CONTEXT *ctx,
    PGPASN_UTCTime **strstruct,
    const unsigned char *buf,
    size_t buflen,
    unsigned char tag,
    int        *erret);
size_t pgpasn_UnpackUTCTime(
    PGPASN_CONTEXT *ctx,
    PGPASN_UTCTime **timestruct,
    const unsigned char *buf,
    size_t buflen, 
    int        *erret);

#define pgpasn_NewVisibleString pgpasn_NewVariableBlock
#define pgpasn_DropInPlaceVisibleString pgpasn_DropInPlaceVariableBlock
#define pgpasn_FreeVisibleString pgpasn_FreeVariableBlock
#define pgpasn_SizeofVisibleStringInternal pgpasn_SizeofVariableBlockInternal
#define pgpasn_SizeofVisibleString pgpasn_SizeofVariableBlock
size_t pgpasn_PackVisibleStringInternal(
    PGPASN_CONTEXT *ctx,
    unsigned char *buf,
    size_t buflen,
    PGPASN_VisibleString *strstruct,
    unsigned char tag,
    int *erret);
size_t pgpasn_PackVisibleString(
    PGPASN_CONTEXT *ctx,
    unsigned char *buf,
    size_t buflen,
    PGPASN_VisibleString *strblock,
    int *erret);
size_t pgpasn_UnpkInPlaceVisibleString(
    PGPASN_CONTEXT *ctx,
    PGPASN_VisibleString *strstruct,
    const unsigned char *buf,
    size_t buflen,
    unsigned char tag,
    int *erret);
size_t pgpasn_UnpackVisibleStringInternal(
    PGPASN_CONTEXT *ctx,
    PGPASN_VisibleString **strstruct,
    const unsigned char *buf,
    size_t buflen,
    unsigned char tag,
    int        *erret);
size_t pgpasn_UnpackVisibleString(
    PGPASN_CONTEXT *ctx,
    PGPASN_VisibleString **strstruct,
    const unsigned char *buf,
    size_t buflen,
    int        *erret);

#endif

