git: 0339b24f8d30 - releng/15.0 - random: Have RANDOM_PURE_START be a cross-platform source
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 10 Nov 2025 18:54:47 UTC
The branch releng/15.0 has been updated by cperciva:
URL: https://cgit.FreeBSD.org/src/commit/?id=0339b24f8d30f92979c4ec5ba2556cd83cce9e98
commit 0339b24f8d30f92979c4ec5ba2556cd83cce9e98
Author: David E. O'Brien <obrien@FreeBSD.org>
AuthorDate: 2025-11-08 02:18:13 +0000
Commit: Colin Percival <cperciva@FreeBSD.org>
CommitDate: 2025-11-10 18:54:37 +0000
random: Have RANDOM_PURE_START be a cross-platform source
and one that will be with us in the long-term future.
(this helps reduce diffs in the future and for down-stream users
that trim entropy sources). Also, move deprecated (removed in 16.0)
sources to the bottom of the list to reduce changes to 15.x.
Approved by: re (cperciva)
Reviewed by: glebius
Obtained from: Juniper Networks
Differential Revision: https://reviews.freebsd.org/D53311
(cherry picked from commit 9f3886347c1750cf80a82314470fc7186088eb9a)
(cherry picked from commit e224f2c1b98ba065942c83d322cdb8e3987d0c81)
---
sys/dev/random/fenestrasX/fx_pool.c | 20 ++++++++++----------
sys/dev/random/random_harvestq.c | 8 ++++----
sys/sys/random.h | 8 ++++----
3 files changed, 18 insertions(+), 18 deletions(-)
diff --git a/sys/dev/random/fenestrasX/fx_pool.c b/sys/dev/random/fenestrasX/fx_pool.c
index 3aefe17a045a..35d06c2a9df1 100644
--- a/sys/dev/random/fenestrasX/fx_pool.c
+++ b/sys/dev/random/fenestrasX/fx_pool.c
@@ -167,13 +167,7 @@ static const struct fxrng_ent_char {
[RANDOM_RANDOMDEV] = {
.entc_cls = &fxrng_lo_push,
},
- [RANDOM_PURE_SAFE] = {
- .entc_cls = &fxrng_hi_push,
- },
- [RANDOM_PURE_GLXSB] = {
- .entc_cls = &fxrng_hi_push,
- },
- [RANDOM_PURE_HIFN] = {
+ [RANDOM_PURE_TPM] = {
.entc_cls = &fxrng_hi_push,
},
[RANDOM_PURE_RDRAND] = {
@@ -200,9 +194,6 @@ static const struct fxrng_ent_char {
[RANDOM_PURE_DARN] = {
.entc_cls = &fxrng_hi_pull,
},
- [RANDOM_PURE_TPM] = {
- .entc_cls = &fxrng_hi_push,
- },
[RANDOM_PURE_VMGENID] = {
.entc_cls = &fxrng_hi_push,
},
@@ -215,6 +206,15 @@ static const struct fxrng_ent_char {
[RANDOM_PURE_ARM_TRNG] = {
.entc_cls = &fxrng_hi_pull,
},
+ [RANDOM_PURE_SAFE] = {
+ .entc_cls = &fxrng_hi_push,
+ },
+ [RANDOM_PURE_GLXSB] = {
+ .entc_cls = &fxrng_hi_push,
+ },
+ [RANDOM_PURE_HIFN] = {
+ .entc_cls = &fxrng_hi_push,
+ },
};
CTASSERT(nitems(fxrng_ent_char) == ENTROPYSOURCE);
diff --git a/sys/dev/random/random_harvestq.c b/sys/dev/random/random_harvestq.c
index f2206044fe7d..0e90b4d6ef9b 100644
--- a/sys/dev/random/random_harvestq.c
+++ b/sys/dev/random/random_harvestq.c
@@ -662,9 +662,7 @@ static const char *random_source_descr[/*ENTROPYSOURCE*/] = {
[RANDOM_UMA] = "UMA",
[RANDOM_CALLOUT] = "CALLOUT",
[RANDOM_RANDOMDEV] = "RANDOMDEV", /* ENVIRONMENTAL_END */
- [RANDOM_PURE_SAFE] = "PURE_SAFE", /* PURE_START */
- [RANDOM_PURE_GLXSB] = "PURE_GLXSB",
- [RANDOM_PURE_HIFN] = "PURE_HIFN",
+ [RANDOM_PURE_TPM] = "PURE_TPM", /* PURE_START */
[RANDOM_PURE_RDRAND] = "PURE_RDRAND",
[RANDOM_PURE_RDSEED] = "PURE_RDSEED",
[RANDOM_PURE_NEHEMIAH] = "PURE_NEHEMIAH",
@@ -673,11 +671,13 @@ static const char *random_source_descr[/*ENTROPYSOURCE*/] = {
[RANDOM_PURE_BROADCOM] = "PURE_BROADCOM",
[RANDOM_PURE_CCP] = "PURE_CCP",
[RANDOM_PURE_DARN] = "PURE_DARN",
- [RANDOM_PURE_TPM] = "PURE_TPM",
[RANDOM_PURE_VMGENID] = "PURE_VMGENID",
[RANDOM_PURE_QUALCOMM] = "PURE_QUALCOMM",
[RANDOM_PURE_ARMV8] = "PURE_ARMV8",
[RANDOM_PURE_ARM_TRNG] = "PURE_ARM_TRNG",
+ [RANDOM_PURE_SAFE] = "PURE_SAFE",
+ [RANDOM_PURE_GLXSB] = "PURE_GLXSB",
+ [RANDOM_PURE_HIFN] = "PURE_HIFN",
/* "ENTROPYSOURCE" */
};
CTASSERT(nitems(random_source_descr) == ENTROPYSOURCE);
diff --git a/sys/sys/random.h b/sys/sys/random.h
index af6b1e117423..64f2a1e1b40c 100644
--- a/sys/sys/random.h
+++ b/sys/sys/random.h
@@ -89,9 +89,7 @@ enum random_entropy_source {
RANDOM_ENVIRONMENTAL_END = RANDOM_RANDOMDEV,
/* Fast hardware random-number sources from here on. */
RANDOM_PURE_START,
- RANDOM_PURE_SAFE = RANDOM_PURE_START,
- RANDOM_PURE_GLXSB,
- RANDOM_PURE_HIFN,
+ RANDOM_PURE_TPM = RANDOM_PURE_START,
RANDOM_PURE_RDRAND,
RANDOM_PURE_RDSEED,
RANDOM_PURE_NEHEMIAH,
@@ -100,11 +98,13 @@ enum random_entropy_source {
RANDOM_PURE_BROADCOM,
RANDOM_PURE_CCP,
RANDOM_PURE_DARN,
- RANDOM_PURE_TPM,
RANDOM_PURE_VMGENID,
RANDOM_PURE_QUALCOMM,
RANDOM_PURE_ARMV8,
RANDOM_PURE_ARM_TRNG,
+ RANDOM_PURE_SAFE,
+ RANDOM_PURE_GLXSB,
+ RANDOM_PURE_HIFN,
ENTROPYSOURCE
};
_Static_assert(ENTROPYSOURCE <= 32,