ASN1_OBJECT_NEW(3)

NAME
ASN1_OBJECT_new, ASN1_OBJECT_free - ASN.1 object identifiers

SYNOPSIS
#include <openssl/asn1.h>
ASN1_OBJECT *
ASN1_OBJECT_new(void);
void
ASN1_OBJECT_free(ASN1_OBJECT *a);

DESCRIPTION
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.

Application programs normally use utility functions like OBJ_nid2obj(3) rather than using ASN1_OBJECT_new() 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
If the allocation fails, ASN1_OBJECT_new() returns NULL and sets an error code that can be obtained by ERR_get_error(3). Otherwise it returns a pointer to the new object.

SEE ALSO
d2i_ASN1_OBJECT(3), OBJ_nid2obj(3)

HISTORY
ASN1_OBJECT_new() and ASN1_OBJECT_free() are available in all versions of SSLeay and OpenSSL.