feat(spiped): enable auto-update, upgrade to 1.6.2

Signed-off-by: Aditya Alok <dev.aditya.alok@gmail.com>
This commit is contained in:
Aditya Alok 2022-04-15 01:52:45 +05:30
parent 8d8ad18487
commit ee7898dfbe
No known key found for this signature in database
GPG Key ID: 345AE134142077D8
4 changed files with 104 additions and 98 deletions

View File

@ -1,15 +1,44 @@
diff -uNr spiped-1.6.1/Makefile spiped-1.6.1.mod/Makefile
--- spiped-1.6.1/Makefile 2020-02-22 03:25:11.000000000 +0200
+++ spiped-1.6.1.mod/Makefile 2020-05-13 12:44:20.982281513 +0300
@@ -5,7 +5,6 @@
tests/pushbits tests/valgrind \
perftests/recv-zeros perftests/send-zeros
BINDIR_DEFAULT= /usr/local/bin
-CFLAGS_DEFAULT= -O2
LIBCPERCIVA_DIR= libcperciva
TEST_CMD= tests/test_spiped.sh
@@ -17,7 +16,7 @@
--- a/spipe/Makefile 2021-12-24 19:27:38.000000000 +0000
+++ b/spipe/Makefile 2022-04-15 16:22:46.461946207 +0000
@@ -4,7 +4,7 @@
MAN1=spipe.1
SRCS=main.c pushbits.c
IDIRS=-I../libcperciva/crypto -I../libcperciva/events -I../libcperciva/util -I../lib/proto -I../lib/util
-LDADD_REQ=-lcrypto -lpthread
+LDADD_REQ=-lcrypto
SUBDIR_DEPTH=..
RELATIVE_DIR=spipe
LIBALL=../liball/liball.a
@@ -21,7 +21,6 @@
install:${PROG}
mkdir -p ${BINDIR}
cp ${PROG} ${BINDIR}/_inst.${PROG}.$$$$_ && \
- strip ${BINDIR}/_inst.${PROG}.$$$$_ && \
chmod 0555 ${BINDIR}/_inst.${PROG}.$$$$_ && \
mv -f ${BINDIR}/_inst.${PROG}.$$$$_ ${BINDIR}/${PROG}
if ! [ -z "${MAN1DIR}" ]; then \
--- a/spiped/Makefile 2021-12-24 19:27:38.000000000 +0000
+++ b/spiped/Makefile 2022-04-15 17:39:31.740187413 +0000
@@ -4,7 +4,7 @@
MAN1=spiped.1
SRCS=main.c dispatch.c
IDIRS=-I../libcperciva/crypto -I../libcperciva/events -I../libcperciva/network -I../libcperciva/util -I../lib/dnsthread -I../lib/proto -I../lib/util
-LDADD_REQ=-lcrypto -lpthread
+LDADD_REQ=-lcrypto
SUBDIR_DEPTH=..
RELATIVE_DIR=spiped
LIBALL=../liball/liball.a
@@ -21,7 +21,6 @@
install:${PROG}
mkdir -p ${BINDIR}
cp ${PROG} ${BINDIR}/_inst.${PROG}.$$$$_ && \
- strip ${BINDIR}/_inst.${PROG}.$$$$_ && \
chmod 0555 ${BINDIR}/_inst.${PROG}.$$$$_ && \
mv -f ${BINDIR}/_inst.${PROG}.$$$$_ ${BINDIR}/${PROG}
if ! [ -z "${MAN1DIR}" ]; then \
--- a/Makefile 2021-12-24 19:27:38.000000000 +0000
+++ b/Makefile 2022-04-15 17:24:16.643530079 +0000
@@ -24,7 +24,7 @@
. ./cpusupport-config.h; \
. ./cflags-filter.sh; \
export HAVE_BUILD_FLAGS=1; \
@ -18,61 +47,3 @@ diff -uNr spiped-1.6.1/Makefile spiped-1.6.1.mod/Makefile
( cd $${D} && ${MAKE} all ) || exit 2; \
done
diff -uNr spiped-1.6.1/spipe/Makefile spiped-1.6.1.mod/spipe/Makefile
--- spiped-1.6.1/spipe/Makefile 2020-02-22 03:25:11.000000000 +0200
+++ spiped-1.6.1.mod/spipe/Makefile 2020-05-13 12:43:17.482323732 +0300
@@ -4,7 +4,7 @@
MAN1=spipe.1
SRCS=main.c pushbits.c proto_conn.c proto_crypt.c proto_handshake.c proto_pipe.c graceful_shutdown.c sha256.c sha256_shani.c elasticarray.c ptrheap.c timerqueue.c asprintf.c entropy.c getopt.c insecure_memzero.c monoclock.c noeintr.c sock.c warnp.c cpusupport_x86_aesni.c cpusupport_x86_rdrand.c cpusupport_x86_shani.c cpusupport_x86_ssse3.c events_immediate.c events_network.c events_network_selectstats.c events_timer.c events.c network_connect.c network_read.c network_write.c crypto_aes.c crypto_aes_aesni.c crypto_aesctr.c crypto_dh.c crypto_dh_group14.c crypto_entropy.c crypto_entropy_rdrand.c crypto_verify_bytes.c
IDIRS=-I../proto -I../lib/util -I../libcperciva/alg -I../libcperciva/datastruct -I../libcperciva/util -I../libcperciva/cpusupport -I../libcperciva/events -I../libcperciva/network -I../libcperciva/crypto
-LDADD_REQ=-lcrypto -lpthread
+LDADD_REQ=-lcrypto
SUBDIR_DEPTH=..
RELATIVE_DIR=spipe
@@ -20,7 +20,6 @@
install:${PROG}
mkdir -p ${BINDIR}
cp ${PROG} ${BINDIR}/_inst.${PROG}.$$$$_ && \
- strip ${BINDIR}/_inst.${PROG}.$$$$_ && \
chmod 0555 ${BINDIR}/_inst.${PROG}.$$$$_ && \
mv -f ${BINDIR}/_inst.${PROG}.$$$$_ ${BINDIR}/${PROG}
if ! [ -z "${MAN1DIR}" ]; then \
@@ -36,7 +35,7 @@
rm -f ${PROG} ${SRCS:.c=.o}
${PROG}:${SRCS:.c=.o}
- ${CC} -o ${PROG} ${SRCS:.c=.o} ${LDFLAGS} ${LDADD_EXTRA} ${LDADD_REQ} ${LDADD_POSIX}
+ ${CC} -o ${PROG} ${SRCS:.c=.o} ${LDFLAGS} -L${TERMUX_PREFIX}/lib ${LDADD_EXTRA} ${LDADD_REQ} ${LDADD_POSIX}
main.o: main.c ../libcperciva/events/events.h ../libcperciva/util/getopt.h ../lib/util/graceful_shutdown.h ../libcperciva/util/parsenum.h ../libcperciva/util/sock.h ../libcperciva/util/warnp.h ../proto/proto_conn.h ../proto/proto_crypt.h ../libcperciva/crypto/crypto_dh.h pushbits.h
${CC} ${CFLAGS_POSIX} -D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=700 -DCPUSUPPORT_CONFIG_FILE=\"cpusupport-config.h\" -I.. ${IDIRS} ${CPPFLAGS} ${CFLAGS} -c main.c -o main.o
diff -uNr spiped-1.6.1/spiped/Makefile spiped-1.6.1.mod/spiped/Makefile
--- spiped-1.6.1/spiped/Makefile 2020-02-22 03:25:11.000000000 +0200
+++ spiped-1.6.1.mod/spiped/Makefile 2020-05-13 12:43:17.486323729 +0300
@@ -4,7 +4,7 @@
MAN1=spiped.1
SRCS=main.c dispatch.c proto_conn.c proto_crypt.c proto_handshake.c proto_pipe.c sha256.c sha256_shani.c elasticarray.c ptrheap.c timerqueue.c dnsthread.c graceful_shutdown.c asprintf.c daemonize.c entropy.c getopt.c insecure_memzero.c monoclock.c noeintr.c setuidgid.c sock.c sock_util.c warnp.c cpusupport_x86_aesni.c cpusupport_x86_rdrand.c cpusupport_x86_shani.c cpusupport_x86_ssse3.c events_immediate.c events_network.c events_network_selectstats.c events_timer.c events.c network_accept.c network_connect.c network_read.c network_write.c crypto_aes.c crypto_aes_aesni.c crypto_aesctr.c crypto_dh.c crypto_dh_group14.c crypto_entropy.c crypto_entropy_rdrand.c crypto_verify_bytes.c
IDIRS=-I../proto -I../libcperciva/alg -I../libcperciva/datastruct -I../lib/dnsthread -I../lib/util -I../libcperciva/util -I../libcperciva/cpusupport -I../libcperciva/events -I../libcperciva/network -I../libcperciva/crypto
-LDADD_REQ=-lcrypto -lpthread
+LDADD_REQ=-lcrypto
SUBDIR_DEPTH=..
RELATIVE_DIR=spiped
@@ -20,7 +20,6 @@
install:${PROG}
mkdir -p ${BINDIR}
cp ${PROG} ${BINDIR}/_inst.${PROG}.$$$$_ && \
- strip ${BINDIR}/_inst.${PROG}.$$$$_ && \
chmod 0555 ${BINDIR}/_inst.${PROG}.$$$$_ && \
mv -f ${BINDIR}/_inst.${PROG}.$$$$_ ${BINDIR}/${PROG}
if ! [ -z "${MAN1DIR}" ]; then \
@@ -36,7 +35,7 @@
rm -f ${PROG} ${SRCS:.c=.o}
${PROG}:${SRCS:.c=.o}
- ${CC} -o ${PROG} ${SRCS:.c=.o} ${LDFLAGS} ${LDADD_EXTRA} ${LDADD_REQ} ${LDADD_POSIX}
+ ${CC} -o ${PROG} ${SRCS:.c=.o} ${LDFLAGS} -L${TERMUX_PREFIX}/lib ${LDADD_EXTRA} ${LDADD_REQ} ${LDADD_POSIX}
main.o: main.c ../libcperciva/util/asprintf.h ../libcperciva/util/daemonize.h ../libcperciva/events/events.h ../libcperciva/util/getopt.h ../lib/util/graceful_shutdown.h ../libcperciva/util/parsenum.h ../libcperciva/util/setuidgid.h ../libcperciva/util/sock.h ../libcperciva/util/warnp.h dispatch.h ../proto/proto_crypt.h ../libcperciva/crypto/crypto_dh.h
${CC} ${CFLAGS_POSIX} -D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=700 -DCPUSUPPORT_CONFIG_FILE=\"cpusupport-config.h\" -I.. ${IDIRS} ${CPPFLAGS} ${CFLAGS} -c main.c -o main.o

View File

@ -2,18 +2,26 @@ TERMUX_PKG_HOMEPAGE=https://www.tarsnap.com/spiped.html
TERMUX_PKG_DESCRIPTION="a utility for creating symmetrically encrypted and authenticated pipes between socket addresses"
TERMUX_PKG_LICENSE="BSD"
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION=1.6.1
TERMUX_PKG_REVISION=3
TERMUX_PKG_VERSION=1.6.2
TERMUX_PKG_SRCURL=https://github.com/Tarsnap/spiped/archive/$TERMUX_PKG_VERSION.tar.gz
TERMUX_PKG_SHA256=d14a0c802f97bfe4da6c1a6c1ec882b7ffb94d28aee1eea11e6ad532fc21254c
TERMUX_PKG_SHA256=7824f74e8dd123ca3075032281c11fbb9ba5a9ec8410e100012ca45210a170f6
TERMUX_PKG_DEPENDS="openssl"
TERMUX_PKG_BUILD_IN_SRC=true
TERMUX_PKG_AUTO_UPDATE=true
TERMUX_PKG_UPDATE_TAG_TYPE="newest-tag"
termux_step_make () {
termux_step_pre_configure() {
if [[ "${TERMUX_ARCH}" == "arm" ]]; then
# armv8 specific features check also enables them for armv7. But why?
patch -p1 --silent <"${TERMUX_PKG_BUILDER_DIR}"/disable_armv8_specific_features.diff
fi
}
termux_step_make() {
CFLAGS+=" $CPPFLAGS"
env LDADD_EXTRA="$LDFLAGS" \
make -j "$TERMUX_MAKE_PROCESSES" BINDIR="$TERMUX_PREFIX/bin" \
MAN1DIR="$TERMUX_PREFIX/share/man/man1"
MAN1DIR="$TERMUX_PREFIX/share/man/man1"
}
termux_step_make_install() {

View File

@ -0,0 +1,17 @@
--- a/libcperciva/cpusupport/Build/cpusupport.sh 2022-04-16 05:30:41.748083177 +0000
+++ b/libcperciva/cpusupport/Build/cpusupport.sh 2022-04-16 05:31:47.356988582 +0000
@@ -81,14 +81,3 @@
"-msse4.2 -Wno-cast-align -fno-strict-aliasing -Wno-cast-qual"
feature X86 SSSE3 "" "-mssse3" \
"-mssse3 -Wno-cast-align"
-
-# Detect specific ARM features
-feature ARM AES "-march=armv8.1-a+crypto" \
- "-march=armv8.1-a+crypto -D__ARM_ACLE=200"
-feature ARM CRC32_64 "-march=armv8.1-a" \
- "-march=armv8.1-a+crc" \
- "-march=armv8.1-a+crc -Wno-cast-align" \
- "-march=armv8.1-a -D__ARM_ACLE=200"
-feature ARM SHA256 "-march=armv8.1-a+crypto" \
- "-march=armv8.1-a+crypto -Wno-cast-align" \
- "-march=armv8.1-a+crypto -D__ARM_ACLE=200"

View File

@ -1,39 +1,49 @@
Android does not provide pthread_cancel().
Replacing it with pthread_kill(a, 0) makes program to compile
without issues but potentially leads to runtime problems.
See https://github.com/termux/termux-packages/issues/4378.
diff -uNr spiped-1.6.1/spipe/main.c spiped-1.6.1.mod/spipe/main.c
--- spiped-1.6.1/spipe/main.c 2020-02-22 03:25:11.000000000 +0200
+++ spiped-1.6.1.mod/spipe/main.c 2020-05-13 12:42:25.818390714 +0300
@@ -70,8 +70,8 @@
* shutdown() that socket.
--- a/lib/util/pthread_create_blocking_np.c 2021-12-24 19:27:38.000000000 +0000
+++ b/lib/util/pthread_create_blocking_np.c 2022-04-15 16:27:13.958553234 +0000
@@ -148,7 +148,7 @@
*/
pthread_mutex_unlock(&U->mutex);
err4:
- pthread_cancel(*thread);
+ pthread_kill(*thread,0);
pthread_join(*thread, NULL);
err3:
pthread_cond_destroy(&U->cond);
--- a/spipe/main.c 2021-12-24 19:27:38.000000000 +0000
+++ b/spipe/main.c 2022-04-15 16:26:28.373620198 +0000
@@ -71,7 +71,7 @@
/* Cancel the threads. */
for (i = 0; i < 2; i++) {
- if ((rc = pthread_cancel(ET->threads[i])) != 0) {
- warn0("pthread_cancel: %s", strerror(rc));
+ if ((rc = pthread_kill(ET->threads[i], 0)) != 0) {
+ warn0("pthread_kill: %s", strerror(rc));
goto err0;
+ if ((rc = pthread_kill(ET->threads[i],0)) != 0) {
/*
* According to the POSIX standard, a Thread ID should
* still be valid after pthread_exit has been invoked
@@ -80,7 +80,7 @@
* this situation.
*/
if (rc != ESRCH) {
- warn0("pthread_cancel: %s", strerror(rc));
+ warn0("pthread_kill: %s", strerror(rc));
goto err0;
}
}
if ((rc = pthread_join(ET->threads[i], NULL)) != 0) {
@@ -294,13 +294,13 @@
@@ -310,13 +310,13 @@
exit(0);
err5:
err6:
- if ((rc = pthread_cancel(ET.threads[0])) != 0)
- warn0("pthread_cancel: %s", strerror(rc));
+ if ((rc = pthread_kill(ET.threads[0], 0)) != 0)
+ if ((rc = pthread_kill(ET.threads[0],0)) != 0)
+ warn0("pthread_kill: %s", strerror(rc));
if ((rc = pthread_join(ET.threads[0], NULL)) != 0)
warn0("pthread_join: %s", strerror(rc));
err4:
err5:
- if ((rc = pthread_cancel(ET.threads[1])) != 0)
- warn0("pthread_cancel: %s", strerror(rc));
+ if ((rc = pthread_kill(ET.threads[1], 0)) != 0)
+ if ((rc = pthread_kill(ET.threads[1],0)) != 0)
+ warn0("pthread_kill: %s", strerror(rc));
if ((rc = pthread_join(ET.threads[1], NULL)) != 0)
warn0("pthread_join: %s", strerror(rc));
err3:
err4: