Update to the upstream v3.7.0

Update to the upstream v3.7.0 @ e783cf1c
Fix PowerPC architecture detection code
Simplify jent_get_nstime() for PowerPC
Restore previous jitterentropy public api

Resolves: RHEL-176348

Signed-off-by: Vladislav Dronov <vdronov@redhat.com>
This commit is contained in:
Vladislav Dronov 2026-05-21 21:19:39 +02:00
parent 7498d61d64
commit 6730f463d0
6 changed files with 117 additions and 13 deletions

View File

@ -1,6 +0,0 @@
--- !Policy
product_versions:
- rhel-10
decision_context: osci_compose_gate
rules:
- !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.functional}

51
jitterentropy-api.patch Normal file
View File

@ -0,0 +1,51 @@
diff --git jitterentropy.h jitterentropy.h
--- jitterentropy.h
+++ jitterentropy.h
@@ -158,6 +158,24 @@ extern "C" {
#define JENT_PTHREAD
#endif
+/* an ugly hack to revert an api change --> */
+#define JENT_PTHREAD
+#ifdef JENT_CONF_ENABLE_INTERNAL_TIMER
+#ifdef JENT_PTHREAD
+#include <pthread.h>
+struct jent_notime_ctx {
+ pthread_attr_t notime_pthread_attr; /* pthreads library */
+ pthread_t notime_thread_id; /* pthreads thread ID */
+};
+#else
+#include <threads.h>
+struct jent_notime_ctx {
+ thrd_t notime_thread_id; /* thread ID */
+};
+#endif
+#endif
+/* <-- an ugly hack to revert an api change */
+
/* Forward declaration of opaque value */
struct rand_data;
diff --git src/jitterentropy-timer.c src/jitterentropy-timer.c
--- src/jitterentropy-timer.c
+++ src/jitterentropy-timer.c
@@ -24,19 +24,6 @@
/* Timer-less entropy source */
#ifdef JENT_CONF_ENABLE_INTERNAL_TIMER
-#ifdef JENT_PTHREAD
-#include <pthread.h>
-struct jent_notime_ctx {
- pthread_attr_t notime_pthread_attr; /* pthreads library */
- pthread_t notime_thread_id; /* pthreads thread ID */
-};
-#else
-#include <threads.h>
-struct jent_notime_ctx {
- thrd_t notime_thread_id; /* thread ID */
-};
-#endif
-
/***************************************************************************
* Thread handler
***************************************************************************/

View File

@ -0,0 +1,49 @@
diff --git jitterentropy-base-user.h jitterentropy-base-user.h
--- jitterentropy-base-user.h
+++ jitterentropy-base-user.h
@@ -196,42 +196,14 @@ static inline void jent_get_nstime(uint64_t *out)
*out = *(uint64_t *)(clk + 1);
}
-#elif defined(__powerpc)
-/*
- * Uncomment this for newer PPC CPUs
- * Newer PPC CPUs do not support mftbu/mftb
- * these instructions were obsoleted and replaced by
- * mfspr. special processor registers 268 and 269 are the
- * ones we want.
- */
- /* #define POWER_PC_USE_NEW_INSTRUCTIONS */
-
-/* taken from http://www.ecrypt.eu.org/ebats/cpucycles.html */
+#elif defined(__powerpc__)
static inline void jent_get_nstime(uint64_t *out)
{
- unsigned long high;
- unsigned long low;
- unsigned long newhigh;
- uint64_t result;
-#ifdef POWER_PC_USE_NEW_INSTRUCTIONS /* Newer PPC CPUs do not support mftbu/mftb */
- __asm__ __volatile__(
- "Lcpucycles:mfspr %0, 269;mfspr %1, 268;mfspr %2, 269;cmpw %0,%2;bne Lcpucycles"
- : "=r" (high), "=r" (low), "=r" (newhigh)
- );
-#else
- __asm__ __volatile__(
- "Lcpucycles:mftbu %0;mftb %1;mftbu %2;cmpw %0,%2;bne Lcpucycles"
- : "=r" (high), "=r" (low), "=r" (newhigh)
- );
-#endif
- result = high;
- result <<= 32;
- result |= low;
- *out = result;
+ *out = (uint64_t)__builtin_ppc_get_timebase();
}
-#else /* (__x86_64__) || (__i386__) || (__aarch64__) || (__s390x__) || (__powerpc) */
+#else /* (__x86_64__) || (__i386__) || (__aarch64__) || (__s390x__) || (__powerpc__) */
static inline void jent_get_nstime(uint64_t *out)
{

View File

@ -5,8 +5,8 @@ diff -up Makefile.orig Makefile
#Hardening
ENABLE_STACK_PROTECTOR ?= 1
CFLAGS ?= -fwrapv --param ssp-buffer-size=4 -fvisibility=hidden -fPIE -Wcast-align -Wmissing-field-initializers -Wshadow -Wswitch-enum
-CFLAGS +=-Wextra -Wall -pedantic -fPIC -O0 -fwrapv -Wconversion
+CFLAGS +=-Wp,-U_FORTIFY_SOURCE -Wextra -Wall -pedantic -fPIC -O0 -fwrapv -Wconversion
-CFLAGS +=-Wextra -Wall -pedantic -fPIC -O0 -fwrapv -Wconversion -std=c11
+CFLAGS +=-Wp,-U_FORTIFY_SOURCE -Wextra -Wall -pedantic -fPIC -O0 -fwrapv -Wconversion -std=c11
LDFLAGS +=-Wl,-z,relro,-z,now -lpthread
# Enable internal timer support

View File

@ -1,7 +1,7 @@
%global libjit_soversion 3
Name: jitterentropy
Version: 3.6.0
Release: 2%{?dist}
Version: 3.7.0
Release: 1%{?dist}
Summary: Library implementing the jitter entropy source
License: BSD-3-Clause OR GPL-2.0-only
@ -13,6 +13,10 @@ BuildRequires: make
# Disable Upstream Makefiles debuginfo strip on install
Patch0: jitterentropy-rh-makefile.patch
# Gcc with -std=c11 defines __powerpc__ only
Patch1: jitterentropy-powerpc.patch
# Restore previous jitterentropy public api
Patch2: jitterentropy-api.patch
%description
Library implementing the CPU jitter entropy source
@ -32,8 +36,8 @@ Development headers and libraries for jitterentropy
%make_build
%install
mkdir -p %{buildroot}/usr/include/
%make_install PREFIX=/usr LIBDIR=%{_lib}
mkdir -p %{buildroot}%{_includedir}
%make_install PREFIX=%{_prefix} LIBDIR=%{_lib}
%files
%doc README.md CHANGES.md
@ -46,6 +50,12 @@ mkdir -p %{buildroot}/usr/include/
%{_mandir}/man3/*
%changelog
* Wed May 20 2026 Vladislav Dronov <vdronov@redhat.com> - 3.7.0-1
- Update to the upstream v3.7.0 @ e783cf1c (RHEL-176348)
- Fix PowerPC architecture detection code
- Simplify jent_get_nstime() for PowerPC
- Restore previous jitterentropy public api
* Tue Oct 29 2024 Troy Dawson <tdawson@redhat.com> - 3.6.0-2
- Bump release for October 2024 mass rebuild:
Resolves: RHEL-64018

View File

@ -1 +1 @@
SHA512 (jitterentropy-library-3.6.0.tar.gz) = d31801d5201f8a5435a8332064ef599d568d42168b708d8e5d72dfec9d80d3d814dcb8c9714d2738919662e8da851e25045cc237c92c9e473b97c3f6861f6929
SHA512 (jitterentropy-library-3.7.0.tar.gz) = 86efb4a0348a8426be9ce3742a9744f91f2bd201046463e3b5d530232735ae13f76fdc79105f683b97cfd211e9132a24f032dde817f83799e5776f472c182fc9