Merge cfcda0a095b8e2a17077a82110b4e6d47c437d4d into f4a1aceb8ca7198b11447d6e1885ce70feb2dcc6

This commit is contained in:
makejian 2026-07-27 21:01:36 +01:00 committed by GitHub
commit 08b8c063ec
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 1 deletions

View File

@ -0,0 +1,8 @@
Bugfix
* Fix the TriCore MULADDC inline assembly in library/bn_mul.h which was
missing register d5 (the high half of the e4 carry-in pair) from its
clobber list. On TriCore 1.8 (AURIX TC4xx) the compiler could allocate
a live value in d5 across the asm block, which the asm then overwrote,
corrupting the carry chain. This produced wrong results in
mbedtls_mpi_core_mla, making mbedtls_mpi_mod_mpi loop forever. Declare
all data registers the asm writes so the compiler does not reuse them.

View File

@ -653,7 +653,8 @@
"st.a %2, %%a2 \n\t" \
: "=m" (c), "=m" (d), "=m" (s) \
: "m" (s), "m" (d), "m" (c), "m" (b) \
: "d0", "d1", "e2", "d4", "a2", "a3" \
: "d0", "d1", "d2", "d3", "d4", "d5", \
"a2", "a3" \
);
#endif /* TriCore */