whrlpool.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*
  2. * Copyright 2005-2016 The OpenSSL Project Authors. All Rights Reserved.
  3. *
  4. * Licensed under the OpenSSL license (the "License"). You may not use
  5. * this file except in compliance with the License. You can obtain a copy
  6. * in the file LICENSE in the source distribution or at
  7. * https://www.openssl.org/source/license.html
  8. */
  9. #ifndef HEADER_WHRLPOOL_H
  10. # define HEADER_WHRLPOOL_H
  11. #include <openssl/opensslconf.h>
  12. # ifndef OPENSSL_NO_WHIRLPOOL
  13. # include <openssl/e_os2.h>
  14. # include <stddef.h>
  15. # ifdef __cplusplus
  16. extern "C" {
  17. # endif
  18. # define WHIRLPOOL_DIGEST_LENGTH (512/8)
  19. # define WHIRLPOOL_BBLOCK 512
  20. # define WHIRLPOOL_COUNTER (256/8)
  21. typedef struct {
  22. union {
  23. unsigned char c[WHIRLPOOL_DIGEST_LENGTH];
  24. /* double q is here to ensure 64-bit alignment */
  25. double q[WHIRLPOOL_DIGEST_LENGTH / sizeof(double)];
  26. } H;
  27. unsigned char data[WHIRLPOOL_BBLOCK / 8];
  28. unsigned int bitoff;
  29. size_t bitlen[WHIRLPOOL_COUNTER / sizeof(size_t)];
  30. } WHIRLPOOL_CTX;
  31. int WHIRLPOOL_Init(WHIRLPOOL_CTX *c);
  32. int WHIRLPOOL_Update(WHIRLPOOL_CTX *c, const void *inp, size_t bytes);
  33. void WHIRLPOOL_BitUpdate(WHIRLPOOL_CTX *c, const void *inp, size_t bits);
  34. int WHIRLPOOL_Final(unsigned char *md, WHIRLPOOL_CTX *c);
  35. unsigned char *WHIRLPOOL(const void *inp, size_t bytes, unsigned char *md);
  36. # ifdef __cplusplus
  37. }
  38. # endif
  39. # endif
  40. #endif