ASN1_AUX_CB(3ossl)
π NAME π
okay bestie, welcome to the ASN1_AUX_CB(3ossl) page β this is all about ASN.1 auxiliary data β¨
ASN1_AUX, ASN1_PRINT_ARG, ASN1_STREAM_ARG, ASN1_aux_cb, ASN1_aux_const_cb β thatβs the whole iconic little crew π«Ά
β¨ SYNOPSIS β¨
#include <openssl/asn1t.h>
struct ASN1_AUX_st {
void *app_data;
int flags;
int ref_offset; /* Offset of reference value */
int ref_lock; /* Offset to an CRYPTO_RWLOCK */
ASN1_aux_cb *asn1_cb;
int enc_offset; /* Offset of ASN1_ENCODING structure */
ASN1_aux_const_cb *asn1_const_cb; /* for ASN1_OP_I2D_ and ASN1_OP_PRINT_ */
};
typedef struct ASN1_AUX_st ASN1_AUX;
struct ASN1_PRINT_ARG_st {
BIO *out;
int indent;
const ASN1_PCTX *pctx;
};
typedef struct ASN1_PRINT_ARG_st ASN1_PRINT_ARG;
struct ASN1_STREAM_ARG_st {
BIO *out;
BIO *ndef_bio;
unsigned char **boundary;
};
typedef struct ASN1_STREAM_ARG_st ASN1_STREAM_ARG;
typedef int ASN1_aux_cb(int operation, ASN1_VALUE **in, const ASN1_ITEM *it,
void *exarg);
typedef int ASN1_aux_const_cb(int operation, const ASN1_VALUE **in,
const ASN1_ITEM *it, void *exarg);
πΈ DESCRIPTION πΈ
so like, ASN.1 data structures can be associated with an ASN1_AUX object to supply extra info about the ASN.1 structure π
An ASN1_AUX structure gets associated with the structure during the definition of the ASN.1 template. For example, an ASN1_AUX structure will be associated by using one of the various ASN.1 template definition macros that supply auxiliary information such as ASN1_SEQUENCE_enc(), ASN1_SEQUENCE_ref(), ASN1_SEQUENCE_cb_const_cb(), ASN1_SEQUENCE_const_cb(), ASN1_SEQUENCE_cb() or ASN1_NDEF_SEQUENCE_cb() π
An ASN1_AUX structure contains the following information, bestie:
app_dataβ arbitrary application data πflagsβ flags which indicate the auxiliary functionality supported β¨- The
ASN1_AFLG_REFCOUNTflag indicates that objects support reference counting. - The
ASN1_AFLG_ENCODINGflag indicates that the original encoding of the object will be saved. - The
ASN1_AFLG_BROKENflag is a work around for broken encoders where the sequence length value may not be correct. This should generally not be used. - The
ASN1_AFLG_CONST_CBflag indicates that the"const"form of theASN1_AUXcallback should be used in preference to the non-const form.
- The
β οΈ bestie, the ASN1_AFLG_BROKEN thing is literally a workaround for broken encoders where the sequence length value may not be correct. This should generally not be used. no cap, leave it alone unless you truly must π
ref_offsetβ if theASN1_AFLG_REFCOUNTflag is set, then this value is assumed to be an offset into theASN1_VALUEstructure where aCRYPTO_REF_COUNTmay be found for the purposes of reference counting πref_lockβ if theASN1_AFLG_REFCOUNTflag is set, then this value is assumed to be an offset into theASN1_VALUEstructure where aCRYPTO_RWLOCKmay be found for the purposes of reference counting πasn1_cbβ a callback that will be invoked at various points during the processing of theASN1_VALUE. See below for further details πenc_offsetβ offset into theASN1_VALUEobject where the original encoding of the object will be saved if theASN1_AFLG_ENCODINGflag has been set.asn1_const_cbβ a callback that will be invoked at various points during the processing of theASN1_VALUE. This is used in preference to theasn1_cbcallback if theASN1_AFLG_CONST_CBflag is set. See below for further details π
During the processing of an ASN1_VALUE object, the callbacks set via asn1_cb or asn1_const_cb will be invoked as a result of various events indicated via the operation parameter. The value of *in will be the ASN1_VALUE object being processed based on the template in it. An additional operation specific parameter may be passed in exarg. The currently supported operations are as follows. The callbacks should return a positive value on success or zero on error, unless otherwise noted below π
ASN1_OP_NEW_PREβ invoked when processing aCHOICE,SEQUENCEorNDEF_SEQUENCEstructure prior to anASN1_VALUEobject being allocated. The callback may allocate theASN1_VALUEitself and store it in*pval. If it does so it should return2from the callback. On error it should return0π«ΆASN1_OP_NEW_POSTβ invoked when processing aCHOICE,SEQUENCEorNDEF_SEQUENCEstructure after anASN1_VALUEobject has been allocated. The allocated object is in*pvalβ¨ASN1_OP_FREE_PREβ invoked when processing aCHOICE,SEQUENCEorNDEF_SEQUENCEstructure immediately before anASN1_VALUEis freed. If the callback originally constructed theASN1_VALUEviaASN1_OP_NEW_PREthen it should free it at this point and return2from the callback. Otherwise it should return1for success or0on error πASN1_OP_FREE_POSTβ invoked when processing aCHOICE,SEQUENCEorNDEF_SEQUENCEstructure immediately afterASN1_VALUEsub-structures are freed.ASN1_OP_D2I_PREβ invoked when processing aCHOICE,SEQUENCEorNDEF_SEQUENCEstructure immediately before a"d2i"operation for theASN1_VALUEπASN1_OP_D2I_POSTβ invoked when processing aCHOICE,SEQUENCEorNDEF_SEQUENCEstructure immediately after a"d2i"operation for theASN1_VALUEβASN1_OP_I2D_PREβ invoked when processing aCHOICE,SEQUENCEorNDEF_SEQUENCEstructure immediately before a"i2d"operation for theASN1_VALUEπ¦ASN1_OP_I2D_POSTβ invoked when processing aCHOICE,SEQUENCEorNDEF_SEQUENCEstructure immediately after a"i2d"operation for theASN1_VALUEπΈASN1_OP_PRINT_PREβ invoked when processing aSEQUENCEorNDEF_SEQUENCEstructure immediately before printing theASN1_VALUE. Theexargargument will be a pointer to anASN1_PRINT_ARGstructure (see below) πASN1_OP_PRINT_POSTβ invoked when processing aSEQUENCEorNDEF_SEQUENCEstructure immediately after printing theASN1_VALUE. Theexargargument will be a pointer to anASN1_PRINT_ARGstructure (see below) πASN1_OP_STREAM_PREβ invoked immediately prior to streaming theASN1_VALUEdata using indefinite length encoding. Theexargargument will be a pointer to anASN1_STREAM_ARGstructure (see below) πASN1_OP_STREAM_POSTβ invoked immediately after streaming theASN1_VALUEdata using indefinite length encoding. Theexargargument will be a pointer to anASN1_STREAM_ARGstructure (see below) β¨ASN1_OP_DETACHED_PREβ invoked immediately prior to processing theASN1_VALUEdata as a"detached"value (as used in CMS and PKCS7). Theexargargument will be a pointer to anASN1_STREAM_ARGstructure (see below) π§ASN1_OP_DETACHED_POSTβ invoked immediately after processing theASN1_VALUEdata as a"detached"value (as used in CMS and PKCS7). Theexargargument will be a pointer to anASN1_STREAM_ARGstructure (see below) πASN1_OP_DUP_PREβ invoked immediate prior to anASN1_VALUEbeing duplicated via a call toASN1_item_dup()π«ΆASN1_OP_DUP_POSTβ invoked immediate after to anASN1_VALUEhas been duplicated via a call toASN1_item_dup()πASN1_OP_GET0_LIBCTXβ invoked in order to obtain theOSSL_LIB_CTXassociated with anASN1_VALUEif any. A pointer to anOSSL_LIB_CTXshould be stored in*exargif such a value exists π₯ASN1_OP_GET0_PROPQβ invoked in order to obtain the property query string associated with anASN1_VALUEif any. A pointer to the property query string should be stored in*exargif such a value exists π
π the ASN1_PRINT_ARG moment π
An ASN1_PRINT_ARG object is used during processing of ASN1_OP_PRINT_PRE and ASN1_OP_PRINT_POST callback operations. It contains the following information:
outβ theBIObeing used to print the data out πndef_bioβ okay so this manual page labels this next itemndef_bio(the struct field itself isindent), and says itβs the current number of indent spaces that should be used for printing this data. not me spotting the label mismatch πpctxβ the context for theASN1_PCTXoperation β¨
π¦ the ASN1_STREAM_ARG moment π¦
An ASN1_STREAM_ARG object is used during processing of ASN1_OP_STREAM_PRE, ASN1_OP_STREAM_POST, ASN1_OP_DETACHED_PRE and ASN1_OP_DETACHED_POST callback operations. It contains the following information:
outβ theBIOto stream through πndef_bioβ theBIOwith filters appended πboundaryβ the streaming I/O boundary π
β RETURN VALUES β
The callbacks return 0 on error and a positive value on success. Some operations require specific positive success values as noted above π
π SEE ALSO π
go peek at ASN1_item_new_ex(3) β thatβs the reference, bestie π«Ά
π HISTORY π
The ASN1_aux_const_cb() callback and the ASN1_OP_GET0_LIBCTX and ASN1_OP_GET0_PROPQ operation types were added in OpenSSL 3.0 β¨
π COPYRIGHT π
Copyright 2021-2025 The OpenSSL Project Authors. All Rights Reserved.
Licensed under the Apache License 2.0 (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>.
xoxo, your local ASN1_AUX_CB(3ossl) bestie β sourced from version 3.5.6, dated 2026-04-07 π
πβ¨
π¦ where this page comes from
- freebsd 15.1: base 15.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms