rng: symlink COLDCARD/rng.c to the Mk4 file instead of duplicating it - #698
rng: symlink COLDCARD/rng.c to the Mk4 file instead of duplicating it#698Silexperience210 wants to merge 1 commit into
Conversation
|
already here #695 This PR is opened against wrong branch - close pls and review 695 if possible - thanks |
|
Unless I'm missing something, the CC and CC4 --- rng-cc.c 2026-08-04 13:50:08.269177951 +0000
+++ rng-cc4.c 2026-08-04 13:50:35.431394302 +0000
@@ -54,8 +54,8 @@
#define RNG_TIMEOUT_MS (10)
#define RNG_MAX_ATTEMPTS (3)
-// Clock-error flags (CEIS/CECS) are intentionally ignored: per RM0351
-// "Error management", "the clock error has no impact on generated random
+// Clock-error flags (CEIS/CECS) are intentionally ignored: per RM0432
+// section 32.3.7, "the clock error has no impact on generated random
// numbers", and ST's errata (ES0250/ES0335) confirm a clock error neither
// stops generation nor invalidates RNG_DR when DRDY is set. A dead clock
// still fails closed via the DRDY timeout below. CEIS is left set on
@@ -75,7 +75,7 @@
RNG->CR &= ~RNG_CR_RNGEN;
RNG->CR |= RNG_CR_RNGEN;
- // RM0351 "Error management": after clearing SEIS, read out 12 words from RNG_DR and
+ // RM0432 32.3.7: after clearing SEIS, read out 12 words from RNG_DR and
// discard each of them to clean the pipeline of pre-error residue.
// Bounded: if the error recurs or DRDY stops arriving, bail out and let
// the next attempt's flag checks and DRDY timeout handle it. |
Per @geldot on Coldcard#698: after Coldcard#693 the two files are identical apart from comments, so there is no reason to carry two copies. They were in fact byte-identical on master before either PR. COLDCARD_Q1/rng.c is already a symlink to the same file, so this just applies the existing pattern. Note this is tree hygiene, not a fix. master has no Mk3 build target (MK-Makefile sets BOARD=COLDCARD_MK4, Q1-Makefile sets COLDCARD_Q1), so stm32/COLDCARD/rng.c is never compiled from this branch. The Mk3 firmware ships from v4-legacy, which carries its own copy. Filed separately against that branch.
df38583 to
fe73918
Compare
|
Good catch, thank you — rewritten as a symlink. Chasing it down turned up the bigger problem: Also correcting myself on the reference: my RM0351 retarget was a search-and-replace, and |
|
Apologies — I missed your comment above before pushing the rewrite, and answered @geldot's Closing #699 too. I opened it against |
|
Np, thanks for contributing. |
Replaces the original contents of this PR. @geldot is right: after #693 the two files
are identical apart from comments, and they were byte-identical on
masterbefore eitherPR touched them.
COLDCARD_Q1/rng.cis already a symlink to../COLDCARD_MK4/rng.c, sothis just applies the pattern already in the tree.
Two corrections to what I originally filed here, both worth stating plainly:
This branch does not build the Mk3.
MK-MakefilesetsBOARD=COLDCARD_MK4andQ1-MakefilesetsBOARD=COLDCARD_Q1; there is no Mk3 target. Sostm32/COLDCARD/rng.con
masteris never compiled, and my original commit here was patching a file that doesnot reach any device. The Mk3 code that shipped as 4.2.0 lives on
v4-legacy. Filedseparately as a PR against that branch.
My RM0351 retarget was not verified. The only substantive thing I changed relative to
#693 was the reference. The 12-word pipeline flush is RM0432 wording; the older L4-series
manual documents the shorter clear-SEIS-then-toggle-RNGEN sequence. I retargeted the
citation by search-and-replace without checking that the newer procedure appears there,
which was sloppy. Collapsing to a symlink removes the question entirely.
So: tree hygiene only, no functional change. Close it if you would rather keep the two
files separate for future divergence.