This script will handle other backports except ECC as well.
Signed-off-by: Daiki Ueno <ueno@gnu.org>
touch ChangeLog || return 1
devel/import-ecc-from-nettle.sh
- devel/import-chacha-from-nettle.sh
+ devel/import-from-nettle.sh
}
#!/bin/sh
-# This script copies the ChaCha20 implementation from the
-# nettle upstream, with necessary adjustments for bundling in GnuTLS.
+# This script copies files from the nettle upstream, with necessary
+# adjustments for bundling in GnuTLS.
set +e
: ${srcdir=.}
SRC=$srcdir/devel/nettle
-DST=$srcdir/lib/nettle/chacha
+DST=$srcdir/lib/nettle/backport
IMPORTS="
chacha-core-internal.c
# Rename header guard so as not to conflict with the public ones.
if grep '^#ifndef NETTLE_.*_H\(_INCLUDED\)*' $dst 2>&1 >/dev/null; then
g=$(sed -n 's/^#ifndef NETTLE_\(.*_H\(_INCLUDED\)*\)/\1/p' $dst)
- sed 's/\(NETTLE_'$g'\)/GNUTLS_LIB_NETTLE_CHACHA_\1/' $dst > $dst-t && \
+ sed 's/\(NETTLE_'$g'\)/GNUTLS_LIB_NETTLE_BACKPORT_\1/' $dst > $dst-t && \
mv $dst-t $dst
fi
;;
case $dst in
*.h)
# Add prefix to function symbols avoid clashing with the public ones.
- sed -e 's/^#define \(.*\) nettle_\1/#define \1 gnutls_nettle_chacha_\1/' \
- -e 's/^#define _\(.*\) _nettle_\1/#define _\1 _gnutls_nettle_chacha_\1/' \
- -e 's/^#define \(.*\) _nettle_\1/#define \1 _gnutls_nettle_chacha_\1/' \
+ sed -e 's/^#define \(.*\) nettle_\1/#define \1 gnutls_nettle_backport_\1/' \
+ -e 's/^#define _\(.*\) _nettle_\1/#define _\1 _gnutls_nettle_backport_\1/' \
+ -e 's/^#define \(.*\) _nettle_\1/#define \1 _gnutls_nettle_backport_\1/' \
$dst > $dst-t && \
mv $dst-t $dst
;;
if NEED_CHACHA
libcrypto_la_SOURCES += \
- chacha/chacha-core-internal.c chacha/chacha-crypt.c \
- chacha/chacha-internal.h chacha/chacha-poly1305.c \
- chacha/chacha-poly1305.h chacha/chacha-set-key.c \
- chacha/chacha-set-nonce.c chacha/chacha.h \
- chacha/poly1305.h chacha/poly1305-internal.c \
- chacha/poly1305-internal.h
+ backport/chacha-core-internal.c backport/chacha-crypt.c \
+ backport/chacha-internal.h backport/chacha-poly1305.c \
+ backport/chacha-poly1305.h backport/chacha-set-key.c \
+ backport/chacha-set-nonce.c backport/chacha.h \
+ backport/poly1305.h backport/poly1305-internal.c \
+ backport/poly1305-internal.h
endif
#include <nettle/chacha.h>
#include <nettle/chacha-poly1305.h>
#else
-#include "chacha/chacha.h"
-#include "chacha/chacha-poly1305.h"
+#include "chacha.h"
+#include "chacha-poly1305.h"
#endif
#ifdef HAVE_NETTLE_CFB8_ENCRYPT
#include <nettle/cfb.h>