mirror of
https://github.com/libtom/libtomcrypt
synced 2026-08-25 20:26:07 -04:00
Ensure the table sizes are OK.
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
This commit is contained in:
parent
5a2bc6b131
commit
97f5d72457
3 changed files with 9 additions and 3 deletions
|
|
@ -54,7 +54,7 @@ int cipher_hash_test(void)
|
|||
int x;
|
||||
|
||||
/* test block ciphers */
|
||||
for (x = 0; cipher_descriptor[x].name != NULL; x++) {
|
||||
for (x = 0; x < TAB_SIZE && cipher_descriptor[x].name != NULL; x++) {
|
||||
DOX(cipher_descriptor[x].test(), cipher_descriptor[x].name);
|
||||
}
|
||||
|
||||
|
|
@ -100,7 +100,7 @@ int cipher_hash_test(void)
|
|||
#endif
|
||||
|
||||
/* test hashes */
|
||||
for (x = 0; hash_descriptor[x].name != NULL; x++) {
|
||||
for (x = 0; x < TAB_SIZE && hash_descriptor[x].name != NULL; x++) {
|
||||
DOX(hash_descriptor[x].test(), hash_descriptor[x].name);
|
||||
/* test that state can be cloned via memcpy */
|
||||
DOX(s_hash_state_clone_test(&hash_descriptor[x], hash_descriptor[x].name), hash_descriptor[x].name);
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ int prng_test(void)
|
|||
#endif
|
||||
|
||||
/* test prngs (test, import/export) */
|
||||
for (x = 0; prng_descriptor[x].name != NULL; x++) {
|
||||
for (x = 0; x < TAB_SIZE && prng_descriptor[x].name != NULL; x++) {
|
||||
if(strstr(prng_descriptor[x].name, "no_prng") == prng_descriptor[x].name) continue;
|
||||
DOX(prng_descriptor[x].test(), prng_descriptor[x].name);
|
||||
DOX(prng_descriptor[x].start(&nprng), prng_descriptor[x].name);
|
||||
|
|
|
|||
|
|
@ -501,6 +501,12 @@ int main(int argc, char **argv)
|
|||
XFREE(tinfo);
|
||||
#endif
|
||||
|
||||
if (cipher_descriptor[TAB_SIZE - 1].name != NULL)
|
||||
printf("cipher_descriptor Table full\n");
|
||||
if (hash_descriptor[TAB_SIZE - 1].name != NULL)
|
||||
printf("hash_descriptor Table full\n");
|
||||
if (prng_descriptor[TAB_SIZE - 1].name != NULL)
|
||||
printf("prng_descriptor Table full\n");
|
||||
x = (fail > 0 || fail+pass+nop == 0) ? EXIT_FAILURE : EXIT_SUCCESS;
|
||||
printf("\n\n%s: passed=%d failed=%d nop=%d duration=%.1fsec real=%.1fsec\n", x ? "FAILURE" : "SUCCESS", pass, fail, nop, (double)(dur)/(1000*1000), (double)(real)/(1000*1000));
|
||||
return x;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue