Merge Mainline

This commit is contained in:
CN_SZTL 2020-06-24 18:29:27 +08:00
commit f000ebc1ee
No known key found for this signature in database
GPG Key ID: 6850B6345C862176
40 changed files with 191 additions and 3832 deletions

View File

@ -8,12 +8,12 @@ endif
LINUX_VERSION-4.9 = .228
LINUX_VERSION-4.14 = .185
LINUX_VERSION-4.19 = .128
LINUX_VERSION-4.19 = .129
LINUX_VERSION-5.4 = .48
LINUX_KERNEL_HASH-4.9.228 = 8fbff429c6453036a0f79a55b4d85c1885c16999751198ddefdca7a3ff17fc34
LINUX_KERNEL_HASH-4.14.185 = f333b10c68d59d7dc7f92684452993c225a34b5f1c95bc44147a94db22ef3dc6
LINUX_KERNEL_HASH-4.19.128 = 29aba6849c972c0079ddee4aaf476a500ef52d937c7ba02ceec4c7cf4753613c
LINUX_KERNEL_HASH-4.19.129 = a87ba0d575c26f7cf386cef9a2c548952defaa8717d75f54ab29991db7bb0a5c
LINUX_KERNEL_HASH-5.4.48 = bf20ddafcd04c114d34654bb10d1eb74f1864f3d14b676c6f0d42d60bbcf1d53
remove_uri_prefix=$(subst git://,,$(subst http://,,$(subst https://,,$(1))))

View File

@ -85,6 +85,11 @@ $(eval $(call SetupHostCommand,find,Please install GNU 'find', \
$(eval $(call SetupHostCommand,bash,Please install GNU 'bash', \
bash --version 2>&1 | grep GNU))
$(eval $(call SetupHostCommand,xargs, \
Please install 'xargs' that supports '-r/--no-run-if-empty', \
gxargs -r --version, \
xargs -r --version))
$(eval $(call SetupHostCommand,patch,Please install GNU 'patch', \
gpatch --version 2>&1 | grep 'Free Software Foundation', \
patch --version 2>&1 | grep 'Free Software Foundation'))

View File

@ -0,0 +1,50 @@
#
# Copyright (C) 2020 coolsnowwolf@gmail.com
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=gmediarender
PKG_VERSION:=2020-01-10
PKG_RELEASE=$(PKG_SOURCE_VERSION)
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/hzeller/gmrender-resurrect.git
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
PKG_SOURCE_VERSION:=26d8f7edf5336bc30f7334c6ad459bf7f4f90ff2
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
PKG_FIXUP:=autoreconf
PKG_INSTALL=1
PKG_REMOVE_FILES:=autogen.sh aclocal.m4
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/nls.mk
define Package/gmediarender
SECTION:=multimedia
CATEGORY:=Multimedia
DEPENDS:= +gstreamer1 +libgstreamer1 +glib2 +libupnp
TITLE:=A Headless UPnP Renderer
endef
define Package/gmediarender/description
gmediarender implements the server component that provides UPnP
controllers a means to render media content (audio, video and images)
from a UPnP media server.
endef
CONFIGURE_ARGS+= \
CFLAGS="$(TARGET_CFLAGS) -std=gnu99" --with-build-cc="$(HOSTCC)" \
--prefix="\usr"
define Package/gmediarender/install
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/$(PKG_NAME) $(1)/usr/sbin/
endef
$(eval $(call BuildPackage,gmediarender))

View File

@ -1,11 +1,11 @@
config flow
option flow_offloading '0'
option flow_offloading '1'
option flow_offloading_hw '0'
option bbr '0'
option dns '0'
option dnscache_enable '1'
option dns_server '114.114.114.114,114.114.115.115,223.5.5.5,223.6.6.6,180.76.76.76,119.29.29.29,119.28.28.28,1.2.4.8,210.2.4.8'
option ipv6dns_server '2001:4860:4860::8888,2001:4860:4860::8844,2001:2001::1111,2001:2001::1001,2400:da00::6666,240C::6666,240C::6644'
option ipv6dns_server '240c::6666,240c::6644,2400:da00::6666,2001:da8::666'

View File

@ -1,10 +1,10 @@
config sfe
option enabled '0'
option enabled '1'
option ipv6 '0'
option wifi '0'
option bbr '0'
option dns '0'
option dnscache_enable '1'
option dns_server '114.114.114.114,114.114.115.115,223.5.5.5,223.6.6.6,180.76.76.76,119.29.29.29,119.28.28.28,1.2.4.8,210.2.4.8'
option ipv6dns_server '2001:4860:4860::8888,2001:4860:4860::8844,2001:2001::1111,2001:2001::1001,2400:da00::6666,240C::6666,240C::6644'
option ipv6dns_server '240c::6666,240c::6644,2400:da00::6666,2001:da8::666'

View File

@ -7,8 +7,8 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=npc
PKG_VERSION:=0.26.7
PKG_RELEASE:=2
PKG_VERSION:=0.26.8
PKG_RELEASE:=1
ifeq ($(ARCH),mipsel)
NPC_ARCH:=mipsle

View File

@ -9,13 +9,13 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=v2ray
PKG_VERSION:=4.24.2
PKG_VERSION:=4.25.1
PKG_RELEASE:=1
PKG_BUILD_DIR:=$(BUILD_DIR)/v2ray-core-$(PKG_VERSION)
PKG_SOURCE:=v2ray-core-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/v2fly/v2ray-core/tar.gz/v$(PKG_VERSION)?
PKG_HASH:=b58b4477020034b67a7649341fae65ea7bdc81851cad47ae7e4a591c0663e4c9
PKG_HASH:=e6fd18d556ea52eb154eb4857759a75be4d3d77053e4ba29f9d2820763a3ca52
PKG_LICENSE:=MIT
PKG_LICENSE_FILES:=LICENSE

View File

@ -27,15 +27,15 @@ define Package/libnetfilter-queue
SECTION:=libs
CATEGORY:=Libraries
DEPENDS:=+libmnl +libnfnetlink
TITLE:=API to the in-kernel connection tracking queue infrastructure
TITLE:=Userspace API to packets queued by kernel packet filter
URL:=http://www.netfilter.org/projects/libnetfilter_queue/
ABI_VERSION:=1
endef
define Package/libnetfilter-queue/description
libnetfilter_queue is a userspace library providing a programming
interface (API) to the in-kernel connection tracking state table.
This library is currently used by conntrack-tools.
interface (API) to packets that have been queued by the kernel
packet filter.
endef
TARGET_CFLAGS += $(FPIC) -D_GNU_SOURCE=1

View File

@ -8,12 +8,12 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=ipt2socks
PKG_VERSION:=1.1.2
PKG_VERSION:=1.1.3
PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/zfl9/ipt2socks.git
PKG_SOURCE_VERSION:=cfbc2189356aba7fcafb0bc961a95419f313d8a7
PKG_SOURCE_VERSION:=384dab4bae5ed9402e07ec1950e502c05812bc26
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION)
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)/$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION)

View File

@ -1,49 +0,0 @@
--- a/ipt2socks.c
+++ b/ipt2socks.c
@@ -28,6 +28,36 @@
#define IPT2SOCKS_VERSION "ipt2socks v1.1.2 <https://github.com/zfl9/ipt2socks>"
+#ifdef __MUSL__
+#include <unistd.h>
+#include <sys/syscall.h>
+
+ssize_t splice(int __fdin, __off64_t *__offin, int __fdout,
+ __off64_t *__offout, size_t __len, unsigned int __flags) {
+#ifdef __NR_splice
+ return syscall(__NR_splice, __fdin, __offin, __fdout, __offout, __len, __flags);
+#else
+ (void)__fdin;
+ (void)__offin;
+ (void)__fdout;
+ (void)__offout;
+ (void)__len;
+ (void)__flags;
+ errno = ENOSYS;
+ return -1;
+#endif
+}
+
+#undef SPLICE_F_MOVE
+#undef SPLICE_F_NONBLOCK
+#undef SPLICE_F_MORE
+
+#define SPLICE_F_MOVE 1
+#define SPLICE_F_NONBLOCK 2
+#define SPLICE_F_MORE 4
+
+#endif /* __MUSL__ */
+
enum {
OPT_ENABLE_TCP = 0x01 << 0, // enable tcp proxy
OPT_ENABLE_UDP = 0x01 << 1, // enable udp proxy
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,5 @@
CC = gcc
-CFLAGS = -std=c99 -Wall -Wextra -O2 -pthread
+CFLAGS = -std=c99 -Wall -Wextra -O2 -pthread -D __MUSL__
LIBS = -lm
SRCS = ipt2socks.c logutils.c lrucache.c netutils.c protocol.c
OBJS = $(SRCS:.c=.o)

View File

@ -8,14 +8,14 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=dropbear
PKG_VERSION:=2019.78
PKG_RELEASE:=5
PKG_VERSION:=2020.79
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
PKG_SOURCE_URL:= \
http://matt.ucc.asn.au/dropbear/releases/ \
https://dropbear.nl/mirror/releases/
PKG_HASH:=525965971272270995364a0eb01f35180d793182e63dd0b0c3eb0292291644a4
PKG_HASH:=084f00546b1610a3422a0773e2c04cbe1a220d984209e033b548b49f379cc441
PKG_LICENSE:=MIT
PKG_LICENSE_FILES:=LICENSE libtomcrypt/LICENSE libtommath/LICENSE
@ -124,8 +124,7 @@ define Build/Configure
# disable legacy/unsafe methods and unused functionality
for OPTION in INETD_MODE DROPBEAR_CLI_NETCAT \
DROPBEAR_3DES DROPBEAR_DSS DROPBEAR_ENABLE_CBC_MODE \
DROPBEAR_SHA1_96_HMAC DROPBEAR_USE_PASSWORD_ENV; do \
DROPBEAR_DSS DROPBEAR_USE_PASSWORD_ENV DO_MOTD ; do \
echo "#define $$$$OPTION 0" >> \
$(PKG_BUILD_DIR)/localoptions.h; \
done

View File

@ -1,119 +0,0 @@
From c153b3612b7c9f24a0f5af43618a646545ed6e22 Mon Sep 17 00:00:00 2001
From: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
Date: Mon, 30 Sep 2019 12:42:13 +0100
Subject: [PATCH] Improve address logging on early exit messages
Change 'Early exit' and 'Exit before auth' messages to include the IP
address & port as part of the message.
This allows log scanning utilities such as 'fail2ban' to obtain the
offending IP address as part of the failure event instead of extracting
the PID from the message and then scanning the log again for match
'child connection from' messages
Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
---
svr-auth.c | 18 +++++++-----------
svr-session.c | 20 ++++++++++++++------
2 files changed, 21 insertions(+), 17 deletions(-)
--- a/svr-auth.c
+++ b/svr-auth.c
@@ -241,8 +241,7 @@ static int checkusername(const char *use
}
if (strlen(username) != userlen) {
- dropbear_exit("Attempted username with a null byte from %s",
- svr_ses.addrstring);
+ dropbear_exit("Attempted username with a null byte");
}
if (ses.authstate.username == NULL) {
@@ -252,8 +251,7 @@ static int checkusername(const char *use
} else {
/* check username hasn't changed */
if (strcmp(username, ses.authstate.username) != 0) {
- dropbear_exit("Client trying multiple usernames from %s",
- svr_ses.addrstring);
+ dropbear_exit("Client trying multiple usernames");
}
}
@@ -268,8 +266,7 @@ static int checkusername(const char *use
if (!ses.authstate.pw_name) {
TRACE(("leave checkusername: user '%s' doesn't exist", username))
dropbear_log(LOG_WARNING,
- "Login attempt for nonexistent user from %s",
- svr_ses.addrstring);
+ "Login attempt for nonexistent user");
ses.authstate.checkusername_failed = 1;
return DROPBEAR_FAILURE;
}
@@ -279,9 +276,8 @@ static int checkusername(const char *use
if (!(DROPBEAR_SVR_MULTIUSER && uid == 0) && uid != ses.authstate.pw_uid) {
TRACE(("running as nonroot, only server uid is allowed"))
dropbear_log(LOG_WARNING,
- "Login attempt with wrong user %s from %s",
- ses.authstate.pw_name,
- svr_ses.addrstring);
+ "Login attempt with wrong user %s",
+ ses.authstate.pw_name);
ses.authstate.checkusername_failed = 1;
return DROPBEAR_FAILURE;
}
@@ -440,8 +436,8 @@ void send_msg_userauth_failure(int parti
} else {
userstr = ses.authstate.pw_name;
}
- dropbear_exit("Max auth tries reached - user '%s' from %s",
- userstr, svr_ses.addrstring);
+ dropbear_exit("Max auth tries reached - user '%s'",
+ userstr);
}
TRACE(("leave send_msg_userauth_failure"))
--- a/svr-session.c
+++ b/svr-session.c
@@ -149,28 +149,36 @@ void svr_session(int sock, int childpipe
void svr_dropbear_exit(int exitcode, const char* format, va_list param) {
char exitmsg[150];
char fullmsg[300];
+ char fromaddr[60];
int i;
/* Render the formatted exit message */
vsnprintf(exitmsg, sizeof(exitmsg), format, param);
+ /* svr_ses.addrstring may not be set for some early exits, or for
+ the listener process */
+ fromaddr[0] = '\0';
+ if (svr_ses.addrstring) {
+ snprintf(fromaddr, sizeof(fromaddr), " from <%s>", svr_ses.addrstring);
+ }
+
/* Add the prefix depending on session/auth state */
if (!ses.init_done) {
/* before session init */
- snprintf(fullmsg, sizeof(fullmsg), "Early exit: %s", exitmsg);
+ snprintf(fullmsg, sizeof(fullmsg), "Early exit%s: %s", fromaddr, exitmsg);
} else if (ses.authstate.authdone) {
/* user has authenticated */
snprintf(fullmsg, sizeof(fullmsg),
- "Exit (%s): %s",
- ses.authstate.pw_name, exitmsg);
+ "Exit (%s)%s: %s",
+ ses.authstate.pw_name, fromaddr, exitmsg);
} else if (ses.authstate.pw_name) {
/* we have a potential user */
snprintf(fullmsg, sizeof(fullmsg),
- "Exit before auth (user '%s', %u fails): %s",
- ses.authstate.pw_name, ses.authstate.failcount, exitmsg);
+ "Exit before auth%s: (user '%s', %u fails): %s",
+ fromaddr, ses.authstate.pw_name, ses.authstate.failcount, exitmsg);
} else {
/* before userauth */
- snprintf(fullmsg, sizeof(fullmsg), "Exit before auth: %s", exitmsg);
+ snprintf(fullmsg, sizeof(fullmsg), "Exit before auth%s: %s", fromaddr, exitmsg);
}
dropbear_log(LOG_INFO, "%s", fullmsg);

View File

@ -0,0 +1,17 @@
From: Matt Johnston <matt@ucc.asn.au>
Date: Thu, 18 Jun 2020 19:12:07 +0800
Subject: Disable toom and karatsuba for new libtommath
--- a/libtommath/tommath_class.h
+++ b/libtommath/tommath_class.h
@@ -1312,6 +1312,10 @@
#undef BN_MP_KARATSUBA_SQR_C
#undef BN_MP_TOOM_MUL_C
#undef BN_MP_TOOM_SQR_C
+#undef BN_S_MP_KARATSUBA_MUL_C
+#undef BN_S_MP_KARATSUBA_SQR_C
+#undef BN_S_MP_TOOM_MUL_C
+#undef BN_S_MP_TOOM_SQR_C
#include "dbmalloc.h"
#define MP_MALLOC m_malloc

View File

@ -1,693 +0,0 @@
From 3cdf9ec918b37c17e12b33e4c244944d1ee836ca Mon Sep 17 00:00:00 2001
From: Vladislav Grishenko <themiron@mail.ru>
Date: Mon, 6 Apr 2020 23:28:09 +0500
Subject: [PATCH] Add Chacha20-Poly1305 authenticated encryption
* Add general AEAD approach.
* Add chacha20-poly1305@openssh.com algo using LibTomCrypt chacha and
poly1305 routines.
Chacha20-Poly1305 is generally faster than AES256 on CPU w/o dedicated
AES instructions, having the same key size.
Compiling in will add ~5,5kB to binary size on x86-64.
---
Makefile.in | 2 +-
algo.h | 8 ++
chachapoly.c | 148 ++++++++++++++++++++
chachapoly.h | 44 ++++++
common-algo.c | 11 +-
common-kex.c | 44 ++++--
default_options.h | 6 +
libtomcrypt/src/headers/tomcrypt_dropbear.h | 4 +
packet.c | 145 +++++++++++++------
session.h | 4 +
sysoptions.h | 8 +-
11 files changed, 368 insertions(+), 56 deletions(-)
create mode 100644 chachapoly.c
create mode 100644 chachapoly.h
diff --git a/Makefile.in b/Makefile.in
index aaf7b3b..3437cb2 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -53,7 +53,7 @@ CLIOBJS=cli-main.o cli-auth.o cli-authpasswd.o cli-kex.o \
CLISVROBJS=common-session.o packet.o common-algo.o common-kex.o \
common-channel.o common-chansession.o termcodes.o loginrec.o \
tcp-accept.o listener.o process-packet.o dh_groups.o \
- common-runopts.o circbuffer.o list.o netio.o
+ common-runopts.o circbuffer.o list.o netio.o chachapoly.o
KEYOBJS=dropbearkey.o
diff --git a/algo.h b/algo.h
index b12fb94..efd0d73 100644
--- a/algo.h
+++ b/algo.h
@@ -72,6 +72,14 @@ struct dropbear_cipher_mode {
unsigned long len, void *cipher_state);
int (*decrypt)(const unsigned char *ct, unsigned char *pt,
unsigned long len, void *cipher_state);
+ int (*aead_crypt)(unsigned int seq,
+ const unsigned char *in, unsigned char *out,
+ unsigned long len, unsigned long taglen,
+ void *cipher_state, int direction);
+ int (*aead_getlength)(unsigned int seq,
+ const unsigned char *in, unsigned int *outlen,
+ unsigned long len, void *cipher_state);
+ const struct dropbear_hash *aead_mac;
};
struct dropbear_hash {
diff --git a/chachapoly.c b/chachapoly.c
new file mode 100644
index 0000000..8fb06c5
--- /dev/null
+++ b/chachapoly.c
@@ -0,0 +1,148 @@
+/*
+ * Dropbear SSH
+ *
+ * Copyright (c) 2002,2003 Matt Johnston
+ * Copyright (c) 2020 by Vladislav Grishenko
+ * All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE. */
+
+#include "includes.h"
+#include "algo.h"
+#include "dbutil.h"
+#include "chachapoly.h"
+
+#if DROPBEAR_CHACHA20POLY1305
+
+#define CHACHA20_KEY_LEN 32
+#define CHACHA20_BLOCKSIZE 8
+#define POLY1305_KEY_LEN 32
+#define POLY1305_TAG_LEN 16
+
+static const struct ltc_cipher_descriptor dummy = {.name = NULL};
+
+static const struct dropbear_hash dropbear_chachapoly_mac =
+ {NULL, POLY1305_KEY_LEN, POLY1305_TAG_LEN};
+
+const struct dropbear_cipher dropbear_chachapoly =
+ {&dummy, CHACHA20_KEY_LEN*2, CHACHA20_BLOCKSIZE};
+
+static int dropbear_chachapoly_start(int UNUSED(cipher), const unsigned char* UNUSED(IV),
+ const unsigned char *key, int keylen,
+ int UNUSED(num_rounds), dropbear_chachapoly_state *state) {
+ int err;
+
+ TRACE2(("enter dropbear_chachapoly_start"))
+
+ if (keylen != CHACHA20_KEY_LEN*2) {
+ return CRYPT_ERROR;
+ }
+
+ if ((err = chacha_setup(&state->chacha, key,
+ CHACHA20_KEY_LEN, 20)) != CRYPT_OK) {
+ return err;
+ }
+
+ if ((err = chacha_setup(&state->header, key + CHACHA20_KEY_LEN,
+ CHACHA20_KEY_LEN, 20) != CRYPT_OK)) {
+ return err;
+ }
+
+ TRACE2(("leave dropbear_chachapoly_start"))
+ return CRYPT_OK;
+}
+
+static int dropbear_chachapoly_crypt(unsigned int seq,
+ const unsigned char *in, unsigned char *out,
+ unsigned long len, unsigned long taglen,
+ dropbear_chachapoly_state *state, int direction) {
+ poly1305_state poly;
+ unsigned char seqbuf[8], key[POLY1305_KEY_LEN], tag[POLY1305_TAG_LEN];
+ int err;
+
+ TRACE2(("enter dropbear_chachapoly_crypt"))
+
+ if (len < 4 || taglen != POLY1305_TAG_LEN) {
+ return CRYPT_ERROR;
+ }
+
+ STORE64H((uint64_t)seq, seqbuf);
+ chacha_ivctr64(&state->chacha, seqbuf, sizeof(seqbuf), 0);
+ if ((err = chacha_keystream(&state->chacha, key, sizeof(key))) != CRYPT_OK) {
+ return err;
+ }
+
+ poly1305_init(&poly, key, sizeof(key));
+ if (direction == LTC_DECRYPT) {
+ poly1305_process(&poly, in, len);
+ poly1305_done(&poly, tag, &taglen);
+ if (constant_time_memcmp(in + len, tag, taglen) != 0) {
+ return CRYPT_ERROR;
+ }
+ }
+
+ chacha_ivctr64(&state->header, seqbuf, sizeof(seqbuf), 0);
+ if ((err = chacha_crypt(&state->header, in, 4, out)) != CRYPT_OK) {
+ return err;
+ }
+
+ chacha_ivctr64(&state->chacha, seqbuf, sizeof(seqbuf), 1);
+ if ((err = chacha_crypt(&state->chacha, in + 4, len - 4, out + 4)) != CRYPT_OK) {
+ return err;
+ }
+
+ if (direction == LTC_ENCRYPT) {
+ poly1305_process(&poly, out, len);
+ poly1305_done(&poly, out + len, &taglen);
+ }
+
+ TRACE2(("leave dropbear_chachapoly_crypt"))
+ return CRYPT_OK;
+}
+
+static int dropbear_chachapoly_getlength(unsigned int seq,
+ const unsigned char *in, unsigned int *outlen,
+ unsigned long len, dropbear_chachapoly_state *state) {
+ unsigned char seqbuf[8], buf[4];
+ int err;
+
+ TRACE2(("enter dropbear_chachapoly_getlength"))
+
+ if (len < sizeof(buf)) {
+ return CRYPT_ERROR;
+ }
+
+ STORE64H((uint64_t)seq, seqbuf);
+ chacha_ivctr64(&state->header, seqbuf, sizeof(seqbuf), 0);
+ if ((err = chacha_crypt(&state->header, in, sizeof(buf), buf)) != CRYPT_OK) {
+ return err;
+ }
+
+ LOAD32H(*outlen, buf);
+
+ TRACE2(("leave dropbear_chachapoly_getlength"))
+ return CRYPT_OK;
+}
+
+const struct dropbear_cipher_mode dropbear_mode_chachapoly =
+ {(void *)dropbear_chachapoly_start, NULL, NULL,
+ (void *)dropbear_chachapoly_crypt,
+ (void *)dropbear_chachapoly_getlength, &dropbear_chachapoly_mac};
+
+#endif /* DROPBEAR_CHACHA20POLY1305 */
diff --git a/chachapoly.h b/chachapoly.h
new file mode 100644
index 0000000..5a7c5b2
--- /dev/null
+++ b/chachapoly.h
@@ -0,0 +1,44 @@
+/*
+ * Dropbear SSH
+ *
+ * Copyright (c) 2002,2003 Matt Johnston
+ * Copyright (c) 2020 by Vladislav Grishenko
+ * All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE. */
+
+#ifndef DROPBEAR_DROPBEAR_CHACHAPOLY_H_
+#define DROPBEAR_DROPBEAR_CHACHAPOLY_H_
+
+#include "includes.h"
+#include "algo.h"
+
+#if DROPBEAR_CHACHA20POLY1305
+
+typedef struct {
+ chacha_state chacha;
+ chacha_state header;
+} dropbear_chachapoly_state;
+
+extern const struct dropbear_cipher dropbear_chachapoly;
+extern const struct dropbear_cipher_mode dropbear_mode_chachapoly;
+
+#endif /* DROPBEAR_CHACHA20POLY1305 */
+
+#endif /* DROPBEAR_DROPBEAR_CHACHAPOLY_H_ */
diff --git a/common-algo.c b/common-algo.c
index 558aad2..1436456 100644
--- a/common-algo.c
+++ b/common-algo.c
@@ -30,6 +30,7 @@
#include "dh_groups.h"
#include "ltc_prng.h"
#include "ecc.h"
+#include "chachapoly.h"
/* This file (algo.c) organises the ciphers which can be used, and is used to
* decide which ciphers/hashes/compression/signing to use during key exchange*/
@@ -86,11 +87,11 @@ const struct dropbear_cipher dropbear_nocipher =
* about the symmetric_CBC vs symmetric_CTR cipher_state pointer */
#if DROPBEAR_ENABLE_CBC_MODE
const struct dropbear_cipher_mode dropbear_mode_cbc =
- {(void*)cbc_start, (void*)cbc_encrypt, (void*)cbc_decrypt};
+ {(void*)cbc_start, (void*)cbc_encrypt, (void*)cbc_decrypt, NULL, NULL, NULL};
#endif /* DROPBEAR_ENABLE_CBC_MODE */
const struct dropbear_cipher_mode dropbear_mode_none =
- {void_start, void_cipher, void_cipher};
+ {void_start, void_cipher, void_cipher, NULL, NULL, NULL};
#if DROPBEAR_ENABLE_CTR_MODE
/* a wrapper to make ctr_start and cbc_start look the same */
@@ -101,7 +102,7 @@ static int dropbear_big_endian_ctr_start(int cipher,
return ctr_start(cipher, IV, key, keylen, num_rounds, CTR_COUNTER_BIG_ENDIAN, ctr);
}
const struct dropbear_cipher_mode dropbear_mode_ctr =
- {(void*)dropbear_big_endian_ctr_start, (void*)ctr_encrypt, (void*)ctr_decrypt};
+ {(void*)dropbear_big_endian_ctr_start, (void*)ctr_encrypt, (void*)ctr_decrypt, NULL, NULL, NULL};
#endif /* DROPBEAR_ENABLE_CTR_MODE */
/* Mapping of ssh hashes to libtomcrypt hashes, including keysize etc.
@@ -137,6 +138,10 @@ const struct dropbear_hash dropbear_nohash =
* that is also supported by the server will get used. */
algo_type sshciphers[] = {
+#if DROPBEAR_CHACHA20POLY1305
+ {"chacha20-poly1305@openssh.com", 0, &dropbear_chachapoly, 1, &dropbear_mode_chachapoly},
+#endif
+
#if DROPBEAR_ENABLE_CTR_MODE
#if DROPBEAR_AES128
{"aes128-ctr", 0, &dropbear_aes128, 1, &dropbear_mode_ctr},
diff --git a/common-kex.c b/common-kex.c
index 16b7e27..5e2923f 100644
--- a/common-kex.c
+++ b/common-kex.c
@@ -329,9 +329,12 @@ static void gen_new_keys() {
hashkeys(S2C_key, sizeof(S2C_key), &hs, 'D');
if (ses.newkeys->recv.algo_crypt->cipherdesc != NULL) {
- int recv_cipher = find_cipher(ses.newkeys->recv.algo_crypt->cipherdesc->name);
- if (recv_cipher < 0)
- dropbear_exit("Crypto error");
+ int recv_cipher = -1;
+ if (ses.newkeys->recv.algo_crypt->cipherdesc->name != NULL) {
+ recv_cipher = find_cipher(ses.newkeys->recv.algo_crypt->cipherdesc->name);
+ if (recv_cipher < 0)
+ dropbear_exit("Crypto error");
+ }
if (ses.newkeys->recv.crypt_mode->start(recv_cipher,
recv_IV, recv_key,
ses.newkeys->recv.algo_crypt->keysize, 0,
@@ -341,9 +344,12 @@ static void gen_new_keys() {
}
if (ses.newkeys->trans.algo_crypt->cipherdesc != NULL) {
- int trans_cipher = find_cipher(ses.newkeys->trans.algo_crypt->cipherdesc->name);
- if (trans_cipher < 0)
- dropbear_exit("Crypto error");
+ int trans_cipher = -1;
+ if (ses.newkeys->trans.algo_crypt->cipherdesc->name != NULL) {
+ trans_cipher = find_cipher(ses.newkeys->trans.algo_crypt->cipherdesc->name);
+ if (trans_cipher < 0)
+ dropbear_exit("Crypto error");
+ }
if (ses.newkeys->trans.crypt_mode->start(trans_cipher,
trans_IV, trans_key,
ses.newkeys->trans.algo_crypt->keysize, 0,
@@ -868,19 +874,29 @@ static void read_kex_algos() {
/* mac_algorithms_client_to_server */
c2s_hash_algo = buf_match_algo(ses.payload, sshhashes, NULL, NULL);
+#if DROPBEAR_AEAD_MODE
+ if (((struct dropbear_cipher_mode*)c2s_cipher_algo->mode)->aead_crypt != NULL) {
+ c2s_hash_algo = NULL;
+ } else
+#endif
if (c2s_hash_algo == NULL) {
erralgo = "mac c->s";
goto error;
}
- TRACE(("hash c2s is %s", c2s_hash_algo->name))
+ TRACE(("hash c2s is %s", c2s_hash_algo ? c2s_hash_algo->name : "<implicit>"))
/* mac_algorithms_server_to_client */
s2c_hash_algo = buf_match_algo(ses.payload, sshhashes, NULL, NULL);
+#if DROPBEAR_AEAD_MODE
+ if (((struct dropbear_cipher_mode*)s2c_cipher_algo->mode)->aead_crypt != NULL) {
+ s2c_hash_algo = NULL;
+ } else
+#endif
if (s2c_hash_algo == NULL) {
erralgo = "mac s->c";
goto error;
}
- TRACE(("hash s2c is %s", s2c_hash_algo->name))
+ TRACE(("hash s2c is %s", s2c_hash_algo ? s2c_hash_algo->name : "<implicit>"))
/* compression_algorithms_client_to_server */
c2s_comp_algo = buf_match_algo(ses.payload, ses.compress_algos, NULL, NULL);
@@ -925,8 +941,14 @@ static void read_kex_algos() {
ses.newkeys->trans.crypt_mode =
(struct dropbear_cipher_mode*)c2s_cipher_algo->mode;
ses.newkeys->recv.algo_mac =
+#if DROPBEAR_AEAD_MODE
+ s2c_hash_algo == NULL ? ses.newkeys->recv.crypt_mode->aead_mac :
+#endif
(struct dropbear_hash*)s2c_hash_algo->data;
ses.newkeys->trans.algo_mac =
+#if DROPBEAR_AEAD_MODE
+ c2s_hash_algo == NULL ? ses.newkeys->trans.crypt_mode->aead_mac :
+#endif
(struct dropbear_hash*)c2s_hash_algo->data;
ses.newkeys->recv.algo_comp = s2c_comp_algo->val;
ses.newkeys->trans.algo_comp = c2s_comp_algo->val;
@@ -941,8 +963,14 @@ static void read_kex_algos() {
ses.newkeys->trans.crypt_mode =
(struct dropbear_cipher_mode*)s2c_cipher_algo->mode;
ses.newkeys->recv.algo_mac =
+#if DROPBEAR_AEAD_MODE
+ c2s_hash_algo == NULL ? ses.newkeys->recv.crypt_mode->aead_mac :
+#endif
(struct dropbear_hash*)c2s_hash_algo->data;
ses.newkeys->trans.algo_mac =
+#if DROPBEAR_AEAD_MODE
+ s2c_hash_algo == NULL ? ses.newkeys->trans.crypt_mode->aead_mac :
+#endif
(struct dropbear_hash*)s2c_hash_algo->data;
ses.newkeys->recv.algo_comp = c2s_comp_algo->val;
ses.newkeys->trans.algo_comp = s2c_comp_algo->val;
diff --git a/default_options.h b/default_options.h
index bafbb07..1a2ab10 100644
--- a/default_options.h
+++ b/default_options.h
@@ -99,6 +99,12 @@ IMPORTANT: Some options will require "make clean" after changes */
* and forwards compatibility */
#define DROPBEAR_ENABLE_CTR_MODE 1
+/* Enable Chacha20-Poly1305 authenticated encryption mode. This is
+ * generally faster than AES256 on CPU w/o dedicated AES instructions,
+ * having the same key size.
+ * Compiling in will add ~5,5kB to binary size on x86-64 */
+#define DROPBEAR_CHACHA20POLY1305 1
+
/* Message integrity. sha2-256 is recommended as a default,
sha1 for compatibility */
#define DROPBEAR_SHA1_HMAC 1
diff --git a/libtomcrypt/src/headers/tomcrypt_dropbear.h b/libtomcrypt/src/headers/tomcrypt_dropbear.h
index b0ce45b..59960e5 100644
--- a/libtomcrypt/src/headers/tomcrypt_dropbear.h
+++ b/libtomcrypt/src/headers/tomcrypt_dropbear.h
@@ -35,6 +35,10 @@
#define LTC_CTR_MODE
#endif
+#if DROPBEAR_CHACHA20POLY1305
+#define LTC_CHACHA
+#define LTC_POLY1305
+#endif
#if DROPBEAR_SHA512
#define LTC_SHA512
diff --git a/packet.c b/packet.c
index 9fda0d6..0454726 100644
--- a/packet.c
+++ b/packet.c
@@ -215,7 +215,7 @@ static int read_packet_init() {
unsigned int maxlen;
int slen;
- unsigned int len;
+ unsigned int len, plen;
unsigned int blocksize;
unsigned int macsize;
@@ -254,21 +254,35 @@ static int read_packet_init() {
/* now we have the first block, need to get packet length, so we decrypt
* the first block (only need first 4 bytes) */
buf_setpos(ses.readbuf, 0);
- if (ses.keys->recv.crypt_mode->decrypt(buf_getptr(ses.readbuf, blocksize),
- buf_getwriteptr(ses.readbuf, blocksize),
- blocksize,
- &ses.keys->recv.cipher_state) != CRYPT_OK) {
- dropbear_exit("Error decrypting");
+#if DROPBEAR_AEAD_MODE
+ if (ses.keys->recv.crypt_mode->aead_crypt) {
+ if (ses.keys->recv.crypt_mode->aead_getlength(ses.recvseq,
+ buf_getptr(ses.readbuf, blocksize), &plen,
+ blocksize,
+ &ses.keys->recv.cipher_state) != CRYPT_OK) {
+ dropbear_exit("Error decrypting");
+ }
+ len = plen + 4 + macsize;
+ } else
+#endif
+ {
+ if (ses.keys->recv.crypt_mode->decrypt(buf_getptr(ses.readbuf, blocksize),
+ buf_getwriteptr(ses.readbuf, blocksize),
+ blocksize,
+ &ses.keys->recv.cipher_state) != CRYPT_OK) {
+ dropbear_exit("Error decrypting");
+ }
+ plen = buf_getint(ses.readbuf) + 4;
+ len = plen + macsize;
}
- len = buf_getint(ses.readbuf) + 4 + macsize;
TRACE2(("packet size is %u, block %u mac %u", len, blocksize, macsize))
/* check packet length */
if ((len > RECV_MAX_PACKET_LEN) ||
- (len < MIN_PACKET_LEN + macsize) ||
- ((len - macsize) % blocksize != 0)) {
+ (plen < blocksize) ||
+ (plen % blocksize != 0)) {
dropbear_exit("Integrity error (bad packet size %u)", len);
}
@@ -294,23 +308,42 @@ void decrypt_packet() {
ses.kexstate.datarecv += ses.readbuf->len;
- /* we've already decrypted the first blocksize in read_packet_init */
- buf_setpos(ses.readbuf, blocksize);
-
- /* decrypt it in-place */
- len = ses.readbuf->len - macsize - ses.readbuf->pos;
- if (ses.keys->recv.crypt_mode->decrypt(
- buf_getptr(ses.readbuf, len),
- buf_getwriteptr(ses.readbuf, len),
- len,
- &ses.keys->recv.cipher_state) != CRYPT_OK) {
- dropbear_exit("Error decrypting");
- }
- buf_incrpos(ses.readbuf, len);
+#if DROPBEAR_AEAD_MODE
+ if (ses.keys->recv.crypt_mode->aead_crypt) {
+ /* first blocksize is not decrypted yet */
+ buf_setpos(ses.readbuf, 0);
+
+ /* decrypt it in-place */
+ len = ses.readbuf->len - macsize - ses.readbuf->pos;
+ if (ses.keys->recv.crypt_mode->aead_crypt(ses.recvseq,
+ buf_getptr(ses.readbuf, len + macsize),
+ buf_getwriteptr(ses.readbuf, len),
+ len, macsize,
+ &ses.keys->recv.cipher_state, LTC_DECRYPT) != CRYPT_OK) {
+ dropbear_exit("Error decrypting");
+ }
+ buf_incrpos(ses.readbuf, len);
+ } else
+#endif
+ {
+ /* we've already decrypted the first blocksize in read_packet_init */
+ buf_setpos(ses.readbuf, blocksize);
+
+ /* decrypt it in-place */
+ len = ses.readbuf->len - macsize - ses.readbuf->pos;
+ if (ses.keys->recv.crypt_mode->decrypt(
+ buf_getptr(ses.readbuf, len),
+ buf_getwriteptr(ses.readbuf, len),
+ len,
+ &ses.keys->recv.cipher_state) != CRYPT_OK) {
+ dropbear_exit("Error decrypting");
+ }
+ buf_incrpos(ses.readbuf, len);
- /* check the hmac */
- if (checkmac() != DROPBEAR_SUCCESS) {
- dropbear_exit("Integrity error");
+ /* check the hmac */
+ if (checkmac() != DROPBEAR_SUCCESS) {
+ dropbear_exit("Integrity error");
+ }
}
/* get padding length */
@@ -557,9 +590,16 @@ void encrypt_packet() {
buf_setpos(ses.writepayload, 0);
buf_setlen(ses.writepayload, 0);
- /* length of padding - packet length must be a multiple of blocksize,
- * with a minimum of 4 bytes of padding */
- padlen = blocksize - (writebuf->len) % blocksize;
+ /* length of padding - packet length excluding the packetlength uint32
+ * field in aead mode must be a multiple of blocksize, with a minimum of
+ * 4 bytes of padding */
+ len = writebuf->len;
+#if DROPBEAR_AEAD_MODE
+ if (ses.keys->trans.crypt_mode->aead_crypt) {
+ len -= 4;
+ }
+#endif
+ padlen = blocksize - len % blocksize;
if (padlen < 4) {
padlen += blocksize;
}
@@ -579,23 +619,42 @@ void encrypt_packet() {
buf_incrlen(writebuf, padlen);
genrandom(buf_getptr(writebuf, padlen), padlen);
- make_mac(ses.transseq, &ses.keys->trans, writebuf, writebuf->len, mac_bytes);
+#if DROPBEAR_AEAD_MODE
+ if (ses.keys->trans.crypt_mode->aead_crypt) {
+ /* do the actual encryption, in-place */
+ buf_setpos(writebuf, 0);
+ /* encrypt it in-place*/
+ len = writebuf->len;
+ buf_incrlen(writebuf, mac_size);
+ if (ses.keys->trans.crypt_mode->aead_crypt(ses.transseq,
+ buf_getptr(writebuf, len),
+ buf_getwriteptr(writebuf, len + mac_size),
+ len, mac_size,
+ &ses.keys->trans.cipher_state, LTC_ENCRYPT) != CRYPT_OK) {
+ dropbear_exit("Error encrypting");
+ }
+ buf_incrpos(writebuf, len + mac_size);
+ } else
+#endif
+ {
+ make_mac(ses.transseq, &ses.keys->trans, writebuf, writebuf->len, mac_bytes);
+
+ /* do the actual encryption, in-place */
+ buf_setpos(writebuf, 0);
+ /* encrypt it in-place*/
+ len = writebuf->len;
+ if (ses.keys->trans.crypt_mode->encrypt(
+ buf_getptr(writebuf, len),
+ buf_getwriteptr(writebuf, len),
+ len,
+ &ses.keys->trans.cipher_state) != CRYPT_OK) {
+ dropbear_exit("Error encrypting");
+ }
+ buf_incrpos(writebuf, len);
- /* do the actual encryption, in-place */
- buf_setpos(writebuf, 0);
- /* encrypt it in-place*/
- len = writebuf->len;
- if (ses.keys->trans.crypt_mode->encrypt(
- buf_getptr(writebuf, len),
- buf_getwriteptr(writebuf, len),
- len,
- &ses.keys->trans.cipher_state) != CRYPT_OK) {
- dropbear_exit("Error encrypting");
+ /* stick the MAC on it */
+ buf_putbytes(writebuf, mac_bytes, mac_size);
}
- buf_incrpos(writebuf, len);
-
- /* stick the MAC on it */
- buf_putbytes(writebuf, mac_bytes, mac_size);
/* Update counts */
ses.kexstate.datatrans += writebuf->len;
diff --git a/session.h b/session.h
index e436882..a8f8914 100644
--- a/session.h
+++ b/session.h
@@ -41,6 +41,7 @@
#include "chansession.h"
#include "dbutil.h"
#include "netio.h"
+#include "chachapoly.h"
void common_session_init(int sock_in, int sock_out);
void session_loop(void(*loophandler)(void)) ATTRIB_NORETURN;
@@ -80,6 +81,9 @@ struct key_context_directional {
symmetric_CBC cbc;
#if DROPBEAR_ENABLE_CTR_MODE
symmetric_CTR ctr;
+#endif
+#if DROPBEAR_CHACHA20POLY1305
+ dropbear_chachapoly_state chachapoly;
#endif
} cipher_state;
unsigned char mackey[MAX_MAC_LEN];
diff --git a/sysoptions.h b/sysoptions.h
index 2c27caf..2432779 100644
--- a/sysoptions.h
+++ b/sysoptions.h
@@ -92,7 +92,11 @@
#define MD5_HASH_SIZE 16
#define MAX_HASH_SIZE 64 /* sha512 */
+#if DROPBEAR_CHACHA20POLY1305
+#define MAX_KEY_LEN 64 /* 2 x 256 bits for chacha20 */
+#else
#define MAX_KEY_LEN 32 /* 256 bits for aes256 etc */
+#endif
#define MAX_IV_LEN 20 /* must be same as max blocksize, */
#if DROPBEAR_SHA2_512_HMAC
@@ -207,6 +211,8 @@ If you test it please contact the Dropbear author */
#define DROPBEAR_TWOFISH ((DROPBEAR_TWOFISH256) || (DROPBEAR_TWOFISH128))
+#define DROPBEAR_AEAD_MODE ((DROPBEAR_CHACHA20POLY1305))
+
#define DROPBEAR_CLI_ANYTCPFWD ((DROPBEAR_CLI_REMOTETCPFWD) || (DROPBEAR_CLI_LOCALTCPFWD))
#define DROPBEAR_TCP_ACCEPT ((DROPBEAR_CLI_LOCALTCPFWD) || (DROPBEAR_SVR_REMOTETCPFWD))
@@ -249,7 +255,7 @@ If you test it please contact the Dropbear author */
#endif
#if !(DROPBEAR_AES128 || DROPBEAR_3DES || DROPBEAR_AES256 || DROPBEAR_BLOWFISH \
- || DROPBEAR_TWOFISH256 || DROPBEAR_TWOFISH128)
+ || DROPBEAR_TWOFISH256 || DROPBEAR_TWOFISH128 || DROPBEAR_CHACHA20POLY1305)
#error "At least one encryption algorithm must be enabled. AES128 is recommended."
#endif
--
2.17.1

View File

@ -1,6 +1,6 @@
--- a/svr-authpubkey.c
+++ b/svr-authpubkey.c
@@ -338,14 +338,19 @@ static int checkpubkey(const char* algo,
@@ -386,14 +386,19 @@ static int checkpubkey(const char* keyal
goto out;
}
@ -28,7 +28,7 @@
#if DROPBEAR_SVR_MULTIUSER
/* open the file as the authenticating user. */
@@ -426,27 +431,36 @@ static int checkpubkeyperms() {
@@ -474,27 +479,36 @@ static int checkpubkeyperms() {
goto out;
}

View File

@ -1,6 +1,6 @@
--- a/svr-chansession.c
+++ b/svr-chansession.c
@@ -953,12 +953,12 @@ static void execchild(const void *user_d
@@ -950,12 +950,12 @@ static void execchild(const void *user_d
/* We can only change uid/gid as root ... */
if (getuid() == 0) {

View File

@ -1,11 +1,11 @@
--- a/Makefile.in
+++ b/Makefile.in
@@ -189,17 +189,17 @@ dropbearkey: $(dropbearkeyobjs)
@@ -199,17 +199,17 @@ dropbearkey: $(dropbearkeyobjs)
dropbearconvert: $(dropbearconvertobjs)
dropbear: $(HEADERS) $(LIBTOM_DEPS) Makefile
- $(CC) $(LDFLAGS) -o $@$(EXEEXT) $($@objs) $(LIBTOM_LIBS) $(LIBS) @CRYPTLIB@
+ +$(CC) $(LDFLAGS) -o $@$(EXEEXT) $($@objs) $(LIBTOM_LIBS) $(LIBS) @CRYPTLIB@
- $(CC) $(LDFLAGS) -o $@$(EXEEXT) $($@objs) $(LIBTOM_LIBS) $(LIBS) @CRYPTLIB@ $(PLUGIN_LIBS)
+ +$(CC) $(LDFLAGS) -o $@$(EXEEXT) $($@objs) $(LIBTOM_LIBS) $(LIBS) @CRYPTLIB@ $(PLUGIN_LIBS)
dbclient: $(HEADERS) $(LIBTOM_DEPS) Makefile
- $(CC) $(LDFLAGS) -o $@$(EXEEXT) $($@objs) $(LIBTOM_LIBS) $(LIBS)
@ -22,7 +22,7 @@
# multi-binary compilation.
@@ -210,7 +210,7 @@ ifeq ($(MULTI),1)
@@ -220,7 +220,7 @@ ifeq ($(MULTI),1)
endif
dropbearmulti$(EXEEXT): $(HEADERS) $(MULTIOBJS) $(LIBTOM_DEPS) Makefile

View File

@ -1,6 +1,6 @@
--- a/libtomcrypt/makefile_include.mk
+++ b/libtomcrypt/makefile_include.mk
@@ -75,6 +75,13 @@ endif
@@ -94,6 +94,13 @@ endif
LTC_CFLAGS += -Wno-type-limits
@ -14,7 +14,7 @@
ifdef LTC_DEBUG
$(info Debug build)
# compile for DEBUGGING (required for ccmalloc checking!!!)
@@ -102,6 +109,9 @@ endif
@@ -121,6 +128,9 @@ endif
endif # COMPILE_SMALL
endif # COMPILE_DEBUG
@ -26,8 +26,8 @@
LTC_CFLAGS += -Wno-typedef-redefinition -Wno-tautological-compare -Wno-builtin-requires-header -Wno-missing-field-initializers
--- a/libtommath/makefile_include.mk
+++ b/libtommath/makefile_include.mk
@@ -37,6 +37,9 @@ CFLAGS += -Wsystem-headers -Wdeclaration
CFLAGS += -Wstrict-prototypes -Wpointer-arith
@@ -70,6 +70,9 @@ else
LTM_CFLAGS += -Wsystem-headers
endif
+ifndef OPENWRT_BUILD
@ -35,14 +35,14 @@
+
ifdef COMPILE_DEBUG
#debug
CFLAGS += -g3
@@ -58,6 +61,9 @@ endif
LTM_CFLAGS += -g3
@@ -90,6 +93,9 @@ endif
endif # COMPILE_SIZE
endif # COMPILE_DEBUG
+ ### ! OPENWRT_BUILD
+endif
+
ifneq ($(findstring clang,$(CC)),)
CFLAGS += -Wno-typedef-redefinition -Wno-tautological-compare -Wno-builtin-requires-header
LTM_CFLAGS += -Wno-typedef-redefinition -Wno-tautological-compare -Wno-builtin-requires-header
endif

View File

@ -11,12 +11,12 @@ include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=wireguard
PKG_VERSION:=1.0.20200611
PKG_VERSION:=1.0.20200623
PKG_RELEASE:=1
PKG_SOURCE:=wireguard-linux-compat-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=https://git.zx2c4.com/wireguard-linux-compat/snapshot/
PKG_HASH:=9b0478c3b1f3a7b488916e632e2fcbb1383bb1a2ef294489858ce2ba1da3246d
PKG_HASH:=130937724515799edf05ff8216bc837df8acda879428f3a7f96a3287758f9445
PKG_LICENSE:=GPL-2.0
PKG_LICENSE_FILES:=COPYING

View File

@ -493,7 +493,7 @@ define Device/gl-ar300m
DEVICE_PACKAGES := kmod-usb-core kmod-usb2
BOARDNAME := GL-AR300M
IMAGE_SIZE := 16000k
MTDPARTS := spi0.0:256k(u-boot)ro,64k(u-boot-env),16000k(firmware),64k(art)ro
MTDPARTS := spi0.0:256k(u-boot),64k(u-boot-env),16000k(firmware),64k(art)ro
endef
TARGET_DEVICES += gl-ar300m
@ -539,7 +539,7 @@ define Device/gl-mifi
BOARDNAME := GL-MIFI
IMAGE_SIZE := 16000k
CONSOLE := ttyATH0,115200
MTDPARTS := spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,16000k(firmware),64k(art)ro
MTDPARTS := spi0.0:256k(u-boot),64k(u-boot-env)ro,16000k(firmware),64k(art)ro
endef
TARGET_DEVICES += gl-mifi

View File

@ -4,10 +4,6 @@ set_rpi_info() {
case "$(board_name)" in
raspberrypi,4-model-b)
sed -i 's/VHT80/VHT40/g' /lib/wifi/mac80211.sh
sed -i 's|pcdata(boardinfo.system or "?")|pcdata(boardinfo.system or "ARMv8 Processor")|g' /usr/lib/lua/luci/view/admin_status/index.htm
;;
*)
sed -i 's|pcdata(boardinfo.system or "?")|pcdata(boardinfo.system or "ARMv8 Processor")|g' /usr/lib/lua/luci/view/admin_status/index.htm
;;
esac
}

View File

@ -76,7 +76,7 @@ Subject: [PATCH] arm: partially revert
--- a/arch/arm/mm/proc-macros.S
+++ b/arch/arm/mm/proc-macros.S
@@ -335,6 +335,8 @@ ENTRY(\name\()_cache_fns)
@@ -336,6 +336,8 @@ ENTRY(\name\()_cache_fns)
.long \name\()_flush_kern_dcache_area
.long \name\()_dma_map_area
.long \name\()_dma_unmap_area

View File

@ -14,7 +14,7 @@ Signed-off-by: Eric Anholt <eric@anholt.net>
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -8008,8 +8008,6 @@ int alloc_contig_range(unsigned long sta
@@ -8003,8 +8003,6 @@ int alloc_contig_range(unsigned long sta
/* Make sure the range is really isolated. */
if (test_pages_isolated(outer_start, end, false)) {

View File

@ -18,7 +18,7 @@ Signed-off-by: Phil Elwell <phil@raspberrypi.org>
--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
+++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
@@ -2150,7 +2150,7 @@ static void bcmgenet_init_tx_ring(struct
@@ -2153,7 +2153,7 @@ static void bcmgenet_init_tx_ring(struct
bcmgenet_tdma_ring_writel(priv, index, 0, TDMA_PROD_INDEX);
bcmgenet_tdma_ring_writel(priv, index, 0, TDMA_CONS_INDEX);
@ -27,7 +27,7 @@ Signed-off-by: Phil Elwell <phil@raspberrypi.org>
/* Disable rate control for now */
bcmgenet_tdma_ring_writel(priv, index, flow_period_val,
TDMA_FLOW_PERIOD);
@@ -3580,9 +3580,12 @@ static int bcmgenet_probe(struct platfor
@@ -3584,9 +3584,12 @@ static int bcmgenet_probe(struct platfor
netif_set_real_num_rx_queues(priv->dev, priv->hw_params->rx_queues + 1);
/* Set default coalescing parameters */

View File

@ -27,9 +27,9 @@ Signed-off-by: Phil Elwell <phil@raspberrypi.org>
--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
+++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
@@ -72,6 +72,10 @@
#define GENET_RDMA_REG_OFF (priv->hw_params->rdma_offset + \
TOTAL_DESC * DMA_DESC_SIZE)
@@ -75,6 +75,10 @@
/* Forward declarations */
static void bcmgenet_set_rx_mode(struct net_device *dev);
+static bool skip_umac_reset = true;
+module_param(skip_umac_reset, bool, 0444);
@ -38,7 +38,7 @@ Signed-off-by: Phil Elwell <phil@raspberrypi.org>
static inline void bcmgenet_writel(u32 value, void __iomem *offset)
{
/* MIPS chips strapped for BE will automagically configure the
@@ -1996,6 +2000,11 @@ static void reset_umac(struct bcmgenet_p
@@ -1999,6 +2003,11 @@ static void reset_umac(struct bcmgenet_p
bcmgenet_rbuf_ctrl_set(priv, 0);
udelay(10);

View File

@ -1,6 +1,6 @@
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -2634,7 +2634,8 @@ static void pcie_write_mrrs(struct pci_d
@@ -2654,7 +2654,8 @@ static void pcie_write_mrrs(struct pci_d
* In the "safe" case, do not configure the MRRS. There appear to be
* issues with setting MRRS to 0 on a number of devices.
*/

View File

@ -15,7 +15,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
--- a/Makefile
+++ b/Makefile
@@ -1237,7 +1237,6 @@ all: modules
@@ -1240,7 +1240,6 @@ endif
PHONY += modules
modules: $(vmlinux-dirs) $(if $(KBUILD_BUILTIN),vmlinux) modules.builtin
@ -23,7 +23,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
@$(kecho) ' Building modules, stage 2.';
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
@@ -1266,7 +1265,6 @@ _modinst_:
@@ -1269,7 +1268,6 @@ _modinst_:
rm -f $(MODLIB)/build ; \
ln -s $(CURDIR) $(MODLIB)/build ; \
fi

View File

@ -33,7 +33,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
# Read KERNELRELEASE from include/config/kernel.release (if it exists)
KERNELRELEASE = $(shell cat include/config/kernel.release 2> /dev/null)
KERNELVERSION = $(VERSION)$(if $(PATCHLEVEL),.$(PATCHLEVEL)$(if $(SUBLEVEL),.$(SUBLEVEL)))$(EXTRAVERSION)
@@ -776,11 +781,6 @@ ifdef CONFIG_DEBUG_SECTION_MISMATCH
@@ -772,11 +777,6 @@ ifdef CONFIG_DEBUG_SECTION_MISMATCH
KBUILD_CFLAGS += $(call cc-option, -fno-inline-functions-called-once)
endif

View File

@ -71,7 +71,7 @@ Signed-off-by: Tobias Wolf <dev-NTEO@vplace.de>
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -6401,7 +6401,7 @@ static void __ref alloc_node_mem_map(str
@@ -6396,7 +6396,7 @@ static void __ref alloc_node_mem_map(str
mem_map = NODE_DATA(0)->node_mem_map;
#if defined(CONFIG_HAVE_MEMBLOCK_NODE_MAP) || defined(CONFIG_FLATMEM)
if (page_to_pfn(mem_map) != pgdat->node_start_pfn)

View File

@ -14,7 +14,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
--- a/Makefile
+++ b/Makefile
@@ -657,9 +657,9 @@ KBUILD_CFLAGS += $(call cc-disable-warni
@@ -653,9 +653,9 @@ KBUILD_CFLAGS += $(call cc-disable-warni
KBUILD_CFLAGS += $(call cc-disable-warning, address-of-packed-member)
ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE

View File

@ -47,7 +47,7 @@ v2: incorporated changes suggested by Jonas Gorski
select OF
--- a/arch/mips/Makefile
+++ b/arch/mips/Makefile
@@ -323,7 +323,7 @@ OBJCOPYFLAGS += --remove-section=.regin
@@ -334,7 +334,7 @@ OBJCOPYFLAGS += --remove-section=.regin
head-y := arch/mips/kernel/head.o
libs-y += arch/mips/lib/

View File

@ -1,6 +1,6 @@
--- a/drivers/mmc/host/sdhci-msm.c
+++ b/drivers/mmc/host/sdhci-msm.c
@@ -1688,7 +1688,7 @@ MODULE_DEVICE_TABLE(of, sdhci_msm_dt_mat
@@ -1694,7 +1694,7 @@ MODULE_DEVICE_TABLE(of, sdhci_msm_dt_mat
static const struct sdhci_ops sdhci_msm_ops = {
.reset = sdhci_reset,

View File

@ -22,7 +22,7 @@ Signed-off-by: Sven Eckelmann <sven@narfation.org>
--- a/drivers/net/ethernet/qualcomm/essedma/edma_axi.c
+++ b/drivers/net/ethernet/qualcomm/essedma/edma_axi.c
@@ -972,17 +972,14 @@ static int edma_axi_probe(struct platfor
@@ -975,17 +975,14 @@ static int edma_axi_probe(struct platfor
edma_netdev[i]->features = NETIF_F_HW_CSUM | NETIF_F_RXCSUM
| NETIF_F_HW_VLAN_CTAG_TX
| NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_SG |

View File

@ -5505,7 +5505,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
unsigned long type);
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -1065,6 +1065,12 @@
@@ -1076,6 +1076,12 @@
#define PCI_DEVICE_ID_SGI_LITHIUM 0x1002
#define PCI_DEVICE_ID_SGI_IOC4 0x100a

View File

@ -28,7 +28,7 @@
#include <linux/of_address.h>
#include <linux/of_pci.h>
#include <linux/of_platform.h>
@@ -162,6 +163,7 @@ struct mtk_pcie_soc {
@@ -167,6 +168,7 @@ struct mtk_pcie_soc {
* @phy: pointer to PHY control block
* @lane: lane count
* @slot: port slot
@ -36,7 +36,7 @@
* @irq_domain: legacy INTx IRQ domain
* @inner_domain: inner IRQ domain
* @msi_domain: MSI IRQ domain
@@ -182,6 +184,7 @@ struct mtk_pcie_port {
@@ -187,6 +189,7 @@ struct mtk_pcie_port {
struct phy *phy;
u32 lane;
u32 slot;
@ -44,7 +44,7 @@
struct irq_domain *irq_domain;
struct irq_domain *inner_domain;
struct irq_domain *msi_domain;
@@ -225,10 +228,8 @@ static void mtk_pcie_subsys_powerdown(st
@@ -230,10 +233,8 @@ static void mtk_pcie_subsys_powerdown(st
clk_disable_unprepare(pcie->free_ck);
@ -57,7 +57,7 @@
}
static void mtk_pcie_port_free(struct mtk_pcie_port *port)
@@ -532,6 +533,27 @@ static void mtk_pcie_enable_msi(struct m
@@ -537,6 +538,27 @@ static void mtk_pcie_enable_msi(struct m
writel(val, port->base + PCIE_INT_MASK);
}
@ -85,7 +85,7 @@
static int mtk_pcie_intx_map(struct irq_domain *domain, unsigned int irq,
irq_hw_number_t hwirq)
{
@@ -561,6 +583,7 @@ static int mtk_pcie_init_irq_domain(stru
@@ -566,6 +588,7 @@ static int mtk_pcie_init_irq_domain(stru
port->irq_domain = irq_domain_add_linear(pcie_intc_node, PCI_NUM_INTX,
&intx_domain_ops, port);
@ -93,7 +93,7 @@
if (!port->irq_domain) {
dev_err(dev, "failed to get INTx IRQ domain\n");
return -ENODEV;
@@ -622,7 +645,7 @@ static int mtk_pcie_setup_irq(struct mtk
@@ -627,7 +650,7 @@ static int mtk_pcie_setup_irq(struct mtk
struct mtk_pcie *pcie = port->pcie;
struct device *dev = pcie->dev;
struct platform_device *pdev = to_platform_device(dev);
@ -102,7 +102,7 @@
err = mtk_pcie_init_irq_domain(port, node);
if (err) {
@@ -630,8 +653,9 @@ static int mtk_pcie_setup_irq(struct mtk
@@ -635,8 +658,9 @@ static int mtk_pcie_setup_irq(struct mtk
return err;
}
@ -114,7 +114,7 @@
return 0;
}
@@ -904,49 +928,29 @@ static int mtk_pcie_parse_port(struct mt
@@ -912,49 +936,29 @@ static int mtk_pcie_parse_port(struct mt
/* sys_ck might be divided into the following parts in some chips */
snprintf(name, sizeof(name), "ahb_ck%d", slot);
@ -179,7 +179,7 @@
snprintf(name, sizeof(name), "pcie-rst%d", slot);
port->reset = devm_reset_control_get_optional_exclusive(dev, name);
@@ -999,10 +1003,8 @@ static int mtk_pcie_subsys_powerup(struc
@@ -1007,10 +1011,8 @@ static int mtk_pcie_subsys_powerup(struc
pcie->free_ck = NULL;
}
@ -192,7 +192,7 @@
/* enable top level clock */
err = clk_prepare_enable(pcie->free_ck);
@@ -1014,10 +1016,8 @@ static int mtk_pcie_subsys_powerup(struc
@@ -1022,10 +1024,8 @@ static int mtk_pcie_subsys_powerup(struc
return 0;
err_free_ck:
@ -205,7 +205,7 @@
return err;
}
@@ -1122,36 +1122,6 @@ static int mtk_pcie_request_resources(st
@@ -1130,36 +1130,6 @@ static int mtk_pcie_request_resources(st
return err;
err = devm_pci_remap_iospace(dev, &pcie->pio, pcie->io.start);
@ -242,7 +242,7 @@
return 0;
}
@@ -1182,7 +1152,14 @@ static int mtk_pcie_probe(struct platfor
@@ -1190,7 +1160,14 @@ static int mtk_pcie_probe(struct platfor
if (err)
goto put_resources;
@ -258,7 +258,7 @@
if (err)
goto put_resources;
@@ -1195,6 +1172,80 @@ put_resources:
@@ -1203,6 +1180,80 @@ put_resources:
return err;
}
@ -339,7 +339,7 @@
static const struct mtk_pcie_soc mtk_pcie_soc_v1 = {
.ops = &mtk_pcie_ops,
.startup = mtk_pcie_startup_port,
@@ -1223,10 +1274,13 @@ static const struct of_device_id mtk_pci
@@ -1241,10 +1292,13 @@ static const struct of_device_id mtk_pci
static struct platform_driver mtk_pcie_driver = {
.probe = mtk_pcie_probe,

View File

@ -19,10 +19,10 @@ KERNELNAME:=bzImage
include $(INCLUDE_DIR)/target.mk
DEFAULT_PACKAGES += partx-utils mkf2fs fdisk e2fsprogs wpad kmod-usb-hid \
kmod-ath5k kmod-ath9k kmod-ath9k-htc kmod-ath10k kmod-rt2800-usb kmod-e1000e kmod-igb kmod-igbvf kmod-ixgbe kmod-pcnet32 kmod-tulip kmod-vmxnet3 kmod-i40e kmod-i40evf kmod-r8125 kmod-8139cp kmod-8139too kmod-fs-f2fs \
htop lm-sensors autocore-x86 automount autosamba luci-app-ipsec-vpnd luci-proto-bonding luci-app-unblockmusic luci-app-zerotier luci-app-xlnetacc ddns-scripts_aliyun ddns-scripts_dnspod ca-certificates \
luci-app-airplay2 luci-app-music-remote-center luci-app-qbittorrent luci-app-amule luci-app-openvpn-server \
DEFAULT_PACKAGES += partx-utils mkf2fs fdisk e2fsprogs wpad kmod-usb-hid kmod-ath5k kmod-ath9k kmod-ath9k-htc kmod-ath10k \
kmod-rt2800-usb kmod-e1000e kmod-igb kmod-igbvf kmod-ixgbe kmod-pcnet32 kmod-tulip kmod-vmxnet3 kmod-i40e kmod-i40evf kmod-r8125 kmod-r8168 kmod-8139cp kmod-8139too kmod-fs-f2fs \
htop lm-sensors autocore-x86 automount autosamba luci-app-ipsec-vpnd luci-proto-bonding luci-app-xlnetacc luci-app-zerotier ca-certificates ddns-scripts_aliyun ddns-scripts_dnspod \
luci-app-airplay2 luci-app-music-remote-center luci-app-qbittorrent luci-app-amule luci-app-openvpn-server luci-app-unblockmusic \
ath10k-firmware-qca988x ath10k-firmware-qca9888 ath10k-firmware-qca9984 brcmfmac-firmware-43602a1-pcie \
kmod-sound-hda-core kmod-sound-hda-codec-realtek kmod-sound-hda-codec-via kmod-sound-via82xx kmod-sound-hda-intel kmod-sound-hda-codec-hdmi kmod-sound-i8x0 kmod-usb-audio \
kmod-usb-net kmod-usb-net-asix kmod-usb-net-asix-ax88179 kmod-usb-net-rtl8150 kmod-usb-net-rtl8152

View File

@ -1,6 +1,6 @@
--- a/arch/x86/kernel/reboot.c
+++ b/arch/x86/kernel/reboot.c
@@ -469,6 +469,16 @@ static const struct dmi_system_id reboot
@@ -477,6 +477,16 @@ static const struct dmi_system_id reboot
},
},

View File

@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=squashfskit4
PKG_VERSION:=4.14
PKG_RELEASE:=2
PKG_SOURCE:=squashfskit-v$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=https://github.com/squashfskit/squashfskit/releases/download/v$(PKG_VERSION)/
PKG_HASH:=5761aaa3aedc4f7112b708367d891c9abdc1ffea972e3fe47923ddba23984d95

View File

@ -0,0 +1,43 @@
From fe2f5da4b0f8994169c53e84b7cb8a0feefc97b5 Mon Sep 17 00:00:00 2001
From: Sergei Trofimovich <slyfox@gentoo.org>
Date: Sun, 26 Jan 2020 18:35:13 +0000
Subject: [PATCH] squashfs-tools: fix build failure against gcc-10
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
On gcc-10 (and gcc-9 -fno-common) build fails as:
```
cc ... -o mksquashfs
ld: read_fs.o:(.bss+0x0):
multiple definition of `fwriter_buffer'; mksquashfs.o:(.bss+0x400c90): first defined here
ld: read_fs.o:(.bss+0x8):
multiple definition of `bwriter_buffer'; mksquashfs.o:(.bss+0x400c98): first defined here
```
gcc-10 will change the default from -fcommon to fno-common:
https://gcc.gnu.org/PR85678.
The error also happens if CFLAGS=-fno-common passed explicitly.
Reported-by: Toralf Förster
Bug: https://bugs.gentoo.org/706456
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
---
squashfs-tools/mksquashfs.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/squashfs-tools/mksquashfs.h b/squashfs-tools/mksquashfs.h
index 1beefef7..b6503063 100644
--- a/squashfs-tools/mksquashfs.h
+++ b/squashfs-tools/mksquashfs.h
@@ -143,7 +143,7 @@ struct append_file {
#endif
extern struct cache *reader_buffer, *fragment_buffer, *reserve_cache;
-struct cache *bwriter_buffer, *fwriter_buffer;
+extern struct cache *bwriter_buffer, *fwriter_buffer;
extern struct queue *to_reader, *to_deflate, *to_writer, *from_writer,
*to_frag, *locked_fragment, *to_process_frag;
extern struct append_file **file_mapping;