Merge Mainline

This commit is contained in:
CN_SZTL 2020-04-19 19:58:30 +08:00
commit 8b41b12f5b
No known key found for this signature in database
GPG Key ID: 6850B6345C862176
34 changed files with 899 additions and 122 deletions

View File

@ -9,9 +9,9 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-unblockneteasemusic-mini
PKG_VERSION:=1.2
PKG_RELEASE:=7
LUCI_TITLE:=LuCI support for UnblockNeteaseMusic (Mini)
LUCI_DEPENDS:=+dnsmasq-full +ipset +iptables +wget
PKG_RELEASE:=8
LUCI_TITLE:=LuCI support for UnblockNeteaseMusic(-Go)
LUCI_DEPENDS:=+busybox +dnsmasq-full +ipset +iptables +wget
LUCI_PKGARCH:=all
PKG_MAINTAINER:=[CTCGFW]Project-OpenWrt

View File

@ -19,7 +19,6 @@ select_server = s:option(ListValue, "select_server", translate("服务器位置"
select_server:value("tencent_shanghai_nodejs", translate("[CTCGFW] 腾讯云上海(高音质)"))
select_server:value("aliyun_beijing_nodejs", translate("[hyird] 阿里云北京(高音质)"))
select_server:value("aliyun_beijing_nodejs_2", translate("[Sunsky] 阿里云北京(高音质)"))
select_server:value("mobile_henan_nodejs",translate("[CTCGFW] 移动河南(无损音质)"))
select_server.description = translate("请合理使用本插件与各个服务器,请勿滥用")
select_server.default = "tencent_shanghai_nodejs"
select_server.rmempty = false

View File

@ -22,11 +22,6 @@ elif [ "${select_server}" = "aliyun_beijing_nodejs_2" ]; then
unblock_server_ip="39.96.56.58"
unblock_server_http_port="30000"
unblock_server_https_port="30001"
elif [ "${select_server}" = "mobile_henan_nodejs" ]; then
unblock_server_ip="$(ping "cdn-henan.service.project-openwrt.eu.org" -c 1 | sed '1{s/[^(]*(//;s/).*//;q}')"
[ -z "${unblock_server_ip}" ] && exit 1
unblock_server_http_port="33221"
unblock_server_https_port="33222"
fi
set_ipset(){

View File

@ -49,6 +49,7 @@ define Package/binutils
CATEGORY:=Development
TITLE:=binutils
DEPENDS:=+objdump +ar
ALTERNATIVES:=200:/usr/bin/strings:/usr/bin/binutils-strings
endef
define Package/objdump
@ -114,7 +115,7 @@ endef
define Package/binutils/install
$(INSTALL_DIR) $(1)/usr $(1)/bin
$(CP) $(PKG_INSTALL_DIR)/usr/bin/ $(1)/usr/
mv $(1)/usr/bin/strings $(1)/bin/strings
mv $(1)/usr/bin/strings $(1)/usr/bin/binutils-strings
rm -f $(1)/usr/bin/objdump
rm -f $(1)/usr/bin/ar
endef

View File

@ -9,8 +9,8 @@ include $(TOPDIR)/rules.mk
LUCI_TITLE:=LuCI for FRPC
LUCI_DEPENDS:=+wget +frpc
LUCI_PKGARCH:=all
PKG_VERSION:=1.1
PKG_RELEASE:=2
PKG_VERSION:=1.2
PKG_RELEASE:=1
include $(TOPDIR)/feeds/luci/luci.mk

View File

@ -105,6 +105,15 @@ e:depends("type","http")
e = t:taboption("other",Value, "host_header_rewrite", translate("Host Header"), translate("The Host header will be rewritten to match the hostname portion of the forwarding address."))
e.default = "dev.yourdomain.com"
e:depends("enable_host_header_rewrite",1)
e = t:taboption("base",ListValue, "proxy_protocol_version", translate("Proxy-Protocol Version"), translate("Proxy Protocol to send user's real IP to local services."))
e.default = "disable"
e:value("disable",translate("Disable"))
e:value("v1",translate("V1"))
e:value("v2",translate("V2"))
e:depends("type","tcp")
e:depends("type","stcp")
e:depends("type","http")
e:depends("type","https")
e = t:taboption("base",Flag, "use_encryption", translate("Use Encryption"), translate("Encrypted the communication between frpc and frps, will effectively prevent the traffic intercepted."))
e.default = "1"
e.rmempty = false

View File

@ -30,7 +30,7 @@ conf_proxy_add() {
local cfg="$1"
local tmpconf="$2"
local enable type domain_type custom_domains remote_port local_ip local_port enable_http_auth enable_host_header_rewrite host_header_rewrite
local subdomain use_encryption use_compression http_user http_pwd remark locations
local subdomain proxy_protocol_version use_encryption use_compression http_user http_pwd remark locations
local enable_plugin plugin plugin_http_user plugin_http_passwd plugin_unix_path stcp_role stcp_secretkey stcp_servername
config_get_bool enable "$cfg" enable 1
@ -54,6 +54,7 @@ conf_proxy_add() {
config_get stcp_role "$cfg" stcp_role
config_get stcp_secretkey "$cfg" stcp_secretkey
config_get stcp_servername "$cfg" stcp_servername
config_get proxy_protocol_version "$cfg" proxy_protocol_version
[ -n "$remark" ] && [ -n "$type" ] || return 1
@ -92,7 +93,11 @@ conf_proxy_add() {
[ -n "$stcp_secretkey" ] && echo "sk=$stcp_secretkey" >>$tmpconf || return 1
}
[ -n "$proxy_protocol_version" ] && {
if [ "$proxy_protocol_version" != "disable" ]; then
echo "proxy_protocol_version=$proxy_protocol_version" >>$tmpconf
fi
}
frp_write_bool use_encryption $cfg 1
frp_write_bool use_compression $cfg 1

View File

@ -9,14 +9,14 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=openvpn
PKG_VERSION:=2.4.8
PKG_VERSION:=2.4.9
PKG_RELEASE:=1
PKG_SOURCE_URL:=\
https://build.openvpn.net/downloads/releases/ \
https://swupdate.openvpn.net/community/releases/
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
PKG_HASH:=fb8ca66bb7807fff595fbdf2a0afd085c02a6aa47715c9aa3171002f9f1a3f91
PKG_HASH:=641f3add8694b2ccc39fd4fd92554e4f089ad16a8db6d2b473ec284839a5ebe2
PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>

View File

@ -1,6 +1,6 @@
--- a/src/openvpn/ssl_mbedtls.c
+++ b/src/openvpn/ssl_mbedtls.c
@@ -1406,7 +1406,7 @@ const char *
@@ -1415,7 +1415,7 @@ const char *
get_ssl_library_version(void)
{
static char mbedtls_version[30];

View File

@ -47,7 +47,7 @@ Signed-off-by: Gert Doering <gert@greenie.muc.de>
#endif
--- a/src/openvpn/ssl_openssl.c
+++ b/src/openvpn/ssl_openssl.c
@@ -1977,7 +1977,7 @@ get_highest_preference_tls_cipher(char *
@@ -2008,7 +2008,7 @@ get_highest_preference_tls_cipher(char *
const char *
get_ssl_library_version(void)
{

View File

@ -11,12 +11,12 @@ include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=wireguard
PKG_VERSION:=1.0.20200401
PKG_VERSION:=1.0.20200413
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:=7dfb4a8315e1d6ae406ff32d01c496175df558dd65968a19e5222d02c7cfb77a
PKG_HASH:=cf166348fbb67419528e73049ce001d29131aea367fa6aef9d3e223f7251e116
PKG_LICENSE:=GPL-2.0
PKG_LICENSE_FILES:=COPYING

View File

@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=dante
PKG_VERSION:=1.4.1
PKG_RELEASE:=3
PKG_RELEASE:=4
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=http://www.inet.no/dante/files/

View File

@ -0,0 +1,53 @@
When compiled with glibc the config_scan.c wants to use the
cpupolicy2numeric() function which is only available when
HAVE_SCHED_SETSCHEDULER is set. It looks like the wrong define was used here.
This fixes a build problem with glibc in combination with the force
ac_cv_func_sched_setscheduler=no in the OpenWrt CONFIGURE_VARS.
--- a/lib/config_scan.c
+++ b/lib/config_scan.c
@@ -3891,7 +3891,7 @@ YY_RULE_SETUP
SERRX(0);
#else /* !SOCKS_CLIENT */
-#if HAVE_SCHED_SETAFFINITY
+#if HAVE_SCHED_SETSCHEDULER
BEGIN(0);
@@ -3899,9 +3899,9 @@ YY_RULE_SETUP
yyerrorx("unknown scheduling policy \"%s\"", yytext);
return SCHEDULEPOLICY;
-#else /* !HAVE_SCHED_SETAFFINITY */
+#else /* !HAVE_SCHED_SETSCHEDULER */
yyerrorx("setting cpu scheduling policy is not supported on this platform");
-#endif /* !HAVE_SCHED_SETAFFINITY */
+#endif /* !HAVE_SCHED_SETSCHEDULER */
#endif /* SOCKS_CLIENT */
}
--- a/lib/config_scan.l
+++ b/lib/config_scan.l
@@ -456,7 +456,7 @@ cpu {
SERRX(0);
#else /* !SOCKS_CLIENT */
-#if HAVE_SCHED_SETAFFINITY
+#if HAVE_SCHED_SETSCHEDULER
BEGIN(0);
@@ -464,9 +464,9 @@ cpu {
yyerrorx("unknown scheduling policy \"%s\"", yytext);
return SCHEDULEPOLICY;
-#else /* !HAVE_SCHED_SETAFFINITY */
+#else /* !HAVE_SCHED_SETSCHEDULER */
yyerrorx("setting cpu scheduling policy is not supported on this platform");
-#endif /* !HAVE_SCHED_SETAFFINITY */
+#endif /* !HAVE_SCHED_SETSCHEDULER */
#endif /* SOCKS_CLIENT */
}

View File

@ -0,0 +1,84 @@
From d3539be8f27b8cbfdfee460fe08299158f08bcd9 Mon Sep 17 00:00:00 2001
From: Alistair Francis <alistair.francis@wdc.com>
Date: Tue, 19 Nov 2019 13:06:40 +0100
Subject: Remove stime() function calls
stime() has been deprecated in glibc 2.31 and replaced with
clock_settime(). Let's replace the stime() function calls with
clock_settime() in preperation.
function old new delta
rdate_main 197 224 +27
clock_settime - 27 +27
date_main 926 941 +15
stime 37 - -37
------------------------------------------------------------------------------
(add/remove: 2/2 grow/shrink: 2/0 up/down: 69/-37) Total: 32 bytes
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
---
coreutils/date.c | 6 +++++-
libbb/missing_syscalls.c | 8 --------
util-linux/rdate.c | 8 ++++++--
3 files changed, 11 insertions(+), 11 deletions(-)
--- a/coreutils/date.c
+++ b/coreutils/date.c
@@ -279,6 +279,9 @@ int date_main(int argc UNUSED_PARAM, cha
time(&ts.tv_sec);
#endif
}
+#if !ENABLE_FEATURE_DATE_NANO
+ ts.tv_nsec = 0;
+#endif
localtime_r(&ts.tv_sec, &tm_time);
/* If date string is given, update tm_time, and maybe set date */
@@ -301,9 +304,10 @@ int date_main(int argc UNUSED_PARAM, cha
if (date_str[0] != '@')
tm_time.tm_isdst = -1;
ts.tv_sec = validate_tm_time(date_str, &tm_time);
+ ts.tv_nsec = 0;
/* if setting time, set it */
- if ((opt & OPT_SET) && stime(&ts.tv_sec) < 0) {
+ if ((opt & OPT_SET) && clock_settime(CLOCK_REALTIME, &ts) < 0) {
bb_perror_msg("can't set date");
}
}
--- a/libbb/missing_syscalls.c
+++ b/libbb/missing_syscalls.c
@@ -15,14 +15,6 @@ pid_t getsid(pid_t pid)
return syscall(__NR_getsid, pid);
}
-int stime(const time_t *t)
-{
- struct timeval tv;
- tv.tv_sec = *t;
- tv.tv_usec = 0;
- return settimeofday(&tv, NULL);
-}
-
int sethostname(const char *name, size_t len)
{
return syscall(__NR_sethostname, name, len);
--- a/util-linux/rdate.c
+++ b/util-linux/rdate.c
@@ -95,9 +95,13 @@ int rdate_main(int argc UNUSED_PARAM, ch
if (!(flags & 2)) { /* no -p (-s may be present) */
if (time(NULL) == remote_time)
bb_error_msg("current time matches remote time");
- else
- if (stime(&remote_time) < 0)
+ else {
+ struct timespec ts;
+ ts.tv_sec = remote_time;
+ ts.tv_nsec = 0;
+ if (clock_settime(CLOCK_REALTIME, &ts) < 0)
bb_perror_msg_and_die("can't set time of day");
+ }
}
if (flags != 1) /* not lone -s */

View File

@ -31,10 +31,6 @@ endef
TARGET_CFLAGS += -I$(STAGING_DIR)/usr/include
ifneq ($(CONFIG_USE_GLIBC),)
TARGET_CFLAGS += -D_DEFAULT_SOURCE
endif
define Package/ugps/conffiles
/etc/config/gps
endef

View File

@ -14,7 +14,7 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
--- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c
+++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
@@ -1722,10 +1722,8 @@ static int bcm_enet_probe(struct platfor
@@ -1723,10 +1723,8 @@ static int bcm_enet_probe(struct platfor
const char *clk_name;
int i, ret;
@ -26,7 +26,7 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
res_irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
res_irq_rx = platform_get_resource(pdev, IORESOURCE_IRQ, 1);
@@ -2700,11 +2698,8 @@ static int bcm_enetsw_probe(struct platf
@@ -2701,11 +2699,8 @@ static int bcm_enetsw_probe(struct platf
struct resource *res_mem;
int ret, irq_rx, irq_tx;

View File

@ -13,7 +13,7 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
--- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c
+++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
@@ -1767,14 +1767,14 @@ static int bcm_enet_probe(struct platfor
@@ -1768,14 +1768,14 @@ static int bcm_enet_probe(struct platfor
clk_name = "enet1";
}
@ -30,7 +30,7 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
/* initialize default and fetch platform data */
priv->rx_ring_size = BCMENET_DEF_RX_DESC;
@@ -1802,7 +1802,7 @@ static int bcm_enet_probe(struct platfor
@@ -1803,7 +1803,7 @@ static int bcm_enet_probe(struct platfor
if (priv->mac_id == 0 && priv->has_phy && !priv->use_external_mii) {
/* using internal PHY, enable clock */
@ -39,7 +39,7 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
if (IS_ERR(priv->phy_clk)) {
ret = PTR_ERR(priv->phy_clk);
priv->phy_clk = NULL;
@@ -1810,7 +1810,7 @@ static int bcm_enet_probe(struct platfor
@@ -1811,7 +1811,7 @@ static int bcm_enet_probe(struct platfor
}
ret = clk_prepare_enable(priv->phy_clk);
if (ret)
@ -48,7 +48,7 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
}
/* do minimal hardware init to be able to probe mii bus */
@@ -1907,14 +1907,8 @@ out_uninit_hw:
@@ -1908,14 +1908,8 @@ out_uninit_hw:
if (priv->phy_clk)
clk_disable_unprepare(priv->phy_clk);
@ -63,7 +63,7 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
out:
free_netdev(dev);
return ret;
@@ -1950,12 +1944,10 @@ static int bcm_enet_remove(struct platfo
@@ -1951,12 +1945,10 @@ static int bcm_enet_remove(struct platfo
}
/* disable hw block clocks */
@ -78,7 +78,7 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
free_netdev(dev);
return 0;
@@ -2738,26 +2730,20 @@ static int bcm_enetsw_probe(struct platf
@@ -2739,26 +2731,20 @@ static int bcm_enetsw_probe(struct platf
if (ret)
goto out;
@ -111,7 +111,7 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
priv->rx_chan = 0;
priv->tx_chan = 1;
@@ -2789,15 +2775,6 @@ static int bcm_enetsw_probe(struct platf
@@ -2790,15 +2776,6 @@ static int bcm_enetsw_probe(struct platf
out_disable_clk:
clk_disable_unprepare(priv->mac_clk);
@ -127,7 +127,7 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
out:
free_netdev(dev);
return ret;
@@ -2809,20 +2786,13 @@ static int bcm_enetsw_remove(struct plat
@@ -2810,20 +2787,13 @@ static int bcm_enetsw_remove(struct plat
{
struct bcm_enet_priv *priv;
struct net_device *dev;

View File

@ -13,7 +13,7 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
--- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c
+++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
@@ -1904,8 +1904,7 @@ out_free_mdio:
@@ -1905,8 +1905,7 @@ out_free_mdio:
out_uninit_hw:
/* turn off mdc clock */
enet_writel(priv, 0, ENET_MIISC_REG);
@ -23,7 +23,7 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
out_disable_clk_mac:
clk_disable_unprepare(priv->mac_clk);
@@ -1944,9 +1943,7 @@ static int bcm_enet_remove(struct platfo
@@ -1945,9 +1944,7 @@ static int bcm_enet_remove(struct platfo
}
/* disable hw block clocks */

View File

@ -13,7 +13,7 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
--- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c
+++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
@@ -1719,7 +1719,6 @@ static int bcm_enet_probe(struct platfor
@@ -1720,7 +1720,6 @@ static int bcm_enet_probe(struct platfor
struct bcm63xx_enet_platform_data *pd;
struct resource *res_mem, *res_irq, *res_irq_rx, *res_irq_tx;
struct mii_bus *bus;
@ -21,7 +21,7 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
int i, ret;
if (!bcm_enet_shared_base[0])
@@ -1760,14 +1759,12 @@ static int bcm_enet_probe(struct platfor
@@ -1761,14 +1760,12 @@ static int bcm_enet_probe(struct platfor
if (priv->mac_id == 0) {
priv->rx_chan = 0;
priv->tx_chan = 1;

View File

@ -45,7 +45,7 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
/*
--- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c
+++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
@@ -1755,15 +1755,6 @@ static int bcm_enet_probe(struct platfor
@@ -1756,15 +1756,6 @@ static int bcm_enet_probe(struct platfor
priv->irq_tx = res_irq_tx->start;
priv->mac_id = pdev->id;
@ -61,7 +61,7 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
priv->mac_clk = devm_clk_get(&pdev->dev, "enet");
if (IS_ERR(priv->mac_clk)) {
ret = PTR_ERR(priv->mac_clk);
@@ -1795,6 +1786,8 @@ static int bcm_enet_probe(struct platfor
@@ -1796,6 +1787,8 @@ static int bcm_enet_probe(struct platfor
priv->dma_chan_width = pd->dma_chan_width;
priv->dma_has_sram = pd->dma_has_sram;
priv->dma_desc_shift = pd->dma_desc_shift;

View File

@ -14,7 +14,7 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
--- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c
+++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
@@ -1790,7 +1790,7 @@ static int bcm_enet_probe(struct platfor
@@ -1791,7 +1791,7 @@ static int bcm_enet_probe(struct platfor
priv->tx_chan = pd->tx_chan;
}

View File

@ -15,7 +15,7 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
--- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c
+++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
@@ -1753,7 +1753,6 @@ static int bcm_enet_probe(struct platfor
@@ -1754,7 +1754,6 @@ static int bcm_enet_probe(struct platfor
dev->irq = priv->irq = res_irq->start;
priv->irq_rx = res_irq_rx->start;
priv->irq_tx = res_irq_tx->start;
@ -23,7 +23,7 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
priv->mac_clk = devm_clk_get(&pdev->dev, "enet");
if (IS_ERR(priv->mac_clk)) {
@@ -1821,7 +1820,7 @@ static int bcm_enet_probe(struct platfor
@@ -1822,7 +1821,7 @@ static int bcm_enet_probe(struct platfor
bus->priv = priv;
bus->read = bcm_enet_mdio_read_phylib;
bus->write = bcm_enet_mdio_write_phylib;

View File

@ -1,26 +0,0 @@
From f1af8bb8e0879a3c2d9679a7274c2774335e9876 Mon Sep 17 00:00:00 2001
From: Jonas Gorski <jonas.gorski@gmail.com>
Date: Wed, 14 Nov 2018 12:06:41 +0100
Subject: [PATCH] MIPS: BCM63XX: fix switch core reset on BCM6368
The Ethernet Switch core mask was set to 0, causing the switch core to
be not reset on BCM6368 on boot. Provide the proper mask so the switch
core gets reset to a known good state.
Fixes: 799faa626c71 ("MIPS: BCM63XX: add core reset helper")
Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
---
arch/mips/bcm63xx/reset.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/arch/mips/bcm63xx/reset.c
+++ b/arch/mips/bcm63xx/reset.c
@@ -120,7 +120,7 @@
#define BCM6368_RESET_DSL 0
#define BCM6368_RESET_SAR SOFTRESET_6368_SAR_MASK
#define BCM6368_RESET_EPHY SOFTRESET_6368_EPHY_MASK
-#define BCM6368_RESET_ENETSW 0
+#define BCM6368_RESET_ENETSW SOFTRESET_6368_ENETSW_MASK
#define BCM6368_RESET_PCM SOFTRESET_6368_PCM_MASK
#define BCM6368_RESET_MPI SOFTRESET_6368_MPI_MASK
#define BCM6368_RESET_PCIE 0

View File

@ -1,6 +1,6 @@
--- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c
+++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
@@ -1636,7 +1636,7 @@ static int bcm_enet_change_mtu(struct ne
@@ -1637,7 +1637,7 @@ static int bcm_enet_change_mtu(struct ne
return -EBUSY;
/* add ethernet header + vlan tag size */

View File

@ -15,7 +15,7 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
--- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c
+++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
@@ -869,10 +869,8 @@ static int bcm_enet_open(struct net_devi
@@ -870,10 +870,8 @@ static int bcm_enet_open(struct net_devi
struct bcm_enet_priv *priv;
struct sockaddr addr;
struct device *kdev;
@ -26,7 +26,7 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
void *p;
u32 val;
@@ -880,40 +878,10 @@ static int bcm_enet_open(struct net_devi
@@ -881,40 +879,10 @@ static int bcm_enet_open(struct net_devi
kdev = &priv->pdev->dev;
if (priv->has_phy) {
@ -68,7 +68,7 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
}
/* mask all interrupts and request them */
@@ -923,7 +891,7 @@ static int bcm_enet_open(struct net_devi
@@ -924,7 +892,7 @@ static int bcm_enet_open(struct net_devi
ret = request_irq(dev->irq, bcm_enet_isr_mac, 0, dev->name, dev);
if (ret)
@ -77,7 +77,7 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
ret = request_irq(priv->irq_rx, bcm_enet_isr_dma, 0,
dev->name, dev);
@@ -1085,8 +1053,8 @@ static int bcm_enet_open(struct net_devi
@@ -1086,8 +1054,8 @@ static int bcm_enet_open(struct net_devi
enet_dmac_writel(priv, priv->dma_chan_int_mask,
ENETDMAC_IRMASK, priv->tx_chan);
@ -88,7 +88,7 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
else
bcm_enet_adjust_link(dev);
@@ -1127,10 +1095,6 @@ out_freeirq_rx:
@@ -1128,10 +1096,6 @@ out_freeirq_rx:
out_freeirq:
free_irq(dev->irq, dev);
@ -99,7 +99,7 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
return ret;
}
@@ -1235,10 +1199,6 @@ static int bcm_enet_stop(struct net_devi
@@ -1236,10 +1200,6 @@ static int bcm_enet_stop(struct net_devi
free_irq(priv->irq_rx, dev);
free_irq(dev->irq, dev);
@ -110,7 +110,7 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
return 0;
}
@@ -1804,14 +1764,49 @@ static int bcm_enet_probe(struct platfor
@@ -1805,14 +1765,49 @@ static int bcm_enet_probe(struct platfor
/* do minimal hardware init to be able to probe mii bus */
bcm_enet_hw_preinit(priv);
@ -161,7 +161,7 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
}
bus = priv->mii_bus;
@@ -1835,6 +1830,35 @@ static int bcm_enet_probe(struct platfor
@@ -1836,6 +1831,35 @@ static int bcm_enet_probe(struct platfor
dev_err(&pdev->dev, "unable to register mdio bus\n");
goto out_free_mdio;
}
@ -197,7 +197,7 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
} else {
/* run platform code to initialize PHY device */
@@ -1842,47 +1866,16 @@ static int bcm_enet_probe(struct platfor
@@ -1843,47 +1867,16 @@ static int bcm_enet_probe(struct platfor
pd->mii_config(dev, 1, bcm_enet_mdio_read_mii,
bcm_enet_mdio_write_mii)) {
dev_err(&pdev->dev, "unable to configure mdio bus\n");
@ -249,7 +249,7 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
if (priv->mii_bus)
mdiobus_unregister(priv->mii_bus);
@@ -1890,6 +1883,9 @@ out_free_mdio:
@@ -1891,6 +1884,9 @@ out_free_mdio:
if (priv->mii_bus)
mdiobus_free(priv->mii_bus);
@ -259,7 +259,7 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
out_uninit_hw:
/* turn off mdc clock */
enet_writel(priv, 0, ENET_MIISC_REG);
@@ -1920,6 +1916,7 @@ static int bcm_enet_remove(struct platfo
@@ -1921,6 +1917,7 @@ static int bcm_enet_remove(struct platfo
enet_writel(priv, 0, ENET_MIISC_REG);
if (priv->has_phy) {

View File

@ -32,7 +32,7 @@ Subject: [PATCH 54/81] bcm63xx_enet: enable rgmii clock on external ports
#define ENETSW_MDIOC_EXT_MASK (1 << 16)
--- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c
+++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
@@ -2191,6 +2191,18 @@ static int bcm_enetsw_open(struct net_de
@@ -2192,6 +2192,18 @@ static int bcm_enetsw_open(struct net_de
priv->sw_port_link[i] = 0;
}

View File

@ -20,7 +20,7 @@
#include <bcm63xx_dev_enet.h>
#include "bcm63xx_enet.h"
@@ -1936,7 +1937,8 @@ static int bcm_enet_remove(struct platfo
@@ -1937,7 +1938,8 @@ static int bcm_enet_remove(struct platfo
return 0;
}
@ -30,7 +30,7 @@
.probe = bcm_enet_probe,
.remove = bcm_enet_remove,
.driver = {
@@ -1945,6 +1947,42 @@ struct platform_driver bcm63xx_enet_driv
@@ -1946,6 +1948,42 @@ struct platform_driver bcm63xx_enet_driv
},
};
@ -73,7 +73,7 @@
/*
* switch mii access callbacks
*/
@@ -2203,29 +2241,6 @@ static int bcm_enetsw_open(struct net_de
@@ -2204,29 +2242,6 @@ static int bcm_enetsw_open(struct net_de
enetsw_writeb(priv, rgmii_ctrl, ENETSW_RGMII_CTRL_REG(i));
}
@ -103,7 +103,7 @@
/* initialize flow control buffer allocation */
enet_dma_writel(priv, ENETDMA_BUFALLOC_FORCE_MASK | 0,
ENETDMA_BUFALLOC_REG(priv->rx_chan));
@@ -2684,6 +2699,9 @@ static int bcm_enetsw_probe(struct platf
@@ -2685,6 +2700,9 @@ static int bcm_enetsw_probe(struct platf
struct bcm63xx_enetsw_platform_data *pd;
struct resource *res_mem;
int ret, irq_rx, irq_tx;
@ -113,7 +113,7 @@
if (!bcm_enet_shared_base[0])
return -EPROBE_DEFER;
@@ -2766,6 +2784,43 @@ static int bcm_enetsw_probe(struct platf
@@ -2767,6 +2785,43 @@ static int bcm_enetsw_probe(struct platf
priv->pdev = pdev;
priv->net_dev = dev;
@ -157,7 +157,7 @@
return 0;
out_disable_clk:
@@ -2787,6 +2842,9 @@ static int bcm_enetsw_remove(struct plat
@@ -2788,6 +2843,9 @@ static int bcm_enetsw_remove(struct plat
priv = netdev_priv(dev);
unregister_netdev(dev);

View File

@ -1,6 +1,6 @@
--- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c
+++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
@@ -2743,9 +2743,9 @@ static int bcm_enetsw_probe(struct platf
@@ -2744,9 +2744,9 @@ static int bcm_enetsw_probe(struct platf
if (ret)
goto out;

View File

@ -1,6 +1,6 @@
--- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c
+++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
@@ -2238,6 +2238,10 @@ static int bcm_enetsw_open(struct net_de
@@ -2239,6 +2239,10 @@ static int bcm_enetsw_open(struct net_de
rgmii_ctrl = enetsw_readb(priv, ENETSW_RGMII_CTRL_REG(i));
rgmii_ctrl |= ENETSW_RGMII_CTRL_GMII_CLK_EN;

View File

@ -7,12 +7,12 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=glibc
PKG_VERSION:=2.27
PKG_VERSION:=2.31
PKG_SOURCE_PROTO:=git
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
PKG_SOURCE_VERSION:=bef0b1cb31bed76a355776154af9191ed1758222
PKG_MIRROR_HASH:=24a137758acdc0d8c5254891204ba38d759838123bab09a64ec0bdb94289aafd
PKG_SOURCE_VERSION:=54ba2541b3a76441a9cbe5dd14c963bf874fd5e9
PKG_MIRROR_HASH:=333bff38151f333e93a239aa91e0de28a1e7d24863aafe569caf05b9bdb01461
PKG_SOURCE_URL:=https://sourceware.org/git/glibc.git
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.xz
@ -60,7 +60,8 @@ GLIBC_CONFIGURE:= \
--without-gd \
--without-cvs \
--enable-add-ons \
--$(if $(CONFIG_SOFT_FLOAT),without,with)-fp
--$(if $(CONFIG_SOFT_FLOAT),without,with)-fp \
--enable-kernel=4.14.0
export libc_cv_ssp=no
export libc_cv_ssp_strong=no

View File

@ -1,26 +0,0 @@
commit 583dd860d5b833037175247230a328f0050dbfe9
Author: Paul Eggert <eggert@cs.ucla.edu>
Date: Mon Jan 21 11:08:13 2019 -0800
regex: fix read overrun [BZ #24114]
Problem found by AddressSanitizer, reported by Hongxu Chen in:
https://debbugs.gnu.org/34140
* posix/regexec.c (proceed_next_node):
Do not read past end of input buffer.
--- a/posix/regexec.c
+++ b/posix/regexec.c
@@ -1293,8 +1293,10 @@ proceed_next_node (const re_match_context_t *mctx, Idx nregs, regmatch_t *regs,
else if (naccepted)
{
char *buf = (char *) re_string_get_buffer (&mctx->input);
- if (memcmp (buf + regs[subexp_idx].rm_so, buf + *pidx,
- naccepted) != 0)
+ if (mctx->input.valid_len - *pidx < naccepted
+ || (memcmp (buf + regs[subexp_idx].rm_so, buf + *pidx,
+ naccepted)
+ != 0))
return -1;
}
}

View File

@ -0,0 +1,686 @@
From cfc93329e00cd23c226f34b3ffd5552a93c35bd7 Mon Sep 17 00:00:00 2001
From: Hauke Mehrtens <hauke@hauke-m.de>
Date: Mon, 23 Mar 2020 22:33:46 +0100
Subject: Revert "Disallow use of DES encryption functions in new programs."
This reverts commit b10a0accee709a5efff2fadf0b0bbb79ff0ad759.
ppp still uses the encrypt functions from the libc. musl libc also
provides them.
---
conform/data/stdlib.h-data | 3 +
conform/data/unistd.h-data | 6 ++
crypt/cert.c | 26 -----
crypt/crypt-entry.c | 15 ++-
crypt/crypt.h | 16 +++
crypt/crypt_util.c | 9 --
manual/conf.texi | 2 -
manual/crypt.texi | 201 +++++++++++++++++++++++++++++++++++++
manual/string.texi | 82 +++++++--------
posix/unistd.h | 22 ++--
stdlib/stdlib.h | 6 ++
sunrpc/Makefile | 2 +-
sunrpc/des_crypt.c | 7 +-
sunrpc/des_soft.c | 2 +-
14 files changed, 303 insertions(+), 96 deletions(-)
--- a/conform/data/stdlib.h-data
+++ b/conform/data/stdlib.h-data
@@ -149,6 +149,9 @@ function {unsigned short int*} seed48 (u
#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX && !defined XPG4 && !defined XPG42 && !defined UNIX98
function int setenv (const char*, const char*, int)
#endif
+#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX && !defined POSIX2008
+function void setkey (const char*)
+#endif
#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined XPG4 && !defined POSIX && !defined POSIX2008
function {char*} setstate (char*)
#endif
--- a/conform/data/unistd.h-data
+++ b/conform/data/unistd.h-data
@@ -437,6 +437,9 @@ function int chroot (const char*)
function int chown (const char*, uid_t, gid_t)
function int close (int)
function size_t confstr (int, char*, size_t)
+#if !defined POSIX && !defined POSIX2008
+function {char*} crypt (const char*, const char*)
+#endif
#if defined XPG4 || defined XPG42 || defined UNIX98
function {char*} ctermid (char*)
function {char*} cuserid (char*)
@@ -446,6 +449,9 @@ allow cuserid
#endif
function int dup (int)
function int dup2 (int, int)
+#if !defined POSIX && !defined POSIX2008
+function void encrypt (char[64], int)
+#endif
function int execl (const char*, const char*, ...)
function int execle (const char*, const char*, ...)
function int execlp (const char*, const char*, ...)
--- a/crypt/cert.c
+++ b/crypt/cert.c
@@ -10,22 +10,6 @@
#include <stdlib.h>
#include "crypt.h"
-/* This file tests the deprecated setkey/encrypt interface. */
-#include <shlib-compat.h>
-#if TEST_COMPAT (libcrypt, GLIBC_2_0, GLIBC_2_28)
-
-#define libcrypt_version_reference(symbol, version) \
- _libcrypt_version_reference (symbol, VERSION_libcrypt_##version)
-#define _libcrypt_version_reference(symbol, version) \
- __libcrypt_version_reference (symbol, version)
-#define __libcrypt_version_reference(symbol, version) \
- __asm__ (".symver " #symbol ", " #symbol "@" #version)
-
-extern void setkey (const char *);
-extern void encrypt (const char *, int);
-libcrypt_version_reference (setkey, GLIBC_2_0);
-libcrypt_version_reference (encrypt, GLIBC_2_0);
-
int totfails = 0;
int main (int argc, char *argv[]);
@@ -120,13 +104,3 @@ put8 (char *cp)
printf("%02x", t);
}
}
-
-#else /* encrypt and setkey are not available. */
-
-int
-main (void)
-{
- return 77; /* UNSUPPORTED */
-}
-
-#endif
--- a/crypt/crypt-entry.c
+++ b/crypt/crypt-entry.c
@@ -35,7 +35,6 @@
#endif
#include "crypt-private.h"
-#include <shlib-compat.h>
/* Prototypes for local functions. */
#ifndef __GNU_LIBRARY__
@@ -177,7 +176,17 @@ crypt (const char *key, const char *salt
return __crypt_r (key, salt, &_ufc_foobar);
}
-#if SHLIB_COMPAT (libcrypt, GLIBC_2_0, GLIBC_2_28)
+
+/*
+ * To make fcrypt users happy.
+ * They don't need to call init_des.
+ */
+#ifdef _LIBC
weak_alias (crypt, fcrypt)
-compat_symbol (libcrypt, fcrypt, fcrypt, GLIBC_2_0);
+#else
+char *
+__fcrypt (const char *key, const char *salt)
+{
+ return crypt (key, salt);
+}
#endif
--- a/crypt/crypt.h
+++ b/crypt/crypt.h
@@ -36,6 +36,14 @@ __BEGIN_DECLS
extern char *crypt (const char *__phrase, const char *__salt)
__THROW __nonnull ((1, 2));
+/* Setup DES tables according KEY. */
+extern void setkey (const char *__key) __THROW __nonnull ((1));
+
+/* Encrypt data in BLOCK in place if EDFLAG is zero; otherwise decrypt
+ block in place. */
+extern void encrypt (char *__glibc_block, int __edflag)
+ __THROW __nonnull ((1));
+
#ifdef __USE_GNU
/* This structure provides scratch and output buffers for 'crypt_r'.
@@ -63,6 +71,14 @@ struct crypt_data
extern char *crypt_r (const char *__phrase, const char *__salt,
struct crypt_data * __restrict __data)
__THROW __nonnull ((1, 2, 3));
+
+extern void setkey_r (const char *__key,
+ struct crypt_data * __restrict __data)
+ __THROW __nonnull ((1, 2));
+
+extern void encrypt_r (char *__glibc_block, int __edflag,
+ struct crypt_data * __restrict __data)
+ __THROW __nonnull ((1, 3));
#endif
__END_DECLS
--- a/crypt/crypt_util.c
+++ b/crypt/crypt_util.c
@@ -34,7 +34,6 @@
#endif
#include "crypt-private.h"
-#include <shlib-compat.h>
/* Prototypes for local functions. */
#ifndef __GNU_LIBRARY__
@@ -151,7 +150,6 @@ static const int sbox[8][4][16]= {
}
};
-#if SHLIB_COMPAT (libcrypt, GLIBC_2_0, GLIBC_2_28)
/*
* This is the initial
* permutation matrix
@@ -162,7 +160,6 @@ static const int initial_perm[64] = {
57, 49, 41, 33, 25, 17, 9, 1, 59, 51, 43, 35, 27, 19, 11, 3,
61, 53, 45, 37, 29, 21, 13, 5, 63, 55, 47, 39, 31, 23, 15, 7
};
-#endif
/*
* This is the final
@@ -788,7 +785,6 @@ _ufc_output_conversion_r (ufc_long v1, u
__data->crypt_3_buf[13] = 0;
}
-#if SHLIB_COMPAT (libcrypt, GLIBC_2_0, GLIBC_2_28)
/*
* UNIX encrypt function. Takes a bitvector
@@ -889,14 +885,12 @@ __encrypt_r (char *__block, int __edflag
}
}
weak_alias (__encrypt_r, encrypt_r)
-compat_symbol (libcrypt, encrypt_r, encrypt_r, GLIBC_2_0);
void
encrypt (char *__block, int __edflag)
{
__encrypt_r(__block, __edflag, &_ufc_foobar);
}
-compat_symbol (libcrypt, encrypt, encrypt, GLIBC_2_0);
/*
@@ -921,15 +915,12 @@ __setkey_r (const char *__key, struct cr
_ufc_mk_keytab_r((char *) ktab, __data);
}
weak_alias (__setkey_r, setkey_r)
-compat_symbol (libcrypt, setkey_r, setkey_r, GLIBC_2_0);
void
setkey (const char *__key)
{
__setkey_r(__key, &_ufc_foobar);
}
-compat_symbol (libcrypt, setkey, setkey, GLIBC_2_0);
-#endif /* SHLIB_COMPAT (libcrypt, GLIBC_2_0, GLIBC_2_28) */
void
__b64_from_24bit (char **cp, int *buflen,
--- a/manual/conf.texi
+++ b/manual/conf.texi
@@ -780,8 +780,6 @@ Inquire about the parameter correspondin
@item _SC_XOPEN_CRYPT
@standards{X/Open, unistd.h}
Inquire about the parameter corresponding to @code{_XOPEN_CRYPT}.
-@Theglibc no longer implements the @code{_XOPEN_CRYPT} extensions,
-so @samp{sysconf (_SC_XOPEN_CRYPT)} always returns @code{-1}.
@item _SC_XOPEN_ENH_I18N
@standards{X/Open, unistd.h}
--- a/manual/crypt.texi
+++ b/manual/crypt.texi
@@ -16,8 +16,19 @@ subject to them, even if you do not use
yourself. The restrictions vary from place to place and are changed
often, so we cannot give any more specific advice than this warning.
+@vindex AUTH_DES
+@cindex FIPS 140-2
+It also provides support for Secure RPC, and some library functions that
+can be used to perform normal DES encryption. The @code{AUTH_DES}
+authentication flavor in Secure RPC, as provided by @theglibc{},
+uses DES and does not comply with FIPS 140-2 nor does any other use of DES
+within @theglibc{}. It is recommended that Secure RPC should not be used
+for systems that need to comply with FIPS 140-2 since all flavors of
+encrypted authentication use normal DES.
+
@menu
* Passphrase Storage:: One-way hashing for passphrases.
+* DES Encryption:: Routines for DES encryption.
* Unpredictable Bytes:: Randomness for cryptographic purposes.
@end menu
@@ -200,6 +211,196 @@ hashes for the same passphrase.
@include testpass.c.texi
@end smallexample
+@node DES Encryption
+@section DES Encryption
+
+@cindex FIPS 46-3
+The Data Encryption Standard is described in the US Government Federal
+Information Processing Standards (FIPS) 46-3 published by the National
+Institute of Standards and Technology. The DES has been very thoroughly
+analyzed since it was developed in the late 1970s, and no new
+significant flaws have been found.
+
+However, the DES uses only a 56-bit key (plus 8 parity bits), and a
+machine has been built in 1998 which can search through all possible
+keys in about 6 days, which cost about US$200000; faster searches would
+be possible with more money. This makes simple DES insecure for most
+purposes, and NIST no longer permits new US government systems
+to use simple DES.
+
+For serious encryption functionality, it is recommended that one of the
+many free encryption libraries be used instead of these routines.
+
+The DES is a reversible operation which takes a 64-bit block and a
+64-bit key, and produces another 64-bit block. Usually the bits are
+numbered so that the most-significant bit, the first bit, of each block
+is numbered 1.
+
+Under that numbering, every 8th bit of the key (the 8th, 16th, and so
+on) is not used by the encryption algorithm itself. But the key must
+have odd parity; that is, out of bits 1 through 8, and 9 through 16, and
+so on, there must be an odd number of `1' bits, and this completely
+specifies the unused bits.
+
+@deftypefun void setkey (const char *@var{key})
+@standards{BSD, crypt.h}
+@standards{SVID, crypt.h}
+@safety{@prelim{}@mtunsafe{@mtasurace{:crypt}}@asunsafe{@asucorrupt{} @asulock{}}@acunsafe{@aculock{}}}
+@c The static buffer stores the key, making it fundamentally
+@c thread-unsafe. The locking issues are only in the initialization
+@c path; cancelling the initialization will leave the lock held, it
+@c would otherwise repeat the initialization on the next call.
+
+The @code{setkey} function sets an internal data structure to be an
+expanded form of @var{key}. @var{key} is specified as an array of 64
+bits each stored in a @code{char}, the first bit is @code{key[0]} and
+the 64th bit is @code{key[63]}. The @var{key} should have the correct
+parity.
+@end deftypefun
+
+@deftypefun void encrypt (char *@var{block}, int @var{edflag})
+@standards{BSD, crypt.h}
+@standards{SVID, crypt.h}
+@safety{@prelim{}@mtunsafe{@mtasurace{:crypt}}@asunsafe{@asucorrupt{} @asulock{}}@acunsafe{@aculock{}}}
+@c Same issues as setkey.
+
+The @code{encrypt} function encrypts @var{block} if
+@var{edflag} is 0, otherwise it decrypts @var{block}, using a key
+previously set by @code{setkey}. The result is
+placed in @var{block}.
+
+Like @code{setkey}, @var{block} is specified as an array of 64 bits each
+stored in a @code{char}, but there are no parity bits in @var{block}.
+@end deftypefun
+
+@deftypefun void setkey_r (const char *@var{key}, {struct crypt_data *} @var{data})
+@deftypefunx void encrypt_r (char *@var{block}, int @var{edflag}, {struct crypt_data *} @var{data})
+@standards{GNU, crypt.h}
+@c setkey_r: @safety{@prelim{}@mtsafe{}@asunsafe{@asucorrupt{} @asulock{}}@acunsafe{@aculock{}}}
+@safety{@prelim{}@mtsafe{}@asunsafe{@asucorrupt{} @asulock{}}@acunsafe{@aculock{}}}
+
+These are reentrant versions of @code{setkey} and @code{encrypt}. The
+only difference is the extra parameter, which stores the expanded
+version of @var{key}. Before calling @code{setkey_r} the first time,
+@code{data->initialized} must be cleared to zero.
+@end deftypefun
+
+The @code{setkey_r} and @code{encrypt_r} functions are GNU extensions.
+@code{setkey}, @code{encrypt}, @code{setkey_r}, and @code{encrypt_r} are
+defined in @file{crypt.h}.
+
+@deftypefun int ecb_crypt (char *@var{key}, char *@var{blocks}, unsigned int @var{len}, unsigned int @var{mode})
+@standards{SUNRPC, rpc/des_crypt.h}
+@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
+
+The function @code{ecb_crypt} encrypts or decrypts one or more blocks
+using DES. Each block is encrypted independently.
+
+The @var{blocks} and the @var{key} are stored packed in 8-bit bytes, so
+that the first bit of the key is the most-significant bit of
+@code{key[0]} and the 63rd bit of the key is stored as the
+least-significant bit of @code{key[7]}. The @var{key} should have the
+correct parity.
+
+@var{len} is the number of bytes in @var{blocks}. It should be a
+multiple of 8 (so that there are a whole number of blocks to encrypt).
+@var{len} is limited to a maximum of @code{DES_MAXDATA} bytes.
+
+The result of the encryption replaces the input in @var{blocks}.
+
+The @var{mode} parameter is the bitwise OR of two of the following:
+
+@vtable @code
+@item DES_ENCRYPT
+@standards{SUNRPC, rpc/des_crypt.h}
+This constant, used in the @var{mode} parameter, specifies that
+@var{blocks} is to be encrypted.
+
+@item DES_DECRYPT
+@standards{SUNRPC, rpc/des_crypt.h}
+This constant, used in the @var{mode} parameter, specifies that
+@var{blocks} is to be decrypted.
+
+@item DES_HW
+@standards{SUNRPC, rpc/des_crypt.h}
+This constant, used in the @var{mode} parameter, asks to use a hardware
+device. If no hardware device is available, encryption happens anyway,
+but in software.
+
+@item DES_SW
+@standards{SUNRPC, rpc/des_crypt.h}
+This constant, used in the @var{mode} parameter, specifies that no
+hardware device is to be used.
+@end vtable
+
+The result of the function will be one of these values:
+
+@vtable @code
+@item DESERR_NONE
+@standards{SUNRPC, rpc/des_crypt.h}
+The encryption succeeded.
+
+@item DESERR_NOHWDEVICE
+@standards{SUNRPC, rpc/des_crypt.h}
+The encryption succeeded, but there was no hardware device available.
+
+@item DESERR_HWERROR
+@standards{SUNRPC, rpc/des_crypt.h}
+The encryption failed because of a hardware problem.
+
+@item DESERR_BADPARAM
+@standards{SUNRPC, rpc/des_crypt.h}
+The encryption failed because of a bad parameter, for instance @var{len}
+is not a multiple of 8 or @var{len} is larger than @code{DES_MAXDATA}.
+@end vtable
+@end deftypefun
+
+@deftypefun int DES_FAILED (int @var{err})
+@standards{SUNRPC, rpc/des_crypt.h}
+@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
+This macro returns 1 if @var{err} is a `success' result code from
+@code{ecb_crypt} or @code{cbc_crypt}, and 0 otherwise.
+@end deftypefun
+
+@deftypefun int cbc_crypt (char *@var{key}, char *@var{blocks}, unsigned int @var{len}, unsigned int @var{mode}, char *@var{ivec})
+@standards{SUNRPC, rpc/des_crypt.h}
+@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
+
+The function @code{cbc_crypt} encrypts or decrypts one or more blocks
+using DES in Cipher Block Chaining mode.
+
+For encryption in CBC mode, each block is exclusive-ored with @var{ivec}
+before being encrypted, then @var{ivec} is replaced with the result of
+the encryption, then the next block is processed. Decryption is the
+reverse of this process.
+
+This has the advantage that blocks which are the same before being
+encrypted are very unlikely to be the same after being encrypted, making
+it much harder to detect patterns in the data.
+
+Usually, @var{ivec} is set to 8 random bytes before encryption starts.
+Then the 8 random bytes are transmitted along with the encrypted data
+(without themselves being encrypted), and passed back in as @var{ivec}
+for decryption. Another possibility is to set @var{ivec} to 8 zeroes
+initially, and have the first block encrypted consist of 8 random
+bytes.
+
+Otherwise, all the parameters are similar to those for @code{ecb_crypt}.
+@end deftypefun
+
+@deftypefun void des_setparity (char *@var{key})
+@standards{SUNRPC, rpc/des_crypt.h}
+@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
+
+The function @code{des_setparity} changes the 64-bit @var{key}, stored
+packed in 8-bit bytes, to have odd parity by altering the low bits of
+each byte.
+@end deftypefun
+
+The @code{ecb_crypt}, @code{cbc_crypt}, and @code{des_setparity}
+functions and their accompanying macros are all defined in the header
+@file{rpc/des_crypt.h}.
+
@node Unpredictable Bytes
@section Generating Unpredictable Bytes
@cindex randomness source
--- a/manual/string.texi
+++ b/manual/string.texi
@@ -36,8 +36,8 @@ too.
for delimiters.
* Erasing Sensitive Data:: Clearing memory which contains sensitive
data, after it's no longer needed.
-* Shuffling Bytes:: Or how to flash-cook a string.
-* Obfuscating Data:: Reversibly obscuring data from casual view.
+* strfry:: Function for flash-cooking a string.
+* Trivial Encryption:: Obscuring data.
* Encode Binary Data:: Encoding and Decoding of Binary Data.
* Argz and Envz Vectors:: Null-separated string vectors.
@end menu
@@ -2426,73 +2426,73 @@ functionality under a different name, su
systems it may be in @file{strings.h} instead.
@end deftypefun
-
-@node Shuffling Bytes
-@section Shuffling Bytes
+@node strfry
+@section strfry
The function below addresses the perennial programming quandary: ``How do
I take good data in string form and painlessly turn it into garbage?''
-This is not a difficult thing to code for oneself, but the authors of
-@theglibc{} wish to make it as convenient as possible.
+This is actually a fairly simple task for C programmers who do not use
+@theglibc{} string functions, but for programs based on @theglibc{},
+the @code{strfry} function is the preferred method for
+destroying string data.
-To @emph{erase} data, use @code{explicit_bzero} (@pxref{Erasing
-Sensitive Data}); to obfuscate it reversibly, use @code{memfrob}
-(@pxref{Obfuscating Data}).
+The prototype for this function is in @file{string.h}.
@deftypefun {char *} strfry (char *@var{string})
@standards{GNU, string.h}
@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
@c Calls initstate_r, time, getpid, strlen, and random_r.
-@code{strfry} performs an in-place shuffle on @var{string}. Each
-character is swapped to a position selected at random, within the
-portion of the string starting with the character's original position.
-(This is the Fisher-Yates algorithm for unbiased shuffling.)
-
-Calling @code{strfry} will not disturb any of the random number
-generators that have global state (@pxref{Pseudo-Random Numbers}).
+@code{strfry} creates a pseudorandom anagram of a string, replacing the
+input with the anagram in place. For each position in the string,
+@code{strfry} swaps it with a position in the string selected at random
+(from a uniform distribution). The two positions may be the same.
The return value of @code{strfry} is always @var{string}.
@strong{Portability Note:} This function is unique to @theglibc{}.
-It is declared in @file{string.h}.
+
@end deftypefun
-@node Obfuscating Data
-@section Obfuscating Data
+@node Trivial Encryption
+@section Trivial Encryption
+@cindex encryption
+
+
+The @code{memfrob} function converts an array of data to something
+unrecognizable and back again. It is not encryption in its usual sense
+since it is easy for someone to convert the encrypted data back to clear
+text. The transformation is analogous to Usenet's ``Rot13'' encryption
+method for obscuring offensive jokes from sensitive eyes and such.
+Unlike Rot13, @code{memfrob} works on arbitrary binary data, not just
+text.
@cindex Rot13
-The @code{memfrob} function reversibly obfuscates an array of binary
-data. This is not true encryption; the obfuscated data still bears a
-clear relationship to the original, and no secret key is required to
-undo the obfuscation. It is analogous to the ``Rot13'' cipher used on
-Usenet for obscuring offensive jokes, spoilers for works of fiction,
-and so on, but it can be applied to arbitrary binary data.
-
-Programs that need true encryption---a transformation that completely
-obscures the original and cannot be reversed without knowledge of a
-secret key---should use a dedicated cryptography library, such as
-@uref{https://www.gnu.org/software/libgcrypt/,,libgcrypt}.
-
-Programs that need to @emph{destroy} data should use
-@code{explicit_bzero} (@pxref{Erasing Sensitive Data}), or possibly
-@code{strfry} (@pxref{Shuffling Bytes}).
+For true encryption, @xref{Cryptographic Functions}.
+
+This function is declared in @file{string.h}.
+@pindex string.h
@deftypefun {void *} memfrob (void *@var{mem}, size_t @var{length})
@standards{GNU, string.h}
@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
-The function @code{memfrob} obfuscates @var{length} bytes of data
-beginning at @var{mem}, in place. Each byte is bitwise xor-ed with
-the binary pattern 00101010 (hexadecimal 0x2A). The return value is
-always @var{mem}.
-
-@code{memfrob} a second time on the same data returns it to
-its original state.
+@code{memfrob} transforms (frobnicates) each byte of the data structure
+at @var{mem}, which is @var{length} bytes long, by bitwise exclusive
+oring it with binary 00101010. It does the transformation in place and
+its return value is always @var{mem}.
+
+Note that @code{memfrob} a second time on the same data structure
+returns it to its original state.
+
+This is a good function for hiding information from someone who doesn't
+want to see it or doesn't want to see it very much. To really prevent
+people from retrieving the information, use stronger encryption such as
+that described in @xref{Cryptographic Functions}.
@strong{Portability Note:} This function is unique to @theglibc{}.
-It is declared in @file{string.h}.
+
@end deftypefun
@node Encode Binary Data
--- a/posix/unistd.h
+++ b/posix/unistd.h
@@ -107,6 +107,9 @@ __BEGIN_DECLS
/* The X/Open Unix extensions are available. */
#define _XOPEN_UNIX 1
+/* Encryption is present. */
+#define _XOPEN_CRYPT 1
+
/* The enhanced internationalization capabilities according to XPG4.2
are present. */
#define _XOPEN_ENH_I18N 1
@@ -1115,17 +1118,20 @@ ssize_t copy_file_range (int __infd, __o
extern int fdatasync (int __fildes);
#endif /* Use POSIX199309 */
-#ifdef __USE_MISC
-/* One-way hash PHRASE, returning a string suitable for storage in the
- user database. SALT selects the one-way function to use, and
- ensures that no two users' hashes are the same, even if they use
- the same passphrase. The return value points to static storage
- which will be overwritten by the next call to crypt. */
+
+/* XPG4.2 specifies that prototypes for the encryption functions must
+ be defined here. */
+#ifdef __USE_XOPEN
+/* Encrypt at most 8 characters from KEY using salt to perturb DES. */
extern char *crypt (const char *__key, const char *__salt)
__THROW __nonnull ((1, 2));
-#endif
-#ifdef __USE_XOPEN
+/* Encrypt data in BLOCK in place if EDFLAG is zero; otherwise decrypt
+ block in place. */
+extern void encrypt (char *__glibc_block, int __edflag)
+ __THROW __nonnull ((1));
+
+
/* Swab pairs bytes in the first N bytes of the area pointed to by
FROM and copy the result to TO. The value of TO must not be in the
range [FROM - N + 1, FROM - 1]. If N is odd the first byte in FROM
--- a/stdlib/stdlib.h
+++ b/stdlib/stdlib.h
@@ -961,6 +961,12 @@ extern int getsubopt (char **__restrict
#endif
+#ifdef __USE_XOPEN
+/* Setup DES tables according KEY. */
+extern void setkey (const char *__key) __THROW __nonnull ((1));
+#endif
+
+
/* X/Open pseudo terminal handling. */
#ifdef __USE_XOPEN2KXSI
--- a/sunrpc/Makefile
+++ b/sunrpc/Makefile
@@ -51,7 +51,7 @@ rpcsvc = bootparam_prot.x nlm_prot.x rst
headers-sunrpc = $(addprefix rpc/,auth.h auth_unix.h clnt.h pmap_clnt.h \
pmap_prot.h pmap_rmt.h rpc.h rpc_msg.h \
svc.h svc_auth.h types.h xdr.h auth_des.h \
- key_prot.h) \
+ des_crypt.h key_prot.h rpc_des.h) \
$(rpcsvc:%=rpcsvc/%) rpcsvc/bootparam.h
headers = rpc/netdb.h
install-others = $(inst_sysconfdir)/rpc
--- a/sunrpc/des_crypt.c
+++ b/sunrpc/des_crypt.c
@@ -86,9 +86,6 @@ common_crypt (char *key, char *buf, regi
return desdev == DES_SW ? DESERR_NONE : DESERR_NOHWDEVICE;
}
-/* Note: these cannot be excluded from the build yet, because they are
- still used internally. */
-
/*
* CBC mode encryption
*/
@@ -105,7 +102,7 @@ cbc_crypt (char *key, char *buf, unsigne
COPY8 (dp.des_ivec, ivec);
return err;
}
-hidden_nolink (cbc_crypt, libc, GLIBC_2_1)
+libc_hidden_nolink_sunrpc (cbc_crypt, GLIBC_2_1)
/*
* ECB mode encryption
@@ -118,4 +115,4 @@ ecb_crypt (char *key, char *buf, unsigne
dp.des_mode = ECB;
return common_crypt (key, buf, len, mode, &dp);
}
-hidden_nolink (ecb_crypt, libc, GLIBC_2_1)
+libc_hidden_nolink_sunrpc (ecb_crypt, GLIBC_2_1)
--- a/sunrpc/des_soft.c
+++ b/sunrpc/des_soft.c
@@ -71,4 +71,4 @@ des_setparity (char *p)
p++;
}
}
-hidden_nolink (des_setparity, libc, GLIBC_2_1)
+libc_hidden_nolink_sunrpc (des_setparity, GLIBC_2_1)

View File

@ -2,7 +2,7 @@ add /usr/lib to default search path for the dynamic linker
--- a/Makeconfig
+++ b/Makeconfig
@@ -589,6 +589,9 @@ else
@@ -601,6 +601,9 @@ else
default-rpath = $(libdir)
endif