[gnutls-devel] GnuTLS | gnutls_rnd manage memory per-thread (!1647)

Read-only notification of GnuTLS library development activities gnutls-devel at lists.gnutls.org
Tue Sep 27 09:23:30 CEST 2022




Zoltán Fridrich commented on a discussion on lib/random.c: https://gitlab.com/gnutls/gnutls/-/merge_requests/1647#note_1115527568

>  
>  /* Per thread context of random generator, and a flag to indicate initialization */
> -static _Thread_local void *gnutls_rnd_ctx;
> -static _Thread_local unsigned rnd_initialized = 0;
> +gl_tls_key_t ctx_key;
> +_Thread_local unsigned rnd_initialized = 0;
>  
> -struct rnd_ctx_list_st {
> -	void *ctx;
> -	struct rnd_ctx_list_st *next;
> -};
> -
> -/* A global list of all allocated contexts - to be
> - * used during deinitialization. */
> -GNUTLS_STATIC_MUTEX(gnutls_rnd_ctx_list_mutex);
> -static struct rnd_ctx_list_st *head = NULL;

I have used list from gnulib. This should be resolved. I guess that can be expected that the contexts will remain  in use until rnd_deinit if the destructor isnt called on thread exit. If the destructor is called, then the context is also removed from the list.

-- 
Reply to this email directly or view it on GitLab: https://gitlab.com/gnutls/gnutls/-/merge_requests/1647#note_1115527568
You're receiving this email because of your account on gitlab.com.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.gnupg.org/pipermail/gnutls-devel/attachments/20220927/319d596a/attachment.html>


More information about the Gnutls-devel mailing list