[Cryptech-Commits] [sw/libhal] 29/58: Operand lengths weren't including bug-workaround padding.

git at cryptech.is git at cryptech.is
Tue Jul 7 18:25:13 UTC 2015


This is an automated email from the git hooks/post-receive script.

sra at hactrn.net pushed a commit to branch master
in repository sw/libhal.

commit 5d21abbc8a727b7a586a91d0fc5c704deb1a69a4
Author: Rob Austein <sra at hactrn.net>
Date:   Wed Jun 10 18:52:16 2015 -0400

    Operand lengths weren't including bug-workaround padding.
---
 modexp.c         | 4 ++--
 tests/test-rsa.c | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/modexp.c b/modexp.c
index 7444d57..5c72f36 100644
--- a/modexp.c
+++ b/modexp.c
@@ -186,10 +186,10 @@ hal_error_t hal_modexp(const uint8_t * const msg, const size_t msg_len, /* Messa
 
   check(set_blockmem(MODEXP_MODULUS_PTR_RST, MODEXP_MODULUS_DATA, mod, mod_len, io_len));
   check(set_blockmem(MODEXP_MESSAGE_PTR_RST, MODEXP_MESSAGE_DATA, msg, msg_len, io_len));
-  check(set_register(MODEXP_MODULUS_LENGTH, mod_len / 4));
+  check(set_register(MODEXP_MODULUS_LENGTH, /* mod_len */ io_len / 4));
 
   check(set_blockmem(MODEXP_EXPONENT_PTR_RST, MODEXP_EXPONENT_DATA, exp, exp_len, io_len));
-  check(set_register(MODEXP_EXPONENT_LENGTH, exp_len / 4));
+  check(set_register(MODEXP_EXPONENT_LENGTH, /* exp_len */ io_len / 4));
 
   check(hal_io_wait_ready(MODEXP_ADDR_STATUS));
 
diff --git a/tests/test-rsa.c b/tests/test-rsa.c
index 5491399..150c6eb 100644
--- a/tests/test-rsa.c
+++ b/tests/test-rsa.c
@@ -82,7 +82,7 @@ static int test_modexp(const char * const kind,
 
 static int test_rsa(const rsa_tc_t * const tc)
 {
-  return (test_modexp("Signature",    tc, &tc->m, &tc->d, &tc->s) || /* RSA decryption */
+  return (test_modexp("Signature",    tc, &tc->m, &tc->d, &tc->s) && /* RSA decryption */
           test_modexp("Verification", tc, &tc->s, &tc->e, &tc->m));  /* RSA encryption */
 }
 



More information about the Commits mailing list