[PATCH] w32: Use __declspec(thread) for FIPS thread context TLS
Knugi
hello at knugi.com
Mon Dec 8 17:17:42 CET 2025
* src/fips.c: Use __declspec(thread) for MinGW32 thread-local context.
Signed-off-by: Knugi <hello at knugi.com>
---
src/fips.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/fips.c b/src/fips.c
index d1aff8a5..d1fa3e03 100644
--- a/src/fips.c
+++ b/src/fips.c
@@ -75,9 +75,15 @@ struct gcry_thread_context {
};
#ifdef HAVE_GCC_STORAGE_CLASS__THREAD
+#ifdef __MINGW32__
+static __declspec(thread) struct gcry_thread_context the_tc = {
+ 0, GCRY_FIPS_FLAG_REJECT_DEFAULT
+};
+#else
static __thread struct gcry_thread_context the_tc = {
0, GCRY_FIPS_FLAG_REJECT_DEFAULT
};
+#endif
#else
#error libgcrypt requires thread-local storage to support FIPS mode
#endif
--
2.52.0
-------------- next part --------------
A non-text attachment was scrubbed...
Name: DCO
Type: application/octet-stream
Size: 1270 bytes
Desc: not available
URL: <https://lists.gnupg.org/pipermail/gcrypt-devel/attachments/20251208/025715b2/attachment-0001.obj>
More information about the Gcrypt-devel
mailing list