ASN1_ITEM_NEW(3SSL)

πŸ’– ASN1_ITEM_NEW πŸ’–

okay so bestie, we're in ASN1_ITEM_NEW(3SSL) territory β€” that's the OpenSSL manual, section 3, and this page is literally just "how do I make a fresh ASN.1 value out of thin air" ✨


πŸŽ€ NAME πŸŽ€

ASN1_item_new_ex, ASN1_item_new β€” create new ASN.1 values


🌸 SYNOPSIS 🌸

#include <openssl/asn1.h>

ASN1_VALUE *ASN1_item_new_ex(const ASN1_ITEM *it, OSSL_LIB_CTX *libctx,
                             const char *propq);
ASN1_VALUE *ASN1_item_new(const ASN1_ITEM *it);

✨ DESCRIPTION ✨

So ASN1_item_new_ex() is the main character here πŸ‘‘ β€” it builds you a brand new ASN1_VALUE structure, and it does it based on the ASN1_ITEM template you hand it in the it parameter. Blueprint in, structure out, no cap.

Now, plot twist: if the process needs to do any algorithm fetches while it's building that thing, it'll use the OSSL_LIB_CTX you passed in as libctx, plus the property query string sitting in propq. If you wanna know what "algorithm fetching" even is, go read the "ALGORITHM FETCHING" section in crypto(7) β€” it's all there, iykyk πŸ¦‹

And ASN1_item_new()? She's the chill, low-effort twin fr fr β€” literally the same as ASN1_item_new_ex() except she uses the default OSSL_LIB_CTX (that's NULL, bestie) and a NULL property query string. No libctx to pass, no propq to think about. Simple life. πŸ’…


πŸ”₯ RETURN VALUES πŸ”₯

ASN1_item_new_ex() and ASN1_item_new() hand you back a pointer to the freshly created ASN1_VALUE... or NULL if something went wrong 😭

bestie check for that NULL, okay?? don't be out here dereferencing a NULL pointer, that's not the vibe πŸ’€

⭐ HISTORY ⭐

The function ASN1_item_new_ex() came into existence in OpenSSL 3.0. She's new-ish, she's iconic, she's here. 🌈


Copyright 2021 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 page, bestie 🫢 OpenSSL 4.0.3, dated 2026-09-29, manual section 3SSL β€” go forth and allocate responsibly πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from