cipher_hash_test.c 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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_XSALSA20
  26. DO(xsalsa20_test());
  27. #endif
  28. #ifdef LTC_SOSEMANUK
  29. DO(sosemanuk_test());
  30. #endif
  31. #ifdef LTC_RABBIT
  32. DO(rabbit_test());
  33. #endif
  34. #ifdef LTC_RC4_STREAM
  35. DO(rc4_stream_test());
  36. #endif
  37. #ifdef LTC_SOBER128_STREAM
  38. DO(sober128_stream_test());
  39. #endif
  40. /* test hashes */
  41. for (x = 0; hash_descriptor[x].name != NULL; x++) {
  42. DOX(hash_descriptor[x].test(), hash_descriptor[x].name);
  43. }
  44. #ifdef LTC_SHA3
  45. /* SHAKE128 + SHAKE256 tests are a bit special */
  46. DOX(sha3_shake_test(), "sha3_shake");
  47. #endif
  48. return 0;
  49. }
  50. /* ref: $Format:%D$ */
  51. /* git commit: $Format:%H$ */
  52. /* commit time: $Format:%ai$ */