cipher_hash_test.c 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /* LibTomCrypt, modular cryptographic library -- Tom St Denis */
  2. /* SPDX-License-Identifier: Unlicense */
  3. /* test the ciphers and hashes using their built-in self-tests */
  4. #include <tomcrypt_test.h>
  5. int cipher_hash_test(void)
  6. {
  7. int x;
  8. /* test block ciphers */
  9. for (x = 0; cipher_descriptor[x].name != NULL; x++) {
  10. DOX(cipher_descriptor[x].test(), cipher_descriptor[x].name);
  11. }
  12. /* test stream ciphers */
  13. #ifdef LTC_CHACHA
  14. DO(chacha_test());
  15. #endif
  16. #ifdef LTC_SALSA20
  17. DO(salsa20_test());
  18. #endif
  19. #ifdef LTC_XSALSA20
  20. DO(xsalsa20_test());
  21. #endif
  22. #ifdef LTC_SOSEMANUK
  23. DO(sosemanuk_test());
  24. #endif
  25. #ifdef LTC_RABBIT
  26. DO(rabbit_test());
  27. #endif
  28. #ifdef LTC_RC4_STREAM
  29. DO(rc4_stream_test());
  30. #endif
  31. #ifdef LTC_SOBER128_STREAM
  32. DO(sober128_stream_test());
  33. #endif
  34. /* test hashes */
  35. for (x = 0; hash_descriptor[x].name != NULL; x++) {
  36. DOX(hash_descriptor[x].test(), hash_descriptor[x].name);
  37. }
  38. #ifdef LTC_SHA3
  39. /* SHAKE128 + SHAKE256 tests are a bit special */
  40. DOX(sha3_shake_test(), "sha3_shake");
  41. #endif
  42. return 0;
  43. }