Skip to content

Conversation

@romanz
Copy link
Contributor

@romanz romanz commented Oct 30, 2025

Also, set it when building with STORAGE_INSECURE_TESTING_MODE=1 (similar to DISABLE_OPTIGA).

@trezor-bot trezor-bot bot added this to Firmware Oct 30, 2025
@github-project-automation github-project-automation bot moved this to 🔎 Needs review in Firmware Oct 30, 2025
@github-actions
Copy link

github-actions bot commented Oct 30, 2025

en main(all)

model device_test click_test persistence_test
T2T1 test(all) main(all) test(all) main(all) test(all) main(all)
T3B1 test(all) main(all) test(all) main(all) test(all) main(all)
T3T1 test(all) main(all) test(all) main(all) test(all) main(all)
T3W1 test(all) main(all) test(all) main(all) test(all) main(all)

Latest CI run: 18965869516

@romanz romanz requested review from cepetr and matejcik October 30, 2025 21:15
@romanz romanz self-assigned this Oct 30, 2025
@romanz
Copy link
Contributor Author

romanz commented Oct 30, 2025

Tested locally with:

$ STORAGE_INSECURE_TESTING_MODE=1 BOOTLOADER_DEVEL=1 BOOTLOADER_QA=1 TREZOR_MODEL=T3W1 PYOPT=0 make -C core build_firmware
$ pytest -v tests/device_tests/

@romanz romanz marked this pull request as ready for review October 31, 2025 07:31
@romanz romanz requested a review from obrusvit as a code owner October 31, 2025 07:31
@romanz romanz added the T3W1 label Oct 31, 2025
@romanz
Copy link
Contributor Author

romanz commented Oct 31, 2025

Without this PR, secmon build fails with:

$ QUIET_MODE=1 STORAGE_INSECURE_TESTING_MODE=1 BOOTLOADER_DEVEL=1 BOOTLOADER_QA=1 TREZOR_MODEL=T3W1 PYOPT=0 make -C core build_firmware
...
scons -Q -j 12 --quiet BENCHMARK="0" BITCOIN_ONLY="0" BOOTLOADER_DEVEL="1" BOOTLOADER_QA="1" UNSAFE_FW="0" CFLAGS="-DSCM_REVISION_INIT='{0x43,0xff,0x03,0x5d,0x1e,0x3c,0x7d,0x5a,0xcd,0x89,0xca,0x41,0x13,0x62,0x04,0x85,0x6f,0x0c,0xfb,0x07,}'" CMAKELISTS="0" DISABLE_OPTIGA="0" DISABLE_TROPIC="1" HW_REVISION="" LOG_STACK_USAGE="0" MICROPY_ENABLE_SOURCE_LINE="0" PRODUCTION="0" PYOPT="0" QUIET_MODE="1" SCM_REVISION="'43ff035d1e3c7d5acd89ca41136204856f0cfb07'" STORAGE_INSECURE_TESTING_MODE="1" THP="1" TREZOR_DISABLE_ANIMATION="1" TREZOR_EMULATOR_ASAN="0" TREZOR_EMULATOR_DEBUGGABLE=0 TREZOR_MEMPERF="0" TREZOR_MODEL="T3W1" UI_PERFORMANCE_OVERLAY="0" BLOCK_ON_VCP="0" DBG_CONSOLE=""  build/secmon/secmon.bin
embed/sec/tropic/tropic.c: In function 'tropic_pin_unmask_kek':
embed/sec/tropic/tropic.c:606:3: error: static assertion failed: "R_MEM_DATA_SIZE_MAX too small"
  606 |   _Static_assert(
      |   ^~~~~~~~~~~~~~

@romanz
Copy link
Contributor Author

romanz commented Oct 31, 2025

It happens due to reduced PIN_MAX_TRIES (67dcf30):

// Maximum number of failed unlock attempts.
// NOTE: The PIN counter logic relies on this constant being less than or equal
// to 16.
#if USE_TROPIC && USE_OPTIGA
// If both Optiga and Tropic are used, every PIN attempt requires a stretched
// PIN slot on Optiga. This restricts the total number of PIN
// attempts.
#define PIN_MAX_TRIES 10
#else
#define PIN_MAX_TRIES 16
#endif

Whereas R_MEM_DATA_SIZE_MAX stays the same:

_Static_assert(
R_MEM_DATA_SIZE_MAX >= PIN_MAX_TRIES * TROPIC_MAC_AND_DESTROY_SIZE,
"R_MEM_DATA_SIZE_MAX too small");

@cepetr
Copy link
Contributor

cepetr commented Oct 31, 2025

After discussion with @andrew, I prepared PR #6097, which addresses the issue with PIN_MAX_TRIES.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: 🔎 Needs review

Development

Successfully merging this pull request may close these issues.

3 participants