libressl-ASN1_OBJECT_new3
Asn.1 object identifiers
Usage
Crypto Library (libcrypto, -lcrypto)
#include <openssl/asn1.h>
ASN1_OBJECT *
ASN1_OBJECT_new(void);
ASN1_OBJECT *
ASN1_OBJECT_create(int nid, unsigned char *content, int len, const char *short_name, const char *long_name);
void
ASN1_OBJECT_free(ASN1_OBJECT *a);
Overview
ASN1_OBJECT_new() allocates and initializes an empty ASN1_OBJECT object, representing an ASN.1 OBJECT IDENTIFIER. It can hold a short name, a long name, a numeric identifier (NID), and a sequence of integers identifying a node in the International Object Identifier tree as specified in ITU-T recommendation X.660. The new object is marked as dynamically allocated.
The ASN.1 object identifier type is also represented by the V_ASN1_OBJECT type identifier constant.
ASN1_OBJECT_create() allocates a new ASN1_OBJECT with the given nid, copies the len DER content octets, the short_name, and the long_name into it, and marks the new object and all data contained in it as dynamically allocated.
Application programs normally use utility functions like OBJ_nid2obj(3) rather than using ASN1_OBJECT_new() or ASN1_OBJECT_create() directly.
ASN1_OBJECT_free() has the following effects:
All data contained in a that is marked as dynamically allocated is freed, and the respective fields of a become empty. Contained data not marked as dynamically allocated remains intact.
If the object a itself is marked as dynamically allocated, it is freed. Otherwise, the pointer a remains valid.
If a is a NULL pointer or if neither the object itself nor any of its content is marked as dynamically allocated, no action occurs.
Return values
ASN1_OBJECT_new() and ASN1_OBJECT_create() return a pointer to the new object or NULL if memory allocation fails,
Errors
After failure of ASN1_OBJECT_new() or ASN1_OBJECT_create(), the following diagnostic can be retrieved with ERR_get_error(3), ERR_GET_REASON(3), and ERR_reason_error_string(3):
- ERR_R_MALLOC_FAILURE "malloc failure"
-
Memory allocation failed.
After some cases of failure of ASN1_OBJECT_create(), the following diagnostic can be retrieved in addition to the above:
- ERR_R_ASN1_LIB "ASN1 lib"
-
Memory allocation failed.