ASN1_OBJECT_NEW(3)
π ASN1_OBJECT_NEW(3) β ASN.1 object identifiers π
Okay bestie, this page is literally the manual for ASN1_OBJECT_NEW(3), and itβs all about the ASN.1 object identifier crew. Letβs get into it π
β¨
π NAME π
ASN1_OBJECT_new, ASN1_OBJECT_create, ASN1_OBJECT_free β ASN.1 object identifiers. Periodt π«Ά
β¨ SYNOPSIS β¨
#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);
π 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. Iconic behavior, honestly π₯
The ASN.1 object identifier type is also represented by the V_ASN1_OBJECT type identifier constant. iykyk π¦
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. Itβs giving βbuild-a-bear, but make it DERβ π
Application programs normally use utility functions like OBJ_nid2obj(3) rather than using ASN1_OBJECT_new() or ASN1_OBJECT_create() directly. So like, you can use these, but the utility functions are the main characters here π
ASN1_OBJECT_free() has the following effects:
- All data contained in
athat is marked as dynamically allocated is freed, and the respective fields ofabecome empty. Contained data not marked as dynamically allocated remains intact. - If the object
aitself is marked as dynamically allocated, it is freed. Otherwise, the pointeraremains valid. - If
ais aNULLpointer or if neither the object itself nor any of its content is marked as dynamically allocated, no action occurs.
No cap, thatβs the whole cleanup vibe check πΈ
π 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.
Not me getting emotional over a malloc failure ππ
π¦ SEE ALSO π¦
Go peek at these besties:
π STANDARDS π
- ITU-T Recommendation X.208, also known as ISO/IEC 8824-1: Specification of Abstract Syntax Notation One (ASN.1), section 28: Notation for the object identifier type
- ITU-T Recommendation X.690, also known as ISO/IEC 8825-1: Information technology - ASN.1 encoding rules: Specification of Basic Encoding Rules (BER), Canonical Encoding Rules (CER) and Distinguished Encoding Rules (DER), section 8.19: Encoding of an object identifier value
Standards girlies, stand up ππ
πΈ HISTORY πΈ
ASN1_OBJECT_new() and ASN1_OBJECT_free() first appeared in SSLeay 0.5.1 and ASN1_OBJECT_create() in SSLeay 0.8.0. These functions have been available since OpenBSD 2.4. Vintage but still on the timeline, fr fr π¦
π BUGS π
The function ASN1_OBJECT_new() is not useful for any practical purpose because the library does not provide any function capable of adding data to an existing object. Consequently, if the application program creates an object with ASN1_OBJECT_new(), that object will always remain empty. Itβs literally giving empty vessel, no notes π
Similarly, if an nid of NID_undef is passed to ASN1_OBJECT_create(), or if NULL is passed for any of its pointer arguments, the returned object will permanently remain incomplete. Sad little incomplete icon, ngl π
π This lilβ page is from Debian, dated September 5, 2023, and itβs the ASN1_OBJECT_NEW(3) manual β mwah! π
π¦ where this page comes from
- opensuse-leap 16.0: libressl-devel-doc 4.1.0-bp160.1.1 Β· OpenSSL
- Copyright (c) 2017, 2021, 2023 Ingo Schwarze <schwarze@openbsd.org>
- Copyright (c) 2002, 2006 The OpenSSL Project. All rights reserved
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms