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

Read-only notification of GnuTLS library development activities gnutls-devel at lists.gnutls.org
Mon Sep 26 09:12:59 CEST 2022

Daiki Ueno commented on a discussion on lib/random.c: https://gitlab.com/gnutls/gnutls/-/merge_requests/1647#note_1113722048

>  #endif
>  /* 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;

That's not correct; see 6.2.2 of [n1250](https://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf):
> There are three kinds of linkage: external, internal, and none.
> If the declaration of a file scope identifier for an object or a function contains the storage-
class specifier static, the identifier has internal linkage.
> If the declaration of an identifier for an object has file scope and no storage-class specifier,
its linkage is external.
If you check with `nm -g random.o`, you will see something like `0000000000000000 B rnd_initialized`.

Reply to this email directly or view it on GitLab: https://gitlab.com/gnutls/gnutls/-/merge_requests/1647#note_1113722048
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/20220926/0a00e4fd/attachment.html>

More information about the Gnutls-devel mailing list