ASN1_OBJECT_NEW(3ossl)

πŸ’– ASN1_OBJECT_NEW β€” bestie edition πŸ’–

okay so this page is from OpenSSL, and it's the 3ossl manual, and it's all about the two lil' object allocation functions ASN1_OBJECT_new and ASN1_OBJECT_free. no cap, it's short, but we're gonna make it cute. ✨

✨ NAME ✨

ASN1_OBJECT_new, ASN1_OBJECT_free β€” the object allocation functions, aka the birth and the farewell of an ASN1_OBJECT. πŸŽ€


🌸 SYNOPSIS 🌸

#include <openssl/asn1.h>

ASN1_OBJECT *ASN1_OBJECT_new(void);
void ASN1_OBJECT_free(ASN1_OBJECT *a);

like, that's it. two lines. one to make it, one to yeet it. πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

so these are the ASN1_OBJECT allocation routines β€” they allocate and free an ASN1_OBJECT structure, and that structure is the thing that represents an ASN1 OBJECT IDENTIFIER. iconic behavior honestly.

  • ASN1_OBJECT_new() β€” allocates and initializes an ASN1_OBJECT structure. brand new baby object, freshly initialized, living its best life. 🫢
  • ASN1_OBJECT_free() β€” frees up the ASN1_OBJECT structure a. and listen: if a is NULL, nothing is done. literally nothing. it just vibes. no crash, no drama. 😌

πŸ’€ NOTES πŸ’€

okay bestie, this is the important part so read it twice:

even though ASN1_OBJECT_new() allocates a new ASN1_OBJECT structure, it is almost never used in applications. like, almost never never.

instead, the ASN1 object utility functions β€” things like OBJ_nid2obj() β€” are what you use. so if you were about to reach for ASN1_OBJECT_new(), maybe don't?? the utility functions are the main characters here. πŸ‘‘


⭐ RETURN VALUES ⭐

  • if the allocation fails, ASN1_OBJECT_new() returns NULL and sets an error code that you can grab with ERR_get_error(3). so if you get NULL, go check the error queue, it's giving receipts. 😭
  • otherwise it returns a pointer to the newly allocated structure. slay. πŸ”₯
  • ASN1_OBJECT_free() returns no value. it's a void function, it gives you nothing back and that's just its vibe. 🀷

🌈 SEE ALSO 🌈


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


and that's the whole page, bestie!! πŸŽ€βœ¨ this was version 3.5.9, dated 2026-09-29, straight from the OpenSSL girlies themselves β€” go forth and free your objects, and remember: if a is NULL, nothing is done, and honestly? that's the energy we're bringing into the rest of our day. πŸ’–πŸ¦‹πŸ’…

πŸ“¦ where this page comes from