Ubuntu Manpages

DECLARE_ASN1_FUNCTIONS, IMPLEMENT_ASN1_FUNCTIONS, ASN1_ITEM,

 #include <openssl/asn1t.h>
 DECLARE_ASN1_FUNCTIONS(type)
 IMPLEMENT_ASN1_FUNCTIONS(stname)
 typedef struct ASN1_ITEM_st ASN1_ITEM;
 extern const ASN1_ITEM TYPE_it;
 TYPE *TYPE_new(void);
 TYPE *TYPE_dup(TYPE *a);
 void TYPE_free(TYPE *a);
 int TYPE_print_ctx(BIO *out, TYPE *a, int indent, const ASN1_PCTX *pctx);

In the description below, TYPE is used as a placeholder for any of the OpenSSL datatypes, such as X509.

The OpenSSL ASN1 parsing library templates are like a data-driven bytecode interpreter. Every ASN1 object as a global variable, TYPE_it, that describes the item such as its fields. (On systems which cannot export variables from shared libraries, the global is instead a function which returns a pointer to a static variable.

The macro DECLARE_ASN1_FUNCTIONS() is typically used in header files to generate the function declarations.

The macro IMPLEMENT_ASN1_FUNCTIONS() is used once in a source file to generate the function bodies.

TYPE_new() allocates an empty object of the indicated type. The object returned must be released by calling TYPE_free().

TYPE_dup() copies an existing object.

TYPE_free() releases the object and all pointers and sub-objects within it.

TYPE_print_ctx() prints the object a on the specified BIO out. Each line will be prefixed with indent spaces. The pctx specifies the printing context and is for internal use; use NULL to get the default behavior. If a print function is user-defined, then pass in any pctx down to any nested calls.

TYPE_new() and TYPE_dup() return a pointer to the object or NULL on failure.

TYPE_print_ctx() returns 1 on success or zero on failure.

Copyright 2016-2018 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>.