skein.h 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /* skein.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 skein.c
  18. * \author Daniel Otte
  19. * \email daniel.otte@rub.de
  20. * \date 2009-03-12
  21. * \license GPLv3 or later
  22. *
  23. */
  24. #ifndef SKEIN_H_
  25. #define SKEIN_H_
  26. #include <stdint.h>
  27. #include <crypto/ubi.h>
  28. #define SKEIN256_BLOCKSIZE UBI256_BLOCKSIZE
  29. #define SKEIN256_BLOCKSIZE_B UBI256_BLOCKSIZE_B
  30. #define SKEIN512_BLOCKSIZE UBI512_BLOCKSIZE
  31. #define SKEIN512_BLOCKSIZE_B UBI512_BLOCKSIZE_B
  32. #define SKEIN1024_BLOCKSIZE UBI1024_BLOCKSIZE
  33. #define SKEIN1024_BLOCKSIZE_B UBI1024_BLOCKSIZE_B
  34. typedef struct{
  35. uint16_t outsize_b;
  36. ubi256_ctx_t ubictx;
  37. }skein256_ctx_t;
  38. void skein256_init(skein256_ctx_t* ctx, uint16_t outsize_b);
  39. void skein256_nextBlock(skein256_ctx_t* ctx, const void* block);
  40. void skein256_lastBlock(skein256_ctx_t* ctx, const void* block, uint16_t length_b);
  41. void skein256_ctx2hash(void* dest, skein256_ctx_t* ctx);
  42. void skein256(void* dest, uint16_t outlength_b, const void* msg, uint32_t length_b);
  43. typedef struct{
  44. uint16_t outsize_b;
  45. ubi512_ctx_t ubictx;
  46. }skein512_ctx_t;
  47. void skein512_init(skein512_ctx_t* ctx, uint16_t outsize_b);
  48. void skein512_nextBlock(skein512_ctx_t* ctx, const void* block);
  49. void skein512_lastBlock(skein512_ctx_t* ctx, const void* block, uint16_t length_b);
  50. void skein512_ctx2hash(void* dest, skein512_ctx_t* ctx);
  51. void skein512(void* dest, uint16_t outlength_b, const void* msg, uint32_t length_b);
  52. typedef struct{
  53. uint16_t outsize_b;
  54. ubi1024_ctx_t ubictx;
  55. }skein1024_ctx_t;
  56. void skein1024_init(skein1024_ctx_t* ctx, uint16_t outsize_b);
  57. void skein1024_nextBlock(skein1024_ctx_t* ctx, const void* block);
  58. void skein1024_lastBlock(skein1024_ctx_t* ctx, const void* block, uint16_t length_b);
  59. void skein1024_ctx2hash(void* dest, skein1024_ctx_t* ctx);
  60. void skein1024(void* dest, uint16_t outlength_b, const void* msg, uint32_t length_b);
  61. #endif /* SKEIN_H_ */