Page MenuHome GnuPG

Improve PPC code using code from CRYPTOGRAMs
Closed, ResolvedPublic

Description

See D501 for the discussion

Revisions and Commits

Event Timeline

I think I am doing to try to do this on top of the work of Szabolcs Nagy[1] with the goal of making it portable, and also serving as a test cast to my carry-less multiplication intrinsic RFC[2]. Hopefully I can also remove the manual register allocation that makes it still a derivitive work of Andy, however this algorithm takes advantage of the communicative properties of carry-less multiplication, which is mult(H) on page 5 of the gcm spec[3], this communicative property works differently than with addition and multiplication in a way I do not entirely understand.

[1] https://github.com/ARM-software/optimized-routines/
[2] http://lists.llvm.org/pipermail/llvm-dev/2020-July/143198.html
[3] https://csrc.nist.rip/groups/ST/toolkit/BCM/documents/proposedmodes/gcm/gcm-spec.pdf

I think the code is using https://en.wikipedia.org/wiki/Estrin%27s_scheme but I have no scholarship applying this to AES-GCM. I will have to look closer.

OK, I upgraded the patch, including style adjustments to GNU style despite feeling that not having clang-format support for GNU style leads to it driving away contributors. It also credits Andy, and I have personally e-mailed Andy before.

I do want to do a wholy original implementation (and a portable one), but I am hoping this is sufficient (the performance certainly is) for now.

I do not think there is any point in contributing the original code when my code diviates from it quite a bit.

I've cleaned up the patch from D501 and tweaked the implementation a bit for performance. Here's patches attached:

Is this ok to apply or is there some checking to be done still pending?

Can you please also update AUTHORS and LICENSE files? I would also ask you to add

*
* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0-only)
*/

As the last line of the header blurb. Here I assumed that the author meant GPL 2.0 only as used by Linux.

I posted patch-set to mailing-list. Please check if AUTHORS/LICENSES updates are ok.
https://lists.gnupg.org/pipermail/gcrypt-devel/2021-March/005120.html

jukivili renamed this task from Impove PPC code using code from CRYPTOGRAMs to Improve PPC code using code from CRYPTOGRAMs.Mar 9 2021, 8:46 PM
jukivili closed this task as Resolved.