[Cryptech-Commits] [core/math/modexp] 01/01: Cleanup of result checking code to make it easier to see any errors.
git at cryptech.is
git at cryptech.is
Tue Jun 2 11:57:12 UTC 2015
This is an automated email from the git hooks/post-receive script.
joachim at secworks.se pushed a commit to branch master
in repository core/math/modexp.
commit d23f8319c764eaa3712c129fab9d650c21eee34d
Author: Joachim Strömbergson <joachim at secworks.se>
Date: Tue Jun 2 13:57:08 2015 +0200
Cleanup of result checking code to make it easier to see any errors.
---
src/model/c/src/bignum_uint32_t.c | 24 +++++++++++++++++-------
1 file changed, 17 insertions(+), 7 deletions(-)
diff --git a/src/model/c/src/bignum_uint32_t.c b/src/model/c/src/bignum_uint32_t.c
index 956e755..5ae367c 100644
--- a/src/model/c/src/bignum_uint32_t.c
+++ b/src/model/c/src/bignum_uint32_t.c
@@ -8,14 +8,24 @@ void assertArrayEquals(uint32_t length, uint32_t *expected, uint32_t *actual) {
int equals = 1;
for (uint32_t i = 0; i < length; i++)
equals &= expected[i] == actual[i];
- printf("%s expected: [", equals ? "PASS" : "FAIL");
- for (uint32_t i = 0; i < length - 1; i++)
- printf("%8x, ", expected[i]);
+ printf("%s expected: \n[", equals ? "PASS" : "FAIL");
+ for (uint32_t i = 0; i < length - 1; i++) {
+ if ((i > 0) && (!(i % 4)))
+ printf("\n ");
+ printf("0x%08x, ", expected[i]);
+ }
+ printf("0x%08x]", expected[length - 1]);
+
+ printf("\n");
+ printf("actual:\n[");
+ for (uint32_t i = 0; i < length - 1; i++) {
+ if ((i > 0) && (!(i % 4)))
+ printf("\n ");
+ printf("0x%08x, ", actual[i]);
+ }
+ printf("0x%08x]\n", actual[length - 1]);
+
printf("\n");
- printf("%8x] actual: [ ", expected[length - 1]);
- for (uint32_t i = 0; i < length - 1; i++)
- printf("%8x, ", actual[i]);
- printf("%8x]\n", actual[length - 1]);
assert_array_total++;
if (!equals)
assert_array_error++;
More information about the Commits
mailing list