utils/gcm-ref (present_gf_pmull): Round width up to a multiple of 64 bits.
authorMark Wooding <mdw@distorted.org.uk>
Tue, 16 Jan 2024 13:38:52 +0000 (13:38 +0000)
committerMark Wooding <mdw@distorted.org.uk>
Tue, 16 Jan 2024 13:44:00 +0000 (13:44 +0000)
Otherwise the later loop, which pulls off 64-bit chunks, gets badly
confused.

Now `gcm-ref' can actually calculate all of the things properly.

for p in pclmul vmullp64 pmull; do
  while read u v; do utils/gcm-ref $p $u $v || break 2; done <<EOF
cde4bef260d7bcda 163547d348b75511
cde4bef260d7bcda163547d3 48b7551195e77022907dd1df
cde4bef260d7bcda163547d348b75511 95e77022907dd1dff7dac5c9941d26d0
cde4bef260d7bcda163547d348b7551195e77022907dd1df f7dac5c9941d26d0c6eb14ad568f86edd1dc9268eeee5332
cde4bef260d7bcda163547d348b7551195e77022907dd1dff7dac5c9941d26d0 c6eb14ad568f86edd1dc9268eeee533285a6ed810c9b689daaa9060d2d4b6003
EOF
done

I wonder what this means about the changes coming up...

utils/gcm-ref

index 0367241..bec00d7 100755 (executable)
@@ -258,6 +258,7 @@ def present_gf_pmull(tag, wd, x, w, n, what):
   if tag == TAG_PRODPIECE or tag == TAG_REDCFULL or tag == TAG_SHIFTED:
     return
   elif tag == TAG_INPUT_V or tag == TAG_KPIECE_V:
+    w = (w + 63)&~63
     bx = C.ReadBuffer(x.storeb(w/8))
     by = C.WriteBuffer()
     while bx.left: chunk = bx.get(8); by.put(chunk).put(chunk)