gnutls: fix random generator crash

This commit is contained in:
Gerasim Troeglazov
2022-08-14 21:47:24 +10:00
parent 72d2fc87ea
commit cda76a6271
2 changed files with 48 additions and 7 deletions

View File

@@ -10,7 +10,7 @@ COPYRIGHT="2000-2018 Free Software Fundation Inc.
2004-2008 Simon Josefsson
2000-2004 Nikos Mavrogiannopoulos"
LICENSE="GNU LGPL v2.1"
REVISION="1"
REVISION="2"
SOURCE_URI="https://www.gnupg.org/ftp/gcrypt/gnutls/v${portVersion%\.*}/gnutls-$portVersion.tar.xz"
CHECKSUM_SHA256="e6adbebcfbc95867de01060d93c789938cf89cc1d1f6ef9ef661890f6217451f"
SOURCE_DIR="gnutls-$portVersion"

View File

@@ -1,4 +1,4 @@
From 8aebb8df1c307f513e3cb3f8d2d481a50519fc84 Mon Sep 17 00:00:00 2001
From 4d052f4cdffb5d6b1eeb04f3441002cfd79ae075 Mon Sep 17 00:00:00 2001
From: fbrosson <fbrosson@localhost>
Date: Tue, 7 Jun 2016 03:05:44 +0000
Subject: include sys/select.h
@@ -47,10 +47,10 @@ index 5eb2eff..1f179e7 100644
#if defined(_WIN32)
--
2.30.2
2.36.1
From 00f79db0c87d92092b3ad468a7c45c90dc43f944 Mon Sep 17 00:00:00 2001
From 6849461521b15853f3bc0c92c1d5db58e6e42a0d Mon Sep 17 00:00:00 2001
From: fbrosson <fbrosson@localhost>
Date: Wed, 6 Jul 2016 22:11:20 +0000
Subject: Use /bin/perl instead of /usr/bin/perl.
@@ -67,10 +67,10 @@ index 34978d3..96b1067 100755
# Copyright (C) 2011-2012 Free Software Foundation, Inc.
#
--
2.30.2
2.36.1
From c2c112879ee5621612e8d8a55f0ffbf8c6e9b0e6 Mon Sep 17 00:00:00 2001
From e00e545a0f3d443153d8d3c250b0bac26f6f10d2 Mon Sep 17 00:00:00 2001
From: fbrosson <fbrosson@localhost>
Date: Wed, 18 Jul 2018 07:44:23 +0000
Subject: doc/examples/tlsproxy/tlsproxy.c calls strdupa and fails to build
@@ -90,5 +90,46 @@ index c40bf4f..85c6bd6 100644
tlsproxy_tlsproxy_SOURCES = tlsproxy/buffer.c tlsproxy/buffer.h tlsproxy/crypto-gnutls.c \
tlsproxy/crypto-gnutls.h tlsproxy/tlsproxy.c
--
2.30.2
2.36.1
From 5afa5b1deca1cbf50934967451914a9cebb4aa48 Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Sat, 13 Aug 2022 11:06:09 +1000
Subject: Remove static for _Thread_local variables
diff --git a/lib/fips.c b/lib/fips.c
index f3d7773..e5c757e 100644
--- a/lib/fips.c
+++ b/lib/fips.c
@@ -50,9 +50,9 @@ struct gnutls_fips140_context_st {
* can use gnutls_fips140_set_mode() to override a specific
* operation on a thread */
static gnutls_fips_mode_t _global_fips_mode = -1;
-static _Thread_local gnutls_fips_mode_t _tfips_mode = -1;
+_Thread_local gnutls_fips_mode_t _tfips_mode = -1;
-static _Thread_local gnutls_fips140_context_t _tfips_context = NULL;
+_Thread_local gnutls_fips140_context_t _tfips_context = NULL;
static int _skip_integrity_checks = 0;
diff --git a/lib/random.c b/lib/random.c
index f1abe74..2219cda 100644
--- a/lib/random.c
+++ b/lib/random.c
@@ -36,8 +36,8 @@ extern gnutls_crypto_rnd_st _gnutls_fuzz_rnd_ops;
#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;
+_Thread_local void *gnutls_rnd_ctx;
+_Thread_local unsigned rnd_initialized = 0;
struct rnd_ctx_list_st {
void *ctx;
--
2.36.1