m_wp.c 873 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /* crypto/evp/m_wp.c */
  2. #include <stdio.h>
  3. #include "cryptlib.h"
  4. #ifndef OPENSSL_NO_WHIRLPOOL
  5. # include <openssl/evp.h>
  6. # include <openssl/objects.h>
  7. # include <openssl/x509.h>
  8. # include <openssl/whrlpool.h>
  9. # include "evp_locl.h"
  10. static int init(EVP_MD_CTX *ctx)
  11. {
  12. return WHIRLPOOL_Init(ctx->md_data);
  13. }
  14. static int update(EVP_MD_CTX *ctx, const void *data, size_t count)
  15. {
  16. return WHIRLPOOL_Update(ctx->md_data, data, count);
  17. }
  18. static int final(EVP_MD_CTX *ctx, unsigned char *md)
  19. {
  20. return WHIRLPOOL_Final(md, ctx->md_data);
  21. }
  22. static const EVP_MD whirlpool_md = {
  23. NID_whirlpool,
  24. 0,
  25. WHIRLPOOL_DIGEST_LENGTH,
  26. 0,
  27. init,
  28. update,
  29. final,
  30. NULL,
  31. NULL,
  32. EVP_PKEY_NULL_method,
  33. WHIRLPOOL_BBLOCK / 8,
  34. sizeof(EVP_MD *) + sizeof(WHIRLPOOL_CTX),
  35. };
  36. const EVP_MD *EVP_whirlpool(void)
  37. {
  38. return (&whirlpool_md);
  39. }
  40. #endif