ASN1_STRING_NEW(3ossl)

πŸ’– ASN1_STRING_NEW πŸ’–

okay bestie, welcome to the ASN1_STRING allocation corner of the OpenSSL manual, page ASN1_STRING_NEW(3ossl) β€” yes that's the manual name, we're just folding it in here at the top because we're ✨casual✨ like that.

This page is literally about three lil functions that make and unmake ASN1_STRING structs. Nothing more, nothing less. It's giving "short king of a manpage" and honestly? We respect it. 🫢


✨ SYNOPSIS ✨

#include <openssl/asn1.h>

ASN1_STRING *ASN1_STRING_new(void);
ASN1_STRING *ASN1_STRING_type_new(int type);
void ASN1_STRING_free(ASN1_STRING *a);

no cap, that's the whole vibe right there. three functions. one header. let's go. πŸ’…


🌸 DESCRIPTION 🌸

okay so here's the tea on each one:

  • ASN1_STRING_new() β€” returns an allocated ASN1_STRING structure. and its type? undefined. literally undefined. it's an unlabeled baddie. πŸ™ˆ
  • ASN1_STRING_type_new() β€” returns an allocated ASN1_STRING structure, but this one knows itself. it's of type type. main character energy fr fr. πŸ‘‘
  • ASN1_STRING_free() β€” frees up a. and if a is NULL? nothing is done. nothing!! it just. does nothing. iconic behaviour, no crash, no drama, we love a function that minds its own business. 😌

πŸŽ€ NOTES πŸŽ€

the way that other string types literally just call these ASN1_STRING functions... iykyk. like, for example, ASN1_OCTET_STRING_new() calls ASN1_STRING_type_new(V_ASN1_OCTET_STRING). so yeah, all the other string types are lowkey just borrowing the same machinery under the hood. it's a whole ecosystem, bestie. 🌈


πŸ’œ RETURN VALUES πŸ’œ

  • ASN1_STRING_new() and ASN1_STRING_type_new() return a valid ASN1_STRING structure, or NULL if an error occurred. so like... check that pointer, okay? don't be out here dereferencing NULL, that's not the move. 😭
  • ASN1_STRING_free() does not return a value. it just frees and dips. πŸ¦‹

⭐ SEE ALSO ⭐

go read it, it's the friend of the friend, you'll need it when something returns NULL and you're like "why tho" πŸ’€


Copyright 2002-2023 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 OpenSSL version 3.5.9, dated 2026-09-29, and the manual page itself goes by ASN1_STRING_NEW(3ossl). now go forth and allocate responsibly, mwah πŸ’‹πŸŒΈπŸ’–

πŸ“¦ where this page comes from