gnutls/SOURCES/gnutls-3.7.6-drbg-reseed.patch

42 lines
1.1 KiB
Diff
Raw Permalink Normal View History

2024-04-30 14:09:30 +00:00
From 968de8a9779788a853a4c0cd75beda779cb15f52 Mon Sep 17 00:00:00 2001
2022-10-11 07:13:05 +00:00
From: rpm-build <rpm-build>
2024-04-30 14:09:30 +00:00
Date: Thu, 16 Nov 2023 17:09:58 +0900
2022-10-11 07:13:05 +00:00
Subject: [PATCH] gnutls-3.7.6-drbg-reseed.patch
Signed-off-by: rpm-build <rpm-build>
---
lib/nettle/sysrng-linux.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/lib/nettle/sysrng-linux.c b/lib/nettle/sysrng-linux.c
2024-04-30 14:09:30 +00:00
index 25d74fe..8b9cc46 100644
2022-10-11 07:13:05 +00:00
--- a/lib/nettle/sysrng-linux.c
+++ b/lib/nettle/sysrng-linux.c
@@ -31,6 +31,9 @@
2024-04-30 14:09:30 +00:00
#include "num.h"
#include <errno.h>
#include "rnd-common.h"
+#include "fips.h"
2022-10-11 07:13:05 +00:00
+#else
2024-04-30 14:09:30 +00:00
+#define _gnutls_fips_mode_enabled() 0
2022-10-11 07:13:05 +00:00
#endif
#include <sys/types.h>
2024-04-30 14:09:30 +00:00
@@ -104,7 +107,12 @@ static int force_getrandom(void *buf, size_t buflen, unsigned int flags)
static int _rnd_get_system_entropy_getrandom(void *_rnd, size_t size)
2022-10-11 07:13:05 +00:00
{
int ret;
- ret = force_getrandom(_rnd, size, 0);
+ unsigned int flags = 0;
+
+ if (_gnutls_fips_mode_enabled()) {
+ flags |= 2/*GRND_RANDOM*/;
+ }
+ ret = force_getrandom(_rnd, size, flags);
if (ret == -1) {
int e = errno;
gnutls_assert();
--
2024-04-30 14:09:30 +00:00
2.41.0
2022-10-11 07:13:05 +00:00