chore: bake QR scan glyph into device fonts - #58
Open
oroderico wants to merge 23 commits into
Open
Conversation
Drop 22 OpenMV image-processing source files (~50.5k lines) whose symbols are unreachable from Krux Python.
image_entropy_16b() copied the whole input frame into a scratch buffer sized for QVGA RGB565 (320*240*2 = 153600 bytes). A CIF frame, which the Maix Bit produced, is 352*288*2 = 202752 bytes and overflowed it by 49152 bytes. Drop the scratch copy and read the caller's buffer directly, which also frees 150KB of heap per call. Cap the read length at QVGA and round it down to whole 16 bit pixels so the i + 1 read stays in bounds on odd-length input. The cap also preserves the invariant that at most one pixel value can exceed a uint16_t count.
No Krux code ever called os.urandom(), and it plays no part in generating keys, mnemonics, or any other secret. Entropy for those comes from the camera or from dice rolls, and none of that is affected by this change. The function was backed by rng_get(), a Yasmarang PRNG with a hardcoded initial state, so it returned the same byte stream on every boot. Its name, and its comment claiming a hardware random number, made it look like a safe source, so a future contributor could reasonably have reached for it. Remove the binding so that cannot happen, and document rng_get() as deterministic. rng_get() itself stays, since mbedtls and lwIP need the symbol. The separate urandom module is unaffected.
Support for the device was discontinued in Krux 25.09.0 and it has no known users. Its CIF framesize was also the only path that triggered the shannon heap overflow.
Adds 选项 and 션옵, needed by the new Chinese and Korean translations of the grouped Wallet Options entry.
gcm_get_tag() drains 4 hardware registers into the caller's buffer and reads them back through a uint32_t* cast, but aes.h documents a 4 byte buffer. AES_run() followed the header, so every GCM encrypt and decrypt wrote 12 bytes past the end of a stack array. Widen the local to 16 bytes with 4 byte alignment, and copy using sizeof(self->gcm_tag) so the struct field stays 4 bytes. digest() and verify() return the same bytes as before, so existing KEF envelopes are unaffected. Document why mac_len stays pinned at 4, since the SDK header still claims a 4 byte tag buffer and the upper 12 tag bytes are unverified.
…flow fix: size GCM tag buffer to the 16 bytes the SDK writes
Adds the QR scan glyph at the private-use codepoint U+E000 to the wide font of every device profile, used by the keypad scan action in krux. Output of bdftokff.py from the krux tree. Co-authored-by: Naman Gupta <55298452+Naman015@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What is this PR for?
Bakes the QR scan glyph into the wide font of every device profile, at the
private-use codepoint
U+E000.This is a dependency of selfcustody/krux#811,
which adds a QR scan action to Krux's text keypads. The glyph is the key label
for that action. Without it the key renders blank on device.
The direction was agreed in that PR's discussion: @odudex asked for the glyph to
live in the BDF sources and be baked into MaixPy rather than drawn at runtime.
What it changes
Regenerated
font_device.hfor the ten device projects:maixpy_amigo,maixpy_cube,maixpy_dock,maixpy_embed_fire,maixpy_m5stickv,maixpy_tzt,maixpy_wonder_k,maixpy_wonder_mv,maixpy_yahboom,maixpy_yahboom_devkit.The output comes from
bdftokff.pyin the Krux tree, from theqr-u14.bdf/qr-u16.bdf/qr-u24.bdfsources added in krux#811(8x14, 8x16 and 12x24 cells).
Only the
U+E000slot changes; no existing glyph is touched.Why it is separate
krux#811's submodule pointer currently references a commit that only exists
locally, which breaks
git submodule update --recursivefor reviewers and failsevery CI job at checkout. Merging this lets that PR point at a published commit.
The glyph design is @Naman015's, credited as coauthor on the commit.
Validation
Built and flashed on a TZT. Glyph renders on the keypad scan key at all three
font heights.