You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
crypto: Use actual mod_size instead of declared byte-padded size (#1475)
The modexp function was using mod_size derived from the byte length of
the input (declared_mod_size), which includes leading zero padding. This
caused the CRT combine's mul(result, mod_odd, y) to receive an oversized
result buffer, violating the mul() assert that r.size() <= x.size() +
y.size().
Return the actual trimmed mod_size from load_mod and use it for the CRT
mul/add operations. The result buffer is still allocated at
declared_mod_size (needed for store()), but CRT operations use the
trimmed mod_size.
Add regression test: 3^3 mod 12 encoded as 32 bytes (4 words padded, but
value only needs 1 word).
0 commit comments