ASN1_STRING_NEW(3SSL)

πŸ’– ASN1_STRING_NEW πŸ’–

okay bestie, welcome to the ASN1_STRING_NEW page from the OpenSSL manual, section 3SSL ✨ this is the little trio of functions that literally just allocate and free ASN1_STRING structures, no cap πŸŽ€


🌸 NAME 🌸

ASN1_STRING_new, ASN1_STRING_type_new, ASN1_STRING_free β€” the ASN1_STRING allocation functions πŸ’…


πŸ¦‹ 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);

✨ DESCRIPTION ✨

so here's the tea, three lil functions, each doing one job 🫢

  • ASN1_STRING_new() β€” returns an allocated ASN1_STRING structure. its type is undefined, like it literally hasn't decided who it is yet 😭 main character in their flop era fr.
  • ASN1_STRING_type_new() β€” returns an allocated ASN1_STRING structure of type type. you tell it who it is πŸ’…
  • ASN1_STRING_free() β€” frees up a. and if a is NULL, nothing is done β€” it's giving "no thoughts, head empty", iconic, no crash, periodt πŸ‘‘

πŸŽ€ NOTES πŸŽ€

the other string types lowkey just call the ASN1_STRING functions underneath, it's all one big friend group πŸ’œ

for example, ASN1_OCTET_STRING_new() calls:

ASN1_STRING_type_new(V_ASN1_OCTET_STRING)

see? it's giving delegation. obsessed 🌈


⭐ RETURN VALUES ⭐

  • ASN1_STRING_new() and ASN1_STRING_type_new() return a valid ASN1_STRING structure, or NULL if an error occurred 😭 (iykyk, always check for that NULL)
  • ASN1_STRING_free() does not return a value. it just vibes and cleans up 🧚

πŸ”₯ SEE ALSO πŸ”₯


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, you ate that πŸ“ this was OpenSSL 4.0.3, dated 2026-09-29, mwah, go forth and allocate responsibly πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from