ring-native 0.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (261) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +9 -0
  3. data/Gemfile +3 -0
  4. data/README.md +22 -0
  5. data/Rakefile +1 -0
  6. data/ext/ring/extconf.rb +29 -0
  7. data/lib/ring/native.rb +8 -0
  8. data/lib/ring/native/version.rb +5 -0
  9. data/ring-native.gemspec +25 -0
  10. data/vendor/ring/BUILDING.md +40 -0
  11. data/vendor/ring/Cargo.toml +43 -0
  12. data/vendor/ring/LICENSE +185 -0
  13. data/vendor/ring/Makefile +35 -0
  14. data/vendor/ring/PORTING.md +163 -0
  15. data/vendor/ring/README.md +113 -0
  16. data/vendor/ring/STYLE.md +197 -0
  17. data/vendor/ring/appveyor.yml +27 -0
  18. data/vendor/ring/build.rs +108 -0
  19. data/vendor/ring/crypto/aes/aes.c +1142 -0
  20. data/vendor/ring/crypto/aes/aes_test.Windows.vcxproj +25 -0
  21. data/vendor/ring/crypto/aes/aes_test.cc +93 -0
  22. data/vendor/ring/crypto/aes/asm/aes-586.pl +2368 -0
  23. data/vendor/ring/crypto/aes/asm/aes-armv4.pl +1249 -0
  24. data/vendor/ring/crypto/aes/asm/aes-x86_64.pl +2246 -0
  25. data/vendor/ring/crypto/aes/asm/aesni-x86.pl +1318 -0
  26. data/vendor/ring/crypto/aes/asm/aesni-x86_64.pl +2084 -0
  27. data/vendor/ring/crypto/aes/asm/aesv8-armx.pl +675 -0
  28. data/vendor/ring/crypto/aes/asm/bsaes-armv7.pl +1364 -0
  29. data/vendor/ring/crypto/aes/asm/bsaes-x86_64.pl +1565 -0
  30. data/vendor/ring/crypto/aes/asm/vpaes-x86.pl +841 -0
  31. data/vendor/ring/crypto/aes/asm/vpaes-x86_64.pl +1116 -0
  32. data/vendor/ring/crypto/aes/internal.h +87 -0
  33. data/vendor/ring/crypto/aes/mode_wrappers.c +61 -0
  34. data/vendor/ring/crypto/bn/add.c +394 -0
  35. data/vendor/ring/crypto/bn/asm/armv4-mont.pl +694 -0
  36. data/vendor/ring/crypto/bn/asm/armv8-mont.pl +1503 -0
  37. data/vendor/ring/crypto/bn/asm/bn-586.pl +774 -0
  38. data/vendor/ring/crypto/bn/asm/co-586.pl +287 -0
  39. data/vendor/ring/crypto/bn/asm/rsaz-avx2.pl +1882 -0
  40. data/vendor/ring/crypto/bn/asm/x86-mont.pl +592 -0
  41. data/vendor/ring/crypto/bn/asm/x86_64-gcc.c +599 -0
  42. data/vendor/ring/crypto/bn/asm/x86_64-mont.pl +1393 -0
  43. data/vendor/ring/crypto/bn/asm/x86_64-mont5.pl +3507 -0
  44. data/vendor/ring/crypto/bn/bn.c +352 -0
  45. data/vendor/ring/crypto/bn/bn_asn1.c +74 -0
  46. data/vendor/ring/crypto/bn/bn_test.Windows.vcxproj +25 -0
  47. data/vendor/ring/crypto/bn/bn_test.cc +1696 -0
  48. data/vendor/ring/crypto/bn/cmp.c +200 -0
  49. data/vendor/ring/crypto/bn/convert.c +433 -0
  50. data/vendor/ring/crypto/bn/ctx.c +311 -0
  51. data/vendor/ring/crypto/bn/div.c +594 -0
  52. data/vendor/ring/crypto/bn/exponentiation.c +1335 -0
  53. data/vendor/ring/crypto/bn/gcd.c +711 -0
  54. data/vendor/ring/crypto/bn/generic.c +1019 -0
  55. data/vendor/ring/crypto/bn/internal.h +316 -0
  56. data/vendor/ring/crypto/bn/montgomery.c +516 -0
  57. data/vendor/ring/crypto/bn/mul.c +888 -0
  58. data/vendor/ring/crypto/bn/prime.c +829 -0
  59. data/vendor/ring/crypto/bn/random.c +334 -0
  60. data/vendor/ring/crypto/bn/rsaz_exp.c +262 -0
  61. data/vendor/ring/crypto/bn/rsaz_exp.h +53 -0
  62. data/vendor/ring/crypto/bn/shift.c +276 -0
  63. data/vendor/ring/crypto/bytestring/bytestring_test.Windows.vcxproj +25 -0
  64. data/vendor/ring/crypto/bytestring/bytestring_test.cc +421 -0
  65. data/vendor/ring/crypto/bytestring/cbb.c +399 -0
  66. data/vendor/ring/crypto/bytestring/cbs.c +227 -0
  67. data/vendor/ring/crypto/bytestring/internal.h +46 -0
  68. data/vendor/ring/crypto/chacha/chacha_generic.c +140 -0
  69. data/vendor/ring/crypto/chacha/chacha_vec.c +323 -0
  70. data/vendor/ring/crypto/chacha/chacha_vec_arm.S +1447 -0
  71. data/vendor/ring/crypto/chacha/chacha_vec_arm_generate.go +153 -0
  72. data/vendor/ring/crypto/cipher/cipher_test.Windows.vcxproj +25 -0
  73. data/vendor/ring/crypto/cipher/e_aes.c +390 -0
  74. data/vendor/ring/crypto/cipher/e_chacha20poly1305.c +208 -0
  75. data/vendor/ring/crypto/cipher/internal.h +173 -0
  76. data/vendor/ring/crypto/cipher/test/aes_128_gcm_tests.txt +543 -0
  77. data/vendor/ring/crypto/cipher/test/aes_128_key_wrap_tests.txt +9 -0
  78. data/vendor/ring/crypto/cipher/test/aes_256_gcm_tests.txt +475 -0
  79. data/vendor/ring/crypto/cipher/test/aes_256_key_wrap_tests.txt +23 -0
  80. data/vendor/ring/crypto/cipher/test/chacha20_poly1305_old_tests.txt +422 -0
  81. data/vendor/ring/crypto/cipher/test/chacha20_poly1305_tests.txt +484 -0
  82. data/vendor/ring/crypto/cipher/test/cipher_test.txt +100 -0
  83. data/vendor/ring/crypto/constant_time_test.Windows.vcxproj +25 -0
  84. data/vendor/ring/crypto/constant_time_test.c +304 -0
  85. data/vendor/ring/crypto/cpu-arm-asm.S +32 -0
  86. data/vendor/ring/crypto/cpu-arm.c +199 -0
  87. data/vendor/ring/crypto/cpu-intel.c +261 -0
  88. data/vendor/ring/crypto/crypto.c +151 -0
  89. data/vendor/ring/crypto/curve25519/asm/x25519-arm.S +2118 -0
  90. data/vendor/ring/crypto/curve25519/curve25519.c +4888 -0
  91. data/vendor/ring/crypto/curve25519/x25519_test.cc +128 -0
  92. data/vendor/ring/crypto/digest/md32_common.h +181 -0
  93. data/vendor/ring/crypto/ec/asm/p256-x86_64-asm.pl +2725 -0
  94. data/vendor/ring/crypto/ec/ec.c +193 -0
  95. data/vendor/ring/crypto/ec/ec_curves.c +61 -0
  96. data/vendor/ring/crypto/ec/ec_key.c +228 -0
  97. data/vendor/ring/crypto/ec/ec_montgomery.c +114 -0
  98. data/vendor/ring/crypto/ec/example_mul.Windows.vcxproj +25 -0
  99. data/vendor/ring/crypto/ec/internal.h +243 -0
  100. data/vendor/ring/crypto/ec/oct.c +253 -0
  101. data/vendor/ring/crypto/ec/p256-64.c +1794 -0
  102. data/vendor/ring/crypto/ec/p256-x86_64-table.h +9548 -0
  103. data/vendor/ring/crypto/ec/p256-x86_64.c +509 -0
  104. data/vendor/ring/crypto/ec/simple.c +1007 -0
  105. data/vendor/ring/crypto/ec/util-64.c +183 -0
  106. data/vendor/ring/crypto/ec/wnaf.c +508 -0
  107. data/vendor/ring/crypto/ecdh/ecdh.c +155 -0
  108. data/vendor/ring/crypto/ecdsa/ecdsa.c +304 -0
  109. data/vendor/ring/crypto/ecdsa/ecdsa_asn1.c +193 -0
  110. data/vendor/ring/crypto/ecdsa/ecdsa_test.Windows.vcxproj +25 -0
  111. data/vendor/ring/crypto/ecdsa/ecdsa_test.cc +327 -0
  112. data/vendor/ring/crypto/header_removed.h +17 -0
  113. data/vendor/ring/crypto/internal.h +495 -0
  114. data/vendor/ring/crypto/libring.Windows.vcxproj +101 -0
  115. data/vendor/ring/crypto/mem.c +98 -0
  116. data/vendor/ring/crypto/modes/asm/aesni-gcm-x86_64.pl +1045 -0
  117. data/vendor/ring/crypto/modes/asm/ghash-armv4.pl +517 -0
  118. data/vendor/ring/crypto/modes/asm/ghash-x86.pl +1393 -0
  119. data/vendor/ring/crypto/modes/asm/ghash-x86_64.pl +1741 -0
  120. data/vendor/ring/crypto/modes/asm/ghashv8-armx.pl +422 -0
  121. data/vendor/ring/crypto/modes/ctr.c +226 -0
  122. data/vendor/ring/crypto/modes/gcm.c +1206 -0
  123. data/vendor/ring/crypto/modes/gcm_test.Windows.vcxproj +25 -0
  124. data/vendor/ring/crypto/modes/gcm_test.c +348 -0
  125. data/vendor/ring/crypto/modes/internal.h +299 -0
  126. data/vendor/ring/crypto/perlasm/arm-xlate.pl +170 -0
  127. data/vendor/ring/crypto/perlasm/readme +100 -0
  128. data/vendor/ring/crypto/perlasm/x86_64-xlate.pl +1164 -0
  129. data/vendor/ring/crypto/perlasm/x86asm.pl +292 -0
  130. data/vendor/ring/crypto/perlasm/x86gas.pl +263 -0
  131. data/vendor/ring/crypto/perlasm/x86masm.pl +200 -0
  132. data/vendor/ring/crypto/perlasm/x86nasm.pl +187 -0
  133. data/vendor/ring/crypto/poly1305/poly1305.c +331 -0
  134. data/vendor/ring/crypto/poly1305/poly1305_arm.c +301 -0
  135. data/vendor/ring/crypto/poly1305/poly1305_arm_asm.S +2015 -0
  136. data/vendor/ring/crypto/poly1305/poly1305_test.Windows.vcxproj +25 -0
  137. data/vendor/ring/crypto/poly1305/poly1305_test.cc +80 -0
  138. data/vendor/ring/crypto/poly1305/poly1305_test.txt +52 -0
  139. data/vendor/ring/crypto/poly1305/poly1305_vec.c +892 -0
  140. data/vendor/ring/crypto/rand/asm/rdrand-x86_64.pl +75 -0
  141. data/vendor/ring/crypto/rand/internal.h +32 -0
  142. data/vendor/ring/crypto/rand/rand.c +189 -0
  143. data/vendor/ring/crypto/rand/urandom.c +219 -0
  144. data/vendor/ring/crypto/rand/windows.c +56 -0
  145. data/vendor/ring/crypto/refcount_c11.c +66 -0
  146. data/vendor/ring/crypto/refcount_lock.c +53 -0
  147. data/vendor/ring/crypto/refcount_test.Windows.vcxproj +25 -0
  148. data/vendor/ring/crypto/refcount_test.c +58 -0
  149. data/vendor/ring/crypto/rsa/blinding.c +462 -0
  150. data/vendor/ring/crypto/rsa/internal.h +108 -0
  151. data/vendor/ring/crypto/rsa/padding.c +300 -0
  152. data/vendor/ring/crypto/rsa/rsa.c +450 -0
  153. data/vendor/ring/crypto/rsa/rsa_asn1.c +261 -0
  154. data/vendor/ring/crypto/rsa/rsa_impl.c +944 -0
  155. data/vendor/ring/crypto/rsa/rsa_test.Windows.vcxproj +25 -0
  156. data/vendor/ring/crypto/rsa/rsa_test.cc +437 -0
  157. data/vendor/ring/crypto/sha/asm/sha-armv8.pl +436 -0
  158. data/vendor/ring/crypto/sha/asm/sha-x86_64.pl +2390 -0
  159. data/vendor/ring/crypto/sha/asm/sha256-586.pl +1275 -0
  160. data/vendor/ring/crypto/sha/asm/sha256-armv4.pl +735 -0
  161. data/vendor/ring/crypto/sha/asm/sha256-armv8.pl +14 -0
  162. data/vendor/ring/crypto/sha/asm/sha256-x86_64.pl +14 -0
  163. data/vendor/ring/crypto/sha/asm/sha512-586.pl +911 -0
  164. data/vendor/ring/crypto/sha/asm/sha512-armv4.pl +666 -0
  165. data/vendor/ring/crypto/sha/asm/sha512-armv8.pl +14 -0
  166. data/vendor/ring/crypto/sha/asm/sha512-x86_64.pl +14 -0
  167. data/vendor/ring/crypto/sha/sha1.c +271 -0
  168. data/vendor/ring/crypto/sha/sha256.c +204 -0
  169. data/vendor/ring/crypto/sha/sha512.c +355 -0
  170. data/vendor/ring/crypto/test/file_test.cc +326 -0
  171. data/vendor/ring/crypto/test/file_test.h +181 -0
  172. data/vendor/ring/crypto/test/malloc.cc +150 -0
  173. data/vendor/ring/crypto/test/scoped_types.h +95 -0
  174. data/vendor/ring/crypto/test/test.Windows.vcxproj +35 -0
  175. data/vendor/ring/crypto/test/test_util.cc +46 -0
  176. data/vendor/ring/crypto/test/test_util.h +41 -0
  177. data/vendor/ring/crypto/thread_none.c +55 -0
  178. data/vendor/ring/crypto/thread_pthread.c +165 -0
  179. data/vendor/ring/crypto/thread_test.Windows.vcxproj +25 -0
  180. data/vendor/ring/crypto/thread_test.c +200 -0
  181. data/vendor/ring/crypto/thread_win.c +282 -0
  182. data/vendor/ring/examples/checkdigest.rs +103 -0
  183. data/vendor/ring/include/openssl/aes.h +121 -0
  184. data/vendor/ring/include/openssl/arm_arch.h +129 -0
  185. data/vendor/ring/include/openssl/base.h +156 -0
  186. data/vendor/ring/include/openssl/bn.h +794 -0
  187. data/vendor/ring/include/openssl/buffer.h +18 -0
  188. data/vendor/ring/include/openssl/bytestring.h +235 -0
  189. data/vendor/ring/include/openssl/chacha.h +37 -0
  190. data/vendor/ring/include/openssl/cmac.h +76 -0
  191. data/vendor/ring/include/openssl/cpu.h +184 -0
  192. data/vendor/ring/include/openssl/crypto.h +43 -0
  193. data/vendor/ring/include/openssl/curve25519.h +88 -0
  194. data/vendor/ring/include/openssl/ec.h +225 -0
  195. data/vendor/ring/include/openssl/ec_key.h +129 -0
  196. data/vendor/ring/include/openssl/ecdh.h +110 -0
  197. data/vendor/ring/include/openssl/ecdsa.h +156 -0
  198. data/vendor/ring/include/openssl/err.h +201 -0
  199. data/vendor/ring/include/openssl/mem.h +101 -0
  200. data/vendor/ring/include/openssl/obj_mac.h +71 -0
  201. data/vendor/ring/include/openssl/opensslfeatures.h +68 -0
  202. data/vendor/ring/include/openssl/opensslv.h +18 -0
  203. data/vendor/ring/include/openssl/ossl_typ.h +18 -0
  204. data/vendor/ring/include/openssl/poly1305.h +51 -0
  205. data/vendor/ring/include/openssl/rand.h +70 -0
  206. data/vendor/ring/include/openssl/rsa.h +399 -0
  207. data/vendor/ring/include/openssl/thread.h +133 -0
  208. data/vendor/ring/include/openssl/type_check.h +71 -0
  209. data/vendor/ring/mk/Common.props +63 -0
  210. data/vendor/ring/mk/Windows.props +42 -0
  211. data/vendor/ring/mk/WindowsTest.props +18 -0
  212. data/vendor/ring/mk/appveyor.bat +62 -0
  213. data/vendor/ring/mk/bottom_of_makefile.mk +54 -0
  214. data/vendor/ring/mk/ring.mk +266 -0
  215. data/vendor/ring/mk/top_of_makefile.mk +214 -0
  216. data/vendor/ring/mk/travis.sh +40 -0
  217. data/vendor/ring/mk/update-travis-yml.py +229 -0
  218. data/vendor/ring/ring.sln +153 -0
  219. data/vendor/ring/src/aead.rs +682 -0
  220. data/vendor/ring/src/agreement.rs +248 -0
  221. data/vendor/ring/src/c.rs +129 -0
  222. data/vendor/ring/src/constant_time.rs +37 -0
  223. data/vendor/ring/src/der.rs +96 -0
  224. data/vendor/ring/src/digest.rs +690 -0
  225. data/vendor/ring/src/digest_tests.txt +57 -0
  226. data/vendor/ring/src/ecc.rs +28 -0
  227. data/vendor/ring/src/ecc_build.rs +279 -0
  228. data/vendor/ring/src/ecc_curves.rs +117 -0
  229. data/vendor/ring/src/ed25519_tests.txt +2579 -0
  230. data/vendor/ring/src/exe_tests.rs +46 -0
  231. data/vendor/ring/src/ffi.rs +29 -0
  232. data/vendor/ring/src/file_test.rs +187 -0
  233. data/vendor/ring/src/hkdf.rs +153 -0
  234. data/vendor/ring/src/hkdf_tests.txt +59 -0
  235. data/vendor/ring/src/hmac.rs +414 -0
  236. data/vendor/ring/src/hmac_tests.txt +97 -0
  237. data/vendor/ring/src/input.rs +312 -0
  238. data/vendor/ring/src/lib.rs +41 -0
  239. data/vendor/ring/src/pbkdf2.rs +265 -0
  240. data/vendor/ring/src/pbkdf2_tests.txt +113 -0
  241. data/vendor/ring/src/polyfill.rs +57 -0
  242. data/vendor/ring/src/rand.rs +28 -0
  243. data/vendor/ring/src/signature.rs +314 -0
  244. data/vendor/ring/third-party/NIST/README.md +9 -0
  245. data/vendor/ring/third-party/NIST/SHAVS/SHA1LongMsg.rsp +263 -0
  246. data/vendor/ring/third-party/NIST/SHAVS/SHA1Monte.rsp +309 -0
  247. data/vendor/ring/third-party/NIST/SHAVS/SHA1ShortMsg.rsp +267 -0
  248. data/vendor/ring/third-party/NIST/SHAVS/SHA224LongMsg.rsp +263 -0
  249. data/vendor/ring/third-party/NIST/SHAVS/SHA224Monte.rsp +309 -0
  250. data/vendor/ring/third-party/NIST/SHAVS/SHA224ShortMsg.rsp +267 -0
  251. data/vendor/ring/third-party/NIST/SHAVS/SHA256LongMsg.rsp +263 -0
  252. data/vendor/ring/third-party/NIST/SHAVS/SHA256Monte.rsp +309 -0
  253. data/vendor/ring/third-party/NIST/SHAVS/SHA256ShortMsg.rsp +267 -0
  254. data/vendor/ring/third-party/NIST/SHAVS/SHA384LongMsg.rsp +519 -0
  255. data/vendor/ring/third-party/NIST/SHAVS/SHA384Monte.rsp +309 -0
  256. data/vendor/ring/third-party/NIST/SHAVS/SHA384ShortMsg.rsp +523 -0
  257. data/vendor/ring/third-party/NIST/SHAVS/SHA512LongMsg.rsp +519 -0
  258. data/vendor/ring/third-party/NIST/SHAVS/SHA512Monte.rsp +309 -0
  259. data/vendor/ring/third-party/NIST/SHAVS/SHA512ShortMsg.rsp +523 -0
  260. data/vendor/ring/third-party/NIST/sha256sums.txt +1 -0
  261. metadata +333 -0
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env perl
2
+ #
3
+ # ====================================================================
4
+ # Written by Andy Polyakov <appro@openssl.org> for the OpenSSL
5
+ # project. Rights for redistribution and usage in source and binary
6
+ # forms are granted according to the OpenSSL license.
7
+ # ====================================================================
8
+
9
+ push @ARGV, 'sha512';
10
+
11
+ $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
12
+ push(@INC,"${dir}");
13
+
14
+ do "sha-x86_64.pl" or die "failed to run sha-armv8.pl: $@";
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env perl
2
+ #
3
+ # ====================================================================
4
+ # Written by Andy Polyakov <appro@openssl.org> for the OpenSSL
5
+ # project. Rights for redistribution and usage in source and binary
6
+ # forms are granted according to the OpenSSL license.
7
+ # ====================================================================
8
+
9
+ push @ARGV, 'sha512';
10
+
11
+ $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
12
+ push(@INC,"${dir}");
13
+
14
+ do "sha-x86_64.pl" or die "failed to run sha-x86_64.pl: $@";
@@ -0,0 +1,271 @@
1
+ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
2
+ * All rights reserved.
3
+ *
4
+ * This package is an SSL implementation written
5
+ * by Eric Young (eay@cryptsoft.com).
6
+ * The implementation was written so as to conform with Netscapes SSL.
7
+ *
8
+ * This library is free for commercial and non-commercial use as long as
9
+ * the following conditions are aheared to. The following conditions
10
+ * apply to all code found in this distribution, be it the RC4, RSA,
11
+ * lhash, DES, etc., code; not just the SSL code. The SSL documentation
12
+ * included with this distribution is covered by the same copyright terms
13
+ * except that the holder is Tim Hudson (tjh@cryptsoft.com).
14
+ *
15
+ * Copyright remains Eric Young's, and as such any Copyright notices in
16
+ * the code are not to be removed.
17
+ * If this package is used in a product, Eric Young should be given attribution
18
+ * as the author of the parts of the library used.
19
+ * This can be in the form of a textual message at program startup or
20
+ * in documentation (online or textual) provided with the package.
21
+ *
22
+ * Redistribution and use in source and binary forms, with or without
23
+ * modification, are permitted provided that the following conditions
24
+ * are met:
25
+ * 1. Redistributions of source code must retain the copyright
26
+ * notice, this list of conditions and the following disclaimer.
27
+ * 2. Redistributions in binary form must reproduce the above copyright
28
+ * notice, this list of conditions and the following disclaimer in the
29
+ * documentation and/or other materials provided with the distribution.
30
+ * 3. All advertising materials mentioning features or use of this software
31
+ * must display the following acknowledgement:
32
+ * "This product includes cryptographic software written by
33
+ * Eric Young (eay@cryptsoft.com)"
34
+ * The word 'cryptographic' can be left out if the rouines from the library
35
+ * being used are not cryptographic related :-).
36
+ * 4. If you include any Windows specific code (or a derivative thereof) from
37
+ * the apps directory (application code) you must include an acknowledgement:
38
+ * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
39
+ *
40
+ * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
41
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
42
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
43
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
44
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
45
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
46
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
47
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
48
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
49
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
50
+ * SUCH DAMAGE.
51
+ *
52
+ * The licence and distribution terms for any publically available version or
53
+ * derivative of this code cannot be changed. i.e. this code cannot simply be
54
+ * copied and put under another distribution licence
55
+ * [including the GNU Public Licence.] */
56
+
57
+ #include "openssl/base.h"
58
+
59
+
60
+ #define DATA_ORDER_IS_BIG_ENDIAN /* Required by md32_common.h. */
61
+ #define HASH_CBLOCK 64
62
+
63
+ #define Xupdate(a, ix, ia, ib, ic, id) \
64
+ ((a) = (ia ^ ib ^ ic ^ id), ix = (a) = ROTATE((a), 1))
65
+
66
+ #include "../digest/md32_common.h"
67
+
68
+ #define K_00_19 0x5a827999UL
69
+ #define K_20_39 0x6ed9eba1UL
70
+ #define K_40_59 0x8f1bbcdcUL
71
+ #define K_60_79 0xca62c1d6UL
72
+
73
+ /* As pointed out by Wei Dai <weidai@eskimo.com>, F() below can be simplified
74
+ * to the code in F_00_19. Wei attributes these optimisations to Peter
75
+ * Gutmann's SHS code, and he attributes it to Rich Schroeppel. #define
76
+ * F(x,y,z) (((x) & (y)) | ((~(x)) & (z))) I've just become aware of another
77
+ * tweak to be made, again from Wei Dai, in F_40_59, (x&a)|(y&a) -> (x|y)&a */
78
+ #define F_00_19(b, c, d) ((((c) ^ (d)) & (b)) ^ (d))
79
+ #define F_20_39(b, c, d) ((b) ^ (c) ^ (d))
80
+ #define F_40_59(b, c, d) (((b) & (c)) | (((b) | (c)) & (d)))
81
+ #define F_60_79(b, c, d) F_20_39(b, c, d)
82
+
83
+ #define BODY_00_15(i, a, b, c, d, e, f, xi) \
84
+ (f) = xi + (e) + K_00_19 + ROTATE((a), 5) + F_00_19((b), (c), (d)); \
85
+ (b) = ROTATE((b), 30);
86
+
87
+ #define BODY_16_19(i, a, b, c, d, e, f, xi, xa, xb, xc, xd) \
88
+ Xupdate(f, xi, xa, xb, xc, xd); \
89
+ (f) += (e) + K_00_19 + ROTATE((a), 5) + F_00_19((b), (c), (d)); \
90
+ (b) = ROTATE((b), 30);
91
+
92
+ #define BODY_20_31(i, a, b, c, d, e, f, xi, xa, xb, xc, xd) \
93
+ Xupdate(f, xi, xa, xb, xc, xd); \
94
+ (f) += (e) + K_20_39 + ROTATE((a), 5) + F_20_39((b), (c), (d)); \
95
+ (b) = ROTATE((b), 30);
96
+
97
+ #define BODY_32_39(i, a, b, c, d, e, f, xa, xb, xc, xd) \
98
+ Xupdate(f, xa, xa, xb, xc, xd); \
99
+ (f) += (e) + K_20_39 + ROTATE((a), 5) + F_20_39((b), (c), (d)); \
100
+ (b) = ROTATE((b), 30);
101
+
102
+ #define BODY_40_59(i, a, b, c, d, e, f, xa, xb, xc, xd) \
103
+ Xupdate(f, xa, xa, xb, xc, xd); \
104
+ (f) += (e) + K_40_59 + ROTATE((a), 5) + F_40_59((b), (c), (d)); \
105
+ (b) = ROTATE((b), 30);
106
+
107
+ #define BODY_60_79(i, a, b, c, d, e, f, xa, xb, xc, xd) \
108
+ Xupdate(f, xa, xa, xb, xc, xd); \
109
+ (f) = xa + (e) + K_60_79 + ROTATE((a), 5) + F_60_79((b), (c), (d)); \
110
+ (b) = ROTATE((b), 30);
111
+
112
+ #ifdef X
113
+ #undef X
114
+ #endif
115
+
116
+ /* Originally X was an array. As it's automatic it's natural
117
+ * to expect RISC compiler to accomodate at least part of it in
118
+ * the register bank, isn't it? Unfortunately not all compilers
119
+ * "find" this expectation reasonable:-( On order to make such
120
+ * compilers generate better code I replace X[] with a bunch of
121
+ * X0, X1, etc. See the function body below...
122
+ * <appro@fy.chalmers.se> */
123
+ #define X(i) XX##i
124
+
125
+ void sha1_block_data_order(uint32_t *state, const uint8_t *data, size_t num) {
126
+ register uint32_t A, B, C, D, E, T, l;
127
+ uint32_t XX0, XX1, XX2, XX3, XX4, XX5, XX6, XX7, XX8, XX9, XX10,
128
+ XX11, XX12, XX13, XX14, XX15;
129
+
130
+ A = state[0];
131
+ B = state[1];
132
+ C = state[2];
133
+ D = state[3];
134
+ E = state[4];
135
+
136
+ for (;;) {
137
+ (void)HOST_c2l(data, l);
138
+ X(0) = l;
139
+ (void)HOST_c2l(data, l);
140
+ X(1) = l;
141
+ BODY_00_15(0, A, B, C, D, E, T, X(0));
142
+ (void)HOST_c2l(data, l);
143
+ X(2) = l;
144
+ BODY_00_15(1, T, A, B, C, D, E, X(1));
145
+ (void)HOST_c2l(data, l);
146
+ X(3) = l;
147
+ BODY_00_15(2, E, T, A, B, C, D, X(2));
148
+ (void)HOST_c2l(data, l);
149
+ X(4) = l;
150
+ BODY_00_15(3, D, E, T, A, B, C, X(3));
151
+ (void)HOST_c2l(data, l);
152
+ X(5) = l;
153
+ BODY_00_15(4, C, D, E, T, A, B, X(4));
154
+ (void)HOST_c2l(data, l);
155
+ X(6) = l;
156
+ BODY_00_15(5, B, C, D, E, T, A, X(5));
157
+ (void)HOST_c2l(data, l);
158
+ X(7) = l;
159
+ BODY_00_15(6, A, B, C, D, E, T, X(6));
160
+ (void)HOST_c2l(data, l);
161
+ X(8) = l;
162
+ BODY_00_15(7, T, A, B, C, D, E, X(7));
163
+ (void)HOST_c2l(data, l);
164
+ X(9) = l;
165
+ BODY_00_15(8, E, T, A, B, C, D, X(8));
166
+ (void)HOST_c2l(data, l);
167
+ X(10) = l;
168
+ BODY_00_15(9, D, E, T, A, B, C, X(9));
169
+ (void)HOST_c2l(data, l);
170
+ X(11) = l;
171
+ BODY_00_15(10, C, D, E, T, A, B, X(10));
172
+ (void)HOST_c2l(data, l);
173
+ X(12) = l;
174
+ BODY_00_15(11, B, C, D, E, T, A, X(11));
175
+ (void)HOST_c2l(data, l);
176
+ X(13) = l;
177
+ BODY_00_15(12, A, B, C, D, E, T, X(12));
178
+ (void)HOST_c2l(data, l);
179
+ X(14) = l;
180
+ BODY_00_15(13, T, A, B, C, D, E, X(13));
181
+ (void)HOST_c2l(data, l);
182
+ X(15) = l;
183
+ BODY_00_15(14, E, T, A, B, C, D, X(14));
184
+ BODY_00_15(15, D, E, T, A, B, C, X(15));
185
+
186
+ BODY_16_19(16, C, D, E, T, A, B, X(0), X(0), X(2), X(8), X(13));
187
+ BODY_16_19(17, B, C, D, E, T, A, X(1), X(1), X(3), X(9), X(14));
188
+ BODY_16_19(18, A, B, C, D, E, T, X(2), X(2), X(4), X(10), X(15));
189
+ BODY_16_19(19, T, A, B, C, D, E, X(3), X(3), X(5), X(11), X(0));
190
+
191
+ BODY_20_31(20, E, T, A, B, C, D, X(4), X(4), X(6), X(12), X(1));
192
+ BODY_20_31(21, D, E, T, A, B, C, X(5), X(5), X(7), X(13), X(2));
193
+ BODY_20_31(22, C, D, E, T, A, B, X(6), X(6), X(8), X(14), X(3));
194
+ BODY_20_31(23, B, C, D, E, T, A, X(7), X(7), X(9), X(15), X(4));
195
+ BODY_20_31(24, A, B, C, D, E, T, X(8), X(8), X(10), X(0), X(5));
196
+ BODY_20_31(25, T, A, B, C, D, E, X(9), X(9), X(11), X(1), X(6));
197
+ BODY_20_31(26, E, T, A, B, C, D, X(10), X(10), X(12), X(2), X(7));
198
+ BODY_20_31(27, D, E, T, A, B, C, X(11), X(11), X(13), X(3), X(8));
199
+ BODY_20_31(28, C, D, E, T, A, B, X(12), X(12), X(14), X(4), X(9));
200
+ BODY_20_31(29, B, C, D, E, T, A, X(13), X(13), X(15), X(5), X(10));
201
+ BODY_20_31(30, A, B, C, D, E, T, X(14), X(14), X(0), X(6), X(11));
202
+ BODY_20_31(31, T, A, B, C, D, E, X(15), X(15), X(1), X(7), X(12));
203
+
204
+ BODY_32_39(32, E, T, A, B, C, D, X(0), X(2), X(8), X(13));
205
+ BODY_32_39(33, D, E, T, A, B, C, X(1), X(3), X(9), X(14));
206
+ BODY_32_39(34, C, D, E, T, A, B, X(2), X(4), X(10), X(15));
207
+ BODY_32_39(35, B, C, D, E, T, A, X(3), X(5), X(11), X(0));
208
+ BODY_32_39(36, A, B, C, D, E, T, X(4), X(6), X(12), X(1));
209
+ BODY_32_39(37, T, A, B, C, D, E, X(5), X(7), X(13), X(2));
210
+ BODY_32_39(38, E, T, A, B, C, D, X(6), X(8), X(14), X(3));
211
+ BODY_32_39(39, D, E, T, A, B, C, X(7), X(9), X(15), X(4));
212
+
213
+ BODY_40_59(40, C, D, E, T, A, B, X(8), X(10), X(0), X(5));
214
+ BODY_40_59(41, B, C, D, E, T, A, X(9), X(11), X(1), X(6));
215
+ BODY_40_59(42, A, B, C, D, E, T, X(10), X(12), X(2), X(7));
216
+ BODY_40_59(43, T, A, B, C, D, E, X(11), X(13), X(3), X(8));
217
+ BODY_40_59(44, E, T, A, B, C, D, X(12), X(14), X(4), X(9));
218
+ BODY_40_59(45, D, E, T, A, B, C, X(13), X(15), X(5), X(10));
219
+ BODY_40_59(46, C, D, E, T, A, B, X(14), X(0), X(6), X(11));
220
+ BODY_40_59(47, B, C, D, E, T, A, X(15), X(1), X(7), X(12));
221
+ BODY_40_59(48, A, B, C, D, E, T, X(0), X(2), X(8), X(13));
222
+ BODY_40_59(49, T, A, B, C, D, E, X(1), X(3), X(9), X(14));
223
+ BODY_40_59(50, E, T, A, B, C, D, X(2), X(4), X(10), X(15));
224
+ BODY_40_59(51, D, E, T, A, B, C, X(3), X(5), X(11), X(0));
225
+ BODY_40_59(52, C, D, E, T, A, B, X(4), X(6), X(12), X(1));
226
+ BODY_40_59(53, B, C, D, E, T, A, X(5), X(7), X(13), X(2));
227
+ BODY_40_59(54, A, B, C, D, E, T, X(6), X(8), X(14), X(3));
228
+ BODY_40_59(55, T, A, B, C, D, E, X(7), X(9), X(15), X(4));
229
+ BODY_40_59(56, E, T, A, B, C, D, X(8), X(10), X(0), X(5));
230
+ BODY_40_59(57, D, E, T, A, B, C, X(9), X(11), X(1), X(6));
231
+ BODY_40_59(58, C, D, E, T, A, B, X(10), X(12), X(2), X(7));
232
+ BODY_40_59(59, B, C, D, E, T, A, X(11), X(13), X(3), X(8));
233
+
234
+ BODY_60_79(60, A, B, C, D, E, T, X(12), X(14), X(4), X(9));
235
+ BODY_60_79(61, T, A, B, C, D, E, X(13), X(15), X(5), X(10));
236
+ BODY_60_79(62, E, T, A, B, C, D, X(14), X(0), X(6), X(11));
237
+ BODY_60_79(63, D, E, T, A, B, C, X(15), X(1), X(7), X(12));
238
+ BODY_60_79(64, C, D, E, T, A, B, X(0), X(2), X(8), X(13));
239
+ BODY_60_79(65, B, C, D, E, T, A, X(1), X(3), X(9), X(14));
240
+ BODY_60_79(66, A, B, C, D, E, T, X(2), X(4), X(10), X(15));
241
+ BODY_60_79(67, T, A, B, C, D, E, X(3), X(5), X(11), X(0));
242
+ BODY_60_79(68, E, T, A, B, C, D, X(4), X(6), X(12), X(1));
243
+ BODY_60_79(69, D, E, T, A, B, C, X(5), X(7), X(13), X(2));
244
+ BODY_60_79(70, C, D, E, T, A, B, X(6), X(8), X(14), X(3));
245
+ BODY_60_79(71, B, C, D, E, T, A, X(7), X(9), X(15), X(4));
246
+ BODY_60_79(72, A, B, C, D, E, T, X(8), X(10), X(0), X(5));
247
+ BODY_60_79(73, T, A, B, C, D, E, X(9), X(11), X(1), X(6));
248
+ BODY_60_79(74, E, T, A, B, C, D, X(10), X(12), X(2), X(7));
249
+ BODY_60_79(75, D, E, T, A, B, C, X(11), X(13), X(3), X(8));
250
+ BODY_60_79(76, C, D, E, T, A, B, X(12), X(14), X(4), X(9));
251
+ BODY_60_79(77, B, C, D, E, T, A, X(13), X(15), X(5), X(10));
252
+ BODY_60_79(78, A, B, C, D, E, T, X(14), X(0), X(6), X(11));
253
+ BODY_60_79(79, T, A, B, C, D, E, X(15), X(1), X(7), X(12));
254
+
255
+ state[0] = (state[0] + E) & 0xffffffffL;
256
+ state[1] = (state[1] + T) & 0xffffffffL;
257
+ state[2] = (state[2] + A) & 0xffffffffL;
258
+ state[3] = (state[3] + B) & 0xffffffffL;
259
+ state[4] = (state[4] + C) & 0xffffffffL;
260
+
261
+ if (--num == 0) {
262
+ break;
263
+ }
264
+
265
+ A = state[0];
266
+ B = state[1];
267
+ C = state[2];
268
+ D = state[3];
269
+ E = state[4];
270
+ }
271
+ }
@@ -0,0 +1,204 @@
1
+ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
2
+ * All rights reserved.
3
+ *
4
+ * This package is an SSL implementation written
5
+ * by Eric Young (eay@cryptsoft.com).
6
+ * The implementation was written so as to conform with Netscapes SSL.
7
+ *
8
+ * This library is free for commercial and non-commercial use as long as
9
+ * the following conditions are aheared to. The following conditions
10
+ * apply to all code found in this distribution, be it the RC4, RSA,
11
+ * lhash, DES, etc., code; not just the SSL code. The SSL documentation
12
+ * included with this distribution is covered by the same copyright terms
13
+ * except that the holder is Tim Hudson (tjh@cryptsoft.com).
14
+ *
15
+ * Copyright remains Eric Young's, and as such any Copyright notices in
16
+ * the code are not to be removed.
17
+ * If this package is used in a product, Eric Young should be given attribution
18
+ * as the author of the parts of the library used.
19
+ * This can be in the form of a textual message at program startup or
20
+ * in documentation (online or textual) provided with the package.
21
+ *
22
+ * Redistribution and use in source and binary forms, with or without
23
+ * modification, are permitted provided that the following conditions
24
+ * are met:
25
+ * 1. Redistributions of source code must retain the copyright
26
+ * notice, this list of conditions and the following disclaimer.
27
+ * 2. Redistributions in binary form must reproduce the above copyright
28
+ * notice, this list of conditions and the following disclaimer in the
29
+ * documentation and/or other materials provided with the distribution.
30
+ * 3. All advertising materials mentioning features or use of this software
31
+ * must display the following acknowledgement:
32
+ * "This product includes cryptographic software written by
33
+ * Eric Young (eay@cryptsoft.com)"
34
+ * The word 'cryptographic' can be left out if the rouines from the library
35
+ * being used are not cryptographic related :-).
36
+ * 4. If you include any Windows specific code (or a derivative thereof) from
37
+ * the apps directory (application code) you must include an acknowledgement:
38
+ * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
39
+ *
40
+ * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
41
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
42
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
43
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
44
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
45
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
46
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
47
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
48
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
49
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
50
+ * SUCH DAMAGE.
51
+ *
52
+ * The licence and distribution terms for any publically available version or
53
+ * derivative of this code cannot be changed. i.e. this code cannot simply be
54
+ * copied and put under another distribution licence
55
+ * [including the GNU Public Licence.] */
56
+
57
+ #include "openssl/base.h"
58
+
59
+
60
+ #if !defined(OPENSSL_NO_ASM) && \
61
+ (defined(OPENSSL_X86) || defined(OPENSSL_X86_64) || \
62
+ defined(OPENSSL_ARM) || defined(OPENSSL_AARCH64))
63
+ #define SHA256_ASM
64
+ #endif
65
+
66
+ #define DATA_ORDER_IS_BIG_ENDIAN /* Required by md32_common.h */
67
+ #define HASH_CBLOCK 64
68
+
69
+ #include "../digest/md32_common.h"
70
+
71
+ #ifndef SHA256_ASM
72
+ static const uint32_t K256[64] = {
73
+ 0x428a2f98UL, 0x71374491UL, 0xb5c0fbcfUL, 0xe9b5dba5UL, 0x3956c25bUL,
74
+ 0x59f111f1UL, 0x923f82a4UL, 0xab1c5ed5UL, 0xd807aa98UL, 0x12835b01UL,
75
+ 0x243185beUL, 0x550c7dc3UL, 0x72be5d74UL, 0x80deb1feUL, 0x9bdc06a7UL,
76
+ 0xc19bf174UL, 0xe49b69c1UL, 0xefbe4786UL, 0x0fc19dc6UL, 0x240ca1ccUL,
77
+ 0x2de92c6fUL, 0x4a7484aaUL, 0x5cb0a9dcUL, 0x76f988daUL, 0x983e5152UL,
78
+ 0xa831c66dUL, 0xb00327c8UL, 0xbf597fc7UL, 0xc6e00bf3UL, 0xd5a79147UL,
79
+ 0x06ca6351UL, 0x14292967UL, 0x27b70a85UL, 0x2e1b2138UL, 0x4d2c6dfcUL,
80
+ 0x53380d13UL, 0x650a7354UL, 0x766a0abbUL, 0x81c2c92eUL, 0x92722c85UL,
81
+ 0xa2bfe8a1UL, 0xa81a664bUL, 0xc24b8b70UL, 0xc76c51a3UL, 0xd192e819UL,
82
+ 0xd6990624UL, 0xf40e3585UL, 0x106aa070UL, 0x19a4c116UL, 0x1e376c08UL,
83
+ 0x2748774cUL, 0x34b0bcb5UL, 0x391c0cb3UL, 0x4ed8aa4aUL, 0x5b9cca4fUL,
84
+ 0x682e6ff3UL, 0x748f82eeUL, 0x78a5636fUL, 0x84c87814UL, 0x8cc70208UL,
85
+ 0x90befffaUL, 0xa4506cebUL, 0xbef9a3f7UL, 0xc67178f2UL};
86
+
87
+ /* FIPS specification refers to right rotations, while our ROTATE macro
88
+ * is left one. This is why you might notice that rotation coefficients
89
+ * differ from those observed in FIPS document by 32-N... */
90
+ #define Sigma0(x) (ROTATE((x), 30) ^ ROTATE((x), 19) ^ ROTATE((x), 10))
91
+ #define Sigma1(x) (ROTATE((x), 26) ^ ROTATE((x), 21) ^ ROTATE((x), 7))
92
+ #define sigma0(x) (ROTATE((x), 25) ^ ROTATE((x), 14) ^ ((x) >> 3))
93
+ #define sigma1(x) (ROTATE((x), 15) ^ ROTATE((x), 13) ^ ((x) >> 10))
94
+
95
+ #define Ch(x, y, z) (((x) & (y)) ^ ((~(x)) & (z)))
96
+ #define Maj(x, y, z) (((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z)))
97
+
98
+ #define ROUND_00_15(i, a, b, c, d, e, f, g, h) \
99
+ do { \
100
+ T1 += h + Sigma1(e) + Ch(e, f, g) + K256[i]; \
101
+ h = Sigma0(a) + Maj(a, b, c); \
102
+ d += T1; \
103
+ h += T1; \
104
+ } while (0)
105
+
106
+ #define ROUND_16_63(i, a, b, c, d, e, f, g, h, X) \
107
+ do { \
108
+ s0 = X[(i + 1) & 0x0f]; \
109
+ s0 = sigma0(s0); \
110
+ s1 = X[(i + 14) & 0x0f]; \
111
+ s1 = sigma1(s1); \
112
+ T1 = X[(i) & 0x0f] += s0 + s1 + X[(i + 9) & 0x0f]; \
113
+ ROUND_00_15(i, a, b, c, d, e, f, g, h); \
114
+ } while (0)
115
+
116
+ void sha256_block_data_order(uint32_t *state, const uint8_t *data, size_t num) {
117
+ uint32_t a, b, c, d, e, f, g, h, s0, s1, T1;
118
+ uint32_t X[16];
119
+ int i;
120
+
121
+ while (num--) {
122
+ a = state[0];
123
+ b = state[1];
124
+ c = state[2];
125
+ d = state[3];
126
+ e = state[4];
127
+ f = state[5];
128
+ g = state[6];
129
+ h = state[7];
130
+
131
+ uint32_t l;
132
+
133
+ HOST_c2l(data, l);
134
+ T1 = X[0] = l;
135
+ ROUND_00_15(0, a, b, c, d, e, f, g, h);
136
+ HOST_c2l(data, l);
137
+ T1 = X[1] = l;
138
+ ROUND_00_15(1, h, a, b, c, d, e, f, g);
139
+ HOST_c2l(data, l);
140
+ T1 = X[2] = l;
141
+ ROUND_00_15(2, g, h, a, b, c, d, e, f);
142
+ HOST_c2l(data, l);
143
+ T1 = X[3] = l;
144
+ ROUND_00_15(3, f, g, h, a, b, c, d, e);
145
+ HOST_c2l(data, l);
146
+ T1 = X[4] = l;
147
+ ROUND_00_15(4, e, f, g, h, a, b, c, d);
148
+ HOST_c2l(data, l);
149
+ T1 = X[5] = l;
150
+ ROUND_00_15(5, d, e, f, g, h, a, b, c);
151
+ HOST_c2l(data, l);
152
+ T1 = X[6] = l;
153
+ ROUND_00_15(6, c, d, e, f, g, h, a, b);
154
+ HOST_c2l(data, l);
155
+ T1 = X[7] = l;
156
+ ROUND_00_15(7, b, c, d, e, f, g, h, a);
157
+ HOST_c2l(data, l);
158
+ T1 = X[8] = l;
159
+ ROUND_00_15(8, a, b, c, d, e, f, g, h);
160
+ HOST_c2l(data, l);
161
+ T1 = X[9] = l;
162
+ ROUND_00_15(9, h, a, b, c, d, e, f, g);
163
+ HOST_c2l(data, l);
164
+ T1 = X[10] = l;
165
+ ROUND_00_15(10, g, h, a, b, c, d, e, f);
166
+ HOST_c2l(data, l);
167
+ T1 = X[11] = l;
168
+ ROUND_00_15(11, f, g, h, a, b, c, d, e);
169
+ HOST_c2l(data, l);
170
+ T1 = X[12] = l;
171
+ ROUND_00_15(12, e, f, g, h, a, b, c, d);
172
+ HOST_c2l(data, l);
173
+ T1 = X[13] = l;
174
+ ROUND_00_15(13, d, e, f, g, h, a, b, c);
175
+ HOST_c2l(data, l);
176
+ T1 = X[14] = l;
177
+ ROUND_00_15(14, c, d, e, f, g, h, a, b);
178
+ HOST_c2l(data, l);
179
+ T1 = X[15] = l;
180
+ ROUND_00_15(15, b, c, d, e, f, g, h, a);
181
+
182
+ for (i = 16; i < 64; i += 8) {
183
+ ROUND_16_63(i + 0, a, b, c, d, e, f, g, h, X);
184
+ ROUND_16_63(i + 1, h, a, b, c, d, e, f, g, X);
185
+ ROUND_16_63(i + 2, g, h, a, b, c, d, e, f, X);
186
+ ROUND_16_63(i + 3, f, g, h, a, b, c, d, e, X);
187
+ ROUND_16_63(i + 4, e, f, g, h, a, b, c, d, X);
188
+ ROUND_16_63(i + 5, d, e, f, g, h, a, b, c, X);
189
+ ROUND_16_63(i + 6, c, d, e, f, g, h, a, b, X);
190
+ ROUND_16_63(i + 7, b, c, d, e, f, g, h, a, X);
191
+ }
192
+
193
+ state[0] += a;
194
+ state[1] += b;
195
+ state[2] += c;
196
+ state[3] += d;
197
+ state[4] += e;
198
+ state[5] += f;
199
+ state[6] += g;
200
+ state[7] += h;
201
+ }
202
+ }
203
+
204
+ #endif /* SHA256_ASM */