Skip to content

Commit 6627135

Browse files
committed
update lrng
1 parent 77a4a85 commit 6627135

30 files changed

Lines changed: 203 additions & 115 deletions

File tree

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
--- linux-6.12.62.orig/kernel/sched/core.c 2025-12-12 18:37:22.000000000 +0100
2+
+++ linux-6.12.62/kernel/sched/core.c 2025-12-12 20:52:21.162357901 +0100
3+
@@ -7,6 +7,8 @@
4+
* Copyright (C) 1991-2002 Linus Torvalds
5+
* Copyright (C) 1998-2024 Ingo Molnar, Red Hat
6+
*/
7+
+#define INSTANTIATE_EXPORTED_MIGRATE_DISABLE
8+
+#include <linux/sched.h>
9+
#include <linux/highmem.h>
10+
#include <linux/hrtimer_api.h>
11+
#include <linux/ktime_api.h>

PATCH/kernel/lrng/696-v59-0001-LRNG-Entropy-Source-and-DRNG-Manager.patch renamed to PATCH/kernel/lrng/696-v60-0001-LRNG-Entropy-Source-and-DRNG-Manager.patch

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
From 14dbacba9d2b0fed496d74908539385dd391820b Mon Sep 17 00:00:00 2001
1+
From de92c8e12d9306f8166942c0b40b8d139856ca2b Mon Sep 17 00:00:00 2001
22
From: Stephan Mueller <smueller@chronox.de>
33
Date: Sat, 1 Feb 2025 11:53:01 +0100
4-
Subject: [PATCH v58 01/25] LRNG: Entropy Source and DRNG Manager
4+
Subject: [PATCH v60 01/25] LRNG: Entropy Source and DRNG Manager
55

66
The kernel crypto API contains deterministic random number generators
77
(DRNG) which a caller must seed and reseed. The task of seeding a DRNG
@@ -201,7 +201,7 @@ Signed-off-by: Stephan Mueller <smueller@chronox.de>
201201
create mode 100644 include/linux/lrng.h
202202

203203
diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig
204-
index 8fb33c90482f..0a09ee313ada 100644
204+
index d2cfc584e202..7f5de8969a49 100644
205205
--- a/drivers/char/Kconfig
206206
+++ b/drivers/char/Kconfig
207207
@@ -423,4 +423,6 @@ config ADI
@@ -212,10 +212,10 @@ index 8fb33c90482f..0a09ee313ada 100644
212212
+
213213
endmenu
214214
diff --git a/drivers/char/Makefile b/drivers/char/Makefile
215-
index e9b360cdc99a..ee08348a94b8 100644
215+
index 1291369b9126..455c6dfb050e 100644
216216
--- a/drivers/char/Makefile
217217
+++ b/drivers/char/Makefile
218-
@@ -43,3 +43,5 @@ obj-$(CONFIG_PS3_FLASH) += ps3flash.o
218+
@@ -44,3 +44,5 @@ obj-$(CONFIG_PS3_FLASH) += ps3flash.o
219219
obj-$(CONFIG_XILLYBUS_CLASS) += xillybus/
220220
obj-$(CONFIG_POWERNV_OP_PANEL) += powernv-op-panel.o
221221
obj-$(CONFIG_ADI) += adi.o
@@ -1461,7 +1461,7 @@ index 000000000000..7ae10f20b4b8
14611461
+#endif /* _LRNG_DRNG_ATOMIC_H */
14621462
diff --git a/drivers/char/lrng/lrng_drng_chacha20.c b/drivers/char/lrng/lrng_drng_chacha20.c
14631463
new file mode 100644
1464-
index 000000000000..31be102e3007
1464+
index 000000000000..36960fdd715c
14651465
--- /dev/null
14661466
+++ b/drivers/char/lrng/lrng_drng_chacha20.c
14671467
@@ -0,0 +1,195 @@
@@ -1504,7 +1504,7 @@ index 000000000000..31be102e3007
15041504
+ BUILD_BUG_ON(CHACHA_BLOCK_SIZE != 2 * CHACHA_KEY_SIZE);
15051505
+
15061506
+ if (used_words > CHACHA_KEY_SIZE_WORDS) {
1507-
+ chacha20_block(&chacha20->constants[0], (u8 *)tmp);
1507+
+ chacha20_block((struct chacha_state *)chacha20, (u8 *)tmp);
15081508
+ for (i = 0; i < CHACHA_KEY_SIZE_WORDS; i++)
15091509
+ chacha20->key.u[i] ^= le32_to_cpu(tmp[i]);
15101510
+ memzero_explicit(tmp, sizeof(tmp));
@@ -1574,13 +1574,13 @@ index 000000000000..31be102e3007
15741574
+ int zeroize_buf = 0;
15751575
+
15761576
+ while (outbuflen >= CHACHA_BLOCK_SIZE) {
1577-
+ chacha20_block(&chacha20->constants[0], outbuf);
1577+
+ chacha20_block((struct chacha_state *)chacha20, outbuf);
15781578
+ outbuf += CHACHA_BLOCK_SIZE;
15791579
+ outbuflen -= CHACHA_BLOCK_SIZE;
15801580
+ }
15811581
+
15821582
+ if (outbuflen) {
1583-
+ chacha20_block(&chacha20->constants[0], (u8 *)aligned_buf);
1583+
+ chacha20_block((struct chacha_state *)chacha20, (u8 *)aligned_buf);
15841584
+ memcpy(outbuf, aligned_buf, outbuflen);
15851585
+ used = ((outbuflen + sizeof(aligned_buf[0]) - 1) /
15861586
+ sizeof(aligned_buf[0]));
@@ -1662,7 +1662,7 @@ index 000000000000..31be102e3007
16621662
+#endif /* CONFIG_LRNG_DFLT_DRNG_CHACHA20 */
16631663
diff --git a/drivers/char/lrng/lrng_drng_chacha20.h b/drivers/char/lrng/lrng_drng_chacha20.h
16641664
new file mode 100644
1665-
index 000000000000..fee6571281b6
1665+
index 000000000000..8e1eb8c1ec96
16661666
--- /dev/null
16671667
+++ b/drivers/char/lrng/lrng_drng_chacha20.h
16681668
@@ -0,0 +1,42 @@
@@ -1696,7 +1696,7 @@ index 000000000000..fee6571281b6
16961696
+
16971697
+static inline void lrng_cc20_init_rfc7539(struct chacha20_block *chacha20)
16981698
+{
1699-
+ chacha_init_consts(chacha20->constants);
1699+
+ chacha_init_consts((struct chacha_state *)chacha20->constants);
17001700
+}
17011701
+
17021702
+#define LRNG_CC20_INIT_RFC7539(x) \
@@ -3078,7 +3078,7 @@ index 000000000000..cf982b9eea05
30783078
+#endif /* _LRNG_ES_RANDOM_H */
30793079
diff --git a/drivers/char/lrng/lrng_es_mgr.c b/drivers/char/lrng/lrng_es_mgr.c
30803080
new file mode 100644
3081-
index 000000000000..4ed5de545a3a
3081+
index 000000000000..54c1f57cad1e
30823082
--- /dev/null
30833083
+++ b/drivers/char/lrng/lrng_es_mgr.c
30843084
@@ -0,0 +1,528 @@
@@ -3260,7 +3260,7 @@ index 000000000000..4ed5de545a3a
32603260
+ lrng_state.all_online_numa_node_seeded = false;
32613261
+
32623262
+#ifdef CONFIG_VDSO_GETRANDOM
3263-
+ WRITE_ONCE(__arch_get_k_vdso_rng_data()->is_ready, false);
3263+
+ WRITE_ONCE(vdso_k_rng_data->is_ready, false);
32643264
+#endif
32653265
+
32663266
+ pr_debug("reset LRNG\n");
@@ -3304,7 +3304,7 @@ index 000000000000..4ed5de545a3a
33043304
+ * The LRNG does not enable the user space ChaCha20
33053305
+ * DRNG in the VDSO.
33063306
+ */
3307-
+ /* WRITE_ONCE(__arch_get_k_vdso_rng_data()->is_ready, true); */
3307+
+ /* WRITE_ONCE(vdso_k_rng_data->is_ready, true); */
33083308
+#endif
33093309
+
33103310
+ wake_up_all(&lrng_init_wait);
@@ -3374,7 +3374,7 @@ index 000000000000..4ed5de545a3a
33743374
+ lrng_state.lrng_fully_seeded = false;
33753375
+
33763376
+#ifdef CONFIG_VDSO_GETRANDOM
3377-
+ WRITE_ONCE(__arch_get_k_vdso_rng_data()->is_ready, false);
3377+
+ WRITE_ONCE(vdso_k_rng_data->is_ready, false);
33783378
+#endif
33793379
+
33803380
+ /* If sufficient entropy is available, reseed now. */
@@ -4448,5 +4448,5 @@ index 000000000000..c0d31a03d51f
44484448
+
44494449
+#endif /* _LRNG_H */
44504450
--
4451-
2.48.1
4451+
2.52.0
44524452

PATCH/kernel/lrng/696-v59-0002-LRNG-allocate-one-DRNG-instance-per-NUMA-node.patch renamed to PATCH/kernel/lrng/696-v60-0002-LRNG-allocate-one-DRNG-instance-per-NUMA-node.patch

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
From 52bcb0383d35bf973c69f76c6afce0e2b8eee218 Mon Sep 17 00:00:00 2001
1+
From 4f7fc946c0b33011878536839cdb5a9b2a65a345 Mon Sep 17 00:00:00 2001
22
From: Stephan Mueller <smueller@chronox.de>
33
Date: Sun, 15 May 2022 15:40:46 +0200
4-
Subject: [PATCH v58 02/25] LRNG - allocate one DRNG instance per NUMA node
4+
Subject: [PATCH v60 02/25] LRNG - allocate one DRNG instance per NUMA node
55

66
In order to improve NUMA-locality when serving getrandom(2) requests,
77
allocate one DRNG instance per node.
@@ -203,5 +203,5 @@ index 000000000000..e8097abe7fbd
203203
+
204204
+#endif /* _LRNG_PROC_H */
205205
--
206-
2.48.1
206+
2.52.0
207207

PATCH/kernel/lrng/696-v59-0003-LRNG-proc-interface.patch renamed to PATCH/kernel/lrng/696-v60-0003-LRNG-proc-interface.patch

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
From 15f76bc8cb79cb19d06f4051566a0993822cf8cc Mon Sep 17 00:00:00 2001
1+
From 0a617c850a9308b0814b8bc11d3df10f8119afc9 Mon Sep 17 00:00:00 2001
22
From: Stephan Mueller <smueller@chronox.de>
33
Date: Sun, 18 Dec 2022 21:12:42 +0100
4-
Subject: [PATCH v58 03/25] LRNG - /proc interface
4+
Subject: [PATCH v60 03/25] LRNG - /proc interface
55

66
The patch adds the file lrng_type which provides details about
77
the LRNG:
@@ -141,5 +141,5 @@ index e8097abe7fbd..c653274f1954 100644
141141

142142
#endif /* _LRNG_PROC_H */
143143
--
144-
2.48.1
144+
2.52.0
145145

PATCH/kernel/lrng/696-v59-0004-LRNG-add-switchable-DRNG-support.patch renamed to PATCH/kernel/lrng/696-v60-0004-LRNG-add-switchable-DRNG-support.patch

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
From 821cb98802bd93c5391122d6c06c7dd83a33ce3c Mon Sep 17 00:00:00 2001
1+
From 254d147ec31cde4209ba20a4fd3f4f6e98ec5a8a Mon Sep 17 00:00:00 2001
22
From: Stephan Mueller <smueller@chronox.de>
33
Date: Mon, 20 Feb 2023 22:02:06 +0100
4-
Subject: [PATCH v58 04/25] LRNG - add switchable DRNG support
4+
Subject: [PATCH v60 04/25] LRNG - add switchable DRNG support
55

66
The DRNG switch support allows replacing the DRNG mechanism of the
77
LRNG. The switching support rests on the interface definition of
@@ -369,5 +369,5 @@ index 000000000000..13c70797b193
369369
+}
370370
+EXPORT_SYMBOL(lrng_set_hash_cb);
371371
--
372-
2.48.1
372+
2.52.0
373373

PATCH/kernel/lrng/696-v59-0005-LRNG-add-common-generic-hash-support.patch renamed to PATCH/kernel/lrng/696-v60-0005-LRNG-add-common-generic-hash-support.patch

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
From 366527aa272e899766c3ce81a3d2903fc208bb15 Mon Sep 17 00:00:00 2001
1+
From 69e6cf33bfac13b8f4c7973f461545454e837802 Mon Sep 17 00:00:00 2001
22
From: Stephan Mueller <smueller@chronox.de>
33
Date: Sun, 15 May 2022 16:01:44 +0200
4-
Subject: [PATCH v58 05/25] LRNG - add common generic hash support
4+
Subject: [PATCH v60 05/25] LRNG - add common generic hash support
55

66
The LRNG switchable DRNG support also allows the replacement of the hash
77
implementation used as conditioning component. The common generic hash
@@ -227,5 +227,5 @@ index 000000000000..13e62db9b6c8
227227
+MODULE_AUTHOR("Stephan Mueller <smueller@chronox.de>");
228228
+MODULE_DESCRIPTION("Entropy Source and DRNG Manager - Kernel crypto API hash backend");
229229
--
230-
2.48.1
230+
2.52.0
231231

PATCH/kernel/lrng/696-v59-0006-crypto-DRBG-externalize-DRBG-functions-for-LRNG.patch renamed to PATCH/kernel/lrng/696-v60-0006-crypto-DRBG-externalize-DRBG-functions-for-LRNG.patch

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
From 82507d3e0789b102d14ac868e743db95fdfcf63b Mon Sep 17 00:00:00 2001
1+
From 64d469ed717a896489488c11d7c154da9a049991 Mon Sep 17 00:00:00 2001
22
From: Stephan Mueller <smueller@chronox.de>
33
Date: Thu, 21 Mar 2024 14:17:33 +0100
4-
Subject: [PATCH v58 06/25] crypto: DRBG - externalize DRBG functions for LRNG
4+
Subject: [PATCH v60 06/25] crypto: DRBG - externalize DRBG functions for LRNG
55

66
This patch allows several DRBG functions to be called by the LRNG kernel
77
code paths outside the drbg.c file.
@@ -13,7 +13,7 @@ Signed-off-by: Stephan Mueller <smueller@chronox.de>
1313
2 files changed, 17 insertions(+), 6 deletions(-)
1414

1515
diff --git a/crypto/drbg.c b/crypto/drbg.c
16-
index f28dfc2511a2..2ad68a760d3b 100644
16+
index dbe4c8bb5ceb..af003950e0b3 100644
1717
--- a/crypto/drbg.c
1818
+++ b/crypto/drbg.c
1919
@@ -116,7 +116,7 @@
@@ -117,5 +117,5 @@ index af5ad51d3eef..b12ae9bdebf4 100644
117117
+
118118
#endif /* _DRBG_H */
119119
--
120-
2.48.1
120+
2.52.0
121121

PATCH/kernel/lrng/696-v59-0007-LRNG-add-SP800-90A-DRBG-extension.patch renamed to PATCH/kernel/lrng/696-v60-0007-LRNG-add-SP800-90A-DRBG-extension.patch

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
From 64709de89c3bd400220424f138e566160ef94ee9 Mon Sep 17 00:00:00 2001
1+
From f28b2800c9580e71ff3c048ff4d21274bb04bbf6 Mon Sep 17 00:00:00 2001
22
From: Stephan Mueller <smueller@chronox.de>
33
Date: Sun, 28 Jul 2024 21:39:01 +0200
4-
Subject: [PATCH v58 07/25] LRNG - add SP800-90A DRBG extension
4+
Subject: [PATCH v60 07/25] LRNG - add SP800-90A DRBG extension
55

66
Using the LRNG switchable DRNG support, the SP800-90A DRBG extension is
77
implemented.
@@ -369,5 +369,5 @@ index 000000000000..0da8150e0d42
369369
+
370370
+#endif /* CONFIG_LRNG_DFLT_DRNG_DRBG */
371371
--
372-
2.48.1
372+
2.52.0
373373

PATCH/kernel/lrng/696-v59-0008-LRNG-add-kernel-crypto-API-PRNG-extension.patch renamed to PATCH/kernel/lrng/696-v60-0008-LRNG-add-kernel-crypto-API-PRNG-extension.patch

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
From 783f0c8132e4b9f216c33eb114332ea7f6c950fb Mon Sep 17 00:00:00 2001
1+
From 23daf3bf2fd38c3bac7dd493a8c7cb14f6327503 Mon Sep 17 00:00:00 2001
22
From: Stephan Mueller <smueller@chronox.de>
33
Date: Mon, 20 Feb 2023 22:23:59 +0100
4-
Subject: [PATCH v58 08/25] LRNG - add kernel crypto API PRNG extension
4+
Subject: [PATCH v60 08/25] LRNG - add kernel crypto API PRNG extension
55

66
Add runtime-pluggable support for all PRNGs that are accessible via
77
the kernel crypto API, including hardware PRNGs. The PRNG is selected
@@ -311,5 +311,5 @@ index 000000000000..a204bcf52a9a
311311
+MODULE_DESCRIPTION("Entropy Source and DRNG Manager - kernel crypto API DRNG backend");
312312
+#endif /* CONFIG_LRNG_DFLT_DRNG_KCAPI */
313313
--
314-
2.48.1
314+
2.52.0
315315

PATCH/kernel/lrng/696-v59-0009-LRNG-add-atomic-DRNG-implementation.patch renamed to PATCH/kernel/lrng/696-v60-0009-LRNG-add-atomic-DRNG-implementation.patch

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
From a51860a2090866f64791c1700ef7c620e113f373 Mon Sep 17 00:00:00 2001
1+
From 9a307ca3026818f670f018280ad77c157dcb5710 Mon Sep 17 00:00:00 2001
22
From: Stephan Mueller <smueller@chronox.de>
33
Date: Mon, 20 Feb 2023 22:05:24 +0100
4-
Subject: [PATCH v58 09/25] LRNG - add atomic DRNG implementation
4+
Subject: [PATCH v60 09/25] LRNG - add atomic DRNG implementation
55

66
The atomic DRNG implementation supports the in-kernel use cases which
77
request random numbers in atomic contexts. It uses the ChaCha20 DRNG
@@ -163,5 +163,5 @@ index 000000000000..290d346ea128
163163
+}
164164
+EXPORT_SYMBOL(lrng_get_random_bytes);
165165
--
166-
2.48.1
166+
2.52.0
167167

0 commit comments

Comments
 (0)