[PATCH gnupg 0/1] ML-KEM for Libgcrypt

Falko Strenzke falko.strenzke at mtg.de
Wed Sep 27 15:54:18 CEST 2023


- This is a patch for adding ML-KEM (a.k.a. Crystals-Kyber) to Libgcrypt.
- Function documentation is often just opportunistically retained from reference implementation and incomplete. It should be decided where header docs are desired / required, and in which format then we can consolidate this.
- The existing tests duplicate a lot of code for helper functions. As a proposed alternative, we introduced test-utils.h in order to enable code reuse for the helper functions.
- AVX2 support is still to come.
- Any feedback is welcome.

Signed-off-by: Falko Strenzke <falko.strenzke at mtg.de>


Falko Strenzke (1):
  added kyber

 .gitignore               |  16 +
 cipher/Makefile.am       |   9 +-
 cipher/consttime.c       |  28 ++
 cipher/consttime.h       |  36 ++
 cipher/dsa.c             |   1 +
 cipher/ecc.c             |   1 +
 cipher/elgamal.c         |   1 +
 cipher/mlkem-aux.c       |  72 ++++
 cipher/mlkem-aux.h       |  34 ++
 cipher/mlkem-cbd.c       | 154 +++++++++
 cipher/mlkem-cbd.h       |  38 ++
 cipher/mlkem-common.c    | 727 +++++++++++++++++++++++++++++++++++++++
 cipher/mlkem-common.h    |  60 ++++
 cipher/mlkem-ntt.c       | 181 ++++++++++
 cipher/mlkem-ntt.h       |  35 ++
 cipher/mlkem-params.h    |  79 +++++
 cipher/mlkem-poly.c      | 436 +++++++++++++++++++++++
 cipher/mlkem-poly.h      |  95 +++++
 cipher/mlkem-polyvec.c   | 409 ++++++++++++++++++++++
 cipher/mlkem-polyvec.h   |  84 +++++
 cipher/mlkem-symmetric.c |  85 +++++
 cipher/mlkem-symmetric.h |  66 ++++
 cipher/mlkem.c           | 479 ++++++++++++++++++++++++++
 cipher/pubkey.c          |  51 +++
 cipher/rsa.c             |   1 +
 configure.ac             |   9 +-
 doc/gcrypt.texi          |  28 ++
 src/cipher-proto.h       |   7 +
 src/cipher.h             |   1 +
 src/gcrypt-int.h         |   1 +
 src/gcrypt.h.in          |  11 +-
 src/global.c             |   4 +
 src/libgcrypt.def        |   1 +
 src/libgcrypt.vers       |   2 +-
 src/secmem.c             |  18 +-
 src/secmem.h             |   1 +
 src/visibility.c         |  12 +
 src/visibility.h         |   2 +
 tests/Makefile.am        |   7 +-
 tests/keygen.c           |  28 ++
 tests/mlkem-1024_ref.inp | 495 ++++++++++++++++++++++++++
 tests/mlkem-512_ref.inp  | 495 ++++++++++++++++++++++++++
 tests/mlkem-768_ref.inp  | 495 ++++++++++++++++++++++++++
 tests/mlkem-test.c       | 565 ++++++++++++++++++++++++++++++
 tests/test-utils.h       | 168 +++++++++
 45 files changed, 5519 insertions(+), 9 deletions(-)
 create mode 100644 cipher/consttime.c
 create mode 100644 cipher/consttime.h
 create mode 100644 cipher/mlkem-aux.c
 create mode 100644 cipher/mlkem-aux.h
 create mode 100644 cipher/mlkem-cbd.c
 create mode 100644 cipher/mlkem-cbd.h
 create mode 100644 cipher/mlkem-common.c
 create mode 100644 cipher/mlkem-common.h
 create mode 100644 cipher/mlkem-ntt.c
 create mode 100644 cipher/mlkem-ntt.h
 create mode 100644 cipher/mlkem-params.h
 create mode 100644 cipher/mlkem-poly.c
 create mode 100644 cipher/mlkem-poly.h
 create mode 100644 cipher/mlkem-polyvec.c
 create mode 100644 cipher/mlkem-polyvec.h
 create mode 100644 cipher/mlkem-symmetric.c
 create mode 100644 cipher/mlkem-symmetric.h
 create mode 100644 cipher/mlkem.c
 create mode 100644 tests/mlkem-1024_ref.inp
 create mode 100644 tests/mlkem-512_ref.inp
 create mode 100644 tests/mlkem-768_ref.inp
 create mode 100644 tests/mlkem-test.c
 create mode 100644 tests/test-utils.h

-- 
2.30.2




More information about the Gcrypt-devel mailing list