summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaiki Ueno <ueno@gnu.org>2020-04-26 19:26:48 +0200
committerDaiki Ueno <ueno@gnu.org>2020-05-04 14:26:13 +0200
commitde52bcc82e672f188e6d763cf95436738154f481 (patch)
treeef8a1d6c6f6bf261cadc6468fe07df8fc63f08ed
parent108a0b233bea58b8fd3f624eba81f77304879b87 (diff)
downloadgnutls-de52bcc82e672f188e6d763cf95436738154f481.tar.gz
nettle: rename import-chacha-from-nettle.sh to import-from-nettle.sh
This script will handle other backports except ECC as well. Signed-off-by: Daiki Ueno <ueno@gnu.org>
-rw-r--r--bootstrap.conf2
-rwxr-xr-xdevel/import-from-nettle.sh (renamed from devel/import-chacha-from-nettle.sh)14
-rw-r--r--lib/nettle/Makefile.am12
-rw-r--r--lib/nettle/cipher.c4
4 files changed, 16 insertions, 16 deletions
diff --git a/bootstrap.conf b/bootstrap.conf
index 04e670ddeb..3693846aaf 100644
--- a/bootstrap.conf
+++ b/bootstrap.conf
@@ -103,5 +103,5 @@ bootstrap_post_import_hook ()
touch ChangeLog || return 1
devel/import-ecc-from-nettle.sh
- devel/import-chacha-from-nettle.sh
+ devel/import-from-nettle.sh
}
diff --git a/devel/import-chacha-from-nettle.sh b/devel/import-from-nettle.sh
index 4b686df765..835248e63f 100755
--- a/devel/import-chacha-from-nettle.sh
+++ b/devel/import-from-nettle.sh
@@ -1,13 +1,13 @@
#!/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
@@ -66,7 +66,7 @@ for f in $IMPORTS; do
# 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
;;
@@ -74,9 +74,9 @@ for f in $IMPORTS; do
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
;;
diff --git a/lib/nettle/Makefile.am b/lib/nettle/Makefile.am
index 9595aef532..188abab845 100644
--- a/lib/nettle/Makefile.am
+++ b/lib/nettle/Makefile.am
@@ -168,10 +168,10 @@ endif
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
diff --git a/lib/nettle/cipher.c b/lib/nettle/cipher.c
index 35719357f4..0a94c49a95 100644
--- a/lib/nettle/cipher.c
+++ b/lib/nettle/cipher.c
@@ -49,8 +49,8 @@
#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>