fix scan-build error

This commit is contained in:
Steffen Jaeckel 2019-09-23 21:53:26 +02:00
parent 9416a88468
commit d4b8d9b507

View File

@ -270,7 +270,7 @@ int chc_test(void)
16 16
} }
}; };
int i, oldhashidx, idx; int i, oldhashidx, idx, err;
unsigned char tmp[MAXBLOCKSIZE]; unsigned char tmp[MAXBLOCKSIZE];
hash_state md; hash_state md;
@ -284,9 +284,15 @@ int chc_test(void)
chc_register(idx); chc_register(idx);
for (i = 0; i < (int)(sizeof(tests)/sizeof(tests[0])); i++) { for (i = 0; i < (int)(sizeof(tests)/sizeof(tests[0])); i++) {
chc_init(&md); if ((err = chc_init(&md)) != CRYPT_OK) {
chc_process(&md, tests[i].msg, strlen((char *)tests[i].msg)); return err;
chc_done(&md, tmp); }
if ((err = chc_process(&md, tests[i].msg, strlen((char *)tests[i].msg))) != CRYPT_OK) {
return err;
}
if ((err = chc_done(&md, tmp)) != CRYPT_OK) {
return err;
}
if (compare_testvector(tmp, tests[i].len, tests[i].hash, tests[i].len, "CHC", i)) { if (compare_testvector(tmp, tests[i].len, tests[i].hash, tests[i].len, "CHC", i)) {
return CRYPT_FAIL_TESTVECTOR; return CRYPT_FAIL_TESTVECTOR;
} }