ring-native 0.0.0 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (267) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/CHANGES.md +7 -0
  4. data/Makefile +5 -0
  5. data/README.md +12 -5
  6. data/Rakefile +4 -0
  7. data/ext/ring/extconf.rb +4 -5
  8. data/lib/ring/native.rb +3 -1
  9. data/lib/ring/native/version.rb +5 -1
  10. data/ring-native.gemspec +6 -6
  11. data/vendor/ring-ffi/Cargo.lock +26 -0
  12. data/vendor/ring-ffi/Cargo.toml +45 -0
  13. data/vendor/ring-ffi/LICENSE +16 -0
  14. data/vendor/ring-ffi/README.md +59 -0
  15. data/vendor/ring-ffi/src/lib.rs +79 -0
  16. metadata +10 -255
  17. data/vendor/ring/BUILDING.md +0 -40
  18. data/vendor/ring/Cargo.toml +0 -43
  19. data/vendor/ring/LICENSE +0 -185
  20. data/vendor/ring/Makefile +0 -35
  21. data/vendor/ring/PORTING.md +0 -163
  22. data/vendor/ring/README.md +0 -113
  23. data/vendor/ring/STYLE.md +0 -197
  24. data/vendor/ring/appveyor.yml +0 -27
  25. data/vendor/ring/build.rs +0 -108
  26. data/vendor/ring/crypto/aes/aes.c +0 -1142
  27. data/vendor/ring/crypto/aes/aes_test.Windows.vcxproj +0 -25
  28. data/vendor/ring/crypto/aes/aes_test.cc +0 -93
  29. data/vendor/ring/crypto/aes/asm/aes-586.pl +0 -2368
  30. data/vendor/ring/crypto/aes/asm/aes-armv4.pl +0 -1249
  31. data/vendor/ring/crypto/aes/asm/aes-x86_64.pl +0 -2246
  32. data/vendor/ring/crypto/aes/asm/aesni-x86.pl +0 -1318
  33. data/vendor/ring/crypto/aes/asm/aesni-x86_64.pl +0 -2084
  34. data/vendor/ring/crypto/aes/asm/aesv8-armx.pl +0 -675
  35. data/vendor/ring/crypto/aes/asm/bsaes-armv7.pl +0 -1364
  36. data/vendor/ring/crypto/aes/asm/bsaes-x86_64.pl +0 -1565
  37. data/vendor/ring/crypto/aes/asm/vpaes-x86.pl +0 -841
  38. data/vendor/ring/crypto/aes/asm/vpaes-x86_64.pl +0 -1116
  39. data/vendor/ring/crypto/aes/internal.h +0 -87
  40. data/vendor/ring/crypto/aes/mode_wrappers.c +0 -61
  41. data/vendor/ring/crypto/bn/add.c +0 -394
  42. data/vendor/ring/crypto/bn/asm/armv4-mont.pl +0 -694
  43. data/vendor/ring/crypto/bn/asm/armv8-mont.pl +0 -1503
  44. data/vendor/ring/crypto/bn/asm/bn-586.pl +0 -774
  45. data/vendor/ring/crypto/bn/asm/co-586.pl +0 -287
  46. data/vendor/ring/crypto/bn/asm/rsaz-avx2.pl +0 -1882
  47. data/vendor/ring/crypto/bn/asm/x86-mont.pl +0 -592
  48. data/vendor/ring/crypto/bn/asm/x86_64-gcc.c +0 -599
  49. data/vendor/ring/crypto/bn/asm/x86_64-mont.pl +0 -1393
  50. data/vendor/ring/crypto/bn/asm/x86_64-mont5.pl +0 -3507
  51. data/vendor/ring/crypto/bn/bn.c +0 -352
  52. data/vendor/ring/crypto/bn/bn_asn1.c +0 -74
  53. data/vendor/ring/crypto/bn/bn_test.Windows.vcxproj +0 -25
  54. data/vendor/ring/crypto/bn/bn_test.cc +0 -1696
  55. data/vendor/ring/crypto/bn/cmp.c +0 -200
  56. data/vendor/ring/crypto/bn/convert.c +0 -433
  57. data/vendor/ring/crypto/bn/ctx.c +0 -311
  58. data/vendor/ring/crypto/bn/div.c +0 -594
  59. data/vendor/ring/crypto/bn/exponentiation.c +0 -1335
  60. data/vendor/ring/crypto/bn/gcd.c +0 -711
  61. data/vendor/ring/crypto/bn/generic.c +0 -1019
  62. data/vendor/ring/crypto/bn/internal.h +0 -316
  63. data/vendor/ring/crypto/bn/montgomery.c +0 -516
  64. data/vendor/ring/crypto/bn/mul.c +0 -888
  65. data/vendor/ring/crypto/bn/prime.c +0 -829
  66. data/vendor/ring/crypto/bn/random.c +0 -334
  67. data/vendor/ring/crypto/bn/rsaz_exp.c +0 -262
  68. data/vendor/ring/crypto/bn/rsaz_exp.h +0 -53
  69. data/vendor/ring/crypto/bn/shift.c +0 -276
  70. data/vendor/ring/crypto/bytestring/bytestring_test.Windows.vcxproj +0 -25
  71. data/vendor/ring/crypto/bytestring/bytestring_test.cc +0 -421
  72. data/vendor/ring/crypto/bytestring/cbb.c +0 -399
  73. data/vendor/ring/crypto/bytestring/cbs.c +0 -227
  74. data/vendor/ring/crypto/bytestring/internal.h +0 -46
  75. data/vendor/ring/crypto/chacha/chacha_generic.c +0 -140
  76. data/vendor/ring/crypto/chacha/chacha_vec.c +0 -323
  77. data/vendor/ring/crypto/chacha/chacha_vec_arm.S +0 -1447
  78. data/vendor/ring/crypto/chacha/chacha_vec_arm_generate.go +0 -153
  79. data/vendor/ring/crypto/cipher/cipher_test.Windows.vcxproj +0 -25
  80. data/vendor/ring/crypto/cipher/e_aes.c +0 -390
  81. data/vendor/ring/crypto/cipher/e_chacha20poly1305.c +0 -208
  82. data/vendor/ring/crypto/cipher/internal.h +0 -173
  83. data/vendor/ring/crypto/cipher/test/aes_128_gcm_tests.txt +0 -543
  84. data/vendor/ring/crypto/cipher/test/aes_128_key_wrap_tests.txt +0 -9
  85. data/vendor/ring/crypto/cipher/test/aes_256_gcm_tests.txt +0 -475
  86. data/vendor/ring/crypto/cipher/test/aes_256_key_wrap_tests.txt +0 -23
  87. data/vendor/ring/crypto/cipher/test/chacha20_poly1305_old_tests.txt +0 -422
  88. data/vendor/ring/crypto/cipher/test/chacha20_poly1305_tests.txt +0 -484
  89. data/vendor/ring/crypto/cipher/test/cipher_test.txt +0 -100
  90. data/vendor/ring/crypto/constant_time_test.Windows.vcxproj +0 -25
  91. data/vendor/ring/crypto/constant_time_test.c +0 -304
  92. data/vendor/ring/crypto/cpu-arm-asm.S +0 -32
  93. data/vendor/ring/crypto/cpu-arm.c +0 -199
  94. data/vendor/ring/crypto/cpu-intel.c +0 -261
  95. data/vendor/ring/crypto/crypto.c +0 -151
  96. data/vendor/ring/crypto/curve25519/asm/x25519-arm.S +0 -2118
  97. data/vendor/ring/crypto/curve25519/curve25519.c +0 -4888
  98. data/vendor/ring/crypto/curve25519/x25519_test.cc +0 -128
  99. data/vendor/ring/crypto/digest/md32_common.h +0 -181
  100. data/vendor/ring/crypto/ec/asm/p256-x86_64-asm.pl +0 -2725
  101. data/vendor/ring/crypto/ec/ec.c +0 -193
  102. data/vendor/ring/crypto/ec/ec_curves.c +0 -61
  103. data/vendor/ring/crypto/ec/ec_key.c +0 -228
  104. data/vendor/ring/crypto/ec/ec_montgomery.c +0 -114
  105. data/vendor/ring/crypto/ec/example_mul.Windows.vcxproj +0 -25
  106. data/vendor/ring/crypto/ec/internal.h +0 -243
  107. data/vendor/ring/crypto/ec/oct.c +0 -253
  108. data/vendor/ring/crypto/ec/p256-64.c +0 -1794
  109. data/vendor/ring/crypto/ec/p256-x86_64-table.h +0 -9548
  110. data/vendor/ring/crypto/ec/p256-x86_64.c +0 -509
  111. data/vendor/ring/crypto/ec/simple.c +0 -1007
  112. data/vendor/ring/crypto/ec/util-64.c +0 -183
  113. data/vendor/ring/crypto/ec/wnaf.c +0 -508
  114. data/vendor/ring/crypto/ecdh/ecdh.c +0 -155
  115. data/vendor/ring/crypto/ecdsa/ecdsa.c +0 -304
  116. data/vendor/ring/crypto/ecdsa/ecdsa_asn1.c +0 -193
  117. data/vendor/ring/crypto/ecdsa/ecdsa_test.Windows.vcxproj +0 -25
  118. data/vendor/ring/crypto/ecdsa/ecdsa_test.cc +0 -327
  119. data/vendor/ring/crypto/header_removed.h +0 -17
  120. data/vendor/ring/crypto/internal.h +0 -495
  121. data/vendor/ring/crypto/libring.Windows.vcxproj +0 -101
  122. data/vendor/ring/crypto/mem.c +0 -98
  123. data/vendor/ring/crypto/modes/asm/aesni-gcm-x86_64.pl +0 -1045
  124. data/vendor/ring/crypto/modes/asm/ghash-armv4.pl +0 -517
  125. data/vendor/ring/crypto/modes/asm/ghash-x86.pl +0 -1393
  126. data/vendor/ring/crypto/modes/asm/ghash-x86_64.pl +0 -1741
  127. data/vendor/ring/crypto/modes/asm/ghashv8-armx.pl +0 -422
  128. data/vendor/ring/crypto/modes/ctr.c +0 -226
  129. data/vendor/ring/crypto/modes/gcm.c +0 -1206
  130. data/vendor/ring/crypto/modes/gcm_test.Windows.vcxproj +0 -25
  131. data/vendor/ring/crypto/modes/gcm_test.c +0 -348
  132. data/vendor/ring/crypto/modes/internal.h +0 -299
  133. data/vendor/ring/crypto/perlasm/arm-xlate.pl +0 -170
  134. data/vendor/ring/crypto/perlasm/readme +0 -100
  135. data/vendor/ring/crypto/perlasm/x86_64-xlate.pl +0 -1164
  136. data/vendor/ring/crypto/perlasm/x86asm.pl +0 -292
  137. data/vendor/ring/crypto/perlasm/x86gas.pl +0 -263
  138. data/vendor/ring/crypto/perlasm/x86masm.pl +0 -200
  139. data/vendor/ring/crypto/perlasm/x86nasm.pl +0 -187
  140. data/vendor/ring/crypto/poly1305/poly1305.c +0 -331
  141. data/vendor/ring/crypto/poly1305/poly1305_arm.c +0 -301
  142. data/vendor/ring/crypto/poly1305/poly1305_arm_asm.S +0 -2015
  143. data/vendor/ring/crypto/poly1305/poly1305_test.Windows.vcxproj +0 -25
  144. data/vendor/ring/crypto/poly1305/poly1305_test.cc +0 -80
  145. data/vendor/ring/crypto/poly1305/poly1305_test.txt +0 -52
  146. data/vendor/ring/crypto/poly1305/poly1305_vec.c +0 -892
  147. data/vendor/ring/crypto/rand/asm/rdrand-x86_64.pl +0 -75
  148. data/vendor/ring/crypto/rand/internal.h +0 -32
  149. data/vendor/ring/crypto/rand/rand.c +0 -189
  150. data/vendor/ring/crypto/rand/urandom.c +0 -219
  151. data/vendor/ring/crypto/rand/windows.c +0 -56
  152. data/vendor/ring/crypto/refcount_c11.c +0 -66
  153. data/vendor/ring/crypto/refcount_lock.c +0 -53
  154. data/vendor/ring/crypto/refcount_test.Windows.vcxproj +0 -25
  155. data/vendor/ring/crypto/refcount_test.c +0 -58
  156. data/vendor/ring/crypto/rsa/blinding.c +0 -462
  157. data/vendor/ring/crypto/rsa/internal.h +0 -108
  158. data/vendor/ring/crypto/rsa/padding.c +0 -300
  159. data/vendor/ring/crypto/rsa/rsa.c +0 -450
  160. data/vendor/ring/crypto/rsa/rsa_asn1.c +0 -261
  161. data/vendor/ring/crypto/rsa/rsa_impl.c +0 -944
  162. data/vendor/ring/crypto/rsa/rsa_test.Windows.vcxproj +0 -25
  163. data/vendor/ring/crypto/rsa/rsa_test.cc +0 -437
  164. data/vendor/ring/crypto/sha/asm/sha-armv8.pl +0 -436
  165. data/vendor/ring/crypto/sha/asm/sha-x86_64.pl +0 -2390
  166. data/vendor/ring/crypto/sha/asm/sha256-586.pl +0 -1275
  167. data/vendor/ring/crypto/sha/asm/sha256-armv4.pl +0 -735
  168. data/vendor/ring/crypto/sha/asm/sha256-armv8.pl +0 -14
  169. data/vendor/ring/crypto/sha/asm/sha256-x86_64.pl +0 -14
  170. data/vendor/ring/crypto/sha/asm/sha512-586.pl +0 -911
  171. data/vendor/ring/crypto/sha/asm/sha512-armv4.pl +0 -666
  172. data/vendor/ring/crypto/sha/asm/sha512-armv8.pl +0 -14
  173. data/vendor/ring/crypto/sha/asm/sha512-x86_64.pl +0 -14
  174. data/vendor/ring/crypto/sha/sha1.c +0 -271
  175. data/vendor/ring/crypto/sha/sha256.c +0 -204
  176. data/vendor/ring/crypto/sha/sha512.c +0 -355
  177. data/vendor/ring/crypto/test/file_test.cc +0 -326
  178. data/vendor/ring/crypto/test/file_test.h +0 -181
  179. data/vendor/ring/crypto/test/malloc.cc +0 -150
  180. data/vendor/ring/crypto/test/scoped_types.h +0 -95
  181. data/vendor/ring/crypto/test/test.Windows.vcxproj +0 -35
  182. data/vendor/ring/crypto/test/test_util.cc +0 -46
  183. data/vendor/ring/crypto/test/test_util.h +0 -41
  184. data/vendor/ring/crypto/thread_none.c +0 -55
  185. data/vendor/ring/crypto/thread_pthread.c +0 -165
  186. data/vendor/ring/crypto/thread_test.Windows.vcxproj +0 -25
  187. data/vendor/ring/crypto/thread_test.c +0 -200
  188. data/vendor/ring/crypto/thread_win.c +0 -282
  189. data/vendor/ring/examples/checkdigest.rs +0 -103
  190. data/vendor/ring/include/openssl/aes.h +0 -121
  191. data/vendor/ring/include/openssl/arm_arch.h +0 -129
  192. data/vendor/ring/include/openssl/base.h +0 -156
  193. data/vendor/ring/include/openssl/bn.h +0 -794
  194. data/vendor/ring/include/openssl/buffer.h +0 -18
  195. data/vendor/ring/include/openssl/bytestring.h +0 -235
  196. data/vendor/ring/include/openssl/chacha.h +0 -37
  197. data/vendor/ring/include/openssl/cmac.h +0 -76
  198. data/vendor/ring/include/openssl/cpu.h +0 -184
  199. data/vendor/ring/include/openssl/crypto.h +0 -43
  200. data/vendor/ring/include/openssl/curve25519.h +0 -88
  201. data/vendor/ring/include/openssl/ec.h +0 -225
  202. data/vendor/ring/include/openssl/ec_key.h +0 -129
  203. data/vendor/ring/include/openssl/ecdh.h +0 -110
  204. data/vendor/ring/include/openssl/ecdsa.h +0 -156
  205. data/vendor/ring/include/openssl/err.h +0 -201
  206. data/vendor/ring/include/openssl/mem.h +0 -101
  207. data/vendor/ring/include/openssl/obj_mac.h +0 -71
  208. data/vendor/ring/include/openssl/opensslfeatures.h +0 -68
  209. data/vendor/ring/include/openssl/opensslv.h +0 -18
  210. data/vendor/ring/include/openssl/ossl_typ.h +0 -18
  211. data/vendor/ring/include/openssl/poly1305.h +0 -51
  212. data/vendor/ring/include/openssl/rand.h +0 -70
  213. data/vendor/ring/include/openssl/rsa.h +0 -399
  214. data/vendor/ring/include/openssl/thread.h +0 -133
  215. data/vendor/ring/include/openssl/type_check.h +0 -71
  216. data/vendor/ring/mk/Common.props +0 -63
  217. data/vendor/ring/mk/Windows.props +0 -42
  218. data/vendor/ring/mk/WindowsTest.props +0 -18
  219. data/vendor/ring/mk/appveyor.bat +0 -62
  220. data/vendor/ring/mk/bottom_of_makefile.mk +0 -54
  221. data/vendor/ring/mk/ring.mk +0 -266
  222. data/vendor/ring/mk/top_of_makefile.mk +0 -214
  223. data/vendor/ring/mk/travis.sh +0 -40
  224. data/vendor/ring/mk/update-travis-yml.py +0 -229
  225. data/vendor/ring/ring.sln +0 -153
  226. data/vendor/ring/src/aead.rs +0 -682
  227. data/vendor/ring/src/agreement.rs +0 -248
  228. data/vendor/ring/src/c.rs +0 -129
  229. data/vendor/ring/src/constant_time.rs +0 -37
  230. data/vendor/ring/src/der.rs +0 -96
  231. data/vendor/ring/src/digest.rs +0 -690
  232. data/vendor/ring/src/digest_tests.txt +0 -57
  233. data/vendor/ring/src/ecc.rs +0 -28
  234. data/vendor/ring/src/ecc_build.rs +0 -279
  235. data/vendor/ring/src/ecc_curves.rs +0 -117
  236. data/vendor/ring/src/ed25519_tests.txt +0 -2579
  237. data/vendor/ring/src/exe_tests.rs +0 -46
  238. data/vendor/ring/src/ffi.rs +0 -29
  239. data/vendor/ring/src/file_test.rs +0 -187
  240. data/vendor/ring/src/hkdf.rs +0 -153
  241. data/vendor/ring/src/hkdf_tests.txt +0 -59
  242. data/vendor/ring/src/hmac.rs +0 -414
  243. data/vendor/ring/src/hmac_tests.txt +0 -97
  244. data/vendor/ring/src/input.rs +0 -312
  245. data/vendor/ring/src/lib.rs +0 -41
  246. data/vendor/ring/src/pbkdf2.rs +0 -265
  247. data/vendor/ring/src/pbkdf2_tests.txt +0 -113
  248. data/vendor/ring/src/polyfill.rs +0 -57
  249. data/vendor/ring/src/rand.rs +0 -28
  250. data/vendor/ring/src/signature.rs +0 -314
  251. data/vendor/ring/third-party/NIST/README.md +0 -9
  252. data/vendor/ring/third-party/NIST/SHAVS/SHA1LongMsg.rsp +0 -263
  253. data/vendor/ring/third-party/NIST/SHAVS/SHA1Monte.rsp +0 -309
  254. data/vendor/ring/third-party/NIST/SHAVS/SHA1ShortMsg.rsp +0 -267
  255. data/vendor/ring/third-party/NIST/SHAVS/SHA224LongMsg.rsp +0 -263
  256. data/vendor/ring/third-party/NIST/SHAVS/SHA224Monte.rsp +0 -309
  257. data/vendor/ring/third-party/NIST/SHAVS/SHA224ShortMsg.rsp +0 -267
  258. data/vendor/ring/third-party/NIST/SHAVS/SHA256LongMsg.rsp +0 -263
  259. data/vendor/ring/third-party/NIST/SHAVS/SHA256Monte.rsp +0 -309
  260. data/vendor/ring/third-party/NIST/SHAVS/SHA256ShortMsg.rsp +0 -267
  261. data/vendor/ring/third-party/NIST/SHAVS/SHA384LongMsg.rsp +0 -519
  262. data/vendor/ring/third-party/NIST/SHAVS/SHA384Monte.rsp +0 -309
  263. data/vendor/ring/third-party/NIST/SHAVS/SHA384ShortMsg.rsp +0 -523
  264. data/vendor/ring/third-party/NIST/SHAVS/SHA512LongMsg.rsp +0 -519
  265. data/vendor/ring/third-party/NIST/SHAVS/SHA512Monte.rsp +0 -309
  266. data/vendor/ring/third-party/NIST/SHAVS/SHA512ShortMsg.rsp +0 -523
  267. data/vendor/ring/third-party/NIST/sha256sums.txt +0 -1
@@ -1,200 +0,0 @@
1
- #!/usr/bin/env perl
2
-
3
- package x86masm;
4
-
5
- *out=\@::out;
6
-
7
- $::lbdecor="\$L"; # local label decoration
8
- $nmdecor="_"; # external name decoration
9
-
10
- $initseg="";
11
- $segment="";
12
-
13
- sub ::generic
14
- { my ($opcode,@arg)=@_;
15
-
16
- # fix hexadecimal constants
17
- for (@arg) { s/(?<![\w\$\.])0x([0-9a-f]+)/0$1h/oi; }
18
-
19
- if ($opcode =~ /lea/ && @arg[1] =~ s/.*PTR\s+(\(.*\))$/OFFSET $1/) # no []
20
- { $opcode="mov"; }
21
- elsif ($opcode !~ /mov[dq]$/)
22
- { # fix xmm references
23
- $arg[0] =~ s/\b[A-Z]+WORD\s+PTR/XMMWORD PTR/i if ($arg[-1]=~/\bxmm[0-7]\b/i);
24
- $arg[-1] =~ s/\b[A-Z]+WORD\s+PTR/XMMWORD PTR/i if ($arg[0]=~/\bxmm[0-7]\b/i);
25
- }
26
-
27
- &::emit($opcode,@arg);
28
- 1;
29
- }
30
- #
31
- # opcodes not covered by ::generic above, mostly inconsistent namings...
32
- #
33
- sub ::call { &::emit("call",(&::islabel($_[0]) or "$nmdecor$_[0]")); }
34
- sub ::call_ptr { &::emit("call",@_); }
35
- sub ::jmp_ptr { &::emit("jmp",@_); }
36
- sub ::lock { &::data_byte(0xf0); }
37
-
38
- sub get_mem
39
- { my($size,$addr,$reg1,$reg2,$idx)=@_;
40
- my($post,$ret);
41
-
42
- if (!defined($idx) && 1*$reg2) { $idx=$reg2; $reg2=$reg1; undef $reg1; }
43
-
44
- $ret .= "$size PTR " if ($size ne "");
45
-
46
- $addr =~ s/^\s+//;
47
- # prepend global references with optional underscore
48
- $addr =~ s/^([^\+\-0-9][^\+\-]*)/&::islabel($1) or "$nmdecor$1"/ige;
49
- # put address arithmetic expression in parenthesis
50
- $addr="($addr)" if ($addr =~ /^.+[\-\+].+$/);
51
-
52
- if (($addr ne "") && ($addr ne 0))
53
- { if ($addr !~ /^-/) { $ret .= "$addr"; }
54
- else { $post=$addr; }
55
- }
56
- $ret .= "[";
57
-
58
- if ($reg2 ne "")
59
- { $idx!=0 or $idx=1;
60
- $ret .= "$reg2*$idx";
61
- $ret .= "+$reg1" if ($reg1 ne "");
62
- }
63
- else
64
- { $ret .= "$reg1"; }
65
-
66
- $ret .= "$post]";
67
- $ret =~ s/\+\]/]/; # in case $addr was the only argument
68
- $ret =~ s/\[\s*\]//;
69
-
70
- $ret;
71
- }
72
- sub ::BP { &get_mem("BYTE",@_); }
73
- sub ::WP { &get_mem("WORD",@_); }
74
- sub ::DWP { &get_mem("DWORD",@_); }
75
- sub ::QWP { &get_mem("QWORD",@_); }
76
- sub ::BC { "@_"; }
77
- sub ::DWC { "@_"; }
78
-
79
- sub ::file
80
- { my $tmp=<<___;
81
- TITLE $_[0].asm
82
- IF \@Version LT 800
83
- ECHO MASM version 8.00 or later is strongly recommended.
84
- ENDIF
85
- .686
86
- .MODEL FLAT
87
- OPTION DOTNAME
88
- IF \@Version LT 800
89
- .text\$ SEGMENT PAGE 'CODE'
90
- ELSE
91
- .text\$ SEGMENT ALIGN(64) 'CODE'
92
- ENDIF
93
- ___
94
- push(@out,$tmp);
95
- $segment = ".text\$";
96
- }
97
-
98
- sub ::function_begin_B
99
- { my $func=shift;
100
- my $global=($func !~ /^_/);
101
- my $begin="${::lbdecor}_${func}_begin";
102
-
103
- &::LABEL($func,$global?"$begin":"$nmdecor$func");
104
- $func="ALIGN\t16\n".$nmdecor.$func."\tPROC";
105
-
106
- if ($global) { $func.=" PUBLIC\n${begin}::\n"; }
107
- else { $func.=" PRIVATE\n"; }
108
- push(@out,$func);
109
- $::stack=4;
110
- }
111
- sub ::function_end_B
112
- { my $func=shift;
113
-
114
- push(@out,"$nmdecor$func ENDP\n");
115
- $::stack=0;
116
- &::wipe_labels();
117
- }
118
-
119
- sub ::file_end
120
- { my $xmmheader=<<___;
121
- .686
122
- .XMM
123
- IF \@Version LT 800
124
- XMMWORD STRUCT 16
125
- DQ 2 dup (?)
126
- XMMWORD ENDS
127
- ENDIF
128
- ___
129
- if (grep {/\b[x]?mm[0-7]\b/i} @out) {
130
- grep {s/\.[3-7]86/$xmmheader/} @out;
131
- }
132
-
133
- push(@out,"$segment ENDS\n");
134
-
135
- if (grep {/\b${nmdecor}OPENSSL_ia32cap_P\b/i} @out)
136
- { my $comm=<<___;
137
- .bss SEGMENT 'BSS'
138
- COMM ${nmdecor}OPENSSL_ia32cap_P:DWORD:4
139
- .bss ENDS
140
- ___
141
- # comment out OPENSSL_ia32cap_P declarations
142
- grep {s/(^EXTERN\s+${nmdecor}OPENSSL_ia32cap_P)/\;$1/} @out;
143
- push (@out,$comm);
144
- }
145
- push (@out,$initseg) if ($initseg);
146
- push (@out,"END\n");
147
- }
148
-
149
- sub ::comment { foreach (@_) { push(@out,"\t; $_\n"); } }
150
-
151
- *::set_label_B = sub
152
- { my $l=shift; push(@out,$l.($l=~/^\Q${::lbdecor}\E[0-9]{3}/?":\n":"::\n")); };
153
-
154
- sub ::external_label
155
- { foreach(@_)
156
- { push(@out, "EXTERN\t".&::LABEL($_,$nmdecor.$_).":NEAR\n"); }
157
- }
158
-
159
- sub ::public_label
160
- { push(@out,"PUBLIC\t".&::LABEL($_[0],$nmdecor.$_[0])."\n"); }
161
-
162
- sub ::data_byte
163
- { push(@out,("DB\t").join(',',splice(@_,0,16))."\n") while(@_); }
164
-
165
- sub ::data_short
166
- { push(@out,("DW\t").join(',',splice(@_,0,8))."\n") while(@_); }
167
-
168
- sub ::data_word
169
- { push(@out,("DD\t").join(',',splice(@_,0,4))."\n") while(@_); }
170
-
171
- sub ::align
172
- { push(@out,"ALIGN\t$_[0]\n"); }
173
-
174
- sub ::picmeup
175
- { my($dst,$sym)=@_;
176
- &::lea($dst,&::DWP($sym));
177
- }
178
-
179
- sub ::initseg
180
- { my $f=$nmdecor.shift;
181
-
182
- $initseg.=<<___;
183
- .CRT\$XCU SEGMENT DWORD PUBLIC 'DATA'
184
- EXTERN $f:NEAR
185
- DD $f
186
- .CRT\$XCU ENDS
187
- ___
188
- }
189
-
190
- sub ::dataseg
191
- { push(@out,"$segment\tENDS\n_DATA\tSEGMENT\n"); $segment="_DATA"; }
192
-
193
- sub ::safeseh
194
- { my $nm=shift;
195
- push(@out,"IF \@Version GE 710\n");
196
- push(@out,".SAFESEH ".&::LABEL($nm,$nmdecor.$nm)."\n");
197
- push(@out,"ENDIF\n");
198
- }
199
-
200
- 1;
@@ -1,187 +0,0 @@
1
- #!/usr/bin/env perl
2
-
3
- package x86nasm;
4
-
5
- *out=\@::out;
6
-
7
- $::lbdecor="L\$"; # local label decoration
8
- $nmdecor=$::netware?"":"_"; # external name decoration
9
- $drdecor=$::mwerks?".":""; # directive decoration
10
-
11
- $initseg="";
12
-
13
- sub ::generic
14
- { my $opcode=shift;
15
- my $tmp;
16
-
17
- if (!$::mwerks)
18
- { if ($opcode =~ m/^j/o && $#_==0) # optimize jumps
19
- { $_[0] = "NEAR $_[0]"; }
20
- elsif ($opcode eq "lea" && $#_==1) # wipe storage qualifier from lea
21
- { $_[1] =~ s/^[^\[]*\[/\[/o; }
22
- elsif ($opcode eq "clflush" && $#_==0)
23
- { $_[0] =~ s/^[^\[]*\[/\[/o; }
24
- }
25
- &::emit($opcode,@_);
26
- 1;
27
- }
28
- #
29
- # opcodes not covered by ::generic above, mostly inconsistent namings...
30
- #
31
- sub ::call { &::emit("call",(&::islabel($_[0]) or "$nmdecor$_[0]")); }
32
- sub ::call_ptr { &::emit("call",@_); }
33
- sub ::jmp_ptr { &::emit("jmp",@_); }
34
-
35
- sub get_mem
36
- { my($size,$addr,$reg1,$reg2,$idx)=@_;
37
- my($post,$ret);
38
-
39
- if (!defined($idx) && 1*$reg2) { $idx=$reg2; $reg2=$reg1; undef $reg1; }
40
-
41
- if ($size ne "")
42
- { $ret .= "$size";
43
- $ret .= " PTR" if ($::mwerks);
44
- $ret .= " ";
45
- }
46
- $ret .= "[";
47
-
48
- $addr =~ s/^\s+//;
49
- # prepend global references with optional underscore
50
- $addr =~ s/^([^\+\-0-9][^\+\-]*)/::islabel($1) or "$nmdecor$1"/ige;
51
- # put address arithmetic expression in parenthesis
52
- $addr="($addr)" if ($addr =~ /^.+[\-\+].+$/);
53
-
54
- if (($addr ne "") && ($addr ne 0))
55
- { if ($addr !~ /^-/) { $ret .= "$addr+"; }
56
- else { $post=$addr; }
57
- }
58
-
59
- if ($reg2 ne "")
60
- { $idx!=0 or $idx=1;
61
- $ret .= "$reg2*$idx";
62
- $ret .= "+$reg1" if ($reg1 ne "");
63
- }
64
- else
65
- { $ret .= "$reg1"; }
66
-
67
- $ret .= "$post]";
68
- $ret =~ s/\+\]/]/; # in case $addr was the only argument
69
-
70
- $ret;
71
- }
72
- sub ::BP { &get_mem("BYTE",@_); }
73
- sub ::DWP { &get_mem("DWORD",@_); }
74
- sub ::WP { &get_mem("WORD",@_); }
75
- sub ::QWP { &get_mem("",@_); }
76
- sub ::BC { (($::mwerks)?"":"BYTE ")."@_"; }
77
- sub ::DWC { (($::mwerks)?"":"DWORD ")."@_"; }
78
-
79
- sub ::file
80
- { if ($::mwerks) { push(@out,".section\t.text,64\n"); }
81
- else
82
- { my $tmp=<<___;
83
- %ifidn __OUTPUT_FORMAT__,obj
84
- section code use32 class=code align=64
85
- %elifidn __OUTPUT_FORMAT__,win32
86
- %ifdef __YASM_VERSION_ID__
87
- %if __YASM_VERSION_ID__ < 01010000h
88
- %error yasm version 1.1.0 or later needed.
89
- %endif
90
- ; Yasm automatically includes @feat.00 and complains about redefining it.
91
- ; https://www.tortall.net/projects/yasm/manual/html/objfmt-win32-safeseh.html
92
- %else
93
- \$\@feat.00 equ 1
94
- %endif
95
- section .text code align=64
96
- %else
97
- section .text code
98
- %endif
99
- ___
100
- push(@out,$tmp);
101
- }
102
- }
103
-
104
- sub ::function_begin_B
105
- { my $func=shift;
106
- my $global=($func !~ /^_/);
107
- my $begin="${::lbdecor}_${func}_begin";
108
-
109
- $begin =~ s/^\@/./ if ($::mwerks); # the torture never stops
110
-
111
- &::LABEL($func,$global?"$begin":"$nmdecor$func");
112
- $func=$nmdecor.$func;
113
-
114
- push(@out,"${drdecor}global $func\n") if ($global);
115
- push(@out,"${drdecor}align 16\n");
116
- push(@out,"$func:\n");
117
- push(@out,"$begin:\n") if ($global);
118
- $::stack=4;
119
- }
120
-
121
- sub ::function_end_B
122
- { $::stack=0;
123
- &::wipe_labels();
124
- }
125
-
126
- sub ::file_end
127
- { if (grep {/\b${nmdecor}OPENSSL_ia32cap_P\b/i} @out)
128
- { my $comm=<<___;
129
- ${drdecor}segment .bss
130
- ${drdecor}common ${nmdecor}OPENSSL_ia32cap_P 16
131
- ___
132
- # comment out OPENSSL_ia32cap_P declarations
133
- grep {s/(^extern\s+${nmdecor}OPENSSL_ia32cap_P)/\;$1/} @out;
134
- push (@out,$comm)
135
- }
136
- push (@out,$initseg) if ($initseg);
137
- }
138
-
139
- sub ::comment { foreach (@_) { push(@out,"\t; $_\n"); } }
140
-
141
- sub ::external_label
142
- { foreach(@_)
143
- { push(@out,"${drdecor}extern\t".&::LABEL($_,$nmdecor.$_)."\n"); }
144
- }
145
-
146
- sub ::public_label
147
- { push(@out,"${drdecor}global\t".&::LABEL($_[0],$nmdecor.$_[0])."\n"); }
148
-
149
- sub ::data_byte
150
- { push(@out,(($::mwerks)?".byte\t":"db\t").join(',',@_)."\n"); }
151
- sub ::data_short
152
- { push(@out,(($::mwerks)?".word\t":"dw\t").join(',',@_)."\n"); }
153
- sub ::data_word
154
- { push(@out,(($::mwerks)?".long\t":"dd\t").join(',',@_)."\n"); }
155
-
156
- sub ::align
157
- { push(@out,"${drdecor}align\t$_[0]\n"); }
158
-
159
- sub ::picmeup
160
- { my($dst,$sym)=@_;
161
- &::lea($dst,&::DWP($sym));
162
- }
163
-
164
- sub ::initseg
165
- { my $f=$nmdecor.shift;
166
- if ($::win32)
167
- { $initseg=<<___;
168
- segment .CRT\$XCU data align=4
169
- extern $f
170
- dd $f
171
- ___
172
- }
173
- }
174
-
175
- sub ::dataseg
176
- { if ($mwerks) { push(@out,".section\t.data,4\n"); }
177
- else { push(@out,"section\t.data align=4\n"); }
178
- }
179
-
180
- sub ::safeseh
181
- { my $nm=shift;
182
- push(@out,"%if __NASM_VERSION_ID__ >= 0x02030000\n");
183
- push(@out,"safeseh ".&::LABEL($nm,$nmdecor.$nm)."\n");
184
- push(@out,"%endif\n");
185
- }
186
-
187
- 1;
@@ -1,331 +0,0 @@
1
- /* Copyright (c) 2014, Google Inc.
2
- *
3
- * Permission to use, copy, modify, and/or distribute this software for any
4
- * purpose with or without fee is hereby granted, provided that the above
5
- * copyright notice and this permission notice appear in all copies.
6
- *
7
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
8
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
9
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
10
- * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
11
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
12
- * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
13
- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
14
-
15
- /* This implementation of poly1305 is by Andrew Moon
16
- * (https://github.com/floodyberry/poly1305-donna) and released as public
17
- * domain. */
18
-
19
- #include <openssl/poly1305.h>
20
-
21
- #include <string.h>
22
-
23
- #include <openssl/cpu.h>
24
-
25
-
26
- #if defined(OPENSSL_WINDOWS) || !defined(OPENSSL_X86_64)
27
-
28
- #if defined(OPENSSL_X86) || defined(OPENSSL_X86_64) || defined(OPENSSL_ARM)
29
- /* We can assume little-endian. */
30
- static uint32_t U8TO32_LE(const uint8_t *m) {
31
- uint32_t r;
32
- memcpy(&r, m, sizeof(r));
33
- return r;
34
- }
35
-
36
- static void U32TO8_LE(uint8_t *m, uint32_t v) { memcpy(m, &v, sizeof(v)); }
37
- #else
38
- static uint32_t U8TO32_LE(const uint8_t *m) {
39
- return (uint32_t)m[0] | (uint32_t)m[1] << 8 | (uint32_t)m[2] << 16 |
40
- (uint32_t)m[3] << 24;
41
- }
42
-
43
- static void U32TO8_LE(uint8_t *m, uint32_t v) {
44
- m[0] = v;
45
- m[1] = v >> 8;
46
- m[2] = v >> 16;
47
- m[3] = v >> 24;
48
- }
49
- #endif
50
-
51
- #if defined(OPENSSL_ARM) && !defined(OPENSSL_NO_ASM)
52
- void CRYPTO_poly1305_init_neon(poly1305_state *state, const uint8_t key[32]);
53
-
54
- void CRYPTO_poly1305_update_neon(poly1305_state *state, const uint8_t *in,
55
- size_t in_len);
56
-
57
- void CRYPTO_poly1305_finish_neon(poly1305_state *state, uint8_t mac[16]);
58
- #endif
59
-
60
- static uint64_t mul32x32_64(uint32_t a, uint32_t b) { return (uint64_t)a * b; }
61
-
62
- struct poly1305_state_st {
63
- uint32_t r0, r1, r2, r3, r4;
64
- uint32_t s1, s2, s3, s4;
65
- uint32_t h0, h1, h2, h3, h4;
66
- uint8_t buf[16];
67
- unsigned int buf_used;
68
- uint8_t key[16];
69
- };
70
-
71
- /* poly1305_blocks updates |state| given some amount of input data. This
72
- * function may only be called with a |len| that is not a multiple of 16 at the
73
- * end of the data. Otherwise the input must be buffered into 16 byte blocks. */
74
- static void poly1305_update(struct poly1305_state_st *state, const uint8_t *in,
75
- size_t len) {
76
- uint32_t t0, t1, t2, t3;
77
- uint64_t t[5];
78
- uint32_t b;
79
- uint64_t c;
80
- size_t j;
81
- uint8_t mp[16];
82
-
83
- if (len < 16) {
84
- goto poly1305_donna_atmost15bytes;
85
- }
86
-
87
- poly1305_donna_16bytes:
88
- t0 = U8TO32_LE(in);
89
- t1 = U8TO32_LE(in + 4);
90
- t2 = U8TO32_LE(in + 8);
91
- t3 = U8TO32_LE(in + 12);
92
-
93
- in += 16;
94
- len -= 16;
95
-
96
- state->h0 += t0 & 0x3ffffff;
97
- state->h1 += ((((uint64_t)t1 << 32) | t0) >> 26) & 0x3ffffff;
98
- state->h2 += ((((uint64_t)t2 << 32) | t1) >> 20) & 0x3ffffff;
99
- state->h3 += ((((uint64_t)t3 << 32) | t2) >> 14) & 0x3ffffff;
100
- state->h4 += (t3 >> 8) | (1 << 24);
101
-
102
- poly1305_donna_mul:
103
- t[0] = mul32x32_64(state->h0, state->r0) + mul32x32_64(state->h1, state->s4) +
104
- mul32x32_64(state->h2, state->s3) + mul32x32_64(state->h3, state->s2) +
105
- mul32x32_64(state->h4, state->s1);
106
- t[1] = mul32x32_64(state->h0, state->r1) + mul32x32_64(state->h1, state->r0) +
107
- mul32x32_64(state->h2, state->s4) + mul32x32_64(state->h3, state->s3) +
108
- mul32x32_64(state->h4, state->s2);
109
- t[2] = mul32x32_64(state->h0, state->r2) + mul32x32_64(state->h1, state->r1) +
110
- mul32x32_64(state->h2, state->r0) + mul32x32_64(state->h3, state->s4) +
111
- mul32x32_64(state->h4, state->s3);
112
- t[3] = mul32x32_64(state->h0, state->r3) + mul32x32_64(state->h1, state->r2) +
113
- mul32x32_64(state->h2, state->r1) + mul32x32_64(state->h3, state->r0) +
114
- mul32x32_64(state->h4, state->s4);
115
- t[4] = mul32x32_64(state->h0, state->r4) + mul32x32_64(state->h1, state->r3) +
116
- mul32x32_64(state->h2, state->r2) + mul32x32_64(state->h3, state->r1) +
117
- mul32x32_64(state->h4, state->r0);
118
-
119
- state->h0 = (uint32_t)t[0] & 0x3ffffff;
120
- c = (t[0] >> 26);
121
- t[1] += c;
122
- state->h1 = (uint32_t)t[1] & 0x3ffffff;
123
- b = (uint32_t)(t[1] >> 26);
124
- t[2] += b;
125
- state->h2 = (uint32_t)t[2] & 0x3ffffff;
126
- b = (uint32_t)(t[2] >> 26);
127
- t[3] += b;
128
- state->h3 = (uint32_t)t[3] & 0x3ffffff;
129
- b = (uint32_t)(t[3] >> 26);
130
- t[4] += b;
131
- state->h4 = (uint32_t)t[4] & 0x3ffffff;
132
- b = (uint32_t)(t[4] >> 26);
133
- state->h0 += b * 5;
134
-
135
- if (len >= 16) {
136
- goto poly1305_donna_16bytes;
137
- }
138
-
139
- /* final bytes */
140
- poly1305_donna_atmost15bytes:
141
- if (!len) {
142
- return;
143
- }
144
-
145
- for (j = 0; j < len; j++) {
146
- mp[j] = in[j];
147
- }
148
- mp[j++] = 1;
149
- for (; j < 16; j++) {
150
- mp[j] = 0;
151
- }
152
- len = 0;
153
-
154
- t0 = U8TO32_LE(mp + 0);
155
- t1 = U8TO32_LE(mp + 4);
156
- t2 = U8TO32_LE(mp + 8);
157
- t3 = U8TO32_LE(mp + 12);
158
-
159
- state->h0 += t0 & 0x3ffffff;
160
- state->h1 += ((((uint64_t)t1 << 32) | t0) >> 26) & 0x3ffffff;
161
- state->h2 += ((((uint64_t)t2 << 32) | t1) >> 20) & 0x3ffffff;
162
- state->h3 += ((((uint64_t)t3 << 32) | t2) >> 14) & 0x3ffffff;
163
- state->h4 += (t3 >> 8);
164
-
165
- goto poly1305_donna_mul;
166
- }
167
-
168
- void CRYPTO_poly1305_init(poly1305_state *statep, const uint8_t key[32]) {
169
- struct poly1305_state_st *state = (struct poly1305_state_st *)statep;
170
- uint32_t t0, t1, t2, t3;
171
-
172
- #if defined(OPENSSL_ARM) && !defined(OPENSSL_NO_ASM)
173
- if (CRYPTO_is_NEON_functional()) {
174
- CRYPTO_poly1305_init_neon(statep, key);
175
- return;
176
- }
177
- #endif
178
-
179
- t0 = U8TO32_LE(key + 0);
180
- t1 = U8TO32_LE(key + 4);
181
- t2 = U8TO32_LE(key + 8);
182
- t3 = U8TO32_LE(key + 12);
183
-
184
- /* precompute multipliers */
185
- state->r0 = t0 & 0x3ffffff;
186
- t0 >>= 26;
187
- t0 |= t1 << 6;
188
- state->r1 = t0 & 0x3ffff03;
189
- t1 >>= 20;
190
- t1 |= t2 << 12;
191
- state->r2 = t1 & 0x3ffc0ff;
192
- t2 >>= 14;
193
- t2 |= t3 << 18;
194
- state->r3 = t2 & 0x3f03fff;
195
- t3 >>= 8;
196
- state->r4 = t3 & 0x00fffff;
197
-
198
- state->s1 = state->r1 * 5;
199
- state->s2 = state->r2 * 5;
200
- state->s3 = state->r3 * 5;
201
- state->s4 = state->r4 * 5;
202
-
203
- /* init state */
204
- state->h0 = 0;
205
- state->h1 = 0;
206
- state->h2 = 0;
207
- state->h3 = 0;
208
- state->h4 = 0;
209
-
210
- state->buf_used = 0;
211
- memcpy(state->key, key + 16, sizeof(state->key));
212
- }
213
-
214
- void CRYPTO_poly1305_update(poly1305_state *statep, const uint8_t *in,
215
- size_t in_len) {
216
- unsigned int i;
217
- struct poly1305_state_st *state = (struct poly1305_state_st *)statep;
218
-
219
- #if defined(OPENSSL_ARM) && !defined(OPENSSL_NO_ASM)
220
- if (CRYPTO_is_NEON_functional()) {
221
- CRYPTO_poly1305_update_neon(statep, in, in_len);
222
- return;
223
- }
224
- #endif
225
-
226
- if (state->buf_used) {
227
- unsigned int todo = 16 - state->buf_used;
228
- if (todo > in_len) {
229
- todo = in_len;
230
- }
231
- for (i = 0; i < todo; i++) {
232
- state->buf[state->buf_used + i] = in[i];
233
- }
234
- state->buf_used += todo;
235
- in_len -= todo;
236
- in += todo;
237
-
238
- if (state->buf_used == 16) {
239
- poly1305_update(state, state->buf, 16);
240
- state->buf_used = 0;
241
- }
242
- }
243
-
244
- if (in_len >= 16) {
245
- size_t todo = in_len & ~0xf;
246
- poly1305_update(state, in, todo);
247
- in += todo;
248
- in_len &= 0xf;
249
- }
250
-
251
- if (in_len) {
252
- for (i = 0; i < in_len; i++) {
253
- state->buf[i] = in[i];
254
- }
255
- state->buf_used = in_len;
256
- }
257
- }
258
-
259
- void CRYPTO_poly1305_finish(poly1305_state *statep, uint8_t mac[16]) {
260
- struct poly1305_state_st *state = (struct poly1305_state_st *)statep;
261
- uint64_t f0, f1, f2, f3;
262
- uint32_t g0, g1, g2, g3, g4;
263
- uint32_t b, nb;
264
-
265
- #if defined(OPENSSL_ARM) && !defined(OPENSSL_NO_ASM)
266
- if (CRYPTO_is_NEON_functional()) {
267
- CRYPTO_poly1305_finish_neon(statep, mac);
268
- return;
269
- }
270
- #endif
271
-
272
- if (state->buf_used) {
273
- poly1305_update(state, state->buf, state->buf_used);
274
- }
275
-
276
- b = state->h0 >> 26;
277
- state->h0 = state->h0 & 0x3ffffff;
278
- state->h1 += b;
279
- b = state->h1 >> 26;
280
- state->h1 = state->h1 & 0x3ffffff;
281
- state->h2 += b;
282
- b = state->h2 >> 26;
283
- state->h2 = state->h2 & 0x3ffffff;
284
- state->h3 += b;
285
- b = state->h3 >> 26;
286
- state->h3 = state->h3 & 0x3ffffff;
287
- state->h4 += b;
288
- b = state->h4 >> 26;
289
- state->h4 = state->h4 & 0x3ffffff;
290
- state->h0 += b * 5;
291
-
292
- g0 = state->h0 + 5;
293
- b = g0 >> 26;
294
- g0 &= 0x3ffffff;
295
- g1 = state->h1 + b;
296
- b = g1 >> 26;
297
- g1 &= 0x3ffffff;
298
- g2 = state->h2 + b;
299
- b = g2 >> 26;
300
- g2 &= 0x3ffffff;
301
- g3 = state->h3 + b;
302
- b = g3 >> 26;
303
- g3 &= 0x3ffffff;
304
- g4 = state->h4 + b - (1 << 26);
305
-
306
- b = (g4 >> 31) - 1;
307
- nb = ~b;
308
- state->h0 = (state->h0 & nb) | (g0 & b);
309
- state->h1 = (state->h1 & nb) | (g1 & b);
310
- state->h2 = (state->h2 & nb) | (g2 & b);
311
- state->h3 = (state->h3 & nb) | (g3 & b);
312
- state->h4 = (state->h4 & nb) | (g4 & b);
313
-
314
- f0 = ((state->h0) | (state->h1 << 26)) + (uint64_t)U8TO32_LE(&state->key[0]);
315
- f1 = ((state->h1 >> 6) | (state->h2 << 20)) +
316
- (uint64_t)U8TO32_LE(&state->key[4]);
317
- f2 = ((state->h2 >> 12) | (state->h3 << 14)) +
318
- (uint64_t)U8TO32_LE(&state->key[8]);
319
- f3 = ((state->h3 >> 18) | (state->h4 << 8)) +
320
- (uint64_t)U8TO32_LE(&state->key[12]);
321
-
322
- U32TO8_LE(&mac[0], f0);
323
- f1 += (f0 >> 32);
324
- U32TO8_LE(&mac[4], f1);
325
- f2 += (f1 >> 32);
326
- U32TO8_LE(&mac[8], f2);
327
- f3 += (f2 >> 32);
328
- U32TO8_LE(&mac[12], f3);
329
- }
330
-
331
- #endif /* OPENSSL_WINDOWS || !OPENSSL_X86_64 */