gnutls_global_set_mem_functions(3)

✨ gnutls_global_set_mem_functions(3) ✨

okay bestie, so this one lives in the gnutls manual, and it's literally the function where you tell gnutls which memory functions it should be using. cute concept, slightly cursed execution. let's get into it πŸ’…


🌸 NAME 🌸

gnutls_global_set_mem_functions β€” API function


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <gnutls/compat.h>

void gnutls_global_set_mem_functions(gnutls_alloc_function alloc_func,
gnutls_alloc_function secure_alloc_func, gnutls_is_secure_function
is_secure_func, gnutls_realloc_function realloc_func,
gnutls_free_function free_func);

πŸŽ€ ARGUMENTS πŸŽ€

  • gnutls_alloc_function alloc_func β€” the default memory allocation function. it's giving malloc(), honestly. like, that's the vibe it's going for.
  • gnutls_alloc_function secure_alloc_func β€” this is the allocation function that gets used for sensitive data. the delicate stuff. the main character data. πŸ‘‘
  • gnutls_is_secure_function is_secure_func β€” a function that returns 0 if the memory you handed it is not secure. and yeah, it may be NULL. no pressure bestie.
  • gnutls_realloc_function realloc_func β€” a realloc function. that's it. that's the whole description. iconic minimalism ✨
  • gnutls_free_function free_func β€” the function that frees allocated data. and hear me when i say this: it must accept a NULL pointer. non-negotiable, fr fr.

πŸ’€ DEPRECATED πŸ’€

🚨 okay so this is the part where i hold your hand: since 3.3.0 it is no longer possible to replace the internally used memory allocation functions. so like… this whole thing is lowkey a relic. it's giving vintage. it's giving "we keep it around for the lore". πŸ™ˆ

so here's the tea anyway, for the history girlies 🫢

this is the function where you set the memory allocation functions that gnutls is going to use. by default, the libc's allocation functions (malloc(), free()) are used by gnutls, and they get used to allocate both sensitive and not sensitive data. so like, everything, all at once, no differentiation. this function exists so you can set those memory allocation functions to something other than the defaults.

⚠️ this function must be called before gnutls_global_init() is called. and no, it is not thread safe. so please, for the love of everything, don't be out here calling it from twelve threads at once. 😭


πŸ› REPORTING BUGS πŸ›

found a bug? tell the gnutls people, they want to know!


Copyright Β© 2001-2023 Free Software Foundation, Inc., and others.

copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. so like, go off, just keep the receipts. 🧾✨


πŸ‘€ SEE ALSO πŸ‘€

the full documentation for gnutls is maintained as a Texinfo manual. if the /usr/share/doc/gnutls/ directory does not contain the HTML form, visit:

https://www.gnutls.org/manual/

and that's the whole page bestie!! stay hydrated, call gnutls_global_init() after this one, and remember: it's deprecated, so maybe don't build your whole personality around it πŸ’œ

this was gnutls 3.8.13, mwah, slay, bye!! πŸŽ€πŸ¦‹βœ¨

πŸ“¦ where this page comes from