IP : 18.219.85.34Hostname : server86.web-hosting.comKernel : Linux server86.web-hosting.com 4.18.0-513.18.1.lve.el8.x86_64 #1 SMP Thu Feb 22 12:55:50 UTC 2024 x86_64Disable Function : None :) OS : Linux
PATH:
/
home/
../
usr/
include/
openssl/
asn1t.h/
/
/* * Copyright 2000-2016 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */
#ifndef HEADER_ASN1T_H # define HEADER_ASN1T_H
# include <stddef.h> # include <openssl/e_os2.h> # include <openssl/asn1.h>
/* This is a ASN1 type which just embeds a template */
/*- * This pair helps declare a SEQUENCE. We can do: * * ASN1_SEQUENCE(stname) = { * ... SEQUENCE components ... * } ASN1_SEQUENCE_END(stname) * * This will produce an ASN1_ITEM called stname_it * for a structure called stname. * * If you want the same structure but a different * name then use: * * ASN1_SEQUENCE(itname) = { * ... SEQUENCE components ... * } ASN1_SEQUENCE_END_name(stname, itname) * * This will create an item called itname_it using * a structure called stname. */
/*- * This pair helps declare a CHOICE type. We can do: * * ASN1_CHOICE(chname) = { * ... CHOICE options ... * ASN1_CHOICE_END(chname) * * This will produce an ASN1_ITEM called chname_it * for a structure called chname. The structure * definition must look like this: * typedef struct { * int type; * union { * ASN1_SOMETHING *opt1; * ASN1_SOMEOTHER *opt2; * } value; * } chname; * * the name of the selector must be 'type'. * to use an alternative selector name use the * ASN1_CHOICE_END_selector() version. */
/* * This is the ASN1 template structure that defines a wrapper round the * actual type. It determines the actual position of the field in the value * structure, various flags such as OPTIONAL and the field name. */
struct ASN1_TEMPLATE_st { unsigned long flags; /* Various flags */ long tag; /* tag, not used if no tagging */ unsigned long offset; /* Offset of this field in structure */ const char *field_name; /* Field name */ ASN1_ITEM_EXP *item; /* Relevant ASN1_ITEM or ASN1_ADB */ };
/* Macro to extract ASN1_ITEM and ASN1_ADB pointer from ASN1_TEMPLATE */
struct ASN1_ADB_st { unsigned long flags; /* Various flags */ unsigned long offset; /* Offset of selector field */ int (*adb_cb)(long *psel); /* Application callback */ const ASN1_ADB_TABLE *tbl; /* Table of possible types */ long tblcount; /* Number of entries in tbl */ const ASN1_TEMPLATE *default_tt; /* Type to use if no match */ const ASN1_TEMPLATE *null_tt; /* Type to use if selector is NULL */ };
struct ASN1_ADB_TABLE_st { long value; /* NID for an object or value for an int */ const ASN1_TEMPLATE tt; /* item for this value */ };
/* template flags */
/* Field is optional */ # define ASN1_TFLG_OPTIONAL (0x1)
/* Field is a SET OF */ # define ASN1_TFLG_SET_OF (0x1 << 1)
/* Field is a SEQUENCE OF */ # define ASN1_TFLG_SEQUENCE_OF (0x2 << 1)
/* * Special case: this refers to a SET OF that will be sorted into DER order * when encoded *and* the corresponding STACK will be modified to match the * new order. */ # define ASN1_TFLG_SET_ORDER (0x3 << 1)
/* Mask for SET OF or SEQUENCE OF */ # define ASN1_TFLG_SK_MASK (0x3 << 1)
/* * These flags mean the tag should be taken from the tag field. If EXPLICIT * then the underlying type is used for the inner tag. */
/* EXPLICIT tagging, inner tag from underlying type */ # define ASN1_TFLG_EXPTAG (0x2 << 3)
# define ASN1_TFLG_TAG_MASK (0x3 << 3)
/* context specific IMPLICIT */ # define ASN1_TFLG_IMPLICIT (ASN1_TFLG_IMPTAG|ASN1_TFLG_CONTEXT)
/* context specific EXPLICIT */ # define ASN1_TFLG_EXPLICIT (ASN1_TFLG_EXPTAG|ASN1_TFLG_CONTEXT)
/* * If tagging is in force these determine the type of tag to use. Otherwise * the tag is determined by the underlying type. These values reflect the * actual octet format. */
/* Universal tag */ # define ASN1_TFLG_UNIVERSAL (0x0<<6) /* Application tag */ # define ASN1_TFLG_APPLICATION (0x1<<6) /* Context specific tag */ # define ASN1_TFLG_CONTEXT (0x2<<6) /* Private tag */ # define ASN1_TFLG_PRIVATE (0x3<<6)
# define ASN1_TFLG_TAG_CLASS (0x3<<6)
/* * These are for ANY DEFINED BY type. In this case the 'item' field points to * an ASN1_ADB structure which contains a table of values to decode the * relevant type */
# define ASN1_TFLG_ADB_MASK (0x3<<8)
# define ASN1_TFLG_ADB_OID (0x1<<8)
# define ASN1_TFLG_ADB_INT (0x1<<9)
/* * This flag when present in a SEQUENCE OF, SET OF or EXPLICIT causes * indefinite length constructed encoding to be used if required. */
# define ASN1_TFLG_NDEF (0x1<<11)
/* Field is embedded and not a pointer */ # define ASN1_TFLG_EMBED (0x1 << 12)
/* This is the actual ASN1 item itself */
struct ASN1_ITEM_st { char itype; /* The item type, primitive, SEQUENCE, CHOICE * or extern */ long utype; /* underlying type */ const ASN1_TEMPLATE *templates; /* If SEQUENCE or CHOICE this contains * the contents */ long tcount; /* Number of templates if SEQUENCE or CHOICE */ const void *funcs; /* functions that handle this type */ long size; /* Structure size (usually) */ const char *sname; /* Structure name */ };
/*- * These are values for the itype field and * determine how the type is interpreted. * * For PRIMITIVE types the underlying type * determines the behaviour if items is NULL. * * Otherwise templates must contain a single * template and the type is treated in the * same way as the type specified in the template. * * For SEQUENCE types the templates field points * to the members, the size field is the * structure size. * * For CHOICE types the templates field points * to each possible member (typically a union) * and the 'size' field is the offset of the * selector. * * The 'funcs' field is used for application * specific functions. * * The EXTERN type uses a new style d2i/i2d. * The new style should be used where possible * because it avoids things like the d2i IMPLICIT * hack. * * MSTRING is a multiple string type, it is used * for a CHOICE of character strings where the * actual strings all occupy an ASN1_STRING * structure. In this case the 'utype' field * has a special meaning, it is used as a mask * of acceptable types using the B_ASN1 constants. * * NDEF_SEQUENCE is the same as SEQUENCE except * that it will use indefinite length constructed * encoding if requested. * */
# define ASN1_ITYPE_PRIMITIVE 0x0
# define ASN1_ITYPE_SEQUENCE 0x1
# define ASN1_ITYPE_CHOICE 0x2
# define ASN1_ITYPE_EXTERN 0x4
# define ASN1_ITYPE_MSTRING 0x5
# define ASN1_ITYPE_NDEF_SEQUENCE 0x6
/* * Cache for ASN1 tag and length, so we don't keep re-reading it for things * like CHOICE */
struct ASN1_TLC_st { char valid; /* Values below are valid */ int ret; /* return value */ long plen; /* length */ int ptag; /* class value */ int pclass; /* class value */ int hdrlen; /* header length */ };
/* Typedefs for ASN1 function pointers */ typedef int ASN1_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len, const ASN1_ITEM *it, int tag, int aclass, char opt, ASN1_TLC *ctx);
typedef int ASN1_ex_i2d(ASN1_VALUE **pval, unsigned char **out, const ASN1_ITEM *it, int tag, int aclass); typedef int ASN1_ex_new_func(ASN1_VALUE **pval, const ASN1_ITEM *it); typedef void ASN1_ex_free_func(ASN1_VALUE **pval, const ASN1_ITEM *it);
typedef int ASN1_ex_print_func(BIO *out, ASN1_VALUE **pval, int indent, const char *fname, const ASN1_PCTX *pctx);
typedef int ASN1_primitive_i2c(ASN1_VALUE **pval, unsigned char *cont, int *putype, const ASN1_ITEM *it); typedef int ASN1_primitive_c2i(ASN1_VALUE **pval, const unsigned char *cont, int len, int utype, char *free_cont, const ASN1_ITEM *it); typedef int ASN1_primitive_print(BIO *out, ASN1_VALUE **pval, const ASN1_ITEM *it, int indent, const ASN1_PCTX *pctx);
/* * This is the ASN1_AUX structure: it handles various miscellaneous * requirements. For example the use of reference counts and an informational * callback. The "informational callback" is called at various points during * the ASN1 encoding and decoding. It can be used to provide minor * customisation of the structures used. This is most useful where the * supplied routines *almost* do the right thing but need some extra help at * a few points. If the callback returns zero then it is assumed a fatal * error has occurred and the main operation should be abandoned. If major * changes in the default behaviour are required then an external type is * more appropriate. */
typedef struct ASN1_AUX_st { void *app_data; int flags; int ref_offset; /* Offset of reference value */ int ref_lock; /* Lock type to use */ ASN1_aux_cb *asn1_cb; int enc_offset; /* Offset of ASN1_ENCODING structure */ } ASN1_AUX;
/* For print related callbacks exarg points to this structure */ typedef struct ASN1_PRINT_ARG_st { BIO *out; int indent; const ASN1_PCTX *pctx; } ASN1_PRINT_ARG;
/* For streaming related callbacks exarg points to this structure */ typedef struct ASN1_STREAM_ARG_st { /* BIO to stream through */ BIO *out; /* BIO with filters appended */ BIO *ndef_bio; /* Streaming I/O boundary */ unsigned char **boundary; } ASN1_STREAM_ARG;
/* Flags in ASN1_AUX */
/* Use a reference count */ # define ASN1_AFLG_REFCOUNT 1 /* Save the encoding of structure (useful for signatures) */ # define ASN1_AFLG_ENCODING 2 /* The Sequence length is invalid */ # define ASN1_AFLG_BROKEN 4
# if OPENSSL_API_COMPAT < 0x10200000L /* * LONG and ZLONG are strongly discouraged for use as stored data, as the * underlying C type (long) differs in size depending on the architecture. * They are designed with 32-bit longs in mind. */ DECLARE_ASN1_ITEM(LONG) DECLARE_ASN1_ITEM(ZLONG) # endif