blake_large.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /* blake_large.h */
  2. /*
  3. This file is part of the ARM-Crypto-Lib.
  4. Copyright (C) 2009 Daniel Otte (daniel.otte@rub.de)
  5. This program is free software: you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation, either version 3 of the License, or
  8. (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. */
  16. /*
  17. * \file blake_large.h
  18. * \author Daniel Otte
  19. * \email daniel.otte@rub.de
  20. * \date 2009-05-08
  21. * \license GPLv3 or later
  22. *
  23. */
  24. #ifndef BLAKE_LARGE_H_
  25. #define BLAKE_LARGE_H_
  26. #include <stdint.h>
  27. #define BLAKE_LARGE_BLOCKSIZE 1024
  28. #define BLAKE_LARGE_BLOCKSIZE_B ((BLAKE_LARGE_BLOCKSIZE+7)/8)
  29. #define BLAKE384_BLOCKSIZE BLAKE_LARGE_BLOCKSIZE
  30. #define BLAKE384_BLOCKSIZE_B BLAKE_LARGE_BLOCKSIZE_B
  31. #define BLAKE512_BLOCKSIZE BLAKE_LARGE_BLOCKSIZE
  32. #define BLAKE512_BLOCKSIZE_B BLAKE_LARGE_BLOCKSIZE_B
  33. typedef struct {
  34. uint64_t h[8];
  35. uint64_t s[4];
  36. uint32_t counter;
  37. uint8_t appendone;
  38. } blake_large_ctx_t;
  39. typedef blake_large_ctx_t blake384_ctx_t;
  40. typedef blake_large_ctx_t blake512_ctx_t;
  41. void blake384_init(blake384_ctx_t* ctx);
  42. void blake512_init(blake512_ctx_t* ctx);
  43. void blake_large_nextBlock(blake_large_ctx_t* ctx, const void* block);
  44. void blake_large_lastBlock(blake_large_ctx_t* ctx, const void* block, uint16_t length_b);
  45. void blake384_nextBlock(blake384_ctx_t* ctx, const void* block);
  46. void blake384_lastBlock(blake384_ctx_t* ctx, const void* block, uint16_t length_b);
  47. void blake512_nextBlock(blake512_ctx_t* ctx, const void* block);
  48. void blake512_lastBlock(blake512_ctx_t* ctx, const void* block, uint16_t length_b);
  49. void blake384_ctx2hash(void* dest, const blake384_ctx_t* ctx);
  50. void blake512_ctx2hash(void* dest, const blake512_ctx_t* ctx);
  51. void blake384(void* dest, const void* msg, uint32_t length_b);
  52. void blake512(void* dest, const void* msg, uint32_t length_b);
  53. #endif /* BLAKE_LARGE_H_ */