hfal_skein512.c 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. /* hfal_skein512.c */
  2. /*
  3. This file is part of the ARM-Crypto-Lib.
  4. Copyright (C) 2008 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 hfal_skein512.c
  18. * \email daniel.otte@rub.de
  19. * \author Daniel Otte
  20. * \date 2009-03-13
  21. * \license GPLv3 or later
  22. *
  23. */
  24. #include <stdlib.h>
  25. #include <crypto/hashfunction_descriptor.h>
  26. #include <crypto/skein.h>
  27. static const char skein512_128_str[] = "Skein-512-128";
  28. static const char skein512_160_str[] = "Skein-512-160";
  29. static const char skein512_224_str[] = "Skein-512-224";
  30. static const char skein512_256_str[] = "Skein-512-256";
  31. static const char skein512_384_str[] = "Skein-512-384";
  32. static const char skein512_512_str[] = "Skein-512-512";
  33. static const char skein512_1024_str[] = "Skein-512-1024";
  34. void skein512_128_init(skein512_ctx_t* ctx){
  35. skein512_init(ctx, 128);
  36. }
  37. void skein512_160_init(skein512_ctx_t* ctx){
  38. skein512_init(ctx, 160);
  39. }
  40. void skein512_224_init(skein512_ctx_t* ctx){
  41. skein512_init(ctx, 224);
  42. }
  43. void skein512_256_init(skein512_ctx_t* ctx){
  44. skein512_init(ctx, 256);
  45. }
  46. void skein512_384_init(skein512_ctx_t* ctx){
  47. skein512_init(ctx, 384);
  48. }
  49. void skein512_512_init(skein512_ctx_t* ctx){
  50. skein512_init(ctx, 512);
  51. }
  52. void skein512_1024_init(skein512_ctx_t* ctx){
  53. skein512_init(ctx, 1024);
  54. }
  55. const hfdesc_t skein512_128_desc = {
  56. HFDESC_TYPE_HASHFUNCTION,
  57. 0,
  58. skein512_128_str,
  59. sizeof(skein512_ctx_t),
  60. SKEIN512_BLOCKSIZE,
  61. 128,
  62. (hf_init_fpt)skein512_128_init,
  63. (hf_nextBlock_fpt)skein512_nextBlock,
  64. (hf_lastBlock_fpt)skein512_lastBlock,
  65. (hf_ctx2hash_fpt)skein512_ctx2hash,
  66. (hf_free_fpt)NULL,
  67. (hf_mem_fpt)NULL
  68. };
  69. const hfdesc_t skein512_160_desc = {
  70. HFDESC_TYPE_HASHFUNCTION,
  71. 0,
  72. skein512_160_str,
  73. sizeof(skein512_ctx_t),
  74. SKEIN512_BLOCKSIZE,
  75. 160,
  76. (hf_init_fpt)skein512_160_init,
  77. (hf_nextBlock_fpt)skein512_nextBlock,
  78. (hf_lastBlock_fpt)skein512_lastBlock,
  79. (hf_ctx2hash_fpt)skein512_ctx2hash,
  80. (hf_free_fpt)NULL,
  81. (hf_mem_fpt)NULL
  82. };
  83. const hfdesc_t skein512_224_desc = {
  84. HFDESC_TYPE_HASHFUNCTION,
  85. 0,
  86. skein512_224_str,
  87. sizeof(skein512_ctx_t),
  88. SKEIN512_BLOCKSIZE,
  89. 224,
  90. (hf_init_fpt)skein512_224_init,
  91. (hf_nextBlock_fpt)skein512_nextBlock,
  92. (hf_lastBlock_fpt)skein512_lastBlock,
  93. (hf_ctx2hash_fpt)skein512_ctx2hash,
  94. (hf_free_fpt)NULL,
  95. (hf_mem_fpt)NULL
  96. };
  97. const hfdesc_t skein512_256_desc = {
  98. HFDESC_TYPE_HASHFUNCTION,
  99. 0,
  100. skein512_256_str,
  101. sizeof(skein512_ctx_t),
  102. SKEIN512_BLOCKSIZE,
  103. 256,
  104. (hf_init_fpt)skein512_256_init,
  105. (hf_nextBlock_fpt)skein512_nextBlock,
  106. (hf_lastBlock_fpt)skein512_lastBlock,
  107. (hf_ctx2hash_fpt)skein512_ctx2hash,
  108. (hf_free_fpt)NULL,
  109. (hf_mem_fpt)NULL
  110. };
  111. const hfdesc_t skein512_384_desc = {
  112. HFDESC_TYPE_HASHFUNCTION,
  113. 0,
  114. skein512_384_str,
  115. sizeof(skein512_ctx_t),
  116. SKEIN512_BLOCKSIZE,
  117. 384,
  118. (hf_init_fpt)skein512_384_init,
  119. (hf_nextBlock_fpt)skein512_nextBlock,
  120. (hf_lastBlock_fpt)skein512_lastBlock,
  121. (hf_ctx2hash_fpt)skein512_ctx2hash,
  122. (hf_free_fpt)NULL,
  123. (hf_mem_fpt)NULL
  124. };
  125. const hfdesc_t skein512_512_desc = {
  126. HFDESC_TYPE_HASHFUNCTION,
  127. 0,
  128. skein512_512_str,
  129. sizeof(skein512_ctx_t),
  130. SKEIN512_BLOCKSIZE,
  131. 512,
  132. (hf_init_fpt)skein512_512_init,
  133. (hf_nextBlock_fpt)skein512_nextBlock,
  134. (hf_lastBlock_fpt)skein512_lastBlock,
  135. (hf_ctx2hash_fpt)skein512_ctx2hash,
  136. (hf_free_fpt)NULL,
  137. (hf_mem_fpt)NULL
  138. };
  139. const hfdesc_t skein512_1024_desc = {
  140. HFDESC_TYPE_HASHFUNCTION,
  141. 0,
  142. skein512_1024_str,
  143. sizeof(skein512_ctx_t),
  144. SKEIN512_BLOCKSIZE,
  145. 1024,
  146. (hf_init_fpt)skein512_1024_init,
  147. (hf_nextBlock_fpt)skein512_nextBlock,
  148. (hf_lastBlock_fpt)skein512_lastBlock,
  149. (hf_ctx2hash_fpt)skein512_ctx2hash,
  150. (hf_free_fpt)NULL,
  151. (hf_mem_fpt)NULL
  152. };