Strange comparision in hash_SHA2_template.c/add_length
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Python-Crypto |
New
|
Undecided
|
Unassigned |
Bug Description
Hi,
We have the following function:
/* adds *inc* to the length of the hash_state *hs*
* return 1 on success
* return 0 if the length overflows
*/
static int add_length(
sha2_word_t overflow_detector;
overflow_
hs-
if (overflow_detector > hs->length_lower) {
if (hs->length_upper > hs->length_upper)
return 0;
}
return 1;
}
Can you tell me when the condition which returns 0 is met? I may be missing something really obvious, but it seems to me that we should compare length_upper with overflow_detector instead.
Thank you,
Marcin