Skip to content

Commit 969ea87

Browse files
committed
[cryptotest] Remove leading 0 in modulo
The wycheproof testvector seem to have a leading 0. This means that a 512-byte modulo for RSA-4096 is actually 513-byte. Currently, the test framework fails because it expects a 512-byte value. Remove this leading 0. Signed-off-by: Pascal Nasahl <[email protected]>
1 parent 06f44d0 commit 969ea87

File tree

1 file changed

+6
-1
lines changed
  • sw/host/tests/crypto/rsa_kat/src

1 file changed

+6
-1
lines changed

sw/host/tests/crypto/rsa_kat/src/main.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,12 @@ fn run_rsa_testcase(
8787
};
8888

8989
// Convert the inputs into the expected format for the CL.
90-
let n: Vec<_> = test_case.n.iter().copied().rev().collect();
90+
let mut n: Vec<_> = test_case.n.iter().copied().rev().collect();
91+
// n in the wycheproof vectors seem to start with a leading 0.
92+
if n.len() != test_case.security_level {
93+
// Remove it.
94+
n.pop();
95+
}
9196

9297
CryptotestCommand::Rsa.send(spi_console)?;
9398
let _operation = &match test_case.operation.as_str() {

0 commit comments

Comments
 (0)