Re: [PATCH] w32: Use __declspec(thread) for FIPS thread context TLS
Werner Koch via Gcrypt-devel <[email protected]> Tue, 09 Dec 2025 15:08:05 +0100
| Newsgroups | gmane.comp.encryption.gpg.libgcrypt.devel |
|---|---|
| Message-ID | <[email protected]> |
On Tue, 9 Dec 2025 05:59, Knugi said:
> the thread-local variables defined using __thread. More specifically, with
> __thread, libaacs could not be properly initialized.
How did you noticed that libgpg-error TLS was also not properly
intialized?
Did you noticed this comment in gpg_err_init:
# ifdef DLL_EXPORT
/* We always have a constructor and thus this function is called
automatically. Due to the way the C init code of mingw works,
the constructors are called before our DllMain function is
called. The problem with that is that the TLS has not been setup
and w32-gettext.c requires TLS. To solve this we do nothing here
but call the actual init code from our DllMain. */
and later in DLLMain:
case DLL_PROCESS_ATTACH:
tls_index = TlsAlloc ();
if (tls_index == TLS_OUT_OF_INDEXES)
return FALSE;
#ifndef _GPG_ERR_HAVE_CONSTRUCTOR
/* If we have no constructors (e.g. MSC) we call it here. */
_gpg_w32__init_gettext_module ();
_gpgrt_w32__init_utils ();
#endif
/* fallthru. */
?
Shalom-Salam,
Werner
--
The pioneers of a warless world are the youth that
refuse military service. - A. Einstein
_______________________________________________
Gcrypt-devel mailing list
[email protected]
https://lists.gnupg.org/mailman/listinfo/gcrypt-devel
openpgp-digital-signature.asc
(application/pgp-signature, 284 B)
-----BEGIN PGP SIGNATURE----- iJ8EARYKAEcWIQSHd0YfKgdOvEgNNZQZzByeCFsQegUCaTgtRRsUgAAAAAAEAA5t YW51MiwyLjUrMS4xMSwyLDINHHdrQGdudXBnLm9yZwAKCRAZzByeCFsQepJqAP92 SccG2lnvErYWpffeY5pYNEaADZp1p/M/tR6dutgYiQEA/7B0AdvnNAfugR7s+hk3 5cW5gMmszdZgOu0hu2TKsQw= =EL02 -----END PGP SIGNATURE-----