Skip to content

Commit d4b8d9b

Browse files
committed
fix scan-build error
1 parent 9416a88 commit d4b8d9b

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/hashes/chc/chc.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ int chc_test(void)
270270
16
271271
}
272272
};
273-
int i, oldhashidx, idx;
273+
int i, oldhashidx, idx, err;
274274
unsigned char tmp[MAXBLOCKSIZE];
275275
hash_state md;
276276

@@ -284,9 +284,15 @@ int chc_test(void)
284284
chc_register(idx);
285285

286286
for (i = 0; i < (int)(sizeof(tests)/sizeof(tests[0])); i++) {
287-
chc_init(&md);
288-
chc_process(&md, tests[i].msg, strlen((char *)tests[i].msg));
289-
chc_done(&md, tmp);
287+
if ((err = chc_init(&md)) != CRYPT_OK) {
288+
return err;
289+
}
290+
if ((err = chc_process(&md, tests[i].msg, strlen((char *)tests[i].msg))) != CRYPT_OK) {
291+
return err;
292+
}
293+
if ((err = chc_done(&md, tmp)) != CRYPT_OK) {
294+
return err;
295+
}
290296
if (compare_testvector(tmp, tests[i].len, tests[i].hash, tests[i].len, "CHC", i)) {
291297
return CRYPT_FAIL_TESTVECTOR;
292298
}

0 commit comments

Comments
 (0)