[PATCH] libosmocore[master]: kasumi_test.c: fix incomplete check

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Vadim Yanitskiy gerrit-no-reply at lists.osmocom.org
Sun May 14 17:28:24 UTC 2017


Review at  https://gerrit.osmocom.org/2590

kasumi_test.c: fix incomplete check

Previously the 'passed' variable in test_expansion() was being
overwritten on every call of _compare_mem(), so only the result
of last call influenced the test result.

Change-Id: Ibf3ab453c20c7eeec234b95bfe14b497c572c35f
---
M tests/kasumi/kasumi_test.c
1 file changed, 8 insertions(+), 8 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/90/2590/1

diff --git a/tests/kasumi/kasumi_test.c b/tests/kasumi/kasumi_test.c
index a4b1f8d..f0f173b 100644
--- a/tests/kasumi/kasumi_test.c
+++ b/tests/kasumi/kasumi_test.c
@@ -24,14 +24,14 @@
 {
 	_kasumi_key_expand(test_key, _KLi1, _KLi2, _KOi1, _KOi2, _KOi3, _KIi1, _KIi2, _KIi3);
 	int passed = 1;
-	passed = _compare_mem((uint8_t *)_KLi1, (uint8_t *)_KLi1_r, 16);
-	passed = _compare_mem((uint8_t *)_KLi2, (uint8_t *)_KLi2_r, 16);
-	passed = _compare_mem((uint8_t *)_KOi1, (uint8_t *)_KOi1_r, 16);
-	passed = _compare_mem((uint8_t *)_KOi2, (uint8_t *)_KOi2_r, 16);
-	passed = _compare_mem((uint8_t *)_KOi3, (uint8_t *)_KOi3_r, 16);
-	passed = _compare_mem((uint8_t *)_KIi1, (uint8_t *)_KIi1_r, 16);
-	passed = _compare_mem((uint8_t *)_KIi2, (uint8_t *)_KIi2_r, 16);
-	passed = _compare_mem((uint8_t *)_KIi3, (uint8_t *)_KIi3_r, 16);
+	passed &= _compare_mem((uint8_t *)_KLi1, (uint8_t *)_KLi1_r, 16);
+	passed &= _compare_mem((uint8_t *)_KLi2, (uint8_t *)_KLi2_r, 16);
+	passed &= _compare_mem((uint8_t *)_KOi1, (uint8_t *)_KOi1_r, 16);
+	passed &= _compare_mem((uint8_t *)_KOi2, (uint8_t *)_KOi2_r, 16);
+	passed &= _compare_mem((uint8_t *)_KOi3, (uint8_t *)_KOi3_r, 16);
+	passed &= _compare_mem((uint8_t *)_KIi1, (uint8_t *)_KIi1_r, 16);
+	passed &= _compare_mem((uint8_t *)_KIi2, (uint8_t *)_KIi2_r, 16);
+	passed &= _compare_mem((uint8_t *)_KIi3, (uint8_t *)_KIi3_r, 16);
 	printf(passed ? " OK. " : "FAILED!");
 }
 

-- 
To view, visit https://gerrit.osmocom.org/2590
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibf3ab453c20c7eeec234b95bfe14b497c572c35f
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy <axilirator at gmail.com>



More information about the gerrit-log mailing list