e79d4b
From 3035e884b3abc68bcebff5adec5bd8819bbc6d7b Mon Sep 17 00:00:00 2001
e79d4b
From: rpm-build <rpm-build>
e79d4b
Date: Fri, 5 Aug 2022 16:16:42 +0900
e79d4b
Subject: [PATCH] gnutls-3.7.6-drbg-reseed.patch
e79d4b
e79d4b
Signed-off-by: rpm-build <rpm-build>
e79d4b
---
e79d4b
 lib/nettle/sysrng-linux.c | 10 +++++++++-
e79d4b
 1 file changed, 9 insertions(+), 1 deletion(-)
e79d4b
e79d4b
diff --git a/lib/nettle/sysrng-linux.c b/lib/nettle/sysrng-linux.c
e79d4b
index 6b3971c..dae9061 100644
e79d4b
--- a/lib/nettle/sysrng-linux.c
e79d4b
+++ b/lib/nettle/sysrng-linux.c
e79d4b
@@ -31,6 +31,9 @@
e79d4b
 # include <num.h>
e79d4b
 # include <errno.h>
e79d4b
 # include <rnd-common.h>
e79d4b
+# include "fips.h"
e79d4b
+#else
e79d4b
+# define _gnutls_fips_mode_enabled() 0
e79d4b
 #endif
e79d4b
 
e79d4b
 #include <sys/types.h>
e79d4b
@@ -103,7 +106,12 @@ static int force_getrandom(void *buf, size_t buflen, unsigned int flags)
e79d4b
 static int _rnd_get_system_entropy_getrandom(void* _rnd, size_t size)
e79d4b
 {
e79d4b
 	int ret;
e79d4b
-	ret = force_getrandom(_rnd, size, 0);
e79d4b
+	unsigned int flags = 0;
e79d4b
+
e79d4b
+	if (_gnutls_fips_mode_enabled()) {
e79d4b
+		flags |= 2/*GRND_RANDOM*/;
e79d4b
+	}
e79d4b
+	ret = force_getrandom(_rnd, size, flags);
e79d4b
 	if (ret == -1) {
e79d4b
 		int e = errno;
e79d4b
 		gnutls_assert();
e79d4b
-- 
e79d4b
2.37.1
e79d4b