-
Notifications
You must be signed in to change notification settings - Fork 1
Building libgcrypt
The branch containing the latest development status of all PQC schemes is all-pqc.
git clone https://dev.gnupg.org/source/libgpg-error.git
Building libgpg-error:
cd libgpg-error
./configure --enable-maintainer-mode --prefix=/opt/libgpg-error --enable-install-gpg-error-config
make install
To build libgcrypt, we need to provide the path to the installed libgpg-error as follows:
./configure --enable-maintainer-mode --prefix=/opt/libgcrypt-pqc --with-libgpg-error-prefix=/opt/libgpg-error
The following tests for the PQC schemes in Libgcrypt can be executed:
cd tests
./t-mldsa
./t-mlkem
./t-slhdsa
The following error might occur when building Libgcrypt:
for file in gcrypt.texi ; do \
./yat2m -I . --release "Libgcrypt 1.11.0" --source "Libgcrypt" --store \
`test -f '$file' || echo './'`$file ; done
yat2m: can't open include file './version.texi': No such file or directory
make[3]: *** [Makefile:933: yat2m-stamp] Fehler 1
This can be fixed by running
touch doc/version.texi
and then again make. Maybe it is the problem described here.
In order to build the library without AVX2 support, provide the argument --disable-avx2-support to the configure script.
The coding guidelines applying to libgcrypt can be found at gnupg/doc/HACKING (gnupg repo).
./configure --enable-maintainer-mode --with-libgpg-error-prefix=/opt/libgpg-error --disable-optimization WITH_DEBUG=yes
For Kyber the additions described in the following subsection where made to add source files for compilation. Most importantly, note that it is not sufficient to run ./configure after build system files have been updated. Before, also
./autogen.sh
has to be run to ensure the generation of a new Makefile.in. (In case of doubt delete Makefile.in manually beforehand.)
The following scripts can be used for this purpose:
thorough_clean.sh:
#!/bin/bash
set -e
make clean
find . -name "Makefile.in" | xargs -n1 rm
full_rebuild.sh:
#!/bin/bash
set -e
./thorough_clean.sh
./autogen.sh
./configure --with-libgpg-error-prefix=/opt/libgpg-error --disable-optimization WITH_DEBUG=yes
make -j8
LIST_MEMBER(kyber, $enabled_pubkey_ciphers)
AM_CONDITIONAL(USE_KYBER, [test "$found" = "1"])
if test "$found" = "1" ; then
GCRYPT_PUBKEY_CIPHERS="$GCRYPT_PUBKEY_CIPHERS kyber.lo kyber-common.lo kyber_indcpa.lo kyber_ntt.lo kyber_poly.lo kyber_polyvec.lo kyber_randombytes.lo kyber_symmetric.lo kyber_reduce.lo kyber_fips202.lo kyber_cbd.lo kyber_aes256.ctr.lo"
AC_DEFINE(USE_KYBER, 1, [Defined if this module should be included])
name=kyber
list=$enabled_pubkey_ciphers
found=0
for n in $list; do
if test "x$name" = "x$n"; then
found=1
fi
done
if test "$found" = "1"; then
USE_KYBER_TRUE=
USE_KYBER_FALSE='#'
else
USE_KYBER_TRUE='#'
USE_KYBER_FALSE=
fi
if test "$found" = "1" ; then
GCRYPT_PUBKEY_CIPHERS="$GCRYPT_PUBKEY_CIPHERS kyber.lo kyber-common.lo kyber_indcpa.lo kyber_ntt.lo kyber_poly.lo kyber_polyvec.lo kyber_randombytes.lo kyber_symmetric.lo kyber_reduce.lo kyber_fips202.lo kyber_cbd.lo kyber_aes256.ctr.lo"
$as_echo "#define USE_KYBER 1" >>confdefs.h
fi
In this file new test binaries have to be registered.
In order for newly defined symbols to be visible for client applications, they have to be registered in
- src/libgcrypt.def (Windows)
- src/libgcrypt.vers (Unix?)
- see older notes at https://github.com/pqc-thunderbird/libgcrypt/issues/1