ASN1_NULL_NEW(3)
β¨ ASN1_NULL_NEW π
ok so bestie, today we're learning about ASN1_NULL_new and ASN1_NULL_free β the AS.1 NULL value girlies. yes it's literally a value that means "nothing" and yes it has its own constructor. we love a low-effort icon π
πΈ SYNOPSIS πΈ
this whole thing lives in library libcrypto, so first things first, you gotta:
#include <openssl/asn1.h>
and then the two functions are:
ASN1_NULL *
ASN1_NULL_new(void);
void
ASN1_NULL_free(ASN1_NULL *val_in);
periodt. that's the whole API. she's simple, she's chic. β¨
π DESCRIPTION π
ASN1_NULL_new()
okay so this is the funny one. ASN1_NULL_new() returns a specific invalid pointer that represents the ASN.1 NULL value β which, fun fact, is the only possible value of the ASN.1 NULL type. like it's the only child and it's an invalid pointer, we stan a quirky main character π
and listen: that pointer is different from a NULL pointer. i cannot stress this enough. it looks like a pointer, it smells like a pointer, but it is not your standard-issue NULL.
π¨ dereferencing it almost certainly results in a segmentation fault. like bestie do NOT. i'm begging. put it down. ππ
the good news? this function does not allocate memory and cannot fail. zero malloc drama, zero error checking needed. it's giving effortless. π
ASN1_NULL_free()
and now for the plot twist: ASN1_NULL_free() has no effect whatsoever. π
like, at all. in particular:
- it ignores the
val_inargument - it does not free any memory
so what's the vibe here? in normal use, application programs only pass the invalid pointer they got from ASN1_NULL_new() to this function. that's the intended path, that's the whole ritual π«Ά
but here's the catch β even if a valid pointer is passed, that pointer does not become invalid. no, she stays valid. this function is just out here doing literally nothing and collecting a paycheck. truly iconique behaviour. πβ¨
one more thing π¦
the ASN.1 NULL type is also represented by the V_ASN1_NULL type identifier constant. iykyk π
π₯ SEE ALSO π₯
go read those next if you're feeling academically inclined, bestie π
π STANDARDS π
this one's certified by the big leagues:
ITU-T Recommendation X.208, also known as ISO/IEC 8824-1: Specification of Abstract Syntax Notation One (ASN.1), section 19: Notation for the null type
section 19 is the NULL section, appropriately. we love a self-explanatory girlie π
β HISTORY β
ASN1_NULL_new() and ASN1_NULL_free() first appeared in OpenSSL 0.9.5 and have been available since OpenBSD 2.7.
so they've been here longer than most of us have been alive, and they've been doing absolutely nothing the whole time. that's consistency bestie π¦π
and that's the tea on ASN1_NULL! this page was brought to you by the Debian fam, dated June 8, 2025, filed under ASN1_NULL_NEW(3). slay, stay safe, and please don't dereference the invalid pointer π
β¨ππ«Ά
π¦ where this page comes from
- alpine 3.24: libressl-doc 4.3.1-r0 Β· custom
- arch rolling: libressl 4.4.0-1 Β· ISC AND custom:OpenSSL
- Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms