groestl_small.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /* groestl_small.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 groestl_small.h
  18. * \author Daniel Otte
  19. * \email daniel.otte@rub.de
  20. * \date 2009-05-19
  21. * \license GPLv3 or later
  22. *
  23. */
  24. #ifndef GROESTL_SMALL_H_
  25. #define GROESTL_SMALL_H_
  26. #include <stdint.h>
  27. #define GROESTL_SMALL_BLOCKSIZE 512
  28. #define GROESTL_SMALL_BLOCKSIZE_B ((GROESTL_SMALL_BLOCKSIZE+7)/8)
  29. #define GROESTL224_BLOCKSIZE GROESTL_SMALL_BLOCKSIZE
  30. #define GROESTL224_BLOCKSIZE_B GROESTL_SMALL_BLOCKSIZE_B
  31. #define GROESTL256_BLOCKSIZE GROESTL_SMALL_BLOCKSIZE
  32. #define GROESTL256_BLOCKSIZE_B GROESTL_SMALL_BLOCKSIZE_B
  33. typedef struct {
  34. uint8_t h[8*8];
  35. uint32_t counter;
  36. } groestl_small_ctx_t;
  37. typedef groestl_small_ctx_t groestl224_ctx_t;
  38. typedef groestl_small_ctx_t groestl256_ctx_t;
  39. void groestl224_init(groestl224_ctx_t* ctx);
  40. void groestl256_init(groestl256_ctx_t* ctx);
  41. void groestl_small_nextBlock(groestl_small_ctx_t* ctx, const void* block);
  42. void groestl_small_lastBlock(groestl_small_ctx_t* ctx, const void* block, uint16_t length_b);
  43. void groestl224_nextBlock(groestl224_ctx_t* ctx, const void* block);
  44. void groestl224_lastBlock(groestl224_ctx_t* ctx, const void* block, uint16_t length_b);
  45. void groestl256_nextBlock(groestl256_ctx_t* ctx, const void* block);
  46. void groestl256_lastBlock(groestl256_ctx_t* ctx, const void* block, uint16_t length_b);
  47. void groestl224_ctx2hash(void* dest, const groestl224_ctx_t* ctx);
  48. void groestl256_ctx2hash(void* dest, const groestl256_ctx_t* ctx);
  49. void groestl224(void* dest, const void* msg, uint32_t length_b);
  50. void groestl256(void* dest, const void* msg, uint32_t length_b);
  51. #endif /* GROESTL_GROESTL_H_ */