digest-kangarootwelve 0.4.5 → 0.4.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5c8b25102cf3f6a925000487653a245a6f153de17a12319ebfd1c6c25549daf6
4
- data.tar.gz: 12d05f0e8b6927105aebc1feffb5bb68482f9235fa6afcee2265b4eeba54cdb2
3
+ metadata.gz: ffce05a13297d1397e3fa033be301d33d248b104099103ed42e902b464407068
4
+ data.tar.gz: fb12f02a91f041ac83f467fe9d0d75db8bc898629aa533fb7386233be711f67f
5
5
  SHA512:
6
- metadata.gz: f3e2047eb8379800ba6fe5bd2b4af801ea3a64e1d62581dd9f0267e2d0ee87c5e963e1e2874d5b57f99c4e5f007fb07fe8749ce3ea452482ea076964e213af6f
7
- data.tar.gz: 9af6b30aef3113ad635cb870628adce507728d684de587d54fb0c14a96d9e0ee1aa984a4cdf32fd18fa50ed1bd1df2711e166c65c656ebc1391963d36b44685f
6
+ metadata.gz: 955f7967d601bdd35be2ac94c83348fab2fd12a1494f2f725dcba14726618da1d67505dc5008fd5512b55ee99c8d8eecf9a165ddd6a89e247d44ab1307ca230a
7
+ data.tar.gz: ae1c8fa1b95804f6a4bd32b827bc6bf4d1a82c441a0dc277a870953d0e31c2872b9c6f3fcde66e059f0e8162b1f04f4bad3f94e00b4552f291b104cd962d17bc
data/LICENSE.XKCP CHANGED
@@ -1,9 +1,169 @@
1
- # Under which license is the XKCP distributed?
1
+ The redistribution and use of this software (with or without changes) is allowed without the payment of fees or royalties provided that the terms of the licenses of the different source files used is respected. Most of the source and header files in the XKCP are released to the public domain and associated to the CC0 (http://creativecommons.org/publicdomain/zero/1.0/) deed, but there are exceptions.
2
2
 
3
- Most of the source and header files in the XKCP are released to the **public domain** and associated to the [CC0](http://creativecommons.org/publicdomain/zero/1.0/) deed. The exceptions are the following:
3
+ In general, the redistribution of this software should include a copy of this file. However, if only a part of the software is redistributed or used, the portions that are no longer relevant may be removed. Hints are given below whether a file is used in libXKCP, UnitTests, Benchmarks or KeccakSum.
4
4
 
5
- * [`lib/common/brg_endian.h`](lib/common/brg_endian.h) is copyrighted by Brian Gladman and comes with a BSD 3-clause license;
6
- * [`tests/UnitTests/genKAT.c`](tests/UnitTests/genKAT.c) is based on [SHA-3 contest's code by Larry Bassham, NIST](http://csrc.nist.gov/groups/ST/hash/sha-3/documents/KAT1.zip), which he licensed under a BSD 3-clause license;
7
- * [`tests/UnitTests/timing.h`](tests/UnitTests/timing.h) is adapted from Google Benchmark and is licensed under the Apache License, Version 2.0;
8
- * [`KeccakP-1600-AVX2.s`](lib/low/KeccakP-1600/AVX2/KeccakP-1600-AVX2.s) is licensed under the [CRYPTOGAMS license](http://www.openssl.org/~appro/cryptogams/) (BSD-like);
9
- * [`support/Kernel-PMU/enable_arm_pmu.c`](support/Kernel-PMU/enable_arm_pmu.c) is licensed under the GNU General Public License by Bruno Pairault.
5
+
6
+ For XKCP/lib/common/brg_endian.h (used in libXKCP, UnitTests, Benchmarks and KeccakSum):
7
+
8
+ ---------------------------------------------------------------------------
9
+ Copyright (c) 1998-2008, Brian Gladman, Worcester, UK. All rights reserved.
10
+
11
+ LICENSE TERMS
12
+
13
+ The redistribution and use of this software (with or without changes)
14
+ is allowed without the payment of fees or royalties provided that:
15
+
16
+ 1. source code distributions include the above copyright notice, this
17
+ list of conditions and the following disclaimer;
18
+
19
+ 2. binary distributions include the above copyright notice, this list
20
+ of conditions and the following disclaimer in their documentation;
21
+
22
+ 3. the name of the copyright holder is not used to endorse products
23
+ built using this software without specific written permission.
24
+
25
+ DISCLAIMER
26
+
27
+ This software is provided 'as is' with no explicit or implied warranties
28
+ in respect of its properties, including, but not limited to, correctness
29
+ and/or fitness for purpose.
30
+ ---------------------------------------------------------------------------
31
+
32
+
33
+ For XKCP/lib/low/KeccakP-1600/AVX2/KeccakP-1600-AVX2.s and XKCP/lib/low/KeccakP-1600/AVX512/KeccakP-1600-AVX512.s (potentially used in libXKCP, UnitTests, Benchmarks and KeccakSum, depending on the target platform):
34
+
35
+ Copyright (c) 2006-2017, CRYPTOGAMS by <appro@openssl.org>
36
+ All rights reserved.
37
+
38
+ Redistribution and use in source and binary forms, with or without
39
+ modification, are permitted provided that the following conditions
40
+ are met:
41
+
42
+ * Redistributions of source code must retain copyright notices,
43
+ this list of conditions and the following disclaimer.
44
+
45
+ * Redistributions in binary form must reproduce the above
46
+ copyright notice, this list of conditions and the following
47
+ disclaimer in the documentation and/or other materials
48
+ provided with the distribution.
49
+
50
+ * Neither the name of the CRYPTOGAMS nor the names of its
51
+ copyright holder and contributors may be used to endorse or
52
+ promote products derived from this software without specific
53
+ prior written permission.
54
+
55
+ ALTERNATIVELY, provided that this notice is retained in full, this
56
+ product may be distributed under the terms of the GNU General Public
57
+ License (GPL), in which case the provisions of the GPL apply INSTEAD OF
58
+ those given above.
59
+
60
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS
61
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
62
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
63
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
64
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
65
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
66
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
67
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
68
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
69
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
70
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
71
+
72
+
73
+ For XKCP/Standalone/CompactFIPS202/C/genKAT.c, XKCP/tests/UnitTests/genKAT.c and XKCP/tests/UnitTests/genKAT.h (used only in UnitTests):
74
+
75
+ Copyright (c) 2008, Lawrence E. Bassham, National Institute of Standards and Technology (NIST),
76
+ for the original version (available at http://csrc.nist.gov/groups/ST/hash/sha-3/documents/KAT1.zip)
77
+
78
+ All rights reserved.
79
+
80
+ Redistribution and use in source and binary forms, with or without
81
+ modification, are permitted provided that the following conditions are met:
82
+ * Redistributions of source code must retain the above copyright
83
+ notice, this list of conditions and the following disclaimer.
84
+ * Redistributions in binary form must reproduce the above copyright
85
+ notice, this list of conditions and the following disclaimer in the
86
+ documentation and/or other materials provided with the distribution.
87
+ * Neither the name of the NIST nor the
88
+ names of its contributors may be used to endorse or promote products
89
+ derived from this software without specific prior written permission.
90
+
91
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
92
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
93
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
94
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
95
+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
96
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
97
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
98
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
99
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
100
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
101
+
102
+
103
+ For XKCP/support/Kernel-PMU/enable_arm_pmu.c (*not* used in libXKCP, UnitTests, Benchmarks nor KeccakSum):
104
+
105
+ Kernel-PMU
106
+ Enabling user-mode access to the performance monitor unit (PMU) on ARMv8 Aarch64 and ARMv7
107
+ Copyright (C) 2019 Bruno Pairault
108
+
109
+ This program is free software: you can redistribute it and/or modify
110
+ it under the terms of the GNU General Public License as published by
111
+ the Free Software Foundation, either version 3 of the License, or
112
+ (at your option) any later version.
113
+
114
+ This program is distributed in the hope that it will be useful,
115
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
116
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
117
+ GNU General Public License for more details.
118
+
119
+ You should have received a copy of the GNU General Public License
120
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
121
+
122
+
123
+ For XKCP/tests/Benchmarks/timing.h (used only in Benchmarks):
124
+
125
+ Copyright 2020 Google Inc.
126
+
127
+ Licensed under the Apache License, Version 2.0 (the "License");
128
+ you may not use this file except in compliance with the License.
129
+ You may obtain a copy of the License at
130
+
131
+ http://www.apache.org/licenses/LICENSE-2.0
132
+
133
+ Unless required by applicable law or agreed to in writing, software
134
+ distributed under the License is distributed on an "AS IS" BASIS,
135
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
136
+ See the License for the specific language governing permissions and
137
+ limitations under the License.
138
+
139
+
140
+ For XKCP/tests/NIST_LWC/genkat_aead_c89.c, XKCP/tests/NIST_LWC/genkat_aead.c, XKCP/tests/NIST_LWC/genkat_hash_c89.c and XKCP/tests/NIST_LWC/genkat_hash.c (*not* used in libXKCP, UnitTests, Benchmarks nor KeccakSum):
141
+
142
+ NIST-developed software is provided by NIST as a public service.
143
+ You may use, copy and distribute copies of the software in any medium,
144
+ provided that you keep intact this entire notice. You may improve,
145
+ modify and create derivative works of the software or any portion of
146
+ the software, and you may copy and distribute such modifications or
147
+ works. Modified works should carry a notice stating that you changed
148
+ the software and should note the date and nature of any such change.
149
+ Please explicitly acknowledge the National Institute of Standards and
150
+ Technology as the source of the software.
151
+
152
+ NIST-developed software is expressly provided "AS IS." NIST MAKES NO
153
+ WARRANTY OF ANY KIND, EXPRESS, IMPLIED, IN FACT OR ARISING BY OPERATION
154
+ OF LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY,
155
+ FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT AND DATA ACCURACY. NIST
156
+ NEITHER REPRESENTS NOR WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE
157
+ UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST
158
+ DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE SOFTWARE
159
+ OR THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE CORRECTNESS, ACCURACY,
160
+ RELIABILITY, OR USEFULNESS OF THE SOFTWARE.
161
+
162
+ You are solely responsible for determining the appropriateness of using and
163
+ distributing the software and you assume all risks associated with its use,
164
+ including but not limited to the risks and costs of program errors, compliance
165
+ with applicable laws, damage to or loss of data, programs or equipment, and
166
+ the unavailability or interruption of operation. This software is not intended
167
+ to be used in any situation where a failure could cause risk of injury or
168
+ damage to property. The software developed by NIST employees is not subject to
169
+ copyright protection within the United States.
data/README.md CHANGED
@@ -55,18 +55,35 @@ using a not so commonly used target. Here's one way to test it:
55
55
  bundle
56
56
  rake test
57
57
 
58
- To know the right value of GEM_DIR, try running `gem info digest-kangarootwelve`.
58
+ To know the right value of GEM_DIR, try running
59
+ `gem info digest-kangarootwelve`.
59
60
 
60
61
  ## Installing in Gentoo
61
62
 
62
- The library can also be globally installed in Gentoo using `layman`:
63
+ The library can also be globally installed in Gentoo using `layman` or
64
+ `eselect-repository`:
63
65
 
64
66
  # Fetch remote list of overlays, and add 'konsolebox' overlay.
65
67
  layman -f && layman -a konsolebox
66
68
 
69
+ # Or enable repo through eselect-repository.
70
+ eselect repository enable konsolebox
71
+ emaint sync --repo konsolebox
72
+
67
73
  # Unmask unstable keyword.
68
74
  echo 'dev-ruby/digest-kangarootwelve' > /etc/portage/package.accept_keywords/dev-ruby.digest-kangarootwelve
69
75
 
76
+ # Optionally specify a different build target that works better in the
77
+ # machine. This may need additional CFLAGS options like -march=native set
78
+ # in the environment. The default build target `compact` should also be
79
+ # disabled.
80
+ echo 'dev-ruby/digest-kangarootwelve target_avx512 -target_compact' > /etc/portage/package.use/dev-ruby.digest-kangarootwelve
81
+
82
+ # To enable testing, FEATURES=test should be set in the environment, and
83
+ # test use flag should also be enabled.
84
+ printf '%s\n' 'FEATURES="${FEATURES-} test"' 'USE="${USE-} test"' > /etc/portage/env/test
85
+ echo 'dev-ruby/digest-kangarootwelve test' > /etc/portage/package.env/dev-ruby.digest-kangarootwelve
86
+
70
87
  # Merge package.
71
88
  emerge dev-ruby/digest-kangarootwelve
72
89
 
@@ -81,7 +98,7 @@ The gem can also be tested from source using the following commands:
81
98
  cd digest-kangarootwelve-ruby
82
99
 
83
100
  # Optionally checkout a tagged version.
84
- git checkout v0.4.0
101
+ git checkout v0.4.6
85
102
 
86
103
  # Run bundle
87
104
  bundle
@@ -97,7 +114,8 @@ The gem can also be tested from source using the following commands:
97
114
  Targets like AVX2 may fail to build unless an explicit `CFLAGS` with proper
98
115
  architecture-related options is specified.
99
116
 
100
- Specifying a `CFLAGS` can be done by using the `--with-cflags` option. For example:
117
+ Specifying a `CFLAGS` can be done by using the `--with-cflags` option. For
118
+ example:
101
119
 
102
120
  rake -- --with-target=avx2 --with-cflags="-march=native"
103
121
 
@@ -113,6 +131,8 @@ so please test the resulting runtime thoroughly.
113
131
 
114
132
  ## Example Usage
115
133
 
134
+ require 'digest/kangarootwelve'
135
+
116
136
  Digest::KangarooTwelve[32].digest("abc")
117
137
  => "\xAB\x17O2\x8CU\xA5Q\v\v \x97\x91\xBF\x8B`\xE8\x01\xA7\xCF\xC2\xAAB\x04-\xCB\x8FT\x7F\xBE:}"
118
138
 
data/Rakefile CHANGED
@@ -20,7 +20,7 @@ end
20
20
 
21
21
  desc "Initialize and update XKCP submodule"
22
22
  task :initialize_xkcp => ".git" do |t|
23
- puts "Initializing and updating XKCP submodule"
23
+ puts "Initializing and updating XKCP submodule."
24
24
  system "git submodule init && git submodule update -f"
25
25
  end
26
26
 
@@ -30,16 +30,13 @@ file "XKCP/README.markdown" => :initialize_xkcp
30
30
  # import_xkcp_license
31
31
 
32
32
  task :import_xkcp_license do
33
- Rake::Task["XKCP/README.markdown"].invoke
34
- puts "Extracting XKCP license from \"XKCP/README.markdown\" and saving it to \"LICENSE.XKCP\"."
35
- license = File.binread("XKCP/README.markdown")
36
- .scan(/# Under which license is the XKCP.*?(?=^#)/m).first
37
- raise "No license extracted" unless license
38
- File.binwrite("LICENSE.XKCP", license.strip + "\n")
33
+ Rake::Task["XKCP/LICENSE"].invoke
34
+ puts "Importing XKCP/LICENSE as LICENSE.XKCP."
35
+ File.binwrite("LICENSE.XKCP", File.binread("XKCP/LICENSE"))
39
36
  end.instance_eval do
40
37
  def needed?
41
- !File.exist?("LICENSE.XKCP") || File.exist?("XKCP/README.markdown") &&
42
- File.mtime("LICENSE.XKCP") < File.mtime("XKCP/README.markdown")
38
+ !File.exist?("LICENSE.XKCP") || File.exist?("XKCP/LICENSE") &&
39
+ File.mtime("LICENSE.XKCP") < File.mtime("XKCP/LICENSE")
43
40
  end
44
41
  end
45
42
 
@@ -161,7 +161,7 @@ int SpongeAbsorb(SpongeInstance *instance, const unsigned char *data, size_t dat
161
161
  i = 0;
162
162
  curData = data;
163
163
  while(i < dataByteLen) {
164
- if ((instance->byteIOIndex == 0) && (dataByteLen >= (i + rateInBytes))) {
164
+ if ((instance->byteIOIndex == 0) && (dataByteLen-i >= rateInBytes)) {
165
165
  #ifdef SnP_FastLoop_Absorb
166
166
  /* processing full blocks first */
167
167
  if ((rateInBytes % (SnP_width/200)) == 0) {
@@ -187,9 +187,10 @@ int SpongeAbsorb(SpongeInstance *instance, const unsigned char *data, size_t dat
187
187
  }
188
188
  else {
189
189
  /* normal lane: using the message queue */
190
- partialBlock = (unsigned int)(dataByteLen - i);
191
- if (partialBlock+instance->byteIOIndex > rateInBytes)
190
+ if (dataByteLen-i > rateInBytes-instance->byteIOIndex)
192
191
  partialBlock = rateInBytes-instance->byteIOIndex;
192
+ else
193
+ partialBlock = (unsigned int)(dataByteLen - i);
193
194
  #ifdef KeccakReference
194
195
  displayBytes(1, "Block to be absorbed (part)", curData, partialBlock);
195
196
  #endif
@@ -264,7 +265,7 @@ int SpongeSqueeze(SpongeInstance *instance, unsigned char *data, size_t dataByte
264
265
  i = 0;
265
266
  curData = data;
266
267
  while(i < dataByteLen) {
267
- if ((instance->byteIOIndex == rateInBytes) && (dataByteLen >= (i + rateInBytes))) {
268
+ if ((instance->byteIOIndex == rateInBytes) && (dataByteLen-i >= rateInBytes)) {
268
269
  for(j=dataByteLen-i; j>=rateInBytes; j-=rateInBytes) {
269
270
  SnP_Permute(instance->state);
270
271
  SnP_ExtractBytes(instance->state, curData, 0, rateInBytes);
@@ -281,9 +282,10 @@ int SpongeSqueeze(SpongeInstance *instance, unsigned char *data, size_t dataByte
281
282
  SnP_Permute(instance->state);
282
283
  instance->byteIOIndex = 0;
283
284
  }
284
- partialBlock = (unsigned int)(dataByteLen - i);
285
- if (partialBlock+instance->byteIOIndex > rateInBytes)
285
+ if (dataByteLen-i > rateInBytes-instance->byteIOIndex)
286
286
  partialBlock = rateInBytes-instance->byteIOIndex;
287
+ else
288
+ partialBlock = (unsigned int)(dataByteLen - i);
287
289
  i += partialBlock;
288
290
 
289
291
  SnP_ExtractBytes(instance->state, curData, instance->byteIOIndex, partialBlock);
@@ -25,8 +25,10 @@
25
25
  .globl KeccakP1600_Initialize
26
26
  .globl _KeccakP1600_Initialize
27
27
  .ifndef old_gas_syntax
28
+ .ifndef no_type
28
29
  .type KeccakP1600_Initialize,@function
29
30
  .endif
31
+ .endif
30
32
  KeccakP1600_Initialize:
31
33
  _KeccakP1600_Initialize:
32
34
  .balign 32
@@ -40,8 +42,10 @@ _KeccakP1600_Initialize:
40
42
  movq $0,6*32(%rdi)
41
43
  ret
42
44
  .ifndef old_gas_syntax
45
+ .ifndef no_size
43
46
  .size KeccakP1600_Initialize,.-KeccakP1600_Initialize
44
47
  .endif
48
+ .endif
45
49
 
46
50
  # -----------------------------------------------------------------------------
47
51
  #
@@ -51,8 +55,10 @@ _KeccakP1600_Initialize:
51
55
  .globl KeccakP1600_AddByte
52
56
  .globl _KeccakP1600_AddByte
53
57
  .ifndef old_gas_syntax
58
+ .ifndef no_type
54
59
  .type KeccakP1600_AddByte,@function
55
60
  .endif
61
+ .endif
56
62
  KeccakP1600_AddByte:
57
63
  _KeccakP1600_AddByte:
58
64
  .balign 32
@@ -66,8 +72,10 @@ _KeccakP1600_AddByte:
66
72
  xorb %sil, (%rdi)
67
73
  ret
68
74
  .ifndef old_gas_syntax
75
+ .ifndef no_size
69
76
  .size KeccakP1600_AddByte,.-KeccakP1600_AddByte
70
77
  .endif
78
+ .endif
71
79
 
72
80
  # -----------------------------------------------------------------------------
73
81
  #
@@ -77,8 +85,10 @@ _KeccakP1600_AddByte:
77
85
  .globl KeccakP1600_AddBytes
78
86
  .globl _KeccakP1600_AddBytes
79
87
  .ifndef old_gas_syntax
88
+ .ifndef no_type
80
89
  .type KeccakP1600_AddBytes,@function
81
90
  .endif
91
+ .endif
82
92
  KeccakP1600_AddBytes:
83
93
  _KeccakP1600_AddBytes:
84
94
  .balign 32
@@ -131,8 +141,10 @@ KeccakP1600_AddBytes_LastIncompleteLaneLoop:
131
141
  KeccakP1600_AddBytes_Exit:
132
142
  ret
133
143
  .ifndef old_gas_syntax
144
+ .ifndef no_size
134
145
  .size KeccakP1600_AddBytes,.-KeccakP1600_AddBytes
135
146
  .endif
147
+ .endif
136
148
 
137
149
  # -----------------------------------------------------------------------------
138
150
  #
@@ -142,8 +154,10 @@ KeccakP1600_AddBytes_Exit:
142
154
  .globl KeccakP1600_OverwriteBytes
143
155
  .globl _KeccakP1600_OverwriteBytes
144
156
  .ifndef old_gas_syntax
157
+ .ifndef no_type
145
158
  .type KeccakP1600_OverwriteBytes,@function
146
159
  .endif
160
+ .endif
147
161
  KeccakP1600_OverwriteBytes:
148
162
  _KeccakP1600_OverwriteBytes:
149
163
  .balign 32
@@ -196,8 +210,10 @@ KeccakP1600_OverwriteBytes_LastIncompleteLaneLoop:
196
210
  KeccakP1600_OverwriteBytes_Exit:
197
211
  ret
198
212
  .ifndef old_gas_syntax
213
+ .ifndef no_size
199
214
  .size KeccakP1600_OverwriteBytes,.-KeccakP1600_OverwriteBytes
200
215
  .endif
216
+ .endif
201
217
 
202
218
  # -----------------------------------------------------------------------------
203
219
  #
@@ -207,8 +223,10 @@ KeccakP1600_OverwriteBytes_Exit:
207
223
  .globl KeccakP1600_OverwriteWithZeroes
208
224
  .globl _KeccakP1600_OverwriteWithZeroes
209
225
  .ifndef old_gas_syntax
226
+ .ifndef no_type
210
227
  .type KeccakP1600_OverwriteWithZeroes,@function
211
228
  .endif
229
+ .endif
212
230
  KeccakP1600_OverwriteWithZeroes:
213
231
  _KeccakP1600_OverwriteWithZeroes:
214
232
  .balign 32
@@ -237,8 +255,10 @@ KeccakP1600_OverwriteWithZeroes_LastIncompleteLaneLoop:
237
255
  KeccakP1600_OverwriteWithZeroes_Exit:
238
256
  ret
239
257
  .ifndef old_gas_syntax
258
+ .ifndef no_size
240
259
  .size KeccakP1600_OverwriteWithZeroes,.-KeccakP1600_OverwriteWithZeroes
241
260
  .endif
261
+ .endif
242
262
 
243
263
  # -----------------------------------------------------------------------------
244
264
  #
@@ -248,8 +268,10 @@ KeccakP1600_OverwriteWithZeroes_Exit:
248
268
  .globl KeccakP1600_ExtractBytes
249
269
  .globl _KeccakP1600_ExtractBytes
250
270
  .ifndef old_gas_syntax
271
+ .ifndef no_type
251
272
  .type KeccakP1600_ExtractBytes,@function
252
273
  .endif
274
+ .endif
253
275
  KeccakP1600_ExtractBytes:
254
276
  _KeccakP1600_ExtractBytes:
255
277
  .balign 32
@@ -305,8 +327,10 @@ KeccakP1600_ExtractBytes_Exit:
305
327
  pop %rbx
306
328
  ret
307
329
  .ifndef old_gas_syntax
330
+ .ifndef no_size
308
331
  .size KeccakP1600_ExtractBytes,.-KeccakP1600_ExtractBytes
309
332
  .endif
333
+ .endif
310
334
 
311
335
  # -----------------------------------------------------------------------------
312
336
  #
@@ -316,8 +340,10 @@ KeccakP1600_ExtractBytes_Exit:
316
340
  .globl KeccakP1600_ExtractAndAddBytes
317
341
  .globl _KeccakP1600_ExtractAndAddBytes
318
342
  .ifndef old_gas_syntax
343
+ .ifndef no_type
319
344
  .type KeccakP1600_ExtractAndAddBytes,@function
320
345
  .endif
346
+ .endif
321
347
  KeccakP1600_ExtractAndAddBytes:
322
348
  _KeccakP1600_ExtractAndAddBytes:
323
349
  .balign 32
@@ -381,16 +407,20 @@ KeccakP1600_ExtractAndAddBytes_Exit:
381
407
  pop %rbx
382
408
  ret
383
409
  .ifndef old_gas_syntax
410
+ .ifndef no_size
384
411
  .size KeccakP1600_ExtractAndAddBytes,.-KeccakP1600_ExtractAndAddBytes
385
412
  .endif
413
+ .endif
386
414
 
387
415
  # -----------------------------------------------------------------------------
388
416
  #
389
417
  # internal
390
418
  #
391
419
  .ifndef old_gas_syntax
420
+ .ifndef no_type
392
421
  .type __KeccakF1600,@function
393
422
  .endif
423
+ .endif
394
424
  .balign 32
395
425
  __KeccakF1600:
396
426
  .Loop_avx2:
@@ -531,8 +561,10 @@ __KeccakF1600:
531
561
  jnz .Loop_avx2
532
562
  ret
533
563
  .ifndef old_gas_syntax
564
+ .ifndef no_size
534
565
  .size __KeccakF1600,.-__KeccakF1600
535
566
  .endif
567
+ .endif
536
568
 
537
569
  # -----------------------------------------------------------------------------
538
570
  #
@@ -542,8 +574,10 @@ __KeccakF1600:
542
574
  .globl KeccakP1600_Permute_24rounds
543
575
  .globl _KeccakP1600_Permute_24rounds
544
576
  .ifndef old_gas_syntax
577
+ .ifndef no_type
545
578
  .type KeccakP1600_Permute_24rounds,@function
546
579
  .endif
580
+ .endif
547
581
  KeccakP1600_Permute_24rounds:
548
582
  _KeccakP1600_Permute_24rounds:
549
583
  .balign 32
@@ -571,8 +605,10 @@ _KeccakP1600_Permute_24rounds:
571
605
  vzeroupper
572
606
  ret
573
607
  .ifndef old_gas_syntax
608
+ .ifndef no_size
574
609
  .size KeccakP1600_Permute_24rounds,.-KeccakP1600_Permute_24rounds
575
610
  .endif
611
+ .endif
576
612
 
577
613
  # -----------------------------------------------------------------------------
578
614
  #
@@ -582,8 +618,10 @@ _KeccakP1600_Permute_24rounds:
582
618
  .globl KeccakP1600_Permute_12rounds
583
619
  .globl _KeccakP1600_Permute_12rounds
584
620
  .ifndef old_gas_syntax
621
+ .ifndef no_type
585
622
  .type KeccakP1600_Permute_12rounds,@function
586
623
  .endif
624
+ .endif
587
625
  KeccakP1600_Permute_12rounds:
588
626
  _KeccakP1600_Permute_12rounds:
589
627
  .balign 32
@@ -611,8 +649,10 @@ _KeccakP1600_Permute_12rounds:
611
649
  vzeroupper
612
650
  ret
613
651
  .ifndef old_gas_syntax
652
+ .ifndef no_size
614
653
  .size KeccakP1600_Permute_12rounds,.-KeccakP1600_Permute_12rounds
615
654
  .endif
655
+ .endif
616
656
 
617
657
  # -----------------------------------------------------------------------------
618
658
  #
@@ -622,8 +662,10 @@ _KeccakP1600_Permute_12rounds:
622
662
  .globl KeccakP1600_Permute_Nrounds
623
663
  .globl _KeccakP1600_Permute_Nrounds
624
664
  .ifndef old_gas_syntax
665
+ .ifndef no_type
625
666
  .type KeccakP1600_Permute_Nrounds,@function
626
667
  .endif
668
+ .endif
627
669
  KeccakP1600_Permute_Nrounds:
628
670
  _KeccakP1600_Permute_Nrounds:
629
671
  .balign 32
@@ -653,8 +695,10 @@ _KeccakP1600_Permute_Nrounds:
653
695
  vzeroupper
654
696
  ret
655
697
  .ifndef old_gas_syntax
698
+ .ifndef no_size
656
699
  .size KeccakP1600_Permute_Nrounds,.-KeccakP1600_Permute_Nrounds
657
700
  .endif
701
+ .endif
658
702
 
659
703
  # -----------------------------------------------------------------------------
660
704
  #
@@ -664,8 +708,10 @@ _KeccakP1600_Permute_Nrounds:
664
708
  .globl KeccakF1600_FastLoop_Absorb
665
709
  .globl _KeccakF1600_FastLoop_Absorb
666
710
  .ifndef old_gas_syntax
711
+ .ifndef no_type
667
712
  .type KeccakF1600_FastLoop_Absorb,@function
668
713
  .endif
714
+ .endif
669
715
  KeccakF1600_FastLoop_Absorb:
670
716
  _KeccakF1600_FastLoop_Absorb:
671
717
  .balign 32
@@ -832,8 +878,10 @@ KeccakF1600_FastLoop_Absorb_LanesAddLoop:
832
878
  jae KeccakF1600_FastLoop_Absorb_Not17Lanes
833
879
  jmp KeccakF1600_FastLoop_Absorb_Exit
834
880
  .ifndef old_gas_syntax
881
+ .ifndef no_size
835
882
  .size KeccakF1600_FastLoop_Absorb,.-KeccakF1600_FastLoop_Absorb
836
883
  .endif
884
+ .endif
837
885
 
838
886
  # -----------------------------------------------------------------------------
839
887
  #
@@ -843,8 +891,10 @@ KeccakF1600_FastLoop_Absorb_LanesAddLoop:
843
891
  .globl KeccakP1600_12rounds_FastLoop_Absorb
844
892
  .globl _KeccakP1600_12rounds_FastLoop_Absorb
845
893
  .ifndef old_gas_syntax
894
+ .ifndef no_type
846
895
  .type KeccakP1600_12rounds_FastLoop_Absorb,@function
847
896
  .endif
897
+ .endif
848
898
  KeccakP1600_12rounds_FastLoop_Absorb:
849
899
  _KeccakP1600_12rounds_FastLoop_Absorb:
850
900
  .balign 32
@@ -1011,8 +1061,10 @@ KeccakP1600_12rounds_FastLoop_Absorb_LanesAddLoop:
1011
1061
  jae KeccakP1600_12rounds_FastLoop_Absorb_Not17Lanes
1012
1062
  jmp KeccakP1600_12rounds_FastLoop_Absorb_Exit
1013
1063
  .ifndef old_gas_syntax
1064
+ .ifndef no_size
1014
1065
  .size KeccakP1600_12rounds_FastLoop_Absorb,.-KeccakP1600_12rounds_FastLoop_Absorb
1015
1066
  .endif
1067
+ .endif
1016
1068
 
1017
1069
  .equ ALLON, 0xFFFFFFFFFFFFFFFF
1018
1070
 
@@ -25,8 +25,10 @@
25
25
  .globl KeccakP1600_Initialize
26
26
  .globl _KeccakP1600_Initialize
27
27
  .ifndef old_gas_syntax
28
+ .ifndef no_type
28
29
  .type KeccakP1600_Initialize,@function
29
30
  .endif
31
+ .endif
30
32
  KeccakP1600_Initialize:
31
33
  _KeccakP1600_Initialize:
32
34
  .balign 32
@@ -37,8 +39,10 @@ _KeccakP1600_Initialize:
37
39
  movq $0,3*64(%rdi)
38
40
  ret
39
41
  .ifndef old_gas_syntax
42
+ .ifndef no_size
40
43
  .size KeccakP1600_Initialize,.-KeccakP1600_Initialize
41
44
  .endif
45
+ .endif
42
46
 
43
47
  # -----------------------------------------------------------------------------
44
48
  #
@@ -67,8 +71,10 @@ _KeccakP1600_Initialize:
67
71
  .globl KeccakP1600_AddBytes
68
72
  .globl _KeccakP1600_AddBytes
69
73
  .ifndef old_gas_syntax
74
+ .ifndef no_type
70
75
  .type KeccakP1600_AddBytes,@function
71
76
  .endif
77
+ .endif
72
78
  KeccakP1600_AddBytes:
73
79
  _KeccakP1600_AddBytes:
74
80
  .balign 32
@@ -111,8 +117,10 @@ KeccakP1600_AddBytes_LastIncompleteLaneLoop:
111
117
  KeccakP1600_AddBytes_Exit:
112
118
  ret
113
119
  .ifndef old_gas_syntax
120
+ .ifndef no_size
114
121
  .size KeccakP1600_AddBytes,.-KeccakP1600_AddBytes
115
122
  .endif
123
+ .endif
116
124
 
117
125
  # -----------------------------------------------------------------------------
118
126
  #
@@ -122,8 +130,10 @@ KeccakP1600_AddBytes_Exit:
122
130
  .globl KeccakP1600_OverwriteBytes
123
131
  .globl _KeccakP1600_OverwriteBytes
124
132
  .ifndef old_gas_syntax
133
+ .ifndef no_type
125
134
  .type KeccakP1600_OverwriteBytes,@function
126
135
  .endif
136
+ .endif
127
137
  KeccakP1600_OverwriteBytes:
128
138
  _KeccakP1600_OverwriteBytes:
129
139
  .balign 32
@@ -166,8 +176,10 @@ KeccakP1600_OverwriteBytes_LastIncompleteLaneLoop:
166
176
  KeccakP1600_OverwriteBytes_Exit:
167
177
  ret
168
178
  .ifndef old_gas_syntax
179
+ .ifndef no_size
169
180
  .size KeccakP1600_OverwriteBytes,.-KeccakP1600_OverwriteBytes
170
181
  .endif
182
+ .endif
171
183
 
172
184
  # -----------------------------------------------------------------------------
173
185
  #
@@ -177,8 +189,10 @@ KeccakP1600_OverwriteBytes_Exit:
177
189
  .globl KeccakP1600_OverwriteWithZeroes
178
190
  .globl _KeccakP1600_OverwriteWithZeroes
179
191
  .ifndef old_gas_syntax
192
+ .ifndef no_type
180
193
  .type KeccakP1600_OverwriteWithZeroes,@function
181
194
  .endif
195
+ .endif
182
196
  KeccakP1600_OverwriteWithZeroes:
183
197
  _KeccakP1600_OverwriteWithZeroes:
184
198
  .balign 32
@@ -202,8 +216,10 @@ KeccakP1600_OverwriteWithZeroes_LastIncompleteLaneLoop:
202
216
  KeccakP1600_OverwriteWithZeroes_Exit:
203
217
  ret
204
218
  .ifndef old_gas_syntax
219
+ .ifndef no_size
205
220
  .size KeccakP1600_OverwriteWithZeroes,.-KeccakP1600_OverwriteWithZeroes
206
221
  .endif
222
+ .endif
207
223
 
208
224
  # -----------------------------------------------------------------------------
209
225
  #
@@ -213,8 +229,10 @@ KeccakP1600_OverwriteWithZeroes_Exit:
213
229
  .globl KeccakP1600_ExtractBytes
214
230
  .globl _KeccakP1600_ExtractBytes
215
231
  .ifndef old_gas_syntax
232
+ .ifndef no_type
216
233
  .type KeccakP1600_ExtractBytes,@function
217
234
  .endif
235
+ .endif
218
236
  KeccakP1600_ExtractBytes:
219
237
  _KeccakP1600_ExtractBytes:
220
238
  .balign 32
@@ -257,8 +275,10 @@ KeccakP1600_ExtractBytes_LastIncompleteLaneLoop:
257
275
  KeccakP1600_ExtractBytes_Exit:
258
276
  ret
259
277
  .ifndef old_gas_syntax
278
+ .ifndef no_size
260
279
  .size KeccakP1600_ExtractBytes,.-KeccakP1600_ExtractBytes
261
280
  .endif
281
+ .endif
262
282
 
263
283
  # -----------------------------------------------------------------------------
264
284
  #
@@ -268,8 +288,10 @@ KeccakP1600_ExtractBytes_Exit:
268
288
  .globl KeccakP1600_ExtractAndAddBytes
269
289
  .globl _KeccakP1600_ExtractAndAddBytes
270
290
  .ifndef old_gas_syntax
291
+ .ifndef no_type
271
292
  .type KeccakP1600_ExtractAndAddBytes,@function
272
293
  .endif
294
+ .endif
273
295
  KeccakP1600_ExtractAndAddBytes:
274
296
  _KeccakP1600_ExtractAndAddBytes:
275
297
  .balign 32
@@ -320,8 +342,10 @@ KeccakP1600_ExtractAndAddBytes_Exit:
320
342
  pop %rbx
321
343
  ret
322
344
  .ifndef old_gas_syntax
345
+ .ifndef no_size
323
346
  .size KeccakP1600_ExtractAndAddBytes,.-KeccakP1600_ExtractAndAddBytes
324
347
  .endif
348
+ .endif
325
349
 
326
350
  # -----------------------------------------------------------------------------
327
351
  #
@@ -329,8 +353,10 @@ KeccakP1600_ExtractAndAddBytes_Exit:
329
353
  #
330
354
  .text
331
355
  .ifndef old_gas_syntax
356
+ .ifndef no_type
332
357
  .type __KeccakF1600,@function
333
358
  .endif
359
+ .endif
334
360
  .balign 32
335
361
  __KeccakF1600:
336
362
  .Loop_avx512:
@@ -440,8 +466,10 @@ __KeccakF1600:
440
466
  jnz .Loop_avx512
441
467
  ret
442
468
  .ifndef old_gas_syntax
469
+ .ifndef no_size
443
470
  .size __KeccakF1600,.-__KeccakF1600
444
471
  .endif
472
+ .endif
445
473
 
446
474
  # -----------------------------------------------------------------------------
447
475
  #
@@ -451,8 +479,10 @@ __KeccakF1600:
451
479
  .globl KeccakP1600_Permute_24rounds
452
480
  .globl _KeccakP1600_Permute_24rounds
453
481
  .ifndef old_gas_syntax
482
+ .ifndef no_type
454
483
  .type KeccakP1600_Permute_24rounds,@function
455
484
  .endif
485
+ .endif
456
486
  KeccakP1600_Permute_24rounds:
457
487
  _KeccakP1600_Permute_24rounds:
458
488
  .balign 32
@@ -502,8 +532,10 @@ _KeccakP1600_Permute_24rounds:
502
532
  vzeroupper
503
533
  ret
504
534
  .ifndef old_gas_syntax
535
+ .ifndef no_size
505
536
  .size KeccakP1600_Permute_24rounds,.-KeccakP1600_Permute_24rounds
506
537
  .endif
538
+ .endif
507
539
 
508
540
  # -----------------------------------------------------------------------------
509
541
  #
@@ -513,8 +545,10 @@ _KeccakP1600_Permute_24rounds:
513
545
  .globl KeccakP1600_Permute_12rounds
514
546
  .globl _KeccakP1600_Permute_12rounds
515
547
  .ifndef old_gas_syntax
548
+ .ifndef no_type
516
549
  .type KeccakP1600_Permute_12rounds,@function
517
550
  .endif
551
+ .endif
518
552
  KeccakP1600_Permute_12rounds:
519
553
  _KeccakP1600_Permute_12rounds:
520
554
  .balign 32
@@ -564,8 +598,10 @@ _KeccakP1600_Permute_12rounds:
564
598
  vzeroupper
565
599
  ret
566
600
  .ifndef old_gas_syntax
601
+ .ifndef no_size
567
602
  .size KeccakP1600_Permute_12rounds,.-KeccakP1600_Permute_12rounds
568
603
  .endif
604
+ .endif
569
605
 
570
606
  # -----------------------------------------------------------------------------
571
607
  #
@@ -575,8 +611,10 @@ _KeccakP1600_Permute_12rounds:
575
611
  .globl KeccakP1600_Permute_Nrounds
576
612
  .globl _KeccakP1600_Permute_Nrounds
577
613
  .ifndef old_gas_syntax
614
+ .ifndef no_type
578
615
  .type KeccakP1600_Permute_Nrounds,@function
579
616
  .endif
617
+ .endif
580
618
  KeccakP1600_Permute_Nrounds:
581
619
  _KeccakP1600_Permute_Nrounds:
582
620
  .balign 32
@@ -697,8 +735,10 @@ _KeccakP1600_Permute_Nrounds:
697
735
  vzeroupper
698
736
  ret
699
737
  .ifndef old_gas_syntax
738
+ .ifndef no_size
700
739
  .size KeccakP1600_Permute_Nrounds,.-KeccakP1600_Permute_Nrounds
701
740
  .endif
741
+ .endif
702
742
 
703
743
  # -----------------------------------------------------------------------------
704
744
  #
@@ -708,8 +748,10 @@ _KeccakP1600_Permute_Nrounds:
708
748
  .globl KeccakF1600_FastLoop_Absorb
709
749
  .globl _KeccakF1600_FastLoop_Absorb
710
750
  .ifndef old_gas_syntax
751
+ .ifndef no_type
711
752
  .type KeccakF1600_FastLoop_Absorb,@function
712
753
  .endif
754
+ .endif
713
755
  KeccakF1600_FastLoop_Absorb:
714
756
  _KeccakF1600_FastLoop_Absorb:
715
757
  .balign 32
@@ -836,8 +878,10 @@ KeccakF1600_FastLoop_Absorb_LanesAddLoop:
836
878
  jae KeccakF1600_FastLoop_Absorb_LanesLoop
837
879
  jmp KeccakF1600_FastLoop_Absorb_Exit
838
880
  .ifndef old_gas_syntax
881
+ .ifndef no_size
839
882
  .size KeccakF1600_FastLoop_Absorb,.-KeccakF1600_FastLoop_Absorb
840
883
  .endif
884
+ .endif
841
885
 
842
886
  # -----------------------------------------------------------------------------
843
887
  #
@@ -847,8 +891,10 @@ KeccakF1600_FastLoop_Absorb_LanesAddLoop:
847
891
  .globl KeccakP1600_12rounds_FastLoop_Absorb
848
892
  .globl _KeccakP1600_12rounds_FastLoop_Absorb
849
893
  .ifndef old_gas_syntax
894
+ .ifndef no_type
850
895
  .type KeccakP1600_12rounds_FastLoop_Absorb,@function
851
896
  .endif
897
+ .endif
852
898
  KeccakP1600_12rounds_FastLoop_Absorb:
853
899
  _KeccakP1600_12rounds_FastLoop_Absorb:
854
900
  .balign 32
@@ -975,8 +1021,10 @@ KeccakP1600_FastLoop_Absorb_LanesAddLoop:
975
1021
  jae KeccakP1600_FastLoop_Absorb_LanesLoop
976
1022
  jmp KeccakP1600_FastLoop_Absorb_Exit
977
1023
  .ifndef old_gas_syntax
1024
+ .ifndef no_size
978
1025
  .size KeccakP1600_12rounds_FastLoop_Absorb,.-KeccakP1600_12rounds_FastLoop_Absorb
979
1026
  .endif
1027
+ .endif
980
1028
  .balign 64
981
1029
  theta_perm:
982
1030
  .quad 0, 1, 2, 3, 4, 5, 6, 7 # [not used]
@@ -53,8 +53,8 @@ typedef __m256i V256;
53
53
  #define ROL64in256(d, a, o) d = _mm256_or_si256(_mm256_slli_epi64(a, o), _mm256_srli_epi64(a, 64-(o)))
54
54
  #define ROL64in256_8(d, a) d = _mm256_shuffle_epi8(a, CONST256(rho8))
55
55
  #define ROL64in256_56(d, a) d = _mm256_shuffle_epi8(a, CONST256(rho56))
56
- static const uint64_t rho8[4] = {0x0605040302010007, 0x0E0D0C0B0A09080F, 0x1615141312111017, 0x1E1D1C1B1A19181F};
57
- static const uint64_t rho56[4] = {0x0007060504030201, 0x080F0E0D0C0B0A09, 0x1017161514131211, 0x181F1E1D1C1B1A19};
56
+ static ALIGN(KeccakP1600times4_statesAlignment) const uint64_t rho8[4] = {0x0605040302010007, 0x0E0D0C0B0A09080F, 0x1615141312111017, 0x1E1D1C1B1A19181F};
57
+ static ALIGN(KeccakP1600times4_statesAlignment) const uint64_t rho56[4] = {0x0007060504030201, 0x080F0E0D0C0B0A09, 0x1017161514131211, 0x181F1E1D1C1B1A19};
58
58
  #define STORE256(a, b) _mm256_store_si256((V256 *)&(a), b)
59
59
  #define STORE256u(a, b) _mm256_storeu_si256((V256 *)&(a), b)
60
60
  #define STORE2_128(ah, al, v) _mm256_storeu2_m128i(&(ah), &(al), v)
@@ -1,5 +1,5 @@
1
1
  module Digest
2
2
  module KangarooTwelve
3
- VERSION = "0.4.5"
3
+ VERSION = "0.4.6"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: digest-kangarootwelve
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.5
4
+ version: 0.4.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - konsolebox
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-05-12 00:00:00.000000000 Z
11
+ date: 2022-12-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake