cipher_hash_test.c 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /* LibTomCrypt, modular cryptographic library -- Tom St Denis
  2. *
  3. * LibTomCrypt is a library that provides various cryptographic
  4. * algorithms in a highly modular and flexible manner.
  5. *
  6. * The library is free for all purposes without any express
  7. * guarantee it works.
  8. */
  9. /* test the ciphers and hashes using their built-in self-tests */
  10. #include <tomcrypt_test.h>
  11. int cipher_hash_test(void)
  12. {
  13. int x;
  14. /* test block ciphers */
  15. for (x = 0; cipher_descriptor[x].name != NULL; x++) {
  16. DOX(cipher_descriptor[x].test(), cipher_descriptor[x].name);
  17. }
  18. /* test stream ciphers */
  19. #ifdef LTC_CHACHA
  20. DO(chacha_test());
  21. #endif
  22. #ifdef LTC_SALSA20
  23. DO(salsa20_test());
  24. #endif
  25. #ifdef LTC_SOSEMANUK
  26. DO(sosemanuk_test());
  27. #endif
  28. #ifdef LTC_RABBIT
  29. DO(rabbit_test());
  30. #endif
  31. #ifdef LTC_RC4_STREAM
  32. DO(rc4_stream_test());
  33. #endif
  34. #ifdef LTC_SOBER128_STREAM
  35. DO(sober128_stream_test());
  36. #endif
  37. /* test hashes */
  38. for (x = 0; hash_descriptor[x].name != NULL; x++) {
  39. DOX(hash_descriptor[x].test(), hash_descriptor[x].name);
  40. }
  41. /* SHAKE128 + SHAKE256 tests are a bit special */
  42. DOX(sha3_shake_test(), "sha3_shake");
  43. return 0;
  44. }
  45. /* ref: $Format:%D$ */
  46. /* git commit: $Format:%H$ */
  47. /* commit time: $Format:%ai$ */