Project

General

Profile

Bug #2229

tests/kasumi/kasumi_test.c: missed check result

Added by fixeria over 2 years ago. Updated over 2 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Start date:
05/04/2017
Due date:
% Done:

100%

Spec Reference:

Description

Have a look at test_expansion():

_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);
printf(passed ? " OK. " : "FAILED!");

Only the last check value makes sense here. Other check values
are being overwritten. What about:

int passed = 1;

_kasumi_key_expand(test_key, _KLi1, _KLi2, _KOi1, _KOi2, _KOi3, _KIi1, _KIi2, _KIi3);
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!");

History

#1 Updated by fixeria over 2 years ago

  • Status changed from New to Feedback
  • % Done changed from 0 to 100

#2 Updated by fixeria over 2 years ago

  • Status changed from Feedback to Closed

Also available in: Atom PDF

Add picture from clipboard (Maximum size: 48.8 MB)