aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--community/alpine-make-rootfs/APKBUILD4
-rw-r--r--community/docker/APKBUILD23
-rw-r--r--community/drupal7/APKBUILD1
-rw-r--r--community/ffmpeg/APKBUILD11
-rw-r--r--community/firefox-esr/APKBUILD36
-rw-r--r--community/gvfs/APKBUILD22
-rw-r--r--community/gvfs/CVE-2019-12447.patch33
-rw-r--r--community/gvfs/CVE-2019-12448.patch128
-rw-r--r--community/gvfs/CVE-2019-12449.patch81
-rw-r--r--community/gvfs/CVE-2019-12795.patch93
-rw-r--r--community/imagemagick6/APKBUILD39
-rw-r--r--community/libraw/APKBUILD3
-rw-r--r--community/nextcloud/APKBUILD4
-rw-r--r--community/openexr/APKBUILD13
-rw-r--r--community/openexr/CVE-2018-18444.patch23
-rw-r--r--community/openjdk7/APKBUILD30
-rw-r--r--community/openjdk7/icedtea-pr64174.patch24
-rw-r--r--community/openjdk8/APKBUILD4
-rw-r--r--community/pdns/4.1.10_to_4.1.11.schema.pgsql.sql.patch31
-rw-r--r--community/pdns/APKBUILD17
-rw-r--r--community/pdns/README.alpine6
-rw-r--r--community/php7/APKBUILD7
-rw-r--r--community/ruby-nokogiri/APKBUILD2
-rw-r--r--community/sox/APKBUILD16
-rw-r--r--community/sox/CVE-2019-8355.patch45
-rw-r--r--community/sox/CVE-2019-8356.patch74
-rw-r--r--community/sox/CVE-2019-8357.patch12
-rw-r--r--community/webkit2gtk/APKBUILD74
-rw-r--r--community/webkit2gtk/fix-fast-memory-disabled.patch6
-rw-r--r--community/webkit2gtk/fix-openjpeg.patch11
-rw-r--r--community/webkit2gtk/fix_armv6l.patch23
-rw-r--r--community/webkit2gtk/musl-fixes.patch20
-rw-r--r--community/zabbix/APKBUILD4
-rw-r--r--community/znc/APKBUILD8
-rw-r--r--community/znc/CVE-2019-12816.patch103
-rw-r--r--main/alpine-git-mirror-syncd/APKBUILD6
-rw-r--r--main/ansible/APKBUILD24
-rw-r--r--main/avahi/APKBUILD14
-rw-r--r--main/avahi/CVE-2017-6519-and-CVE-2018-1000845.patch27
-rw-r--r--main/ghostscript/APKBUILD8
-rw-r--r--main/ghostscript/CVE-2019-10216.patch49
-rw-r--r--main/hostapd/0001-OpenSSL-Use-constant-time-operations-for-private-big.patch92
-rw-r--r--main/hostapd/0002-OpenSSL-Use-constant-time-selection-for-crypto_bignu.patch60
-rw-r--r--main/hostapd/0003-SAE-Minimize-timing-differences-in-PWE-derivation.patch241
-rw-r--r--main/hostapd/0004-SAE-Avoid-branches-in-is_quadratic_residue_blind.patch144
-rw-r--r--main/hostapd/0005-SAE-Mask-timing-of-MODP-groups-22-23-24.patch118
-rw-r--r--main/hostapd/0006-SAE-Use-const_time-selection-for-PWE-in-FFC.patch105
-rw-r--r--main/hostapd/0007-SAE-Use-constant-time-operations-in-sae_test_pwd_see.patch135
-rw-r--r--main/hostapd/0008-Add-helper-functions-for-constant-time-operations.patch218
-rw-r--r--main/hostapd/0009-EAP-pwd-Use-constant-time-and-memory-access-for-find.patch324
-rw-r--r--main/hostapd/0010-EAP-pwd-server-Detect-reflection-attacks.patch45
-rw-r--r--main/hostapd/0011-EAP-pwd-client-Verify-received-scalar-and-element.patch58
-rw-r--r--main/hostapd/0012-EAP-pwd-server-Verify-received-scalar-and-element.patch58
-rw-r--r--main/hostapd/0013-EAP-pwd-Check-element-x-y-coordinates-explicitly.patch331
-rw-r--r--main/hostapd/0014-EAP-pwd-server-Fix-reassembly-buffer-handling.patch (renamed from main/hostapd/0001-EAP-pwd-server-Fix-reassembly-buffer-handling.patch)0
-rw-r--r--main/hostapd/0015-EAP-pwd-peer-Fix-reassembly-buffer-handling.patch (renamed from main/hostapd/0003-EAP-pwd-peer-Fix-reassembly-buffer-handling.patch)0
-rw-r--r--main/hostapd/0016-SAE-Use-const_time_memcmp-for-pwd_value-prime-compar.patch31
-rw-r--r--main/hostapd/0017-EAP-pwd-Enforce-1-rand-mask-r-and-rand-mask-mod-r-1.patch121
-rw-r--r--main/hostapd/0018-EAP-pwd-Remove-unused-checks-for-cofactor-1-cases.patch257
-rw-r--r--main/hostapd/0019-EAP-pwd-Use-const_time_memcmp-for-pwd_value-prime-co.patch70
-rw-r--r--main/hostapd/0020-OpenSSL-Use-BN_bn2binpad-or-BN_bn2bin_padded-if-avai.patch66
-rw-r--r--main/hostapd/0021-SAE-Run-through-prf-result-processing-even-if-it-pri.patch59
-rw-r--r--main/hostapd/0022-EAP-pwd-Run-through-prf-result-processing-even-if-it.patch57
-rw-r--r--main/hostapd/0023-EAP-pwd-Disallow-ECC-groups-with-a-prime-under-256-b.patch45
-rw-r--r--main/hostapd/0024-SAE-Reject-unsuitable-groups-based-on-REVmd-changes.patch59
-rw-r--r--main/hostapd/0025-dragonfly-Disable-use-of-groups-using-Brainpool-curv.patch51
-rw-r--r--main/hostapd/APKBUILD58
-rw-r--r--main/imagemagick/APKBUILD37
-rw-r--r--main/imagemagick/disable-avaraging-tests.patch26
-rw-r--r--main/kamailio/0001-mohqueue.patch17
-rw-r--r--main/kamailio/APKBUILD3
-rw-r--r--main/libcroco/APKBUILD20
-rw-r--r--main/libcroco/CVE-2017-7960.patch59
-rw-r--r--main/libcroco/CVE-2017-7961.patch43
-rw-r--r--main/libcroco/CVE-2017-8871-and-CVE-2017-8834.patch29
-rw-r--r--main/libebml/APKBUILD4
-rw-r--r--main/libgcrypt/APKBUILD15
-rw-r--r--main/libgcrypt/CVE-2019-12904.patch475
-rw-r--r--main/libjpeg-turbo/APKBUILD8
-rw-r--r--main/libjpeg-turbo/CVE-2018-14498.patch110
-rw-r--r--main/libmad/APKBUILD14
-rw-r--r--main/libmad/length-check.patch817
-rw-r--r--main/libmad/md_size.patch58
-rw-r--r--main/libtasn1/APKBUILD15
-rw-r--r--main/libtasn1/CVE-2017-10790.patch55
-rw-r--r--main/mariadb/APKBUILD14
-rw-r--r--main/mariadb/fix-c11-atomics-check.patch10
-rw-r--r--main/musl/APKBUILD6
-rw-r--r--main/musl/CVE-2019-14697.patch233
-rw-r--r--main/pango/APKBUILD14
-rw-r--r--main/pango/CVE-2019-1010238.patch34
-rw-r--r--main/patch/0001-Allow-input-files-to-be-missing-for-ed-style-patches.patch33
-rw-r--r--main/patch/0002-Fix-arbitrary-command-execution-in-ed-style-patches-.patch211
-rw-r--r--main/patch/APKBUILD32
-rw-r--r--main/patch/CVE-2019-13636.patch109
-rw-r--r--main/patch/CVE-2019-13638.patch38
-rw-r--r--main/polkit/APKBUILD4
-rw-r--r--main/polkit/CVE-2019-6133.patch159
-rw-r--r--main/postgresql/APKBUILD7
-rw-r--r--main/py-django/APKBUILD11
-rw-r--r--main/redis/APKBUILD9
-rw-r--r--main/sdl/0001-CVE-2019-7572.patch64
-rw-r--r--main/sdl/0001-CVE-2019-7573.patch83
-rw-r--r--main/sdl/0001-CVE-2019-7574.patch71
-rw-r--r--main/sdl/0001-CVE-2019-7575.patch84
-rw-r--r--main/sdl/0001-CVE-2019-7577.patch75
-rw-r--r--main/sdl/0001-CVE-2019-7578.patch67
-rw-r--r--main/sdl/0001-CVE-2019-7635.patch53
-rw-r--r--main/sdl/0001-CVE-2019-7636.patch29
-rw-r--r--main/sdl/0001-CVE-2019-7637.patch182
-rw-r--r--main/sdl/0002-CVE-2019-7572.patch59
-rw-r--r--main/sdl/0002-CVE-2019-7577.patch57
-rw-r--r--main/sdl/0002-CVE-2019-7635.patch21
-rw-r--r--main/sdl/0002-CVE-2019-7637.patch42
-rw-r--r--main/sdl/APKBUILD45
-rw-r--r--main/sdl2/APKBUILD17
-rw-r--r--main/subversion/APKBUILD9
-rw-r--r--main/tcl-tls/APKBUILD2
-rw-r--r--main/wpa_supplicant/0016-SAE-Use-const_time_memcmp-for-pwd_value-prime-compar.patch31
-rw-r--r--main/wpa_supplicant/0017-EAP-pwd-Enforce-1-rand-mask-r-and-rand-mask-mod-r-1.patch121
-rw-r--r--main/wpa_supplicant/0018-EAP-pwd-Remove-unused-checks-for-cofactor-1-cases.patch257
-rw-r--r--main/wpa_supplicant/0019-EAP-pwd-Use-const_time_memcmp-for-pwd_value-prime-co.patch70
-rw-r--r--main/wpa_supplicant/0020-OpenSSL-Use-BN_bn2binpad-or-BN_bn2bin_padded-if-avai.patch66
-rw-r--r--main/wpa_supplicant/0021-SAE-Run-through-prf-result-processing-even-if-it-pri.patch59
-rw-r--r--main/wpa_supplicant/0022-EAP-pwd-Run-through-prf-result-processing-even-if-it.patch57
-rw-r--r--main/wpa_supplicant/0023-EAP-pwd-Disallow-ECC-groups-with-a-prime-under-256-b.patch45
-rw-r--r--main/wpa_supplicant/0024-SAE-Reject-unsuitable-groups-based-on-REVmd-changes.patch59
-rw-r--r--main/wpa_supplicant/0025-dragonfly-Disable-use-of-groups-using-Brainpool-curv.patch51
-rw-r--r--main/wpa_supplicant/APKBUILD24
-rw-r--r--main/xen/APKBUILD50
-rw-r--r--main/xen/x86-msr-Shorten-ARCH_CAPABILITIES_-constants.patch71
-rw-r--r--main/xen/x86-spec-ctrl-Extend-repoline-safey-calcuations-for-.patch68
-rw-r--r--main/xen/x86-tsx-Implement-controls-for-RTM-force-abort-mode.patch194
-rw-r--r--main/xen/xen-Fix-backport-of-x86-tsx-Implement-controls-for-R.patch34
-rw-r--r--main/xen/xen-Fix-backport-of-xen-cmdline-Fix-buggy-strncmp-s-.patch52
-rw-r--r--main/xen/xen-cmdline-Fix-buggy-strncmp-s-LITERAL-ss-s-constru.patch464
-rw-r--r--main/xen/xsa297-4.11-1.patch163
-rw-r--r--main/xen/xsa297-4.11-2.patch54
-rw-r--r--main/xen/xsa297-4.11-3.patch109
-rw-r--r--main/xen/xsa297-4.11-4.patch55
-rw-r--r--main/xen/xsa297-4.11-5.patch141
-rw-r--r--main/xen/xsa297-4.11-6.patch134
-rw-r--r--main/xen/xsa297-4.11-7.patch316
-rw-r--r--main/zeromq/APKBUILD14
144 files changed, 8254 insertions, 2156 deletions
diff --git a/community/alpine-make-rootfs/APKBUILD b/community/alpine-make-rootfs/APKBUILD
index 0786c10e40..9b01ab2d82 100644
--- a/community/alpine-make-rootfs/APKBUILD
+++ b/community/alpine-make-rootfs/APKBUILD
@@ -1,7 +1,7 @@
# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=alpine-make-rootfs
-pkgver=0.3.0
+pkgver=0.3.1
pkgrel=0
pkgdesc="Make customized Alpine Linux rootfs (base image) for containers"
url="https://github.com/alpinelinux/alpine-make-rootfs"
@@ -17,4 +17,4 @@ package() {
make install DESTDIR="$pkgdir" PREFIX=/usr
}
-sha512sums="1c595dac5f09f4bd74f16a16f771944972fa466ab22f69c9627d32b6a3edf776aa3133e327ad398ccd91fe0331a9ebeca1aaa220062531cbdbb8927afd2c79f1 alpine-make-rootfs-0.3.0.tar.gz"
+sha512sums="7971ac0275e4d2e9bdc3ea29197b40a66e493bf9977249922418f06e1bd9434a62a4ffa0cc637839ae1837f2f8916535977e695cb959288213ce1fee90cc3b44 alpine-make-rootfs-0.3.1.tar.gz"
diff --git a/community/docker/APKBUILD b/community/docker/APKBUILD
index c665c71bad..fec0f4a4ba 100644
--- a/community/docker/APKBUILD
+++ b/community/docker/APKBUILD
@@ -1,9 +1,9 @@
+# Contributor: Eivind Uggedal <eu@eju.no>
# Contributor: Jake Buchholz <tomalok@gmail.com>
# Maintainer: Jake Buchholz <tomalok@gmail.com>
-
pkgname=docker
-pkgver=18.09.7
-_gitcommit=2d0083d657f82c47044c8d3948ba434b622fe2fd # https://github.com/docker/docker-ce/commits/v$pkgver
+pkgver=18.09.8
+_gitcommit=0dd43dd87fd530113bf44c9bba9ad8b20ce4637f # https://github.com/docker/docker-ce/commits/v$pkgver
_ver=${pkgver/_/-}-ce
pkgrel=0
pkgdesc="Pack, ship and run any application as a lightweight container"
@@ -11,13 +11,20 @@ url="http://www.docker.io/"
arch="all"
license="Apache-2.0"
depends="ca-certificates containerd iptables tini-static"
-makedepends="go go-md2man btrfs-progs-dev bash linux-headers coreutils lvm2-dev libtool"
+makedepends="go go-md2man btrfs-progs-dev bash linux-headers coreutils lvm2-dev libtool
+ libseccomp-dev"
install="$pkgname.pre-install"
# from https://github.com/docker/docker-ce/blob/v$pkgver/components/engine/vendor.conf
_libnetwork_ver=e7933d41e7b206756115aa9df5e0599fc5169742
_cobra_ver="0.0.3"
+# secfixes:
+# 18.09.8:
+# - CVE-2019-13509
+# 18.09.7:
+# - CVE-2018-15664
+
subpackages="
$pkgname-bash-completion:bashcomp:noarch
$pkgname-fish-completion:fishcomp:noarch
@@ -38,14 +45,10 @@ source="
_dockerdir="$srcdir"/docker-$_ver
_cli_builddir="$_dockerdir"/components/cli
_daemon_builddir="$_dockerdir"/components/engine
-_buildtags=""
+_buildtags="seccomp"
_libnetwork_builddir="$srcdir"/libnetwork-$_libnetwork_ver
-# secfixes:
-# 18.09.7-r0:
-# - CVE-2018-15664
-
_apply_patches() {
local _dir="$1"
local _prefix="$2"
@@ -191,7 +194,7 @@ vim() {
done
}
-sha512sums="7d06ab01673b5931a8dde1d2fcebf442d1a107c98c95cd8fe3b886c123b48470950601782fe0c83e7537a1e856069e79a096b9f4523fea7984fd3e773b243b66 docker-18.09.7.tar.gz
+sha512sums="34cf91da732ebbde88f0c8cd39664130e6bd344b18d4643715a00e1c4062d0838a37650a8ee68fb371abd8f01910c7bdce1237af74a49cd63b5ed5382eaf00ed docker-18.09.8.tar.gz
0a833510df0029999bfc05c23445a58a8b2ff165c0fb2fd5c411498d1e89b5b1990d2778b32346dd2b6d61c166ff707c6277a5d1937db6345c77d3825eb59875 libnetwork-e7933d41e7b206756115aa9df5e0599fc5169742.tar.gz
c38db9432a168f913b41a1e1b11d84bedfade82ff70791be9d343a6cc86b8a05b18bae344d67ebd8bae4c98662db7ac664a9dc86fa9b9ad4aa5c96cbf0178efb cobra-0.0.3.tar.gz
33155a79799cc6c0520a030e1a9bdba60441776d612e5e255574b23bbce1c7a8e5d868284b05a8a92704be6bbb7db905388564e867986a705acbe4884ac58584 docker-openrc-fixes.patch
diff --git a/community/drupal7/APKBUILD b/community/drupal7/APKBUILD
index ce8d350340..a2a88ef2f4 100644
--- a/community/drupal7/APKBUILD
+++ b/community/drupal7/APKBUILD
@@ -38,6 +38,7 @@ options="!check" # This package not have testsuite
# secfixes:
# 7.67-r0:
# - CVE-2019-11831
+# - CVE-2019-11358
# 7.62-r0:
# - CVE-2018-1000888
# 7.59-r0:
diff --git a/community/ffmpeg/APKBUILD b/community/ffmpeg/APKBUILD
index 92d47f96c6..132ec41c6e 100644
--- a/community/ffmpeg/APKBUILD
+++ b/community/ffmpeg/APKBUILD
@@ -3,10 +3,10 @@
# Contributor: Jakub Skrzypnik <j.skrzypnik@openmailbox.org>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=ffmpeg
-pkgver=4.0.2
+pkgver=4.0.4
pkgrel=0
pkgdesc="Complete and free Internet live audio and video broadcasting solution for Linux/Unix"
-url="http://ffmpeg.org/"
+url="https://ffmpeg.org/"
arch="all"
license="GPL"
options="!check" # tests/data/hls-lists.append.m3u8 fails
@@ -22,6 +22,11 @@ source="https://ffmpeg.org/releases/ffmpeg-$pkgver.tar.xz
builddir="$srcdir/$pkgname-$pkgver"
# secfixes:
+# 4.0.4-r0:
+# - CVE-2018-15822
+# - CVE-2019-9718
+# - CVE-2019-9721
+# - CVE-2019-11339
# 3.4.4-r0:
# - CVE-2018-14395
# 3.4.3-r0:
@@ -112,5 +117,5 @@ libs() {
mv "$pkgdir"/usr/lib "$subpkgdir"/usr
}
-sha512sums="2dc2b8c66d9c31b6d06da5da336ef45415e3c24fac8c9063cd47f7d4cf688ec4846f88cdd9e841b956cea81e56bb3c6b7655aef503400c7367c32910c28990ac ffmpeg-4.0.2.tar.xz
+sha512sums="b7f66f5b38df4114f96fd85e42c6a42cb9673d4ca042d6775d1b64b7966cc9833e01bfa83e429e2cff8f2ecdd7dea44ede135aca75c31a7ed706e7384657196c ffmpeg-4.0.4.tar.xz
32652e18d4eb231a2e32ad1cacffdf33264aac9d459e0e2e6dd91484fced4e1ca5a62886057b1f0b4b1589c014bbe793d17c78adbaffec195f9a75733b5b18cb 0001-libavutil-clean-up-unused-FF_SYMVER-macro.patch"
diff --git a/community/firefox-esr/APKBUILD b/community/firefox-esr/APKBUILD
index 9156238802..0183696102 100644
--- a/community/firefox-esr/APKBUILD
+++ b/community/firefox-esr/APKBUILD
@@ -2,7 +2,7 @@
# Contributor: William Pitcock <nenolod@dereferenced.org>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=firefox-esr
-pkgver=60.6.1
+pkgver=60.8.0
pkgrel=0
pkgdesc="Firefox web browser - Extended Support Release"
url="https://www.mozilla.org/en-US/firefox/organizations/"
@@ -79,6 +79,38 @@ _mozappdir=/usr/lib/firefox
ldpath="$_mozappdir"
# secfixes:
+# 60.8.0-r0:
+# - CVE-2019-9811
+# - CVE-2019-11709
+# - CVE-2019-11711
+# - CVE-2019-11712
+# - CVE-2019-11713
+# - CVE-2019-11715
+# - CVE-2019-11717
+# - CVE-2019-11719
+# - CVE-2019-11729
+# - CVE-2019-11730
+# 60.7.2-r0:
+# - CVE-2019-11708
+# 60.7.1-r0:
+# - CVE-2019-11707
+# 60.7.0-r0:
+# - CVE-2019-9815
+# - CVE-2019-9816
+# - CVE-2019-9817
+# - CVE-2019-9818
+# - CVE-2019-9819
+# - CVE-2019-9820
+# - CVE-2019-11691
+# - CVE-2019-11692
+# - CVE-2019-11693
+# - CVE-2019-7317
+# - CVE-2019-9797
+# - CVE-2018-18511
+# - CVE-2019-11694
+# - CVE-2019-11698
+# - CVE-2019-5798
+# - CVE-2019-9800
# 60.6.1-r0:
# - CVE-2019-9810
# - CVE-2019-9813
@@ -244,7 +276,7 @@ __EOF__
rm -f "$pkgdir"/${_mozappdirdev}/sdk/lib/libxul.so
}
-sha512sums="a1683e9ad551c2aa6b84013216393fe1f7107728c253ed8e5700d419cf0956513110ed4e1b5dbac3e3bc23930e3024706f1b24d405b6edcdf8c175b03ab241ed firefox-60.6.1esr.source.tar.xz
+sha512sums="0332b6049b97e488e55a3b9540baad3bd159e297084e9a625b8492497c73f86eb3e144219dabc5e9f2c2e4a27630d83d243c919cd4f86b7f59f47133ed3afc54 firefox-60.8.0esr.source.tar.xz
0b3f1e4b9fdc868e4738b5c81fd6c6128ce8885b260affcb9a65ff9d164d7232626ce1291aaea70132b3e3124f5e13fef4d39326b8e7173e362a823722a85127 stab.h
2f4f15974d52de4bb273b62a332d13620945d284bbc6fe6bd0a1f58ff7388443bc1d3bf9c82cc31a8527aad92b0cd3a1bc41d0af5e1800e0dcbd7033e58ffd71 fix-fortify-system-wrappers.patch
09bc32cf9ee81b9cc6bb58ddbc66e6cc5c344badff8de3435cde5848e5a451e0172153231db85c2385ff05b5d9c20760cb18e4138dfc99060a9e960de2befbd5 fix-fortify-inline.patch
diff --git a/community/gvfs/APKBUILD b/community/gvfs/APKBUILD
index d7743e43c1..f161c09dc8 100644
--- a/community/gvfs/APKBUILD
+++ b/community/gvfs/APKBUILD
@@ -2,7 +2,7 @@
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=gvfs
pkgver=1.36.2
-pkgrel=0
+pkgrel=1
pkgdesc="Backends for the gio framework in GLib"
url="http://ftp.gnome.org/pub/gnome/sources/gvfs/${pkgver%.*}/"
arch="all"
@@ -27,7 +27,19 @@ subpackages="$pkgname-dev $pkgname-lang
$pkgname-nfs
$pkgname-smb
"
-source="https://download.gnome.org/sources/gvfs/${pkgver%.*}/gvfs-$pkgver.tar.xz"
+source="https://download.gnome.org/sources/gvfs/${pkgver%.*}/gvfs-$pkgver.tar.xz
+ CVE-2019-12448.patch
+ CVE-2019-12795.patch
+ CVE-2019-12449.patch
+ CVE-2019-12447.patch
+ "
+
+# secfixes:
+# 1.36.2-r1:
+# - CVE-2019-12447
+# - CVE-2019-12448
+# - CVE-2019-12795
+# - CVE-2019-12449
builddir="$srcdir/$pkgname-$pkgver"
build() {
@@ -161,4 +173,8 @@ nfs() {
usr/lib/gvfs/gvfsd-nfs
}
-sha512sums="c5ffc3d36ad1f438c245877d94924aa22c4edf9d89be0a990ad03897d462459229e576064797e53a62063f4aaf91ad30870f0b57df3731a69951f4ceb61db0db gvfs-1.36.2.tar.xz"
+sha512sums="c5ffc3d36ad1f438c245877d94924aa22c4edf9d89be0a990ad03897d462459229e576064797e53a62063f4aaf91ad30870f0b57df3731a69951f4ceb61db0db gvfs-1.36.2.tar.xz
+a4daaf8e7f6ece24fd0fdbe0ca4cfa5a5d36189249c36779a09f6ab9033b0fcd1db47d1aaa0b5dd4b14c444cc3763d9e25e0580fb2e2021aa42bc5e6d1eef1ec CVE-2019-12448.patch
+4d381da1e164c1205a4fea19b235163e22c8d1d65ea7ffb130df9c8c76395f20c4b5879111e4ba6d4f54cadbfb084b8c82434ab698e39e6ab2d1e5e0b5ab93ac CVE-2019-12795.patch
+15c7c46f74049b539ae5d76d03f22b7efda39f0424b13582afca1e82ca90a03bb372ef8c42afdd21f257a46aae8c6c709715bdd76cb5aa4fdf13e4c1f58fa012 CVE-2019-12449.patch
+02c4e94d8eef1f69b6d45ddbbbfa22ff9452238251c8bd3b8ae5cbbdc3a7c1fcde4612f96851dfff55f276bcf84f5b82561b06a18c1d9e20033457e72987013d CVE-2019-12447.patch"
diff --git a/community/gvfs/CVE-2019-12447.patch b/community/gvfs/CVE-2019-12447.patch
new file mode 100644
index 0000000000..4b37fc5070
--- /dev/null
+++ b/community/gvfs/CVE-2019-12447.patch
@@ -0,0 +1,33 @@
+diff --git a/daemon/gvfsbackendadmin.c b/daemon/gvfsbackendadmin.c
+index d67353d..daa6df9 100644
+--- a/daemon/gvfsbackendadmin.c
++++ b/daemon/gvfsbackendadmin.c
+@@ -907,7 +907,8 @@ g_vfs_backend_admin_init (GVfsBackendAdmin *self)
+
+ #define REQUIRED_CAPS (CAP_TO_MASK(CAP_FOWNER) | \
+ CAP_TO_MASK(CAP_DAC_OVERRIDE) | \
+- CAP_TO_MASK(CAP_DAC_READ_SEARCH))
++ CAP_TO_MASK(CAP_DAC_READ_SEARCH) | \
++ CAP_TO_MASK(CAP_CHOWN))
+
+ static void
+ acquire_caps (uid_t uid)
+@@ -919,10 +920,15 @@ acquire_caps (uid_t uid)
+ if (prctl (PR_SET_KEEPCAPS, 1, 0, 0, 0) < 0)
+ g_error ("prctl(PR_SET_KEEPCAPS) failed");
+
+- /* Drop root uid, but retain the required permitted caps */
+- if (setuid (uid) < 0)
++ /* Set euid to user to make dbus work */
++ if (seteuid (uid) < 0)
+ g_error ("unable to drop privs");
+
++ /* Set fsuid to still behave like root when working with files */
++ setfsuid (0);
++ if (setfsuid (-1) != 0)
++ g_error ("setfsuid failed");
++
+ memset (&hdr, 0, sizeof(hdr));
+ hdr.version = _LINUX_CAPABILITY_VERSION;
+
+
diff --git a/community/gvfs/CVE-2019-12448.patch b/community/gvfs/CVE-2019-12448.patch
new file mode 100644
index 0000000000..53542a3a1b
--- /dev/null
+++ b/community/gvfs/CVE-2019-12448.patch
@@ -0,0 +1,128 @@
+From 5cd76d627f4d1982b6e77a0e271ef9301732d09e Mon Sep 17 00:00:00 2001
+From: Ondrej Holy <oholy@redhat.com>
+Date: Thu, 23 May 2019 10:24:36 +0200
+Subject: [PATCH] admin: Add query_info_on_read/write functionality
+
+Admin backend doesn't implement query_info_on_read/write which might
+potentially lead to some race conditions which aren't really wanted
+especially in case of admin backend. Let's add this missing functionality.
+---
+ daemon/gvfsbackendadmin.c | 79 +++++++++++++++++++++++++++++++++------
+ 1 file changed, 67 insertions(+), 12 deletions(-)
+
+diff --git a/daemon/gvfsbackendadmin.c b/daemon/gvfsbackendadmin.c
+index 65a979e7..23d16f16 100644
+--- a/daemon/gvfsbackendadmin.c
++++ b/daemon/gvfsbackendadmin.c
+@@ -42,6 +42,8 @@
+ #include "gvfsjobopenforwrite.h"
+ #include "gvfsjobqueryattributes.h"
+ #include "gvfsjobqueryinfo.h"
++#include "gvfsjobqueryinforead.h"
++#include "gvfsjobqueryinfowrite.h"
+ #include "gvfsjobread.h"
+ #include "gvfsjobseekread.h"
+ #include "gvfsjobseekwrite.h"
+@@ -155,6 +157,19 @@ complete_job (GVfsJob *job,
+ g_vfs_job_succeeded (job);
+ }
+
++static void
++fix_file_info (GFileInfo *info)
++{
++ /* Override read/write flags, since the above call will use access()
++ * to determine permissions, which does not honor our privileged
++ * capabilities.
++ */
++ g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_READ, TRUE);
++ g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE, TRUE);
++ g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_DELETE, TRUE);
++ g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_RENAME, TRUE);
++}
++
+ static void
+ do_query_info (GVfsBackend *backend,
+ GVfsJobQueryInfo *query_info_job,
+@@ -180,19 +195,57 @@ do_query_info (GVfsBackend *backend,
+ if (error != NULL)
+ goto out;
+
+- /* Override read/write flags, since the above call will use access()
+- * to determine permissions, which does not honor our privileged
+- * capabilities.
+- */
+- g_file_info_set_attribute_boolean (real_info,
+- G_FILE_ATTRIBUTE_ACCESS_CAN_READ, TRUE);
+- g_file_info_set_attribute_boolean (real_info,
+- G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE, TRUE);
+- g_file_info_set_attribute_boolean (real_info,
+- G_FILE_ATTRIBUTE_ACCESS_CAN_DELETE, TRUE);
+- g_file_info_set_attribute_boolean (real_info,
+- G_FILE_ATTRIBUTE_ACCESS_CAN_RENAME, TRUE);
++ fix_file_info (real_info);
++ g_file_info_copy_into (real_info, info);
++ g_object_unref (real_info);
++
++ out:
++ complete_job (job, error);
++}
++
++static void
++do_query_info_on_read (GVfsBackend *backend,
++ GVfsJobQueryInfoRead *query_info_job,
++ GVfsBackendHandle handle,
++ GFileInfo *info,
++ GFileAttributeMatcher *matcher)
++{
++ GVfsJob *job = G_VFS_JOB (query_info_job);
++ GFileInputStream *stream = handle;
++ GError *error = NULL;
++ GFileInfo *real_info;
++
++ real_info = g_file_input_stream_query_info (stream, query_info_job->attributes,
++ job->cancellable, &error);
++ if (error != NULL)
++ goto out;
++
++ fix_file_info (real_info);
++ g_file_info_copy_into (real_info, info);
++ g_object_unref (real_info);
++
++ out:
++ complete_job (job, error);
++}
++
++static void
++do_query_info_on_write (GVfsBackend *backend,
++ GVfsJobQueryInfoWrite *query_info_job,
++ GVfsBackendHandle handle,
++ GFileInfo *info,
++ GFileAttributeMatcher *matcher)
++{
++ GVfsJob *job = G_VFS_JOB (query_info_job);
++ GFileOutputStream *stream = handle;
++ GError *error = NULL;
++ GFileInfo *real_info;
++
++ real_info = g_file_output_stream_query_info (stream, query_info_job->attributes,
++ job->cancellable, &error);
++ if (error != NULL)
++ goto out;
+
++ fix_file_info (real_info);
+ g_file_info_copy_into (real_info, info);
+ g_object_unref (real_info);
+
+@@ -868,6 +921,8 @@ g_vfs_backend_admin_class_init (GVfsBackendAdminClass * klass)
+ backend_class->mount = do_mount;
+ backend_class->open_for_read = do_open_for_read;
+ backend_class->query_info = do_query_info;
++ backend_class->query_info_on_read = do_query_info_on_read;
++ backend_class->query_info_on_write = do_query_info_on_write;
+ backend_class->read = do_read;
+ backend_class->create = do_create;
+ backend_class->append_to = do_append_to;
+--
+2.21.0
+
+
diff --git a/community/gvfs/CVE-2019-12449.patch b/community/gvfs/CVE-2019-12449.patch
new file mode 100644
index 0000000000..7d58c5d3d8
--- /dev/null
+++ b/community/gvfs/CVE-2019-12449.patch
@@ -0,0 +1,81 @@
+From d5dfd823c94045488aef8727c553f1e0f7666b90 Mon Sep 17 00:00:00 2001
+From: Ondrej Holy <oholy@redhat.com>
+Date: Fri, 24 May 2019 09:43:43 +0200
+Subject: [PATCH] admin: Ensure correct ownership when moving to file:// uri
+
+User and group is not restored properly when moving (or copying with
+G_FILE_COPY_ALL_METADATA) from admin:// to file://, because it is handled
+by GIO fallback code, which doesn't run with root permissions. Let's
+handle this case with pull method to ensure correct ownership.
+---
+ daemon/gvfsbackendadmin.c | 46 +++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 46 insertions(+)
+
+diff --git a/daemon/gvfsbackendadmin.c b/daemon/gvfsbackendadmin.c
+index 32b51b1a..9a7e8295 100644
+--- a/daemon/gvfsbackendadmin.c
++++ b/daemon/gvfsbackendadmin.c
+@@ -807,6 +807,51 @@ do_move (GVfsBackend *backend,
+ complete_job (job, error);
+ }
+
++static void
++do_pull (GVfsBackend *backend,
++ GVfsJobPull *pull_job,
++ const char *source,
++ const char *local_path,
++ GFileCopyFlags flags,
++ gboolean remove_source,
++ GFileProgressCallback progress_callback,
++ gpointer progress_callback_data)
++{
++ GVfsBackendAdmin *self = G_VFS_BACKEND_ADMIN (backend);
++ GVfsJob *job = G_VFS_JOB (pull_job);
++ GError *error = NULL;
++ GFile *src_file, *dst_file;
++
++ /* Pull method is necessary when user/group needs to be restored, return
++ * G_IO_ERROR_NOT_SUPPORTED in other cases to proceed with the fallback code.
++ */
++ if (!(flags & G_FILE_COPY_ALL_METADATA))
++ {
++ g_vfs_job_failed_literal (G_VFS_JOB (job), G_IO_ERROR,
++ G_IO_ERROR_NOT_SUPPORTED,
++ _("Operation not supported"));
++ return;
++ }
++
++ if (!check_permission (self, job))
++ return;
++
++ src_file = g_file_new_for_path (source);
++ dst_file = g_file_new_for_path (local_path);
++
++ if (remove_source)
++ g_file_move (src_file, dst_file, flags, job->cancellable,
++ progress_callback, progress_callback_data, &error);
++ else
++ g_file_copy (src_file, dst_file, flags, job->cancellable,
++ progress_callback, progress_callback_data, &error);
++
++ g_object_unref (src_file);
++ g_object_unref (dst_file);
++
++ complete_job (job, error);
++}
++
+ static void
+ do_query_settable_attributes (GVfsBackend *backend,
+ GVfsJobQueryAttributes *query_job,
+@@ -927,6 +972,7 @@ g_vfs_backend_admin_class_init (GVfsBackendAdminClass * klass)
+ backend_class->set_attribute = do_set_attribute;
+ backend_class->delete = do_delete;
+ backend_class->move = do_move;
++ backend_class->pull = do_pull;
+ backend_class->query_settable_attributes = do_query_settable_attributes;
+ backend_class->query_writable_namespaces = do_query_writable_namespaces;
+ }
+--
+2.21.0
+
+
diff --git a/community/gvfs/CVE-2019-12795.patch b/community/gvfs/CVE-2019-12795.patch
new file mode 100644
index 0000000000..8d22342424
--- /dev/null
+++ b/community/gvfs/CVE-2019-12795.patch
@@ -0,0 +1,93 @@
+From e3808a1b4042761055b1d975333a8243d67b8bfe Mon Sep 17 00:00:00 2001
+From: Simon McVittie <smcv@collabora.com>
+Date: Wed, 5 Jun 2019 13:33:38 +0100
+Subject: [PATCH] gvfsdaemon: Check that the connecting client is the same user
+
+Otherwise, an attacker who learns the abstract socket address from
+netstat(8) or similar could connect to it and issue D-Bus method
+calls.
+
+Signed-off-by: Simon McVittie <smcv@collabora.com>
+---
+ daemon/gvfsdaemon.c | 36 +++++++++++++++++++++++++++++++++++-
+ 1 file changed, 35 insertions(+), 1 deletion(-)
+
+diff --git a/daemon/gvfsdaemon.c b/daemon/gvfsdaemon.c
+index 406d4f8e..be148a7b 100644
+--- a/daemon/gvfsdaemon.c
++++ b/daemon/gvfsdaemon.c
+@@ -79,6 +79,7 @@ struct _GVfsDaemon
+
+ gint mount_counter;
+
++ GDBusAuthObserver *auth_observer;
+ GDBusConnection *conn;
+ GVfsDBusDaemon *daemon_skeleton;
+ GVfsDBusMountable *mountable_skeleton;
+@@ -171,6 +172,8 @@ g_vfs_daemon_finalize (GObject *object)
+ }
+ if (daemon->conn != NULL)
+ g_object_unref (daemon->conn);
++ if (daemon->auth_observer != NULL)
++ g_object_unref (daemon->auth_observer);
+
+ g_hash_table_destroy (daemon->registered_paths);
+ g_hash_table_destroy (daemon->client_connections);
+@@ -236,6 +239,35 @@ name_vanished_handler (GDBusConnection *connection,
+ daemon->lost_main_daemon = TRUE;
+ }
+
++/*
++ * Authentication observer signal handler that authorizes connections
++ * from the same uid as this process. This matches the behaviour of a
++ * libdbus DBusServer/DBusConnection when no DBusAllowUnixUserFunction
++ * has been set, but is not the default in GDBus.
++ */
++static gboolean
++authorize_authenticated_peer_cb (GDBusAuthObserver *observer,
++ G_GNUC_UNUSED GIOStream *stream,
++ GCredentials *credentials,
++ G_GNUC_UNUSED gpointer user_data)
++{
++ gboolean authorized = FALSE;
++
++ if (credentials != NULL)
++ {
++ GCredentials *own_credentials;
++
++ own_credentials = g_credentials_new ();
++
++ if (g_credentials_is_same_user (credentials, own_credentials, NULL))
++ authorized = TRUE;
++
++ g_object_unref (own_credentials);
++ }
++
++ return authorized;
++}
++
+ static void
+ g_vfs_daemon_init (GVfsDaemon *daemon)
+ {
+@@ -265,6 +297,8 @@ g_vfs_daemon_init (GVfsDaemon *daemon)
+
+ daemon->conn = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, NULL);
+ g_assert (daemon->conn != NULL);
++ daemon->auth_observer = g_dbus_auth_observer_new ();
++ g_signal_connect (daemon->auth_observer, "authorize-authenticated-peer", G_CALLBACK (authorize_authenticated_peer_cb), NULL);
+
+ daemon->daemon_skeleton = gvfs_dbus_daemon_skeleton_new ();
+ g_signal_connect (daemon->daemon_skeleton, "handle-get-connection", G_CALLBACK (handle_get_connection), daemon);
+@@ -876,7 +910,7 @@ handle_get_connection (GVfsDBusDaemon *object,
+ server = g_dbus_server_new_sync (address1,
+ G_DBUS_SERVER_FLAGS_NONE,
+ guid,
+- NULL, /* GDBusAuthObserver */
++ daemon->auth_observer,
+ NULL, /* GCancellable */
+ &error);
+ g_free (guid);
+--
+2.21.0
+
+
diff --git a/community/imagemagick6/APKBUILD b/community/imagemagick6/APKBUILD
index db10abb5cd..13db4617d2 100644
--- a/community/imagemagick6/APKBUILD
+++ b/community/imagemagick6/APKBUILD
@@ -2,8 +2,8 @@
# Contributor: Carlo Landmeter <clandmeter@gmail.com>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=imagemagick6
-_pkgname=ImageMagick
-pkgver=6.9.10.44
+_pkgname=ImageMagick6
+pkgver=6.9.10.60
_pkgver=${pkgver%.*}-${pkgver##*.}
_abiver=${pkgname#imagemagick}
pkgrel=0
@@ -18,10 +18,36 @@ makedepends="fontconfig-dev freetype-dev ghostscript-dev lcms2-dev
zlib-dev"
checkdepends="freetype fontconfig ghostscript ghostscript-fonts lcms2 graphviz"
subpackages="$pkgname-doc $pkgname-dev $pkgname-c++:_cxx $pkgname-libs"
-source="https://www.imagemagick.org/download/releases/$_pkgname-$_pkgver.tar.xz"
+source="$_pkgname-$_pkgver.tar.gz::https://github.com/ImageMagick/ImageMagick6/archive/$_pkgver.tar.gz"
builddir="$srcdir/$_pkgname-$_pkgver"
# secfixes:
+# 6.9.10.55-r0:
+# - CVE-2019-13454
+# 6.9.10.53-r0:
+# - CVE-2019-13391
+# - CVE-2019-13311
+# - CVE-2019-13310
+# - CVE-2019-13309
+# - CVE-2019-13308
+# - CVE-2019-13307
+# - CVE-2019-13306
+# - CVE-2019-13305
+# - CVE-2019-13304
+# - CVE-2019-13303
+# - CVE-2019-13302
+# - CVE-2019-13301
+# - CVE-2019-13300
+# - CVE-2019-13299
+# - CVE-2019-13298
+# - CVE-2019-13297
+# - CVE-2019-13296
+# - CVE-2019-13295
+# - CVE-2019-13137
+# - CVE-2019-13136
+# - CVE-2019-13135
+# - CVE-2019-13134
+# - CVE-2019-13133
# 6.9.10.44-r0:
# - CVE-2019-11598
# - CVE-2019-11597
@@ -84,8 +110,6 @@ prepare() {
}
build() {
- cd "$builddir"
-
./configure \
--build=$CBUILD \
--host=$CHOST \
@@ -110,13 +134,10 @@ build() {
}
check() {
- cd "$builddir"
make check
}
package() {
- cd "$builddir"
-
make -j1 DESTDIR="$pkgdir" install
if [ ! -e "$pkgdir"/usr/lib/libMagickCore-$_abiver.Q16.so ]; then
@@ -165,4 +186,4 @@ _cxx() {
mv "$pkgdir"/usr/lib/libMagick++*.so.* "$subpkgdir"/usr/lib/
}
-sha512sums="520f93cada3b439198301916a3b59f5f4cbc2ff4dd3e8ba8e9023a109db024591e36c52e976906335e6f3eec9682cc987c025a1ed342db89206a660ce2d21d5e ImageMagick-6.9.10-44.tar.xz"
+sha512sums="e8a28fdce0e48261cbd68ec6e863e06ecfc4830ce0042f36a257f5e6d524e1deb260f590f6e04d01679148b69bd317813198237ef835777b13cb1adb09b5bea3 ImageMagick6-6.9.10-60.tar.gz"
diff --git a/community/libraw/APKBUILD b/community/libraw/APKBUILD
index be3a5ea021..87d13be10b 100644
--- a/community/libraw/APKBUILD
+++ b/community/libraw/APKBUILD
@@ -17,6 +17,9 @@ builddir="$srcdir"/LibRaw-$pkgver
# - CVE-2018-20363
# - CVE-2018-20364
# - CVE-2018-20365
+# - CVE-2018-5817
+# - CVE-2018-5818
+# - CVE-2018-5819
# 0.18.6-r0:
# - CVE-2017-16910
# 0.18.5-r0:
diff --git a/community/nextcloud/APKBUILD b/community/nextcloud/APKBUILD
index 5f32c67752..7db49cc09b 100644
--- a/community/nextcloud/APKBUILD
+++ b/community/nextcloud/APKBUILD
@@ -1,7 +1,7 @@
# Maintainer: Leonardo Arena <rnalrd@alpinelinux.org>
# Contributor: Jakub Jirutka <jakub@jirutka.cz>
pkgname=nextcloud
-pkgver=15.0.8
+pkgver=15.0.11
pkgrel=0
pkgdesc="A safe home for all your data"
url="http://nextcloud.com"
@@ -228,7 +228,7 @@ _package_app() {
mv "$pkgdir"/$_appsdir/$appname "$subpkgdir"/$_appsdir/
}
-sha512sums="c800a703880f4f1aa5896f3eac34e70de7d0fd16f4f0ddef473f350a768b02aa96ad717ed67b254d6dbb4c632ac84fdb834049bae813a0f2a5468b29395a2b11 nextcloud-15.0.8.zip
+sha512sums="6052ca71dd0e9312b156fd3a3350ffe45908a30e2217dd058ed7919ad23532f6d6092e4d19b4b82541f4558f759ba7def0a72fa31f61e9bbecd2e30c4ff36deb nextcloud-15.0.11.zip
59151300c1153cad7fa2a1a972825c81a71df523b319b22799ce1bd846c1a63c7e37c608a125a98e4e733857cc65db9f329fafef7a5b1365d802c476450fce22 nextcloud15-dont-chmod.patch
e9d15d00368c8840c0144a9f0f45a951717b6c441f98a98568c064639f223df4b6190be040fc56840d3a23b3f7c69348b3d9e94ad4e86f371754ecd057a329d2 nextcloud15-app-encryption-info-add-mcrypt.patch
aef3c92497d738d6968e0f0b0d415b4953500db24ae14af41ef972665cf7eff00cb6c53dc953845fdbb389c3c965a75b8b14b9247513c05cf4130fe1cfc61731 dont-update-htaccess.patch
diff --git a/community/openexr/APKBUILD b/community/openexr/APKBUILD
index 821309910e..0b1516b02b 100644
--- a/community/openexr/APKBUILD
+++ b/community/openexr/APKBUILD
@@ -2,7 +2,7 @@
# Maintainer: Mark Riedesel <mark+alpine@klowner.com>
pkgname=openexr
pkgver=2.2.1
-pkgrel=0
+pkgrel=1
pkgdesc="A high dynamic-range image file format library"
url="http://www.openexr.com/"
arch="all"
@@ -10,9 +10,15 @@ license="BSD"
depends=""
makedepends="ilmbase-dev zlib-dev"
subpackages="$pkgname-doc $pkgname-dev $pkgname-tools"
-source="http://download.savannah.nongnu.org/releases/openexr/${pkgname}-${pkgver}.tar.gz"
+source="http://download.savannah.nongnu.org/releases/openexr/${pkgname}-${pkgver}.tar.gz
+ CVE-2018-18444.patch
+ "
builddir="$srcdir/$pkgname-$pkgver"
+# secfixes:
+# 2.2.1-r1:
+# - CVE-2018-18444
+
build() {
cd "$builddir"
./configure \
@@ -37,4 +43,5 @@ tools() {
mv "$pkgdir"/usr/bin "$subpkgdir"/usr/
}
-sha512sums="192100c6ac47534f3a93c55327d2ab90b07a8265156855086b326184328c257dcde12991b3f3f1831e2df4226fe884adcfe481c2f02a157c715aee665e89a480 openexr-2.2.1.tar.gz"
+sha512sums="192100c6ac47534f3a93c55327d2ab90b07a8265156855086b326184328c257dcde12991b3f3f1831e2df4226fe884adcfe481c2f02a157c715aee665e89a480 openexr-2.2.1.tar.gz
+c88f42bf9cb4fb2ccff493a3fded1a6efc67dedbe9475c0fa16e2bde8970fd6a03c5684558203cc7261b91c1f4521b0e007a653233ba16dfa3153320c7efe93d CVE-2018-18444.patch"
diff --git a/community/openexr/CVE-2018-18444.patch b/community/openexr/CVE-2018-18444.patch
new file mode 100644
index 0000000000..54be2400ba
--- /dev/null
+++ b/community/openexr/CVE-2018-18444.patch
@@ -0,0 +1,23 @@
+From 1b0f1e5d7dcf2e9d6cbb4e005e803808b010b1e0 Mon Sep 17 00:00:00 2001
+From: pgajdos <pgajdos@suse.cz>
+Date: Fri, 14 Jun 2019 22:19:30 +0200
+Subject: [PATCH] fix CVE-2018-18444
+
+---
+ exrmultiview/Image.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/OpenEXR/exrmultiview/Image.h b/OpenEXR/exrmultiview/Image.h
+index 5d718f5d..c465d380 100644
+--- a/exrmultiview/Image.h
++++ b/exrmultiview/Image.h
+@@ -227,7 +227,7 @@ template <class T>
+ void
+ TypedImageChannel<T>::black ()
+ {
+- memset(&_pixels[0][0],0,image().width()/_xSampling*image().height()/_ySampling*sizeof(T));
++ memset(&_pixels[0][0],0,image().width()/_xSampling*(image().height()/_ySampling)*sizeof(T));
+ }
+
+
+
diff --git a/community/openjdk7/APKBUILD b/community/openjdk7/APKBUILD
index 6e10f94e6a..d955112f88 100644
--- a/community/openjdk7/APKBUILD
+++ b/community/openjdk7/APKBUILD
@@ -2,11 +2,11 @@
# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Timo Teras <timo.teras@iki.fi>
pkgname=openjdk7
-_icedteaver=2.6.17
-_icedteaversrc=$_icedteaver-r1
+_icedteaver=2.6.18
+_icedteaversrc=$_icedteaver
# pkgver is <JDK version>.<JDK update>
# check icedtea JDK when updating
-pkgver=7.211.$_icedteaver
+pkgver=7.221.$_icedteaver
pkgrel=0
pkgdesc="OpenJDK 7 via IcedTea"
url="https://icedtea.classpath.org/"
@@ -73,13 +73,13 @@ source="https://icedtea.classpath.org/download/source/icedtea-$_icedteaversrc.ta
https://archive.apache.org/dist/ant/binaries/apache-ant-$ANT_VER-bin.tar.gz
https://github.com/mozilla/rhino/releases/download/Rhino${RHINO_VER//./_}_Release/rhino-$RHINO_VER.zip
+ icedtea-pr64174.patch
icedtea-hotspot-musl.patch
icedtea-hotspot-musl-ppc.patch
icedtea-hotspot-noagent-musl.patch
icedtea-hotspot-uclibc-fixes.patch
icedtea-jdk-fix-build.patch
icedtea-jdk-execinfo.patch
- icedtea-jdk-fix-freetype-detection.patch
icedtea-jdk-fix-ipv6-init.patch
icedtea-jdk-musl.patch
icedtea-jdk-no-soname.patch
@@ -87,6 +87,10 @@ source="https://icedtea.classpath.org/download/source/icedtea-$_icedteaversrc.ta
"
# secfixes:
+# 7.221.2.6.18-r0:
+# - CVE-2019-2602
+# - CVE-2019-2684
+# - CVE-2019-2698
# 7.211.2.6.17-r0:
# - CVE-2018-11212
# - CVE-2019-2422
@@ -267,23 +271,23 @@ doc() {
mv "$pkgdir"/$INSTALL_BASE/man "$subpkgdir"/$INSTALL_BASE/
}
-sha512sums="cc4f3f06da3332224e3826e7b3f8292e708a791d6b478db612b7bd01bdcf5ab717507d144ec03349361d665df899459930e0f21f6a5ee78195575488e58bec57 icedtea-2.6.17-r1.tar.xz
-fe1ce302fe887dcb71f589387b44d3ae71ea389825df4f09d578a67c23aee79a1c2a463da84b22cf74e9b2ce92801da72c40d66093d0eb1c790f09955bb277cc openjdk-2.6.17.tar.bz2
-20336ab198e42d42c2f68d15b82fd25db523d68b65313df4c1233a13ccb286fc94e9941c84a2b2b18a196aa121109aedb0c2c6ca772b71c8e1721ebf04b702f6 corba-2.6.17.tar.bz2
-d7589d0586eb155225b263387099022af69b9e79c07348db4d48200f7b0a2f53b59c42df284a41604647b06ee4aff43b07dbc4d737b2a0cb29f857cb7fbc7f54 jaxp-2.6.17.tar.bz2
-cbc40096706743302b03204099ddc2d632cd14c24dd3d7a5dcb8ad6258146535d660a5f384e2df64c2b97e376122852f050f69f7e67983d86bfbf12a92c7cd2c jaxws-2.6.17.tar.bz2
-f0ba8dd6011b205fbc3b67924c7535cd7618df3b1ed084aa65e70532a352d604a908894bbc010d7a50fc2e2d28be7c3d0730d73fc30f1c361e444e63d4b34ac5 jdk-2.6.17.tar.bz2
-fd6cb9004c886b78b45ddad7ba98b202998d497ff26e3f0dd861cd418a52e7c0dd7e25e1e035a4278db449abd606a8248cccc28a10cdc543e9870848e05d30f5 langtools-2.6.17.tar.bz2
-2777299457b9f82736351a4c948431c1671a40bdc1315da66ba13f0f9930a40812da5385f7d8b10f4a847592cc4f253a36eb14b15bd6699fa5dcd7841718f821 hotspot-2.6.17.tar.bz2
+sha512sums="202038af902c7619e787c3f55ccc4ab5b758a72e4c841d17065809d2331ed4f8ed7a2bce753917d9e6215525ba56840793c9a9850142e865edde1a92a7e5806d icedtea-2.6.18.tar.xz
+af8bbdad44448fb73d4f8ac87c00fa2198b7d6a401b9af9c8330768aa5ca395b50ff85f053b02a3e6d4b166b0a8f7badf6bd3c983cc9b2e35f157d0389983982 openjdk-2.6.18.tar.bz2
+0c688037efebbea1175ae26fc77be205cb43f8de886b00a6d89d35666c523bad8dbde3be636a428bff1331e89c4a6acf2aefc5611e65e4a3a7b617e240c536bf corba-2.6.18.tar.bz2
+0a23f37bf35537333d93c88e6f3e018af32f9019ec081e679a4f204848851f4fbcf47f2c0e58e27b8a0c5fdfc9897d427070e62022afcfc42ad70bb413f12c1e jaxp-2.6.18.tar.bz2
+1b2b8fd93e9f94af202c3816b4ecaa8c0809d5eed5962ff57f2edd15232abcaa11d4ac74bfb5b9f9121e5cdec3ea33559ebcc5605d8aa1fd013152abafe14aa9 jaxws-2.6.18.tar.bz2
+82d8b69f6ba3eeb3825275506704b793b5c3ea416da04319fd62948c7fa9db9a4bcb96b0b43d13fc58fbaf2f8d4b5eea098d98d5da68977cb41f9614e8c30933 jdk-2.6.18.tar.bz2
+b64c832474295b3c8d3a22a906b156555171128002c1870d071c98902f7b611d8d0f0dab4c98bf21a102011a7bf2a542d0207cdbe23433a77073670a17eb6322 langtools-2.6.18.tar.bz2
+bff77060aa4ccceec62fc14a1c47ba6d31d510353050b9b213ef87a58b82132e5cad72c59ff38f50a2c290fd2cfd84e0db9768e205d72865b6fc4b6d15fb5f0c hotspot-2.6.18.tar.bz2
0da12cb0f761b8cb76e042449e7d93f43236e7bc948e337215470a70031f0a2dda6d1b508f9397b283808d84c4ebddb31558fe1cd8e6e6469c1dd390d69ec6e7 apache-ant-1.9.11-bin.tar.gz
1b9e8721749e81c5420a00af1e00ee0e4f48624ccb4e9aa969032114116ad50f59b254d4d16d74feff74de64157cc8b0a2ead9b555907c84b7055b796fba9a75 rhino-1.7.7.2.zip
+dbebef0b6246ffaba8d10e1b672821b55e69950961dcfd265f8b37a8123a71bd80b33a1e4f1ea27343e08803744138687c6ee367e4158bc3540f5d886c0e9cb4 icedtea-pr64174.patch
f62b942f0bacda8e37d0f1876d8ba14ddb4fc55a7d5fd1019463744927f40f422a85e9ee051948d566242f5a785aa28f275eb58768611283cba89af91235f43c icedtea-hotspot-musl.patch
e5cf4d70f96fc1e72ae8b97a887adb96092ff36584711cbb8de9d9fa9e859cb8731d638838de0d9591239fc44ffe5c74422d1842bd9f10a0c00dff1627bdeeef icedtea-hotspot-musl-ppc.patch
e7a2c1771bb582d427041f8d22e48c0daf8f20d7c0926cbce3549d49c4e949359ee25a35682b486e82f3e390535c950c5beee3bd8d06fb5a717b50f2d9b2a6bc icedtea-hotspot-noagent-musl.patch
822eee0dc4d3ba677a289dfeb3668b536d2d626708390a9d9702fb4144a481fd443a215a0d2041c6026113837aafa4ba0b5e9ead8589d2da6717a238bbc95a5a icedtea-hotspot-uclibc-fixes.patch
213a537de5f011cb39d608515c3413513ac75fb93593f9a9ef4205f71d72bdd8b097c80db185f7b26021d5bb85045b866f34f3478482dc4189972d8614a13458 icedtea-jdk-fix-build.patch
0391970e6a32946aa3cccf38fdef9c0fe2af26cd0df824b98aa2fcfa1bf661d4a68e339bffcfd16f386c565fc68bb28a29208a67d4bad8a0e847ad02bd8becbb icedtea-jdk-execinfo.patch
-7b1525b5fb4bc7f0c6a8b957584a35297003b3063b6319f5557257ee1e6c277f0d4d1cf26cc389c72dd5157871010944f3fcb3fe70b64c429c76323521b6eb3d icedtea-jdk-fix-freetype-detection.patch
48533f87fc2cf29d26b259be0df51087d2fe5b252e72d00c6ea2f4add7b0fb113141718c116279c5905e03f64a1118082e719393786811367cf4d472b5d36774 icedtea-jdk-fix-ipv6-init.patch
44a35941c80f408d0607e32763b3b6ccee21e1d39886309327d3d74d2900117e4346ef59e77c663fd022fec10ee8f365eeb46c1260014d5765d226ce175ce3c5 icedtea-jdk-musl.patch
bf4b184e170f7b0ff64ab30d2162784fe2bd5460d1fa31973259f7065fd4c511c46f97724fe2bd72bb94e9006cb568d0e0c87d1a9c90819e65880f8f44830bb1 icedtea-jdk-no-soname.patch
diff --git a/community/openjdk7/icedtea-pr64174.patch b/community/openjdk7/icedtea-pr64174.patch
new file mode 100644
index 0000000000..ec8f0d5d3a
--- /dev/null
+++ b/community/openjdk7/icedtea-pr64174.patch
@@ -0,0 +1,24 @@
+--- patches.orig/boot/pr64174.patch
++++ patches/boot/pr64174.patch
+@@ -1,8 +1,7 @@
+-diff -Nru openjdk-boot.orig/jdk/src/share/classes/java/util/CurrencyData.properties openjdk-boot/jdk/src/share/classes/java/util/CurrencyData.properties
+---- openjdk-boot.orig/jdk/src/share/classes/java/util/CurrencyData.properties 2014-12-04 15:09:06.030312835 +0000
+-+++ openjdk-boot/jdk/src/share/classes/java/util/CurrencyData.properties 2014-12-04 15:10:07.527160626 +0000
+-@@ -320,7 +320,7 @@
+- # LAO PEOPLE'S DEMOCRATIC REPUBLIC
++--- openjdk-boot.orig/jdk/src/share/classes/java/util/CurrencyData.properties
+++++ openjdk-boot/jdk/src/share/classes/java/util/CurrencyData.properties
++@@ -323,7 +323,7 @@
++ # LAO PEOPLE'S DEMOCRATIC REPUBLIC (THE)
+ LA=LAK
+ # LATVIA
+ -LV=LVL;2013-12-31-22-00-00;EUR
+@@ -10,7 +9,7 @@
+ # LEBANON
+ LB=LBP
+ # LESOTHO
+-@@ -332,7 +332,7 @@
++@@ -335,7 +335,7 @@
+ # LIECHTENSTEIN
+ LI=CHF
+ # LITHUANIA
diff --git a/community/openjdk8/APKBUILD b/community/openjdk8/APKBUILD
index 86c8cd388e..1a40d90e9e 100644
--- a/community/openjdk8/APKBUILD
+++ b/community/openjdk8/APKBUILD
@@ -6,7 +6,7 @@ _icedteaver=3.12.0
# pkgver is <JDK version>.<JDK update>.<JDK build>
# Check https://icedtea.classpath.org/wiki/Main_Page when updating!
pkgver=8.212.04
-pkgrel=0
+pkgrel=1
pkgdesc="OpenJDK 8 provided by IcedTea"
url="https://icedtea.classpath.org/"
arch="all"
@@ -255,7 +255,7 @@ jre() {
jrebase() {
pkgdesc="OpenJDK 8 Java Runtime (no GUI support)"
- depends="$pkgname-jre-lib java-common java-cacerts"
+ depends="$pkgname-jre-lib java-common java-cacerts nss"
mkdir -p "$subpkgdir"/$_java_home/bin \
"$subpkgdir"/$_java_home/lib/$_jarch
diff --git a/community/pdns/4.1.10_to_4.1.11.schema.pgsql.sql.patch b/community/pdns/4.1.10_to_4.1.11.schema.pgsql.sql.patch
new file mode 100644
index 0000000000..525f954d14
--- /dev/null
+++ b/community/pdns/4.1.10_to_4.1.11.schema.pgsql.sql.patch
@@ -0,0 +1,31 @@
+diff --git a/modules/gpgsqlbackend/4.1.10_to_4.1.11.schema.pgsql.sql b/modules/gpgsqlbackend/4.1.10_to_4.1.11.schema.pgsql.sql
+new file mode 100644
+index 0000000..b0c2ee1
+--- /dev/null
++++ b/modules/gpgsqlbackend/4.1.10_to_4.1.11.schema.pgsql.sql
+@@ -0,0 +1 @@
++ALTER TABLE domains ALTER notified_serial TYPE bigint USING CASE WHEN notified_serial >= 0 THEN notified_serial::bigint END;
+diff --git a/modules/gpgsqlbackend/Makefile.am b/modules/gpgsqlbackend/Makefile.am
+index 8a820d5..9e2f271 100644
+--- a/modules/gpgsqlbackend/Makefile.am
++++ b/modules/gpgsqlbackend/Makefile.am
+@@ -12,6 +12,7 @@ dist_doc_DATA = \
+ schema.pgsql.sql \
+ nodnssec-3.x_to_3.4.0_schema.pgsql.sql \
+ dnssec-3.x_to_3.4.0_schema.pgsql.sql \
++ 4.1.10_to_4.1.11.schema.pgsql.sql \
+ 3.4.0_to_4.1.0_schema.pgsql.sql
+
+ libgpgsqlbackend_la_SOURCES = \
+diff --git a/modules/gpgsqlbackend/Makefile.in b/modules/gpgsqlbackend/Makefile.in
+index 4c1f978..9793c9d 100644
+--- a/modules/gpgsqlbackend/Makefile.in
++++ b/modules/gpgsqlbackend/Makefile.in
+@@ -479,6 +479,7 @@ dist_doc_DATA = \
+ schema.pgsql.sql \
+ nodnssec-3.x_to_3.4.0_schema.pgsql.sql \
+ dnssec-3.x_to_3.4.0_schema.pgsql.sql \
++ 4.1.10_to_4.1.11.schema.pgsql.sql \
+ 3.4.0_to_4.1.0_schema.pgsql.sql
+
+ libgpgsqlbackend_la_SOURCES = \
diff --git a/community/pdns/APKBUILD b/community/pdns/APKBUILD
index 1f793ab187..ce40f88cc6 100644
--- a/community/pdns/APKBUILD
+++ b/community/pdns/APKBUILD
@@ -5,7 +5,7 @@
# Contributor: Fabian Zoske <fabian@zoske.it>
# Maintainer: Matt Smith <mcs@darkregion.net>
pkgname=pdns
-pkgver=4.1.10
+pkgver=4.1.11
pkgrel=0
pkgdesc="PowerDNS Authoritative Server"
url="https://www.powerdns.com/"
@@ -37,10 +37,15 @@ pkgusers="pdns"
pkggroups="pdns"
source="https://downloads.powerdns.com/releases/$pkgname-$pkgver.tar.bz2
$pkgname.initd
- $pkgname.conf"
+ $pkgname.conf
+ 4.1.10_to_4.1.11.schema.pgsql.sql.patch
+ README.alpine
+ "
builddir="$srcdir/$pkgname-$pkgver"
# secfixes:
+# 4.1.11-r0:
+# - CVE-2019-10203
# 4.1.10-r0:
# - CVE-2019-10163
# - CVE-2019-10162
@@ -85,6 +90,8 @@ package() {
install -m600 -D "$srcdir/$pkgname.conf" \
"$pkgdir/etc/$pkgname/$pkgname.conf"
chown pdns:pdns "$pkgdir/etc/$pkgname/$pkgname.conf"
+
+ install -Dm644 "$srcdir"/README.alpine "$pkgdir"/usr/share/doc/$pkgname/README.alpine
}
tools() {
@@ -138,6 +145,8 @@ backend_remote() { _mv_backend remote; }
backend_sqlite3() { _mv_backend gsqlite3 sqlite; }
#backend_tinydns() { _mv_backend tinydns; }
-sha512sums="59a7a52468f6daae8de01bb2b08d812906ef58047026369895341cfff253a5b9ba29d6a6b43a822f1632641eec34fa1afa6fbb5b0ba5e72ecce8e61787892136 pdns-4.1.10.tar.bz2
+sha512sums="18215f523a39d48c8756bc13ecae1bd78967c2d66619d93ddaafb13062690002a9bdfe1d337796820706692c449286c7b9e9b8d45933684d32acbc20e490c0c4 pdns-4.1.11.tar.bz2
3a55547e1b6407e7d2faa6e02982ed903c2364381af1b7eeb626ae3a8b0e32558dd79bf31c982b134414e5636d4868c1f3660ac523f25d2440ed6f7b436843bf pdns.initd
-3f809f3257680c3e496fa6a4c86c8a636db5d9d5b92aef96fe54c29b8266ee590deb792d13205cc171e27307fa73295dd3b101b09102fd66a2393a7cdbf9dd27 pdns.conf"
+3f809f3257680c3e496fa6a4c86c8a636db5d9d5b92aef96fe54c29b8266ee590deb792d13205cc171e27307fa73295dd3b101b09102fd66a2393a7cdbf9dd27 pdns.conf
+a3caac012fae6d53afa9d08eaf4d2e70b406197e586b6716e0a9177d3833165493a55bf119669fd29c4397a8230a33982e38ef0b5a6883d71ee8869c06f0fe22 4.1.10_to_4.1.11.schema.pgsql.sql.patch
+f2781a23e14bea9b4bbb84f3b596663c76359c449ef6fd39c87b5ea1163c47e01c5ba490c804709033598f0542ac558bde477729ad1ab9f17d49606fa61b2049 README.alpine"
diff --git a/community/pdns/README.alpine b/community/pdns/README.alpine
new file mode 100644
index 0000000000..625cb68d2b
--- /dev/null
+++ b/community/pdns/README.alpine
@@ -0,0 +1,6 @@
+When upgrading from 4.1.10 and previous:
+
+This release contains a fix for CVE-2019-10203
+Upgrading is not enough you need to manually apply the schema change
+
+ALTER TABLE domains ALTER notified_serial TYPE bigint USING CASE WHEN notified_serial >= 0 THEN notified_serial::bigint END;
diff --git a/community/php7/APKBUILD b/community/php7/APKBUILD
index 9bc83877a7..dc0faffc3f 100644
--- a/community/php7/APKBUILD
+++ b/community/php7/APKBUILD
@@ -25,7 +25,7 @@
pkgname=php7
_pkgreal=php
-pkgver=7.2.19
+pkgver=7.2.21
pkgrel=0
_apiver=20170718
_suffix=${pkgname#php}
@@ -181,6 +181,9 @@ case "$CARCH" in
esac
# secfixes:
+# 7.2.21-r0:
+# - CVE-2019-11041
+# - CVE-2019-11042
# 7.2.19-r0:
# - CVE-2019-11039
# - CVE-2019-11040
@@ -667,7 +670,7 @@ _mv() {
mv $@
}
-sha512sums="79077e73075f4aaba86699c536d8bad4929d351ad40f89c35b6f9ff0d1237b9e3d528be2918dae16519659bdaf93c5ab16fc81653fe13f667e6251871f05d722 php-7.2.19.tar.bz2
+sha512sums="b234305f04bd621d355450ba38b34558a5b08403571749ac3b04ffa60d7639e847750109bef09a14f616110ba175b970d68cbae0d0b671c2dfeac6917f12f21d php-7.2.21.tar.bz2
1c708de82d1086f272f484faf6cf6d087af7c31750cc2550b0b94ed723961b363f28a947b015b2dfc0765caea185a75f5d2c2f2b099c948b65c290924f606e4f php7-fpm.initd
cacce7bf789467ff40647b7319e3760c6c587218720538516e8d400baa75651f72165c4e28056cd0c1dc89efecb4d00d0d7823bed80b29136262c825ce816691 php7-fpm.logrotate
274bd7b0b2b7002fa84c779640af37b59258bb37b05cb7dd5c89452977d71807f628d91b523b5039608376d1f760f3425d165242ca75ee5129b2730e71c4e198 php7-module.conf
diff --git a/community/ruby-nokogiri/APKBUILD b/community/ruby-nokogiri/APKBUILD
index 88e465ae2e..40f1cf4b49 100644
--- a/community/ruby-nokogiri/APKBUILD
+++ b/community/ruby-nokogiri/APKBUILD
@@ -3,7 +3,7 @@
pkgname=ruby-nokogiri
_gemname=${pkgname#ruby-}
pkgver=1.8.5
-pkgrel=0
+pkgrel=1
pkgdesc="An HTML, XML, SAX, and Reader parser"
url="http://nokogiri.org/"
arch="all"
diff --git a/community/sox/APKBUILD b/community/sox/APKBUILD
index e50a1d5d75..1c6c41a6f8 100644
--- a/community/sox/APKBUILD
+++ b/community/sox/APKBUILD
@@ -2,7 +2,7 @@
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=sox
pkgver=14.4.2
-pkgrel=2
+pkgrel=3
pkgdesc="The Swiss Army knife of sound processing tools"
url="http://sox.sourceforge.net/"
arch="all"
@@ -18,8 +18,17 @@ subpackages="$pkgname-dev $pkgname-doc"
source="https://downloads.sourceforge.net/sourceforge/$pkgname/$pkgname-$pkgver.tar.gz
sox-uclibc.patch
sox-dynamic.patch
+ CVE-2019-8357.patch
+ CVE-2019-8356.patch
+ CVE-2019-8355.patch
"
+# secfixes:
+# 14.4.2-r3:
+# - CVE-2019-8357
+# - CVE-2019-8356
+# - CVE-2019-8355
+
prepare() {
cd "$builddir"
default_prepare
@@ -47,4 +56,7 @@ package() {
}
sha512sums="b5c6203f4f5577503a034fe5b3d6a033ee97fe4d171c533933e2b036118a43a14f97c9668433229708609ccf9ee16abdeca3fc7501aa0aafe06baacbba537eca sox-14.4.2.tar.gz
08c55a0de96733e10544d450f39c2205b4057b9fc024503ec97b1906a075752ee8a4b0a1b4c5bbad2eebec17bcf8d069b22d243a63d28b77c23d545efcca6aec sox-uclibc.patch
-3950834db26faa0523006c6fd8e0769d080518f127d345c8ec9bf53e9db8a6bd67cd724f0f86492aaf9ce6ede2dfbde167049768f35c14ef3c2b96e7e00302b6 sox-dynamic.patch"
+3950834db26faa0523006c6fd8e0769d080518f127d345c8ec9bf53e9db8a6bd67cd724f0f86492aaf9ce6ede2dfbde167049768f35c14ef3c2b96e7e00302b6 sox-dynamic.patch
+b5daae78fc4eb855049c298da98ff6bb16933fb9b308801c02853fe58fb9086304343007740e2783a64fddc09c3ba576645e10cf4d5fe24f99ae98c4c1d943d7 CVE-2019-8357.patch
+38f0572603181422ffa9d25ee17dea924b9b523803d0a835039c64aab1408d8e7cc36f9d2285d6d9a310901c3449b90ccc34da1273e33842e9f0634a5bb2757f CVE-2019-8356.patch
+7a5499a5dea5635eb67703f95144e57b68c4c0c50aea04f2ecbfffd4cdd31cc183d97410da4f79cdbb9af4f357792a04fc7496f031cd2e30eb9dacf258050ff3 CVE-2019-8355.patch"
diff --git a/community/sox/CVE-2019-8355.patch b/community/sox/CVE-2019-8355.patch
new file mode 100644
index 0000000000..0936b38d51
--- /dev/null
+++ b/community/sox/CVE-2019-8355.patch
@@ -0,0 +1,45 @@
+diff --git a/src/Makefile.am b/src/Makefile.am
+index 4e50abb..c76c812 100644
+--- a/src/Makefile.am
++++ b/src/Makefile.am
+@@ -95,7 +95,7 @@ libsox_la_LIBADD += @GOMP_LIBS@
+
+ libsox_la_CFLAGS = @WARN_CFLAGS@
+ libsox_la_LDFLAGS = @APP_LDFLAGS@ -version-info @SHLIB_VERSION@ \
+- -export-symbols-regex '^(sox_.*|lsx_(error|flush|check_read_params|(close|open)_dllibrary|(debug(_more|_most)?|fail|report|warn)_impl|eof|fail_errno|filelength|find_(enum_(text|value)|file_extension)|getopt(_init)?|lpc10_(create_(de|en)coder_state|(de|en)code)|raw(read|write)|read(_b_buf|buf|chars)|realloc|rewind|seeki|sigfigs3p?|strcasecmp|tell|unreadb|write(b|_b_buf|buf|s)))$$'
++ -export-symbols-regex '^(sox_.*|lsx_(([cm]|re)alloc.*|check_read_params|(close|open)_dllibrary|(debug(_more|_most)?|fail|report|warn)_impl|eof|error|fail_errno|filelength|find_(enum_(text|value)|file_extension)|flush|getopt(_init)?|lpc10_(create_(de|en)coder_state|(de|en)code)|raw(read|write)|read(_b_buf|buf|chars)|rewind|seeki|sigfigs3p?|strcasecmp|strdup|tell|unreadb|write(b|_b_buf|buf|s)))$$'
+
+ if HAVE_WIN32_LTDL
+ libsox_la_SOURCES += win32-ltdl.c win32-ltdl.h
+diff --git a/src/xmalloc.c b/src/xmalloc.c
+index 9bf1596..5ca7cdd 100644
+--- a/src/xmalloc.c
++++ b/src/xmalloc.c
+@@ -41,3 +41,13 @@ void *lsx_realloc(void *ptr, size_t newsize)
+
+ return ptr;
+ }
++
++void *lsx_realloc_array(void *p, size_t n, size_t size)
++{
++ if (n > (size_t)-1 / size) {
++ lsx_fail("malloc size overflow");
++ exit(2);
++ }
++
++ return lsx_realloc(p, n * size);
++}
+diff --git a/src/xmalloc.h b/src/xmalloc.h
+index 9ee77f6..d708a90 100644
+--- a/src/xmalloc.h
++++ b/src/xmalloc.h
+@@ -28,7 +28,7 @@
+ #define lsx_Calloc(v,n) v = lsx_calloc(n,sizeof(*(v)))
+ #define lsx_strdup(p) ((p)? strcpy((char *)lsx_malloc(strlen(p) + 1), p) : NULL)
+ #define lsx_memdup(p,s) ((p)? memcpy(lsx_malloc(s), p, s) : NULL)
+-#define lsx_valloc(v,n) v = lsx_malloc((n)*sizeof(*(v)))
+-#define lsx_revalloc(v,n) v = lsx_realloc(v, (n)*sizeof(*(v)))
++#define lsx_valloc(v,n) v = lsx_realloc_array(NULL, n, sizeof(*(v)))
++#define lsx_revalloc(v,n) v = lsx_realloc_array(v, n, sizeof(*(v)))
+
+ #endif
diff --git a/community/sox/CVE-2019-8356.patch b/community/sox/CVE-2019-8356.patch
new file mode 100644
index 0000000000..a9ae615bf8
--- /dev/null
+++ b/community/sox/CVE-2019-8356.patch
@@ -0,0 +1,74 @@
+--- a/src/fft4g.h
++++ b/src/fft4g.h
+@@ -12,6 +12,8 @@
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
++
++#define FFT4G_MAX_SIZE 262144
+
+ void lsx_cdft(int, int, double *, int *, double *);
+ void lsx_rdft(int, int, double *, int *, double *);
+
+--- a/src/fft4g.c
++++ b/src/fft4g.c
+@@ -322,6 +322,9 @@
+
+ void cdft(int n, int isgn, double *a, int *ip, double *w)
+ {
++ if (n > FFT4G_MAX_SIZE)
++ return;
++
+ if (n > (ip[0] << 2)) {
+ makewt(n >> 2, ip, w);
+ }
+@@ -344,6 +347,9 @@
+ int nw, nc;
+ double xi;
+
++ if (n > FFT4G_MAX_SIZE)
++ return;
++
+ nw = ip[0];
+ if (n > (nw << 2)) {
+ nw = n >> 2;
+@@ -384,6 +390,9 @@
+ int j, nw, nc;
+ double xr;
+
++ if (n > FFT4G_MAX_SIZE)
++ return;
++
+ nw = ip[0];
+ if (n > (nw << 2)) {
+ nw = n >> 2;
+@@ -435,6 +444,9 @@
+ int j, nw, nc;
+ double xr;
+
++ if (n > FFT4G_MAX_SIZE)
++ return;
++
+ nw = ip[0];
+ if (n > (nw << 2)) {
+ nw = n >> 2;
+@@ -486,6 +498,9 @@
+ int j, k, l, m, mh, nw, nc;
+ double xr, xi, yr, yi;
+
++ if (n > FFT4G_MAX_SIZE)
++ return;
++
+ nw = ip[0];
+ if (n > (nw << 3)) {
+ nw = n >> 3;
+@@ -576,6 +591,9 @@
+ int j, k, l, m, mh, nw, nc;
+ double xr, xi, yr, yi;
+
++ if (n > FFT4G_MAX_SIZE)
++ return;
++
+ nw = ip[0];
+ if (n > (nw << 3)) {
+ nw = n >> 3;
diff --git a/community/sox/CVE-2019-8357.patch b/community/sox/CVE-2019-8357.patch
new file mode 100644
index 0000000000..6f0bf72e53
--- /dev/null
+++ b/community/sox/CVE-2019-8357.patch
@@ -0,0 +1,12 @@
+--- a/src/effects_i_dsp.c
++++ b/src/effects_i_dsp.c
+@@ -362,6 +362,9 @@
+ assert(Fc >= 0 && Fc <= 1);
+ lsx_debug("make_lpf(n=%i Fc=%.7g β=%g ρ=%g dc-norm=%i scale=%g)", num_taps, Fc, beta, rho, dc_norm, scale);
+
++ if (!h)
++ return NULL;
++
+ for (i = 0; i <= m / 2; ++i) {
+ double z = i - .5 * m, x = z * M_PI, y = z * mult1;
+ h[i] = x? sin(Fc * x) / x : Fc;
diff --git a/community/webkit2gtk/APKBUILD b/community/webkit2gtk/APKBUILD
index ce57ab2be5..eddcba2132 100644
--- a/community/webkit2gtk/APKBUILD
+++ b/community/webkit2gtk/APKBUILD
@@ -1,13 +1,14 @@
+# Contributor: Rasmus Thomsen <oss@cogitri.dev>
# Contributor: Sergei Lukin <sergej.lukin@gmail.com>
# Contributor: Jiri Horner <laeqten@gmail.com>
# Maintainer: Jiri Horner <laeqten@gmail.com>
pkgname=webkit2gtk
-pkgver=2.22.7
+pkgver=2.24.3
pkgrel=0
pkgdesc="Portable web rendering engine WebKit for GTK+"
url="https://webkitgtk.org/"
arch="all"
-license="LGPL-2.0-or-later BSD-2-Clause"
+license="LGPL-2.0-or-later AND BSD-2-Clause"
options="!check" # 2.20.3-r1 no idea why gtest is removed in prepare
makedepends="
bison
@@ -35,6 +36,9 @@ makedepends="
libxslt-dev
libxt-dev
mesa-dev
+ ninja
+ openjpeg-dev
+ openjpeg-tools
pango-dev
paxmark
python2
@@ -42,15 +46,28 @@ makedepends="
sqlite-dev
"
replaces="webkit"
-subpackages="$pkgname-dev $pkgname-doc $pkgname-lang"
+options="!check" # upstream doesn't package them in release tarballs: Tools/Scripts/run-gtk-tests: Command not found
+subpackages="$pkgname-dev $pkgname-lang"
source="https://webkitgtk.org/releases/webkitgtk-$pkgver.tar.xz
fix-fast-memory-disabled.patch
- fix_armv6l.patch
musl-fixes.patch
+ fix-openjpeg.patch
"
builddir="$srcdir/webkitgtk-$pkgver"
# secfixes:
+# 2.24.1-r0:
+# - CVE-2019-6251
+# - CVE-2019-8506
+# - CVE-2019-8524
+# - CVE-2019-8535
+# - CVE-2019-8536
+# - CVE-2019-8544
+# - CVE-2019-8551
+# - CVE-2019-8558
+# - CVE-2019-8559
+# - CVE-2019-8563
+# - CVE-2019-11070
# 2.22.7-r0:
# - CVE-2018-4437
# - CVE-2019-6212
@@ -81,48 +98,53 @@ builddir="$srcdir/webkitgtk-$pkgver"
# - CVE-2017-2371
# - CVE-2017-2373
-prepare() {
- default_prepare
- cd "$builddir"
- rm -r Source/ThirdParty/gtest/
-}
-
build() {
local _archopt=
case "$CARCH" in
- armhf) _archopt="-DUSE_LD_GOLD=OFF -DENABLE_JIT=OFF -DUSE_SYSMEM_MALLOC=ON";;
- aarch64) _archopt="-DUSE_LD_GOLD=OFF";;
- ppc64le) _archopt="-DENABLE_JIT=OFF -DUSE_SYSMTE_MALLOC=ON";;
- s390x) _archopt="-DUSE_LD_GOLD=OFF -DENABLE_JIT=OFF -DUSE_SYSMEM_MALLOC=ON";;
+ # disable _FORTIFY_SOURCE to work around:
+ # cc1plus: out of memory allocating 65536 bytes after a total of 3131101184 bytes
+ x86) CXXFLAGS="$CXXFLAGS -U_FORTIFY_SOURCE";;
+ armhf|armv7|ppc64le|s390x) _archopt="-DENABLE_JIT=OFF";;
esac
- cd "$builddir"
+ # reduce memory usage on 32 bit
+ # https://bugs.webkit.org/show_bug.cgi?id=199272
+ export CXXFLAGS="$CXXFLAGS -g1"
+
mkdir build
cd build
- cmake -DPORT=GTK \
- -DCMAKE_BUILD_TYPE=Release \
+ cmake -GNinja \
+ -DPORT=GTK \
+ -DCMAKE_BUILD_TYPE=MinSizeRel \
-DCMAKE_SKIP_RPATH=ON \
-DCMAKE_INSTALL_PREFIX=/usr \
-DLIB_INSTALL_DIR=/usr/lib \
-DLIBEXEC_INSTALL_DIR=/usr/lib/webkit2gtk-4.0 \
- -DENABLE_GTKDOC=ON \
+ -DENABLE_GTKDOC=OFF \
-DENABLE_GEOLOCATION=OFF \
-DENABLE_PLUGIN_PROCESS_GTK2=OFF \
-DENABLE_SAMPLING_PROFILER=OFF \
- -DUSE_WOFF2=OFF\
+ -DENABLE_MINIBROWSER=ON \
+ -DUSE_WOFF2=OFF \
+ -DCMAKE_CXX_FLAGS="$CXXFLAGS" \
$_archopt \
..
- make
+ # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=923476
+ ninja JavaScriptCore-4-gir
+ ninja
+}
+
+check() {
+ ninja -C "$builddir"/build check
}
package() {
- cd "$builddir"/build
- make DESTDIR="$pkgdir" install
+ DESTDIR="$pkgdir" ninja -C "$builddir"/build install
# needed for JIT
paxmark -m "$pkgdir"/usr/lib/webkit2gtk-4.0/WebKitWebProcess
}
-sha512sums="c11f60b14f279752bb75efce4b69cbfd75e854bfb16772edc3b24d28eff2fb65090e03f24c1cfaf1f27668e017d877e04d5210560da70568029c5af33a916126 webkitgtk-2.22.7.tar.xz
-9d7de4755c21d2573103dde326bb86ba37d54032627cb1bd362138906ac1d6a1dc48d4e548f29e29dc507831bae833ac5a8d2cf7fdb3d6a9d5bd5fb06f222b00 fix-fast-memory-disabled.patch
-f8fad1450d87f1cb195818cddb8a2307616916612e4676a4d71a20d58864d1c153550e4465a128e04f136c437518a4b90f1fa685ef6519fa8054637760635c72 fix_armv6l.patch
-922957ae400853bcfd5bff2c4e5b98a8351227a0b3b759dc34913ea5c8437e852899467a293cd2fb7a67f65022c4e99506f2be3c54fbcd74f038eb98ac02189e musl-fixes.patch"
+sha512sums="b358bb11f7df477e5b3d6a12e2e6b41cb4e6a7274e34ce6299bf0c56044ffc7db5a834e9abf5c71d992ef41d194d30171b8be406420ffc54fe766cc811afb79f webkitgtk-2.24.3.tar.xz
+e1537b9937af1cb936669d405993a52204cb9968b8b3161cb12a3f3f1343c260088c9490fcd7a7deeab6dbabdb5f7ce7e6cb2f857b9f0a4205aba6db2b11fb20 fix-fast-memory-disabled.patch
+d0d5e37822644cab071e33d325affd1ce5948b414f6f54d695e6b4a7bffadecd25c0df6dc1cb63e70127499f5a8da43b02286a3518b2488b5da32c622df45d97 musl-fixes.patch
+c517c012f5630ef6be5be7d9592c5e042a070f849a141859edefa7984acb98dbd0d718fe6613cd35ba3b7d8530beebcc7408fd077cd914ed335c5e524e9e746a fix-openjpeg.patch"
diff --git a/community/webkit2gtk/fix-fast-memory-disabled.patch b/community/webkit2gtk/fix-fast-memory-disabled.patch
index 95b9f6a091..9d2747c7da 100644
--- a/community/webkit2gtk/fix-fast-memory-disabled.patch
+++ b/community/webkit2gtk/fix-fast-memory-disabled.patch
@@ -1,6 +1,6 @@
---- a/Source/JavaScriptCore/wasm/WasmFaultSignalHandler.cpp.orig 2017-09-14 10:03:40.908890971 +0200
-+++ b/Source/JavaScriptCore/wasm/WasmFaultSignalHandler.cpp 2017-09-14 10:04:17.084859537 +0200
-@@ -112,7 +112,11 @@ void unregisterCode(void* start, void* e
+--- a/Source/JavaScriptCore/wasm/WasmFaultSignalHandler.cpp
++++ b/Source/JavaScriptCore/wasm/WasmFaultSignalHandler.cpp
+@@ -118,7 +118,11 @@ void unregisterCode(void* start, void* e
bool fastMemoryEnabled()
{
diff --git a/community/webkit2gtk/fix-openjpeg.patch b/community/webkit2gtk/fix-openjpeg.patch
new file mode 100644
index 0000000000..221f060f7e
--- /dev/null
+++ b/community/webkit2gtk/fix-openjpeg.patch
@@ -0,0 +1,11 @@
+--- a/Source/WebCore/platform/image-decoders/jpeg2000/JPEG2000ImageDecoder.cpp
++++ b/Source/WebCore/platform/image-decoders/jpeg2000/JPEG2000ImageDecoder.cpp
+@@ -28,7 +28,7 @@
+
+ #if USE(OPENJPEG)
+
+-#include <openjpeg.h>
++#include <openjpeg-2.3/openjpeg.h>
+
+ namespace WebCore {
+
diff --git a/community/webkit2gtk/fix_armv6l.patch b/community/webkit2gtk/fix_armv6l.patch
deleted file mode 100644
index c07a95b9c3..0000000000
--- a/community/webkit2gtk/fix_armv6l.patch
+++ /dev/null
@@ -1,23 +0,0 @@
-Fix code emitted for armv6l to not use movw/movt but ldr.
-See https://bugs.webkit.org/show_bug.cgi?id=131612
-and https://bugs.webkit.org/show_bug.cgi?id=141288
-
---- a/Source/JavaScriptCore/offlineasm/arm.rb 2015-07-22 14:37:57.000000000 +0200
-+++ b/Source/JavaScriptCore/offlineasm/arm.rb 2015-08-08 00:31:21.011824644 +0200
-@@ -473,8 +473,16 @@
- $asm.puts "mov #{armFlippedOperands(operands)}"
- end
- when "mvlbl"
-+ if isARMv7 or isARMv7Traditional
- $asm.puts "movw #{operands[1].armOperand}, \#:lower16:#{operands[0].value}"
- $asm.puts "movt #{operands[1].armOperand}, \#:upper16:#{operands[0].value}"
-+ else
-+ $mvlbl_counter ||= 0
-+ $mvlbl_counter += 1
-+ const_label = "_mvlbl_const_label#{$mvlbl_counter}"
-+ $asm.puts ".equ #{const_label}, (#{operands[0].value})"
-+ $asm.puts "ldr #{operands[1].armOperand}, =#{const_label}"
-+ end
- when "nop"
- $asm.puts "nop"
- when "bieq", "bpeq", "bbeq"
diff --git a/community/webkit2gtk/musl-fixes.patch b/community/webkit2gtk/musl-fixes.patch
index b5fd0bbbf1..c829f19fe7 100644
--- a/community/webkit2gtk/musl-fixes.patch
+++ b/community/webkit2gtk/musl-fixes.patch
@@ -1,5 +1,3 @@
-diff --git a/Source/JavaScriptCore/runtime/MachineContext.h b/Source/JavaScriptCore/runtime/MachineContext.h
-index 836d755..4a0518a 100644
--- a/Source/JavaScriptCore/runtime/MachineContext.h
+++ b/Source/JavaScriptCore/runtime/MachineContext.h
@@ -188,7 +188,7 @@ static inline void*& stackPointerImpl(mcontext_t& machineContext)
@@ -47,11 +45,10 @@ index 836d755..4a0518a 100644
// The following sequence depends on glibc's sys/ucontext.h.
#if CPU(X86)
-diff --git a/Source/JavaScriptCore/runtime/Options.h b/Source/JavaScriptCore/runtime/Options.h
-index 27396d2..23a7b9e 100644
+
--- a/Source/JavaScriptCore/runtime/Options.h
+++ b/Source/JavaScriptCore/runtime/Options.h
-@@ -144,9 +144,9 @@ constexpr bool enableWebAssemblyStreamingApi = false;
+@@ -138,9 +138,9 @@ constexpr bool enableWebAssemblyStreamingApi = false;
\
v(bool, reportMustSucceedExecutableAllocations, false, Normal, nullptr) \
\
@@ -64,8 +61,7 @@ index 27396d2..23a7b9e 100644
\
v(bool, crashIfCantAllocateJITMemory, false, Normal, nullptr) \
v(unsigned, jitMemoryReservationSize, 0, Normal, "Set this number to change the executable allocation size in ExecutableAllocatorFixedVMPool. (In bytes.)") \
-diff --git a/Source/ThirdParty/ANGLE/src/compiler/preprocessor/ExpressionParser.cpp b/Source/ThirdParty/ANGLE/src/compiler/preprocessor/ExpressionParser.cpp
-index c0f8b9c..1074cce 100644
+
--- a/Source/ThirdParty/ANGLE/src/compiler/preprocessor/ExpressionParser.cpp
+++ b/Source/ThirdParty/ANGLE/src/compiler/preprocessor/ExpressionParser.cpp
@@ -836,7 +836,7 @@ int yydebug;
@@ -86,8 +82,7 @@ index c0f8b9c..1074cce 100644
# define yystpcpy stpcpy
# else
/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
-diff --git a/Source/ThirdParty/ANGLE/src/compiler/translator/glslang_tab.cpp b/Source/ThirdParty/ANGLE/src/compiler/translator/glslang_tab.cpp
-index 14cd536..6084d64 100644
+
--- a/Source/ThirdParty/ANGLE/src/compiler/translator/glslang_tab.cpp
+++ b/Source/ThirdParty/ANGLE/src/compiler/translator/glslang_tab.cpp
@@ -1975,7 +1975,7 @@ int yydebug;
@@ -108,11 +103,10 @@ index 14cd536..6084d64 100644
# define yystpcpy stpcpy
# else
/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
-diff --git a/Source/WTF/wtf/Platform.h b/Source/WTF/wtf/Platform.h
-index 67cfa93..341a9f5 100644
+
--- a/Source/WTF/wtf/Platform.h
+++ b/Source/WTF/wtf/Platform.h
-@@ -697,7 +697,7 @@
+@@ -710,7 +710,7 @@
#define HAVE_CFNETWORK_STORAGE_PARTITIONING 1
#endif
@@ -121,8 +115,6 @@ index 67cfa93..341a9f5 100644
#define HAVE_MACHINE_CONTEXT 1
#endif
-diff --git a/Source/WebCore/xml/XPathGrammar.cpp b/Source/WebCore/xml/XPathGrammar.cpp
-index 31df1c0..bc569c1 100644
--- a/Source/WebCore/xml/XPathGrammar.cpp
+++ b/Source/WebCore/xml/XPathGrammar.cpp
@@ -966,7 +966,7 @@ int yydebug;
diff --git a/community/zabbix/APKBUILD b/community/zabbix/APKBUILD
index 705fa6e2a7..ef53c8c45b 100644
--- a/community/zabbix/APKBUILD
+++ b/community/zabbix/APKBUILD
@@ -3,7 +3,7 @@
# Contributor: Leonardo Arena <rnalrd@alpinelinux.org>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=zabbix
-pkgver=4.0.9
+pkgver=4.0.11
pkgrel=0
pkgdesc="Enterprise-class open source distributed monitoring"
url="http://www.zabbix.com"
@@ -200,7 +200,7 @@ agent_openrc() {
"$subpkgdir"/etc/init.d/zabbix-agentd
}
-sha512sums="4e04d80490f43d2e7833a4e11dbc7ce0ed70dc1f43653eeff923f5bfa16bbeedf37597599d68e0de3194820501d896d785a20d6ae0dce9328c458fd711a6a7bf zabbix-4.0.9.tar.gz
+sha512sums="55fe3eb4ea784c4d906ef89ed80d3cc7203b15e17d10a4ba6e9460fcf95d40ea20c25696fb834896d8efb0934d0473d883aadb00ef5ee62ffe3e3526298c6c29 zabbix-4.0.11.tar.gz
9998ee172a28002d98bacc3f76038ff52b8cf2b206e101418d76b4ca3de94afaf92cb4f7a6235ecf177f74beb9dd3ea1f3983c4f164b4f60bb601acba65aa175 zabbix-server.initd
9c06527bf653c40585fa7eeb3f7a0b2fc454031d24cd0d1633aed87b78a681c5227a193c5b9fcfcea0839135874e27ba7dd9b198573f905f680a2856f79e9512 zabbix-server.confd
523013cab3ba79cbc00db92f09d4c5d514fd6aa9cbebf8f29227dc91fbc19d2f8375af74c21d2037e4f3380a818f808194dbc94e69709ef2cf90f66e715895c4 zabbix-agentd.initd
diff --git a/community/znc/APKBUILD b/community/znc/APKBUILD
index 7f8d2b413b..d7dc8b7f1e 100644
--- a/community/znc/APKBUILD
+++ b/community/znc/APKBUILD
@@ -2,7 +2,7 @@
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=znc
pkgver=1.7.1
-pkgrel=3
+pkgrel=4
pkgdesc="Advanced IRC bouncer"
url="http://znc.in"
arch="all"
@@ -14,13 +14,16 @@ pkggroups="$pkgusers"
install="$pkgname.pre-install"
subpackages="$pkgname-dev $pkgname-doc $pkgname-extra $pkgname-modtcl
$pkgname-modperl $pkgname-modpython"
-source="http://znc.in/releases/znc-$pkgver.tar.gz
+source="http://znc.in/releases/archive/znc-$pkgver.tar.gz
CVE-2019-9917.patch
+ CVE-2019-12816.patch
$pkgname.initd
$pkgname.confd"
builddir="$srcdir/znc-$pkgver"
# secfixes:
+# 1.7.1-r4:
+# - CVE-2019-12816
# 1.7.1-r3:
# - CVE-2019-9917
# 1.7.1-r0:
@@ -114,5 +117,6 @@ _mv_to_sub() {
sha512sums="907068fb0828091026d440145b70ca76109302f13c18d94f772660192434287f209a06a52da1dd39726b9a38735b3cea9afbd062eb6def4cd428bb73c562a902 znc-1.7.1.tar.gz
0c1bdb08ce5ca4b0ff8efedff9e711ffceba460594caf14aa1bfd04ca81ec2d3e2b10ed6e34960b8251f2d9d1e95ad1e9093db1aefd36beb35ff92c2e58e84f8 CVE-2019-9917.patch
+187dad0bbe90b354b746ca8dc13bcaf5781cdc86b8c94670ecfbbf2b6e99b3182b588873ec58a475ece06021265f6e7f60a73bae18b28e284387b550dc3ca65d CVE-2019-12816.patch
47f9bd00f07861e195333d2cda5b1c7386e2324a1842b890837a7936a94b65b7a269f7fee656a522ec86b58a94bd451a2a3629bd6465578681b8d0733c2c77dc znc.initd
00360f9b487ed5a9d50c85ce597e65c89cf869cabb893c294d0bc7fcd88f9610ecb63ba6df7af1ba1dd977b6d5b05da625a3ee799a46d381f17ac04b976a1f29 znc.confd"
diff --git a/community/znc/CVE-2019-12816.patch b/community/znc/CVE-2019-12816.patch
new file mode 100644
index 0000000000..6d4d8b199d
--- /dev/null
+++ b/community/znc/CVE-2019-12816.patch
@@ -0,0 +1,103 @@
+From 8de9e376ce531fe7f3c8b0aa4876d15b479b7311 Mon Sep 17 00:00:00 2001
+From: Alexey Sokolov <alexey+znc@asokolov.org>
+Date: Wed, 12 Jun 2019 08:57:29 +0100
+Subject: [PATCH] Fix remote code execution and privilege escalation
+ vulnerability.
+
+To trigger this, need to have a user already.
+
+Thanks for Jeriko One <jeriko.one@gmx.us> for finding and reporting this.
+
+CVE-2019-12816
+---
+ include/znc/Modules.h | 1 +
+ src/Modules.cpp | 38 +++++++++++++++++++++++++++++---------
+ 2 files changed, 30 insertions(+), 9 deletions(-)
+
+diff --git a/include/znc/Modules.h b/include/znc/Modules.h
+index 28fdd3a62..db8f87b81 100644
+--- a/include/znc/Modules.h
++++ b/include/znc/Modules.h
+@@ -1600,6 +1600,7 @@ class CModules : public std::vector<CModule*>, private CCoreTranslationMixin {
+ private:
+ static ModHandle OpenModule(const CString& sModule, const CString& sModPath,
+ CModInfo& Info, CString& sRetMsg);
++ static bool ValidateModuleName(const CString& sModule, CString& sRetMsg);
+
+ protected:
+ CUser* m_pUser;
+diff --git a/src/Modules.cpp b/src/Modules.cpp
+index 5aec7805a..d41951a8d 100644
+--- a/src/Modules.cpp
++++ b/src/Modules.cpp
+@@ -1624,11 +1624,30 @@ CModule* CModules::FindModule(const CString& sModule) const {
+ return nullptr;
+ }
+
++bool CModules::ValidateModuleName(const CString& sModule, CString& sRetMsg) {
++ for (unsigned int a = 0; a < sModule.length(); a++) {
++ if (((sModule[a] < '0') || (sModule[a] > '9')) &&
++ ((sModule[a] < 'a') || (sModule[a] > 'z')) &&
++ ((sModule[a] < 'A') || (sModule[a] > 'Z')) && (sModule[a] != '_')) {
++ sRetMsg =
++ t_f("Module names can only contain letters, numbers and "
++ "underscores, [{1}] is invalid")(sModule);
++ return false;
++ }
++ }
++
++ return true;
++}
++
+ bool CModules::LoadModule(const CString& sModule, const CString& sArgs,
+ CModInfo::EModuleType eType, CUser* pUser,
+ CIRCNetwork* pNetwork, CString& sRetMsg) {
+ sRetMsg = "";
+
++ if (!ValidateModuleName(sModule, sRetMsg)) {
++ return false;
++ }
++
+ if (FindModule(sModule) != nullptr) {
+ sRetMsg = t_f("Module {1} already loaded.")(sModule);
+ return false;
+@@ -1781,6 +1800,10 @@ bool CModules::ReloadModule(const CString& sModule, const CString& sArgs,
+
+ bool CModules::GetModInfo(CModInfo& ModInfo, const CString& sModule,
+ CString& sRetMsg) {
++ if (!ValidateModuleName(sModule, sRetMsg)) {
++ return false;
++ }
++
+ CString sModPath, sTmp;
+
+ bool bSuccess;
+@@ -1799,6 +1822,10 @@ bool CModules::GetModInfo(CModInfo& ModInfo, const CString& sModule,
+
+ bool CModules::GetModPathInfo(CModInfo& ModInfo, const CString& sModule,
+ const CString& sModPath, CString& sRetMsg) {
++ if (!ValidateModuleName(sModule, sRetMsg)) {
++ return false;
++ }
++
+ ModInfo.SetName(sModule);
+ ModInfo.SetPath(sModPath);
+
+@@ -1911,15 +1938,8 @@ ModHandle CModules::OpenModule(const CString& sModule, const CString& sModPath,
+ // Some sane defaults in case anything errors out below
+ sRetMsg.clear();
+
+- for (unsigned int a = 0; a < sModule.length(); a++) {
+- if (((sModule[a] < '0') || (sModule[a] > '9')) &&
+- ((sModule[a] < 'a') || (sModule[a] > 'z')) &&
+- ((sModule[a] < 'A') || (sModule[a] > 'Z')) && (sModule[a] != '_')) {
+- sRetMsg =
+- t_f("Module names can only contain letters, numbers and "
+- "underscores, [{1}] is invalid")(sModule);
+- return nullptr;
+- }
++ if (!ValidateModuleName(sModule, sRetMsg)) {
++ return nullptr;
+ }
+
+ // The second argument to dlopen() has a long history. It seems clear
diff --git a/main/alpine-git-mirror-syncd/APKBUILD b/main/alpine-git-mirror-syncd/APKBUILD
index 72574046de..d465f2e700 100644
--- a/main/alpine-git-mirror-syncd/APKBUILD
+++ b/main/alpine-git-mirror-syncd/APKBUILD
@@ -2,14 +2,14 @@
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=alpine-git-mirror-syncd
_shortname=git-mirror-syncd
-pkgver=0.3.0
+pkgver=0.3.1
pkgrel=0
pkgdesc="Lua script that listens on MQTT and synchronizes Git mirrors when notified about changes"
url="https://github.com/jirutka/alpine-git-mirror-syncd"
arch="noarch"
license="MIT"
depends="ca-certificates git lua5.1 lua5.1-cjson lua5.1-mosquitto"
-source="$pkgname-$pkgver.tar.gz::https://github.com/jirutka/$pkgname/archive/v$pkgver.tar.gz"
+source="https://github.com/jirutka/$pkgname/archive/v$pkgver/$pkgname-$pkgver.tar.gz"
builddir="$srcdir/$pkgname-$pkgver"
options="!check" # upstream does not provide any tests yet
@@ -28,4 +28,4 @@ package() {
install -D -m 644 etc/conf.d/$_shortname "$pkgdir"/etc/conf.d/$_shortname
}
-sha512sums="714deff8915eefbc48f6786d3142f75a8befbd48f6bf1e20ba369fd66e5e1c41c7226972b199b736c43fa70728142daf6ae26f211c0b37ac87d4a2d2f959f8f1 alpine-git-mirror-syncd-0.3.0.tar.gz"
+sha512sums="ec85f1907d23332c9342aa6e44edc9591fdd5f77501de7df39abdacff7482d942aa499ba70152b461f7ec2d77f72279710e55d14def483b69bdc39651b272008 alpine-git-mirror-syncd-0.3.1.tar.gz"
diff --git a/main/ansible/APKBUILD b/main/ansible/APKBUILD
index e23d0826f9..688a7e9b85 100644
--- a/main/ansible/APKBUILD
+++ b/main/ansible/APKBUILD
@@ -3,15 +3,16 @@
# Contributor: Takuya Noguchi <takninnovationresearch@gmail.com>
# Maintainer: Fabian Affolter <fabian@affolter-engineering.ch>
pkgname=ansible
-pkgver=2.7.0
-pkgrel=1
+pkgver=2.7.12
+pkgrel=0
pkgdesc="A configuration-management, deployment, task-execution, and multinode orchestration framework"
url="https://ansible.com"
arch="noarch"
license="GPL-3.0-or-later"
_py=py3
depends="python3 $_py-yaml $_py-paramiko $_py-jinja2 $_py-markupsafe $_py-crypto"
-makedepends="python2-dev py-setuptools"
+makedepends="python3-dev py3-setuptools"
+options="!check" # not included in release tarball
subpackages="$pkgname-doc"
source="$pkgname-$pkgver.tar.gz::https://releases.ansible.com/ansible/$pkgname-$pkgver.tar.gz
add-lxc-container_shell-option.patch
@@ -20,9 +21,24 @@ source="$pkgname-$pkgver.tar.gz::https://releases.ansible.com/ansible/$pkgname-$
builddir="$srcdir/$pkgname-$pkgver"
# secfixes:
+# 2.7.12-r0:
+# - CVE-2019-101562
+# 2.7.8-r0:
+# - CVE-2019-38287
+# 2.7.5-r0:
+# - CVE-2018-16876
+# 2.7.3-r0:
+# - CVE 2018-16859
+# 2.7.1-r0:
+# - CVE-2018-16837
# 2.6.3-r0:
# - CVE-2018-10875
+prepare() {
+ # Windows-only scripts
+ rm -r examples/scripts
+}
+
build() {
cd "$builddir"
python3 setup.py build
@@ -42,5 +58,5 @@ package() {
install -m644 README.rst "$pkgdir"/usr/share/doc/$pkgname
}
-sha512sums="a5e0e0b87bb2fa8fbc76825733a5c6afe642d4602be80466e5f28324e90be4487fd1c300e567a164222f171bd9eac65b7b36ca9b6fe4bebfcbd2c24dd60049ad ansible-2.7.0.tar.gz
+sha512sums="0ab68af8239f6d4d2a13bd38a09fe6f3c700231e7c83df0af77c70ea62faebd0d45e1ff316963c6c72931608d49a79b98e8d3ddc6f4c8b826aabe87dc71cc6f9 ansible-2.7.12.tar.gz
e1bd1affec585abf4556d1f2598df2689c2341fc0ddaec3eadc0a9c6df5725b8ab97092771f2c57da6ecaa72ae1bb5e5ccce55db8c4d74bfc785f611dd5b8c32 add-lxc-container_shell-option.patch"
diff --git a/main/avahi/APKBUILD b/main/avahi/APKBUILD
index db7e8135a4..2784482032 100644
--- a/main/avahi/APKBUILD
+++ b/main/avahi/APKBUILD
@@ -1,7 +1,7 @@
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=avahi
pkgver=0.7
-pkgrel=1
+pkgrel=2
pkgdesc="A multicast/unicast DNS-SD framework"
url="https://www.avahi.org/"
arch="all"
@@ -17,9 +17,16 @@ subpackages="$pkgname-dev $pkgname-doc $pkgname-tools $pkgname-glib
$pkgname-libs $pkgname-compat-howl:howl
$pkgname-compat-libdns_sd:lidns_sd $pkgname-lang
py2-avahi:_py2:noarch"
-source="https://github.com/lathiat/avahi/releases/download/v$pkgver/avahi-$pkgver.tar.gz"
+source="https://github.com/lathiat/avahi/releases/download/v$pkgver/avahi-$pkgver.tar.gz
+ CVE-2017-6519-and-CVE-2018-1000845.patch
+ "
builddir="$srcdir/$pkgname-$pkgver"
+# secfixes:
+# 0.7-r2:
+# - CVE-2017-6519
+# - CVE-2018-1000845
+
prepare() {
default_prepare
autoreconf -vif
@@ -128,4 +135,5 @@ _py2() {
mv "$pkgdir"/usr/lib/python2.* "$subpkgdir"/usr/lib/
}
-sha512sums="bae5a1e9204aca90b90e7fd223d19e809e3514d03ba5fa2da1e55bf1d72d3d3b98567f357900c36393613dc17dc98e15ff3ebf0f226f2f6b9766e592452a6ce7 avahi-0.7.tar.gz"
+sha512sums="bae5a1e9204aca90b90e7fd223d19e809e3514d03ba5fa2da1e55bf1d72d3d3b98567f357900c36393613dc17dc98e15ff3ebf0f226f2f6b9766e592452a6ce7 avahi-0.7.tar.gz
+dc5c9fde8d1244e70e3cf1c09bc274b094458d2fad982f5a79bcbf3cbddc43a0cf79e9ba106b3b0446a6f0b006fd3beeee48a03bd3d8a06cf8d9821f6945ffed CVE-2017-6519-and-CVE-2018-1000845.patch"
diff --git a/main/avahi/CVE-2017-6519-and-CVE-2018-1000845.patch b/main/avahi/CVE-2017-6519-and-CVE-2018-1000845.patch
new file mode 100644
index 0000000000..513489fa5b
--- /dev/null
+++ b/main/avahi/CVE-2017-6519-and-CVE-2018-1000845.patch
@@ -0,0 +1,27 @@
+diff --git a/avahi-core/server.c b/avahi-core/server.c
+index a2cb19a..a2580e3 100644
+--- a/avahi-core/server.c
++++ b/avahi-core/server.c
+@@ -930,6 +930,7 @@ static void dispatch_packet(AvahiServer *s, AvahiDnsPacket *p, const AvahiAddres
+
+ if (avahi_dns_packet_is_query(p)) {
+ int legacy_unicast = 0;
++ char t[AVAHI_ADDRESS_STR_MAX];
+
+ /* For queries EDNS0 might allow ARCOUNT != 0. We ignore the
+ * AR section completely here, so far. Until the day we add
+@@ -947,6 +948,13 @@ static void dispatch_packet(AvahiServer *s, AvahiDnsPacket *p, const AvahiAddres
+ legacy_unicast = 1;
+ }
+
++ if (!is_mdns_mcast_address(dst_address) &&
++ !avahi_interface_address_on_link(i, src_address)) {
++
++ avahi_log_debug("Received non-local unicast query from host %s on interface '%s.%i'.", avahi_address_snprint(t, sizeof(t), src_address), i->hardware->name, i->protocol);
++ return;
++ }
++
+ if (legacy_unicast)
+ reflect_legacy_unicast_query_packet(s, p, i, src_address, port);
+
+
diff --git a/main/ghostscript/APKBUILD b/main/ghostscript/APKBUILD
index 84fa2799c4..ff515ed561 100644
--- a/main/ghostscript/APKBUILD
+++ b/main/ghostscript/APKBUILD
@@ -2,7 +2,7 @@
# Maintainer: Cameron Banta <cbanta@gmail.com>
pkgname=ghostscript
pkgver=9.26
-pkgrel=2
+pkgrel=3
pkgdesc="An interpreter for the PostScript language and for PDF"
url="https://ghostscript.com/"
arch="all"
@@ -16,12 +16,15 @@ source="https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/download/
CVE-2019-6116.patch
CVE-2019-3835.patch
CVE-2019-3838.patch
+ CVE-2019-10216.patch
ghostscript-system-zlib.patch
fix-sprintf.patch
"
builddir="$srcdir/$pkgname-$pkgver"
# secfixes:
+# 9.26-r3:
+# - CVE-2019-10216
# 9.26-r2:
# - CVE-2019-3835
# - CVE-2019-3838
@@ -135,8 +138,9 @@ gtk() {
sha512sums="670159c23618ffafa85c671642bf182a107a82c053a1fd8c3f45f73f203524077be1b212d2ddbabae7892c7713922877e03b020f78bd2aab1ae582c4fc7d820a ghostscript-9.26.tar.gz
289d916a0b0da410e6f721e42bc44659c91c66ca0f7b96b1a6b010ae1c25e47788e282edc3578b4e4b120a2c684c7b1fd4cc574084bdc9cbbf6e431a01fbae0e 0001-Bug700317-Address-.force-operators-exposure.tgz
+78564c1dd878cb6a924663cb5d61901a413a867dedc8753e537e08a4da9cc0aaeb817bab266fd66e5d0e871d9ed6078af6e6f455b5426e0917875682d76638f5 CVE-2019-6116.patch
31769852e75be4e1cd0e7c3f43cc7b3457bf9ba505fc2a5acda53779cc5626854bf15fef3e225f3d922f4038dd18c598dbac30abb863159202e4d0fe02c02d3b CVE-2019-3835.patch
dc3bd1de86e4a968ed35a35a125f682cffeed51fe4dbf9b3939dd78b07ef0748fe6b34816e689bcfffb4f819e51bcb5022f3151a5610aa24fd2468cdcbc665ea CVE-2019-3838.patch
-78564c1dd878cb6a924663cb5d61901a413a867dedc8753e537e08a4da9cc0aaeb817bab266fd66e5d0e871d9ed6078af6e6f455b5426e0917875682d76638f5 CVE-2019-6116.patch
+f89744b17922b7d9c04c6de69ce35fa621732e4373eccc158b7ff6a9e56d2cf0bbea30c28119f4808864ca584e94342e5125d7bcc6195252455b5f223f379e3f CVE-2019-10216.patch
70721e3a335afa5e21d4e6cf919119010bd4544a03ab8f53f5325c173902221ad9b88c118b4bfeee80b3e1956bcdbaf4c53f64ae7fb81f5ba57dbc956750c482 ghostscript-system-zlib.patch
beefcf395f7f828e1b81c088022c08a506e218f27535b9de01e0f0edf7979b435316c318fa676771630f6ad16ff1ab059cd68aa128ed97e5a9f2f3fa840200c4 fix-sprintf.patch"
diff --git a/main/ghostscript/CVE-2019-10216.patch b/main/ghostscript/CVE-2019-10216.patch
new file mode 100644
index 0000000000..e8dfa05a94
--- /dev/null
+++ b/main/ghostscript/CVE-2019-10216.patch
@@ -0,0 +1,49 @@
+From 5b85ddd19a8420a1bd2d5529325be35d78e94234 Mon Sep 17 00:00:00 2001
+From: Chris Liddell <chris.liddell@artifex.com>
+Date: Fri, 2 Aug 2019 15:18:26 +0100
+Subject: [PATCH] Bug 701394: protect use of .forceput with executeonly
+
+---
+ Resource/Init/gs_type1.ps | 14 +++++++-------
+ 1 file changed, 7 insertions(+), 7 deletions(-)
+
+diff --git a/Resource/Init/gs_type1.ps b/Resource/Init/gs_type1.ps
+index 6c7735b..a039cce 100644
+--- a/Resource/Init/gs_type1.ps
++++ b/Resource/Init/gs_type1.ps
+@@ -118,25 +118,25 @@
+ ( to be the same as glyph: ) print 1 index //== exec } if
+ 3 index exch 3 index .forceput
+ % scratch(string) RAGL(dict) AGL(dict) CharStrings(dict) cstring gname
+- }
++ }executeonly
+ {pop} ifelse
+- } forall
++ } executeonly forall
+ pop pop
+- }
++ } executeonly
+ {
+ pop pop pop
+ } ifelse
+- }
++ } executeonly
+ {
+ % scratch(string) RAGL(dict) AGL(dict) CharStrings(dict) cstring gname
+ pop pop
+ } ifelse
+- } forall
++ } executeonly forall
+ 3 1 roll pop pop
+- } if
++ } executeonly if
+ pop
+ dup /.AGLprocessed~GS //true .forceput
+- } if
++ } executeonly if
+
+ %% We need to excute the C .buildfont1 in a stopped context so that, if there
+ %% are errors we can put the stack back sanely and exit. Otherwise callers won't
+--
+2.9.1
+
diff --git a/main/hostapd/0001-OpenSSL-Use-constant-time-operations-for-private-big.patch b/main/hostapd/0001-OpenSSL-Use-constant-time-operations-for-private-big.patch
new file mode 100644
index 0000000000..516c3b633a
--- /dev/null
+++ b/main/hostapd/0001-OpenSSL-Use-constant-time-operations-for-private-big.patch
@@ -0,0 +1,92 @@
+From d42c477cc794163a3757956bbffca5cea000923c Mon Sep 17 00:00:00 2001
+From: Jouni Malinen <jouni@codeaurora.org>
+Date: Tue, 26 Feb 2019 11:43:03 +0200
+Subject: [PATCH] OpenSSL: Use constant time operations for private bignums
+
+This helps in reducing measurable timing differences in operations
+involving private information. BoringSSL has removed BN_FLG_CONSTTIME
+and expects specific constant time functions to be called instead, so a
+bit different approach is needed depending on which library is used.
+
+The main operation that needs protection against side channel attacks is
+BN_mod_exp() that depends on private keys (the public key validation
+step in crypto_dh_derive_secret() is an exception that can use the
+faster version since it does not depend on private keys).
+
+crypto_bignum_div() is currently used only in SAE FFC case with not
+safe-prime groups and only with values that do not depend on private
+keys, so it is not critical to protect it.
+
+crypto_bignum_inverse() is currently used only in SAE FFC PWE
+derivation. The additional protection here is targeting only OpenSSL.
+BoringSSL may need conversion to using BN_mod_inverse_blinded().
+
+This is related to CVE-2019-9494 and CVE-2019-9495.
+
+Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
+---
+ src/crypto/crypto_openssl.c | 20 +++++++++++++++-----
+ 1 file changed, 15 insertions(+), 5 deletions(-)
+
+diff --git a/src/crypto/crypto_openssl.c b/src/crypto/crypto_openssl.c
+index 9c2ba58d5..ac53cc81a 100644
+--- a/src/crypto/crypto_openssl.c
++++ b/src/crypto/crypto_openssl.c
+@@ -607,7 +607,8 @@ int crypto_mod_exp(const u8 *base, size_t base_len,
+ bn_result == NULL)
+ goto error;
+
+- if (BN_mod_exp(bn_result, bn_base, bn_exp, bn_modulus, ctx) != 1)
++ if (BN_mod_exp_mont_consttime(bn_result, bn_base, bn_exp, bn_modulus,
++ ctx, NULL) != 1)
+ goto error;
+
+ *result_len = BN_bn2bin(bn_result, result);
+@@ -1360,8 +1361,9 @@ int crypto_bignum_exptmod(const struct crypto_bignum *a,
+ bnctx = BN_CTX_new();
+ if (bnctx == NULL)
+ return -1;
+- res = BN_mod_exp((BIGNUM *) d, (const BIGNUM *) a, (const BIGNUM *) b,
+- (const BIGNUM *) c, bnctx);
++ res = BN_mod_exp_mont_consttime((BIGNUM *) d, (const BIGNUM *) a,
++ (const BIGNUM *) b, (const BIGNUM *) c,
++ bnctx, NULL);
+ BN_CTX_free(bnctx);
+
+ return res ? 0 : -1;
+@@ -1380,6 +1382,11 @@ int crypto_bignum_inverse(const struct crypto_bignum *a,
+ bnctx = BN_CTX_new();
+ if (bnctx == NULL)
+ return -1;
++#ifdef OPENSSL_IS_BORINGSSL
++ /* TODO: use BN_mod_inverse_blinded() ? */
++#else /* OPENSSL_IS_BORINGSSL */
++ BN_set_flags((BIGNUM *) a, BN_FLG_CONSTTIME);
++#endif /* OPENSSL_IS_BORINGSSL */
+ res = BN_mod_inverse((BIGNUM *) c, (const BIGNUM *) a,
+ (const BIGNUM *) b, bnctx);
+ BN_CTX_free(bnctx);
+@@ -1413,6 +1420,9 @@ int crypto_bignum_div(const struct crypto_bignum *a,
+ bnctx = BN_CTX_new();
+ if (bnctx == NULL)
+ return -1;
++#ifndef OPENSSL_IS_BORINGSSL
++ BN_set_flags((BIGNUM *) a, BN_FLG_CONSTTIME);
++#endif /* OPENSSL_IS_BORINGSSL */
+ res = BN_div((BIGNUM *) c, NULL, (const BIGNUM *) a,
+ (const BIGNUM *) b, bnctx);
+ BN_CTX_free(bnctx);
+@@ -1504,8 +1514,8 @@ int crypto_bignum_legendre(const struct crypto_bignum *a,
+ /* exp = (p-1) / 2 */
+ !BN_sub(exp, (const BIGNUM *) p, BN_value_one()) ||
+ !BN_rshift1(exp, exp) ||
+- !BN_mod_exp(tmp, (const BIGNUM *) a, exp, (const BIGNUM *) p,
+- bnctx))
++ !BN_mod_exp_mont_consttime(tmp, (const BIGNUM *) a, exp,
++ (const BIGNUM *) p, bnctx, NULL))
+ goto fail;
+
+ if (BN_is_word(tmp, 1))
+--
+2.21.0
+
diff --git a/main/hostapd/0002-OpenSSL-Use-constant-time-selection-for-crypto_bignu.patch b/main/hostapd/0002-OpenSSL-Use-constant-time-selection-for-crypto_bignu.patch
new file mode 100644
index 0000000000..8e635c1371
--- /dev/null
+++ b/main/hostapd/0002-OpenSSL-Use-constant-time-selection-for-crypto_bignu.patch
@@ -0,0 +1,60 @@
+From c93461c1d98f52681717a088776ab32fd97872b0 Mon Sep 17 00:00:00 2001
+From: Jouni Malinen <jouni@codeaurora.org>
+Date: Fri, 8 Mar 2019 00:24:12 +0200
+Subject: [PATCH] OpenSSL: Use constant time selection for
+ crypto_bignum_legendre()
+
+Get rid of the branches that depend on the result of the Legendre
+operation. This is needed to avoid leaking information about different
+temporary results in blinding mechanisms.
+
+This is related to CVE-2019-9494 and CVE-2019-9495.
+
+Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
+---
+ src/crypto/crypto_openssl.c | 15 +++++++++------
+ 1 file changed, 9 insertions(+), 6 deletions(-)
+
+diff --git a/src/crypto/crypto_openssl.c b/src/crypto/crypto_openssl.c
+index ac53cc81a..0f52101ea 100644
+--- a/src/crypto/crypto_openssl.c
++++ b/src/crypto/crypto_openssl.c
+@@ -24,6 +24,7 @@
+ #endif /* CONFIG_ECC */
+
+ #include "common.h"
++#include "utils/const_time.h"
+ #include "wpabuf.h"
+ #include "dh_group5.h"
+ #include "sha1.h"
+@@ -1500,6 +1501,7 @@ int crypto_bignum_legendre(const struct crypto_bignum *a,
+ BN_CTX *bnctx;
+ BIGNUM *exp = NULL, *tmp = NULL;
+ int res = -2;
++ unsigned int mask;
+
+ if (TEST_FAIL())
+ return -2;
+@@ -1518,12 +1520,13 @@ int crypto_bignum_legendre(const struct crypto_bignum *a,
+ (const BIGNUM *) p, bnctx, NULL))
+ goto fail;
+
+- if (BN_is_word(tmp, 1))
+- res = 1;
+- else if (BN_is_zero(tmp))
+- res = 0;
+- else
+- res = -1;
++ /* Return 1 if tmp == 1, 0 if tmp == 0, or -1 otherwise. Need to use
++ * constant time selection to avoid branches here. */
++ res = -1;
++ mask = const_time_eq(BN_is_word(tmp, 1), 1);
++ res = const_time_select_int(mask, 1, res);
++ mask = const_time_eq(BN_is_zero(tmp), 1);
++ res = const_time_select_int(mask, 0, res);
+
+ fail:
+ BN_clear_free(tmp);
+--
+2.21.0
+
diff --git a/main/hostapd/0003-SAE-Minimize-timing-differences-in-PWE-derivation.patch b/main/hostapd/0003-SAE-Minimize-timing-differences-in-PWE-derivation.patch
new file mode 100644
index 0000000000..10b89d6b02
--- /dev/null
+++ b/main/hostapd/0003-SAE-Minimize-timing-differences-in-PWE-derivation.patch
@@ -0,0 +1,241 @@
+From 6513db3e96c43c2e36805cf5ead349765d18eaf7 Mon Sep 17 00:00:00 2001
+From: Jouni Malinen <jouni@codeaurora.org>
+Date: Tue, 26 Feb 2019 13:05:09 +0200
+Subject: [PATCH] SAE: Minimize timing differences in PWE derivation
+
+The QR test result can provide information about the password to an
+attacker, so try to minimize differences in how the
+sae_test_pwd_seed_ecc() result is used. (CVE-2019-9494)
+
+Use heap memory for the dummy password to allow the same password length
+to be used even with long passwords.
+
+Use constant time selection functions to track the real vs. dummy
+variables so that the exact same operations can be performed for both QR
+test results.
+
+Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
+---
+ src/common/sae.c | 106 +++++++++++++++++++++++++----------------------
+ 1 file changed, 57 insertions(+), 49 deletions(-)
+
+diff --git a/src/common/sae.c b/src/common/sae.c
+index 8129a7c15..d55323bcd 100644
+--- a/src/common/sae.c
++++ b/src/common/sae.c
+@@ -9,6 +9,7 @@
+ #include "includes.h"
+
+ #include "common.h"
++#include "utils/const_time.h"
+ #include "crypto/crypto.h"
+ #include "crypto/sha256.h"
+ #include "crypto/random.h"
+@@ -292,15 +293,12 @@ static int sae_test_pwd_seed_ecc(struct sae_data *sae, const u8 *pwd_seed,
+ const u8 *prime,
+ const struct crypto_bignum *qr,
+ const struct crypto_bignum *qnr,
+- struct crypto_bignum **ret_x_cand)
++ u8 *pwd_value)
+ {
+- u8 pwd_value[SAE_MAX_ECC_PRIME_LEN];
+ struct crypto_bignum *y_sqr, *x_cand;
+ int res;
+ size_t bits;
+
+- *ret_x_cand = NULL;
+-
+ wpa_hexdump_key(MSG_DEBUG, "SAE: pwd-seed", pwd_seed, SHA256_MAC_LEN);
+
+ /* pwd-value = KDF-z(pwd-seed, "SAE Hunting and Pecking", p) */
+@@ -309,7 +307,7 @@ static int sae_test_pwd_seed_ecc(struct sae_data *sae, const u8 *pwd_seed,
+ prime, sae->tmp->prime_len, pwd_value, bits) < 0)
+ return -1;
+ if (bits % 8)
+- buf_shift_right(pwd_value, sizeof(pwd_value), 8 - bits % 8);
++ buf_shift_right(pwd_value, sae->tmp->prime_len, 8 - bits % 8);
+ wpa_hexdump_key(MSG_DEBUG, "SAE: pwd-value",
+ pwd_value, sae->tmp->prime_len);
+
+@@ -320,20 +318,13 @@ static int sae_test_pwd_seed_ecc(struct sae_data *sae, const u8 *pwd_seed,
+ if (!x_cand)
+ return -1;
+ y_sqr = crypto_ec_point_compute_y_sqr(sae->tmp->ec, x_cand);
+- if (!y_sqr) {
+- crypto_bignum_deinit(x_cand, 1);
++ crypto_bignum_deinit(x_cand, 1);
++ if (!y_sqr)
+ return -1;
+- }
+
+ res = is_quadratic_residue_blind(sae, prime, bits, qr, qnr, y_sqr);
+ crypto_bignum_deinit(y_sqr, 1);
+- if (res <= 0) {
+- crypto_bignum_deinit(x_cand, 1);
+- return res;
+- }
+-
+- *ret_x_cand = x_cand;
+- return 1;
++ return res;
+ }
+
+
+@@ -454,25 +445,30 @@ static int sae_derive_pwe_ecc(struct sae_data *sae, const u8 *addr1,
+ const u8 *addr[3];
+ size_t len[3];
+ size_t num_elem;
+- u8 dummy_password[32];
+- size_t dummy_password_len;
++ u8 *dummy_password, *tmp_password;
+ int pwd_seed_odd = 0;
+ u8 prime[SAE_MAX_ECC_PRIME_LEN];
+ size_t prime_len;
+- struct crypto_bignum *x = NULL, *qr, *qnr;
++ struct crypto_bignum *x = NULL, *qr = NULL, *qnr = NULL;
++ u8 x_bin[SAE_MAX_ECC_PRIME_LEN];
++ u8 x_cand_bin[SAE_MAX_ECC_PRIME_LEN];
+ size_t bits;
+- int res;
++ int res = -1;
++ u8 found = 0; /* 0 (false) or 0xff (true) to be used as const_time_*
++ * mask */
+
+- dummy_password_len = password_len;
+- if (dummy_password_len > sizeof(dummy_password))
+- dummy_password_len = sizeof(dummy_password);
+- if (random_get_bytes(dummy_password, dummy_password_len) < 0)
+- return -1;
++ os_memset(x_bin, 0, sizeof(x_bin));
++
++ dummy_password = os_malloc(password_len);
++ tmp_password = os_malloc(password_len);
++ if (!dummy_password || !tmp_password ||
++ random_get_bytes(dummy_password, password_len) < 0)
++ goto fail;
+
+ prime_len = sae->tmp->prime_len;
+ if (crypto_bignum_to_bin(sae->tmp->prime, prime, sizeof(prime),
+ prime_len) < 0)
+- return -1;
++ goto fail;
+ bits = crypto_ec_prime_len_bits(sae->tmp->ec);
+
+ /*
+@@ -481,7 +477,7 @@ static int sae_derive_pwe_ecc(struct sae_data *sae, const u8 *addr1,
+ */
+ if (get_random_qr_qnr(prime, prime_len, sae->tmp->prime, bits,
+ &qr, &qnr) < 0)
+- return -1;
++ goto fail;
+
+ wpa_hexdump_ascii_key(MSG_DEBUG, "SAE: password",
+ password, password_len);
+@@ -497,7 +493,7 @@ static int sae_derive_pwe_ecc(struct sae_data *sae, const u8 *addr1,
+ */
+ sae_pwd_seed_key(addr1, addr2, addrs);
+
+- addr[0] = password;
++ addr[0] = tmp_password;
+ len[0] = password_len;
+ num_elem = 1;
+ if (identifier) {
+@@ -514,9 +510,8 @@ static int sae_derive_pwe_ecc(struct sae_data *sae, const u8 *addr1,
+ * attacks that attempt to determine the number of iterations required
+ * in the loop.
+ */
+- for (counter = 1; counter <= k || !x; counter++) {
++ for (counter = 1; counter <= k || !found; counter++) {
+ u8 pwd_seed[SHA256_MAC_LEN];
+- struct crypto_bignum *x_cand;
+
+ if (counter > 200) {
+ /* This should not happen in practice */
+@@ -524,36 +519,45 @@ static int sae_derive_pwe_ecc(struct sae_data *sae, const u8 *addr1,
+ break;
+ }
+
+- wpa_printf(MSG_DEBUG, "SAE: counter = %u", counter);
++ wpa_printf(MSG_DEBUG, "SAE: counter = %03u", counter);
++ const_time_select_bin(found, dummy_password, password,
++ password_len, tmp_password);
+ if (hmac_sha256_vector(addrs, sizeof(addrs), num_elem,
+ addr, len, pwd_seed) < 0)
+ break;
+
+ res = sae_test_pwd_seed_ecc(sae, pwd_seed,
+- prime, qr, qnr, &x_cand);
++ prime, qr, qnr, x_cand_bin);
++ const_time_select_bin(found, x_bin, x_cand_bin, prime_len,
++ x_bin);
++ pwd_seed_odd = const_time_select_u8(
++ found, pwd_seed_odd,
++ pwd_seed[SHA256_MAC_LEN - 1] & 0x01);
++ os_memset(pwd_seed, 0, sizeof(pwd_seed));
+ if (res < 0)
+ goto fail;
+- if (res > 0 && !x) {
+- wpa_printf(MSG_DEBUG,
+- "SAE: Selected pwd-seed with counter %u",
+- counter);
+- x = x_cand;
+- pwd_seed_odd = pwd_seed[SHA256_MAC_LEN - 1] & 0x01;
+- os_memset(pwd_seed, 0, sizeof(pwd_seed));
++ /* Need to minimize differences in handling res == 0 and 1 here
++ * to avoid differences in timing and instruction cache access,
++ * so use const_time_select_*() to make local copies of the
++ * values based on whether this loop iteration was the one that
++ * found the pwd-seed/x. */
++
++ /* found is 0 or 0xff here and res is 0 or 1. Bitwise OR of them
++ * (with res converted to 0/0xff) handles this in constant time.
++ */
++ found |= res * 0xff;
++ wpa_printf(MSG_DEBUG, "SAE: pwd-seed result %d found=0x%02x",
++ res, found);
++ }
+
+- /*
+- * Use a dummy password for the following rounds, if
+- * any.
+- */
+- addr[0] = dummy_password;
+- len[0] = dummy_password_len;
+- } else if (res > 0) {
+- crypto_bignum_deinit(x_cand, 1);
+- }
++ if (!found) {
++ wpa_printf(MSG_DEBUG, "SAE: Could not generate PWE");
++ res = -1;
++ goto fail;
+ }
+
++ x = crypto_bignum_init_set(x_bin, prime_len);
+ if (!x) {
+- wpa_printf(MSG_DEBUG, "SAE: Could not generate PWE");
+ res = -1;
+ goto fail;
+ }
+@@ -566,7 +570,6 @@ static int sae_derive_pwe_ecc(struct sae_data *sae, const u8 *addr1,
+ res = crypto_ec_point_solve_y_coord(sae->tmp->ec,
+ sae->tmp->pwe_ecc, x,
+ pwd_seed_odd);
+- crypto_bignum_deinit(x, 1);
+ if (res < 0) {
+ /*
+ * This should not happen since we already checked that there
+@@ -578,6 +581,11 @@ static int sae_derive_pwe_ecc(struct sae_data *sae, const u8 *addr1,
+ fail:
+ crypto_bignum_deinit(qr, 0);
+ crypto_bignum_deinit(qnr, 0);
++ os_free(dummy_password);
++ bin_clear_free(tmp_password, password_len);
++ crypto_bignum_deinit(x, 1);
++ os_memset(x_bin, 0, sizeof(x_bin));
++ os_memset(x_cand_bin, 0, sizeof(x_cand_bin));
+
+ return res;
+ }
+--
+2.21.0
+
diff --git a/main/hostapd/0004-SAE-Avoid-branches-in-is_quadratic_residue_blind.patch b/main/hostapd/0004-SAE-Avoid-branches-in-is_quadratic_residue_blind.patch
new file mode 100644
index 0000000000..aad9b1d4a4
--- /dev/null
+++ b/main/hostapd/0004-SAE-Avoid-branches-in-is_quadratic_residue_blind.patch
@@ -0,0 +1,144 @@
+From 362704dda04507e7ebb8035122e83d9f0ae7c320 Mon Sep 17 00:00:00 2001
+From: Jouni Malinen <jouni@codeaurora.org>
+Date: Tue, 26 Feb 2019 19:34:38 +0200
+Subject: [PATCH] SAE: Avoid branches in is_quadratic_residue_blind()
+
+Make the non-failure path in the function proceed without branches based
+on r_odd and in constant time to minimize risk of observable differences
+in timing or cache use. (CVE-2019-9494)
+
+Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
+---
+ src/common/sae.c | 64 ++++++++++++++++++++++++++++--------------------
+ 1 file changed, 37 insertions(+), 27 deletions(-)
+
+diff --git a/src/common/sae.c b/src/common/sae.c
+index d55323bcd..5df9b95aa 100644
+--- a/src/common/sae.c
++++ b/src/common/sae.c
+@@ -232,12 +232,14 @@ get_rand_1_to_p_1(const u8 *prime, size_t prime_len, size_t prime_bits,
+
+ static int is_quadratic_residue_blind(struct sae_data *sae,
+ const u8 *prime, size_t bits,
+- const struct crypto_bignum *qr,
+- const struct crypto_bignum *qnr,
++ const u8 *qr, const u8 *qnr,
+ const struct crypto_bignum *y_sqr)
+ {
+- struct crypto_bignum *r, *num;
++ struct crypto_bignum *r, *num, *qr_or_qnr = NULL;
+ int r_odd, check, res = -1;
++ u8 qr_or_qnr_bin[SAE_MAX_ECC_PRIME_LEN];
++ size_t prime_len = sae->tmp->prime_len;
++ unsigned int mask;
+
+ /*
+ * Use the blinding technique to mask y_sqr while determining
+@@ -248,7 +250,7 @@ static int is_quadratic_residue_blind(struct sae_data *sae,
+ * r = a random number between 1 and p-1, inclusive
+ * num = (v * r * r) modulo p
+ */
+- r = get_rand_1_to_p_1(prime, sae->tmp->prime_len, bits, &r_odd);
++ r = get_rand_1_to_p_1(prime, prime_len, bits, &r_odd);
+ if (!r)
+ return -1;
+
+@@ -258,41 +260,45 @@ static int is_quadratic_residue_blind(struct sae_data *sae,
+ crypto_bignum_mulmod(num, r, sae->tmp->prime, num) < 0)
+ goto fail;
+
+- if (r_odd) {
+- /*
+- * num = (num * qr) module p
+- * LGR(num, p) = 1 ==> quadratic residue
+- */
+- if (crypto_bignum_mulmod(num, qr, sae->tmp->prime, num) < 0)
+- goto fail;
+- check = 1;
+- } else {
+- /*
+- * num = (num * qnr) module p
+- * LGR(num, p) = -1 ==> quadratic residue
+- */
+- if (crypto_bignum_mulmod(num, qnr, sae->tmp->prime, num) < 0)
+- goto fail;
+- check = -1;
+- }
++ /*
++ * Need to minimize differences in handling different cases, so try to
++ * avoid branches and timing differences.
++ *
++ * If r_odd:
++ * num = (num * qr) module p
++ * LGR(num, p) = 1 ==> quadratic residue
++ * else:
++ * num = (num * qnr) module p
++ * LGR(num, p) = -1 ==> quadratic residue
++ */
++ mask = const_time_is_zero(r_odd);
++ const_time_select_bin(mask, qnr, qr, prime_len, qr_or_qnr_bin);
++ qr_or_qnr = crypto_bignum_init_set(qr_or_qnr_bin, prime_len);
++ if (!qr_or_qnr ||
++ crypto_bignum_mulmod(num, qr_or_qnr, sae->tmp->prime, num) < 0)
++ goto fail;
++ /* r_odd is 0 or 1; branchless version of check = r_odd ? 1 : -1, */
++ check = const_time_select_int(mask, -1, 1);
+
+ res = crypto_bignum_legendre(num, sae->tmp->prime);
+ if (res == -2) {
+ res = -1;
+ goto fail;
+ }
+- res = res == check;
++ /* branchless version of res = res == check
++ * (res is -1, 0, or 1; check is -1 or 1) */
++ mask = const_time_eq(res, check);
++ res = const_time_select_int(mask, 1, 0);
+ fail:
+ crypto_bignum_deinit(num, 1);
+ crypto_bignum_deinit(r, 1);
++ crypto_bignum_deinit(qr_or_qnr, 1);
+ return res;
+ }
+
+
+ static int sae_test_pwd_seed_ecc(struct sae_data *sae, const u8 *pwd_seed,
+- const u8 *prime,
+- const struct crypto_bignum *qr,
+- const struct crypto_bignum *qnr,
++ const u8 *prime, const u8 *qr, const u8 *qnr,
+ u8 *pwd_value)
+ {
+ struct crypto_bignum *y_sqr, *x_cand;
+@@ -452,6 +458,8 @@ static int sae_derive_pwe_ecc(struct sae_data *sae, const u8 *addr1,
+ struct crypto_bignum *x = NULL, *qr = NULL, *qnr = NULL;
+ u8 x_bin[SAE_MAX_ECC_PRIME_LEN];
+ u8 x_cand_bin[SAE_MAX_ECC_PRIME_LEN];
++ u8 qr_bin[SAE_MAX_ECC_PRIME_LEN];
++ u8 qnr_bin[SAE_MAX_ECC_PRIME_LEN];
+ size_t bits;
+ int res = -1;
+ u8 found = 0; /* 0 (false) or 0xff (true) to be used as const_time_*
+@@ -476,7 +484,9 @@ static int sae_derive_pwe_ecc(struct sae_data *sae, const u8 *addr1,
+ * (qnr) modulo p for blinding purposes during the loop.
+ */
+ if (get_random_qr_qnr(prime, prime_len, sae->tmp->prime, bits,
+- &qr, &qnr) < 0)
++ &qr, &qnr) < 0 ||
++ crypto_bignum_to_bin(qr, qr_bin, sizeof(qr_bin), prime_len) < 0 ||
++ crypto_bignum_to_bin(qnr, qnr_bin, sizeof(qnr_bin), prime_len) < 0)
+ goto fail;
+
+ wpa_hexdump_ascii_key(MSG_DEBUG, "SAE: password",
+@@ -527,7 +537,7 @@ static int sae_derive_pwe_ecc(struct sae_data *sae, const u8 *addr1,
+ break;
+
+ res = sae_test_pwd_seed_ecc(sae, pwd_seed,
+- prime, qr, qnr, x_cand_bin);
++ prime, qr_bin, qnr_bin, x_cand_bin);
+ const_time_select_bin(found, x_bin, x_cand_bin, prime_len,
+ x_bin);
+ pwd_seed_odd = const_time_select_u8(
+--
+2.21.0
+
diff --git a/main/hostapd/0005-SAE-Mask-timing-of-MODP-groups-22-23-24.patch b/main/hostapd/0005-SAE-Mask-timing-of-MODP-groups-22-23-24.patch
new file mode 100644
index 0000000000..11dc244f5f
--- /dev/null
+++ b/main/hostapd/0005-SAE-Mask-timing-of-MODP-groups-22-23-24.patch
@@ -0,0 +1,118 @@
+From 90839597cc4016b33f00055b12d59174c62770a3 Mon Sep 17 00:00:00 2001
+From: Jouni Malinen <jouni@codeaurora.org>
+Date: Sat, 2 Mar 2019 12:24:09 +0200
+Subject: [PATCH] SAE: Mask timing of MODP groups 22, 23, 24
+
+These groups have significant probability of coming up with pwd-value
+that is equal or greater than the prime and as such, need for going
+through the PWE derivation loop multiple times. This can result in
+sufficient timing different to allow an external observer to determine
+how many rounds are needed and that can leak information about the used
+password.
+
+Force at least 40 loop rounds for these MODP groups similarly to the ECC
+group design to mask timing. This behavior is not described in IEEE Std
+802.11-2016 for SAE, but it does not result in different values (i.e.,
+only different timing), so such implementation specific countermeasures
+can be done without breaking interoperability with other implementation.
+
+Note: These MODP groups 22, 23, and 24 are not considered sufficiently
+strong to be used with SAE (or more or less anything else). As such,
+they should never be enabled in runtime configuration for any production
+use cases. These changes to introduce additional protection to mask
+timing is only for completeness of implementation and not an indication
+that these groups should be used.
+
+This is related to CVE-2019-9494.
+
+Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
+---
+ src/common/sae.c | 38 ++++++++++++++++++++++++++++----------
+ 1 file changed, 28 insertions(+), 10 deletions(-)
+
+diff --git a/src/common/sae.c b/src/common/sae.c
+index 5df9b95aa..75b1b4a83 100644
+--- a/src/common/sae.c
++++ b/src/common/sae.c
+@@ -601,22 +601,27 @@ fail:
+ }
+
+
++static int sae_modp_group_require_masking(int group)
++{
++ /* Groups for which pwd-value is likely to be >= p frequently */
++ return group == 22 || group == 23 || group == 24;
++}
++
++
+ static int sae_derive_pwe_ffc(struct sae_data *sae, const u8 *addr1,
+ const u8 *addr2, const u8 *password,
+ size_t password_len, const char *identifier)
+ {
+- u8 counter;
++ u8 counter, k;
+ u8 addrs[2 * ETH_ALEN];
+ const u8 *addr[3];
+ size_t len[3];
+ size_t num_elem;
+ int found = 0;
++ struct crypto_bignum *pwe = NULL;
+
+- if (sae->tmp->pwe_ffc == NULL) {
+- sae->tmp->pwe_ffc = crypto_bignum_init();
+- if (sae->tmp->pwe_ffc == NULL)
+- return -1;
+- }
++ crypto_bignum_deinit(sae->tmp->pwe_ffc, 1);
++ sae->tmp->pwe_ffc = NULL;
+
+ wpa_hexdump_ascii_key(MSG_DEBUG, "SAE: password",
+ password, password_len);
+@@ -640,7 +645,9 @@ static int sae_derive_pwe_ffc(struct sae_data *sae, const u8 *addr1,
+ len[num_elem] = sizeof(counter);
+ num_elem++;
+
+- for (counter = 1; !found; counter++) {
++ k = sae_modp_group_require_masking(sae->group) ? 40 : 1;
++
++ for (counter = 1; counter <= k || !found; counter++) {
+ u8 pwd_seed[SHA256_MAC_LEN];
+ int res;
+
+@@ -650,19 +657,30 @@ static int sae_derive_pwe_ffc(struct sae_data *sae, const u8 *addr1,
+ break;
+ }
+
+- wpa_printf(MSG_DEBUG, "SAE: counter = %u", counter);
++ wpa_printf(MSG_DEBUG, "SAE: counter = %02u", counter);
+ if (hmac_sha256_vector(addrs, sizeof(addrs), num_elem,
+ addr, len, pwd_seed) < 0)
+ break;
+- res = sae_test_pwd_seed_ffc(sae, pwd_seed, sae->tmp->pwe_ffc);
++ if (!pwe) {
++ pwe = crypto_bignum_init();
++ if (!pwe)
++ break;
++ }
++ res = sae_test_pwd_seed_ffc(sae, pwd_seed, pwe);
+ if (res < 0)
+ break;
+ if (res > 0) {
+- wpa_printf(MSG_DEBUG, "SAE: Use this PWE");
+ found = 1;
++ if (!sae->tmp->pwe_ffc) {
++ wpa_printf(MSG_DEBUG, "SAE: Use this PWE");
++ sae->tmp->pwe_ffc = pwe;
++ pwe = NULL;
++ }
+ }
+ }
+
++ crypto_bignum_deinit(pwe, 1);
++
+ return found ? 0 : -1;
+ }
+
+--
+2.21.0
+
diff --git a/main/hostapd/0006-SAE-Use-const_time-selection-for-PWE-in-FFC.patch b/main/hostapd/0006-SAE-Use-const_time-selection-for-PWE-in-FFC.patch
new file mode 100644
index 0000000000..f336d5b74a
--- /dev/null
+++ b/main/hostapd/0006-SAE-Use-const_time-selection-for-PWE-in-FFC.patch
@@ -0,0 +1,105 @@
+From f8f20717f87eff1f025f48ed585c7684debacf72 Mon Sep 17 00:00:00 2001
+From: Jouni Malinen <jouni@codeaurora.org>
+Date: Sat, 2 Mar 2019 12:45:33 +0200
+Subject: [PATCH] SAE: Use const_time selection for PWE in FFC
+
+This is an initial step towards making the FFC case use strictly
+constant time operations similarly to the ECC case.
+sae_test_pwd_seed_ffc() does not yet have constant time behavior,
+though.
+
+This is related to CVE-2019-9494.
+
+Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
+---
+ src/common/sae.c | 53 ++++++++++++++++++++++++++++++++----------------
+ 1 file changed, 35 insertions(+), 18 deletions(-)
+
+diff --git a/src/common/sae.c b/src/common/sae.c
+index 75b1b4a83..fa9a145e3 100644
+--- a/src/common/sae.c
++++ b/src/common/sae.c
+@@ -612,17 +612,28 @@ static int sae_derive_pwe_ffc(struct sae_data *sae, const u8 *addr1,
+ const u8 *addr2, const u8 *password,
+ size_t password_len, const char *identifier)
+ {
+- u8 counter, k;
++ u8 counter, k, sel_counter = 0;
+ u8 addrs[2 * ETH_ALEN];
+ const u8 *addr[3];
+ size_t len[3];
+ size_t num_elem;
+- int found = 0;
+- struct crypto_bignum *pwe = NULL;
++ u8 found = 0; /* 0 (false) or 0xff (true) to be used as const_time_*
++ * mask */
++ u8 mask;
++ struct crypto_bignum *pwe;
++ size_t prime_len = sae->tmp->prime_len * 8;
++ u8 *pwe_buf;
+
+ crypto_bignum_deinit(sae->tmp->pwe_ffc, 1);
+ sae->tmp->pwe_ffc = NULL;
+
++ /* Allocate a buffer to maintain selected and candidate PWE for constant
++ * time selection. */
++ pwe_buf = os_zalloc(prime_len * 2);
++ pwe = crypto_bignum_init();
++ if (!pwe_buf || !pwe)
++ goto fail;
++
+ wpa_hexdump_ascii_key(MSG_DEBUG, "SAE: password",
+ password, password_len);
+
+@@ -661,27 +672,33 @@ static int sae_derive_pwe_ffc(struct sae_data *sae, const u8 *addr1,
+ if (hmac_sha256_vector(addrs, sizeof(addrs), num_elem,
+ addr, len, pwd_seed) < 0)
+ break;
+- if (!pwe) {
+- pwe = crypto_bignum_init();
+- if (!pwe)
+- break;
+- }
+ res = sae_test_pwd_seed_ffc(sae, pwd_seed, pwe);
++ /* res is -1 for fatal failure, 0 if a valid PWE was not found,
++ * or 1 if a valid PWE was found. */
+ if (res < 0)
+ break;
+- if (res > 0) {
+- found = 1;
+- if (!sae->tmp->pwe_ffc) {
+- wpa_printf(MSG_DEBUG, "SAE: Use this PWE");
+- sae->tmp->pwe_ffc = pwe;
+- pwe = NULL;
+- }
+- }
++ /* Store the candidate PWE into the second half of pwe_buf and
++ * the selected PWE in the beginning of pwe_buf using constant
++ * time selection. */
++ if (crypto_bignum_to_bin(pwe, pwe_buf + prime_len, prime_len,
++ prime_len) < 0)
++ break;
++ const_time_select_bin(found, pwe_buf, pwe_buf + prime_len,
++ prime_len, pwe_buf);
++ sel_counter = const_time_select_u8(found, sel_counter, counter);
++ mask = const_time_eq_u8(res, 1);
++ found = const_time_select_u8(found, found, mask);
+ }
+
+- crypto_bignum_deinit(pwe, 1);
++ if (!found)
++ goto fail;
+
+- return found ? 0 : -1;
++ wpa_printf(MSG_DEBUG, "SAE: Use PWE from counter = %02u", sel_counter);
++ sae->tmp->pwe_ffc = crypto_bignum_init_set(pwe_buf, prime_len);
++fail:
++ crypto_bignum_deinit(pwe, 1);
++ bin_clear_free(pwe_buf, prime_len * 2);
++ return sae->tmp->pwe_ffc ? 0 : -1;
+ }
+
+
+--
+2.21.0
+
diff --git a/main/hostapd/0007-SAE-Use-constant-time-operations-in-sae_test_pwd_see.patch b/main/hostapd/0007-SAE-Use-constant-time-operations-in-sae_test_pwd_see.patch
new file mode 100644
index 0000000000..bf22916b7d
--- /dev/null
+++ b/main/hostapd/0007-SAE-Use-constant-time-operations-in-sae_test_pwd_see.patch
@@ -0,0 +1,135 @@
+From cff138b0747fa39765cbc641b66cfa5d7f1735d1 Mon Sep 17 00:00:00 2001
+From: Jouni Malinen <jouni@codeaurora.org>
+Date: Sat, 2 Mar 2019 16:05:56 +0200
+Subject: [PATCH] SAE: Use constant time operations in sae_test_pwd_seed_ffc()
+
+Try to avoid showing externally visible timing or memory access
+differences regardless of whether the derived pwd-value is smaller than
+the group prime.
+
+This is related to CVE-2019-9494.
+
+Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
+---
+ src/common/sae.c | 75 +++++++++++++++++++++++++++++-------------------
+ 1 file changed, 46 insertions(+), 29 deletions(-)
+
+diff --git a/src/common/sae.c b/src/common/sae.c
+index fa9a145e3..eaf825d19 100644
+--- a/src/common/sae.c
++++ b/src/common/sae.c
+@@ -334,14 +334,17 @@ static int sae_test_pwd_seed_ecc(struct sae_data *sae, const u8 *pwd_seed,
+ }
+
+
++/* Returns -1 on fatal failure, 0 if PWE cannot be derived from the provided
++ * pwd-seed, or 1 if a valid PWE was derived from pwd-seed. */
+ static int sae_test_pwd_seed_ffc(struct sae_data *sae, const u8 *pwd_seed,
+ struct crypto_bignum *pwe)
+ {
+ u8 pwd_value[SAE_MAX_PRIME_LEN];
+ size_t bits = sae->tmp->prime_len * 8;
+ u8 exp[1];
+- struct crypto_bignum *a, *b;
+- int res;
++ struct crypto_bignum *a, *b = NULL;
++ int res, is_val;
++ u8 pwd_value_valid;
+
+ wpa_hexdump_key(MSG_DEBUG, "SAE: pwd-seed", pwd_seed, SHA256_MAC_LEN);
+
+@@ -353,16 +356,29 @@ static int sae_test_pwd_seed_ffc(struct sae_data *sae, const u8 *pwd_seed,
+ wpa_hexdump_key(MSG_DEBUG, "SAE: pwd-value", pwd_value,
+ sae->tmp->prime_len);
+
+- if (os_memcmp(pwd_value, sae->tmp->dh->prime, sae->tmp->prime_len) >= 0)
+- {
+- wpa_printf(MSG_DEBUG, "SAE: pwd-value >= p");
+- return 0;
+- }
++ /* Check whether pwd-value < p */
++ res = const_time_memcmp(pwd_value, sae->tmp->dh->prime,
++ sae->tmp->prime_len);
++ /* pwd-value >= p is invalid, so res is < 0 for the valid cases and
++ * the negative sign can be used to fill the mask for constant time
++ * selection */
++ pwd_value_valid = const_time_fill_msb(res);
++
++ /* If pwd-value >= p, force pwd-value to be < p and perform the
++ * calculations anyway to hide timing difference. The derived PWE will
++ * be ignored in that case. */
++ pwd_value[0] = const_time_select_u8(pwd_value_valid, pwd_value[0], 0);
+
+ /* PWE = pwd-value^((p-1)/r) modulo p */
+
++ res = -1;
+ a = crypto_bignum_init_set(pwd_value, sae->tmp->prime_len);
++ if (!a)
++ goto fail;
+
++ /* This is an optimization based on the used group that does not depend
++ * on the password in any way, so it is fine to use separate branches
++ * for this step without constant time operations. */
+ if (sae->tmp->dh->safe_prime) {
+ /*
+ * r = (p-1)/2 for the group used here, so this becomes:
+@@ -376,33 +392,34 @@ static int sae_test_pwd_seed_ffc(struct sae_data *sae, const u8 *pwd_seed,
+ b = crypto_bignum_init_set(exp, sizeof(exp));
+ if (b == NULL ||
+ crypto_bignum_sub(sae->tmp->prime, b, b) < 0 ||
+- crypto_bignum_div(b, sae->tmp->order, b) < 0) {
+- crypto_bignum_deinit(b, 0);
+- b = NULL;
+- }
++ crypto_bignum_div(b, sae->tmp->order, b) < 0)
++ goto fail;
+ }
+
+- if (a == NULL || b == NULL)
+- res = -1;
+- else
+- res = crypto_bignum_exptmod(a, b, sae->tmp->prime, pwe);
+-
+- crypto_bignum_deinit(a, 0);
+- crypto_bignum_deinit(b, 0);
++ if (!b)
++ goto fail;
+
+- if (res < 0) {
+- wpa_printf(MSG_DEBUG, "SAE: Failed to calculate PWE");
+- return -1;
+- }
++ res = crypto_bignum_exptmod(a, b, sae->tmp->prime, pwe);
++ if (res < 0)
++ goto fail;
+
+- /* if (PWE > 1) --> found */
+- if (crypto_bignum_is_zero(pwe) || crypto_bignum_is_one(pwe)) {
+- wpa_printf(MSG_DEBUG, "SAE: PWE <= 1");
+- return 0;
+- }
++ /* There were no fatal errors in calculations, so determine the return
++ * value using constant time operations. We get here for number of
++ * invalid cases which are cleared here after having performed all the
++ * computation. PWE is valid if pwd-value was less than prime and
++ * PWE > 1. Start with pwd-value check first and then use constant time
++ * operations to clear res to 0 if PWE is 0 or 1.
++ */
++ res = const_time_select_u8(pwd_value_valid, 1, 0);
++ is_val = crypto_bignum_is_zero(pwe);
++ res = const_time_select_u8(const_time_is_zero(is_val), res, 0);
++ is_val = crypto_bignum_is_one(pwe);
++ res = const_time_select_u8(const_time_is_zero(is_val), res, 0);
+
+- wpa_printf(MSG_DEBUG, "SAE: PWE found");
+- return 1;
++fail:
++ crypto_bignum_deinit(a, 1);
++ crypto_bignum_deinit(b, 1);
++ return res;
+ }
+
+
+--
+2.21.0
+
diff --git a/main/hostapd/0008-Add-helper-functions-for-constant-time-operations.patch b/main/hostapd/0008-Add-helper-functions-for-constant-time-operations.patch
new file mode 100644
index 0000000000..e0b8550c8f
--- /dev/null
+++ b/main/hostapd/0008-Add-helper-functions-for-constant-time-operations.patch
@@ -0,0 +1,218 @@
+From 6e34f618d37ddbb5854c42e2ad4fca83492fa7b7 Mon Sep 17 00:00:00 2001
+From: Jouni Malinen <jouni@codeaurora.org>
+Date: Wed, 27 Feb 2019 18:38:30 +0200
+Subject: [PATCH] Add helper functions for constant time operations
+
+These functions can be used to help implement constant time operations
+for various cryptographic operations that must minimize externally
+observable differences in processing (both in timing and also in
+internal cache use, etc.).
+
+This is related to CVE-2019-9494 and CVE-2019-9495.
+
+Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
+---
+ src/utils/const_time.h | 191 +++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 191 insertions(+)
+ create mode 100644 src/utils/const_time.h
+
+diff --git a/src/utils/const_time.h b/src/utils/const_time.h
+new file mode 100644
+index 000000000..ab8f611ef
+--- /dev/null
++++ b/src/utils/const_time.h
+@@ -0,0 +1,191 @@
++/*
++ * Helper functions for constant time operations
++ * Copyright (c) 2019, The Linux Foundation
++ *
++ * This software may be distributed under the terms of the BSD license.
++ * See README for more details.
++ *
++ * These helper functions can be used to implement logic that needs to minimize
++ * externally visible differences in execution path by avoiding use of branches,
++ * avoiding early termination or other time differences, and forcing same memory
++ * access pattern regardless of values.
++ */
++
++#ifndef CONST_TIME_H
++#define CONST_TIME_H
++
++
++#if defined(__clang__)
++#define NO_UBSAN_UINT_OVERFLOW \
++ __attribute__((no_sanitize("unsigned-integer-overflow")))
++#else
++#define NO_UBSAN_UINT_OVERFLOW
++#endif
++
++
++/**
++ * const_time_fill_msb - Fill all bits with MSB value
++ * @val: Input value
++ * Returns: Value with all the bits set to the MSB of the input val
++ */
++static inline unsigned int const_time_fill_msb(unsigned int val)
++{
++ /* Move the MSB to LSB and multiple by -1 to fill in all bits. */
++ return (val >> (sizeof(val) * 8 - 1)) * ~0U;
++}
++
++
++/* Returns: -1 if val is zero; 0 if val is not zero */
++static inline unsigned int const_time_is_zero(unsigned int val)
++ NO_UBSAN_UINT_OVERFLOW
++{
++ /* Set MSB to 1 for 0 and fill rest of bits with the MSB value */
++ return const_time_fill_msb(~val & (val - 1));
++}
++
++
++/* Returns: -1 if a == b; 0 if a != b */
++static inline unsigned int const_time_eq(unsigned int a, unsigned int b)
++{
++ return const_time_is_zero(a ^ b);
++}
++
++
++/* Returns: -1 if a == b; 0 if a != b */
++static inline u8 const_time_eq_u8(unsigned int a, unsigned int b)
++{
++ return (u8) const_time_eq(a, b);
++}
++
++
++/**
++ * const_time_eq_bin - Constant time memory comparison
++ * @a: First buffer to compare
++ * @b: Second buffer to compare
++ * @len: Number of octets to compare
++ * Returns: -1 if buffers are equal, 0 if not
++ *
++ * This function is meant for comparing passwords or hash values where
++ * difference in execution time or memory access pattern could provide external
++ * observer information about the location of the difference in the memory
++ * buffers. The return value does not behave like memcmp(), i.e.,
++ * const_time_eq_bin() cannot be used to sort items into a defined order. Unlike
++ * memcmp(), the execution time of const_time_eq_bin() does not depend on the
++ * contents of the compared memory buffers, but only on the total compared
++ * length.
++ */
++static inline unsigned int const_time_eq_bin(const void *a, const void *b,
++ size_t len)
++{
++ const u8 *aa = a;
++ const u8 *bb = b;
++ size_t i;
++ u8 res = 0;
++
++ for (i = 0; i < len; i++)
++ res |= aa[i] ^ bb[i];
++
++ return const_time_is_zero(res);
++}
++
++
++/**
++ * const_time_select - Constant time unsigned int selection
++ * @mask: 0 (false) or -1 (true) to identify which value to select
++ * @true_val: Value to select for the true case
++ * @false_val: Value to select for the false case
++ * Returns: true_val if mask == -1, false_val if mask == 0
++ */
++static inline unsigned int const_time_select(unsigned int mask,
++ unsigned int true_val,
++ unsigned int false_val)
++{
++ return (mask & true_val) | (~mask & false_val);
++}
++
++
++/**
++ * const_time_select_int - Constant time int selection
++ * @mask: 0 (false) or -1 (true) to identify which value to select
++ * @true_val: Value to select for the true case
++ * @false_val: Value to select for the false case
++ * Returns: true_val if mask == -1, false_val if mask == 0
++ */
++static inline int const_time_select_int(unsigned int mask, int true_val,
++ int false_val)
++{
++ return (int) const_time_select(mask, (unsigned int) true_val,
++ (unsigned int) false_val);
++}
++
++
++/**
++ * const_time_select_u8 - Constant time u8 selection
++ * @mask: 0 (false) or -1 (true) to identify which value to select
++ * @true_val: Value to select for the true case
++ * @false_val: Value to select for the false case
++ * Returns: true_val if mask == -1, false_val if mask == 0
++ */
++static inline u8 const_time_select_u8(u8 mask, u8 true_val, u8 false_val)
++{
++ return (u8) const_time_select(mask, true_val, false_val);
++}
++
++
++/**
++ * const_time_select_s8 - Constant time s8 selection
++ * @mask: 0 (false) or -1 (true) to identify which value to select
++ * @true_val: Value to select for the true case
++ * @false_val: Value to select for the false case
++ * Returns: true_val if mask == -1, false_val if mask == 0
++ */
++static inline s8 const_time_select_s8(u8 mask, s8 true_val, s8 false_val)
++{
++ return (s8) const_time_select(mask, (unsigned int) true_val,
++ (unsigned int) false_val);
++}
++
++
++/**
++ * const_time_select_bin - Constant time binary buffer selection copy
++ * @mask: 0 (false) or -1 (true) to identify which value to copy
++ * @true_val: Buffer to copy for the true case
++ * @false_val: Buffer to copy for the false case
++ * @len: Number of octets to copy
++ * @dst: Destination buffer for the copy
++ *
++ * This function copies the specified buffer into the destination buffer using
++ * operations with identical memory access pattern regardless of which buffer
++ * is being copied.
++ */
++static inline void const_time_select_bin(u8 mask, const u8 *true_val,
++ const u8 *false_val, size_t len,
++ u8 *dst)
++{
++ size_t i;
++
++ for (i = 0; i < len; i++)
++ dst[i] = const_time_select_u8(mask, true_val[i], false_val[i]);
++}
++
++
++static inline int const_time_memcmp(const void *a, const void *b, size_t len)
++{
++ const u8 *aa = a;
++ const u8 *bb = b;
++ int diff, res = 0;
++ unsigned int mask;
++
++ if (len == 0)
++ return 0;
++ do {
++ len--;
++ diff = (int) aa[len] - (int) bb[len];
++ mask = const_time_is_zero((unsigned int) diff);
++ res = const_time_select_int(mask, res, diff);
++ } while (len);
++
++ return res;
++}
++
++#endif /* CONST_TIME_H */
+--
+2.21.0
+
diff --git a/main/hostapd/0009-EAP-pwd-Use-constant-time-and-memory-access-for-find.patch b/main/hostapd/0009-EAP-pwd-Use-constant-time-and-memory-access-for-find.patch
new file mode 100644
index 0000000000..f363f1563c
--- /dev/null
+++ b/main/hostapd/0009-EAP-pwd-Use-constant-time-and-memory-access-for-find.patch
@@ -0,0 +1,324 @@
+From aaf65feac67c3993935634eefe5bc76b9fce03aa Mon Sep 17 00:00:00 2001
+From: Jouni Malinen <jouni@codeaurora.org>
+Date: Tue, 26 Feb 2019 11:59:45 +0200
+Subject: [PATCH] EAP-pwd: Use constant time and memory access for finding the
+ PWE
+
+This algorithm could leak information to external observers in form of
+timing differences or memory access patterns (cache use). While the
+previous implementation had protection against the most visible timing
+differences (looping 40 rounds and masking the legendre operation), it
+did not protect against memory access patterns between the two possible
+code paths in the masking operations. That might be sufficient to allow
+an unprivileged process running on the same device to be able to
+determine which path is being executed through a cache attack and based
+on that, determine information about the used password.
+
+Convert the PWE finding loop to use constant time functions and
+identical memory access path without different branches for the QR/QNR
+cases to minimize possible side-channel information similarly to the
+changes done for SAE authentication. (CVE-2019-9495)
+
+Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
+---
+ src/eap_common/eap_pwd_common.c | 187 +++++++++++++++++---------------
+ 1 file changed, 99 insertions(+), 88 deletions(-)
+
+diff --git a/src/eap_common/eap_pwd_common.c b/src/eap_common/eap_pwd_common.c
+index 02fe01e9f..e49aaf8c7 100644
+--- a/src/eap_common/eap_pwd_common.c
++++ b/src/eap_common/eap_pwd_common.c
+@@ -8,11 +8,15 @@
+
+ #include "includes.h"
+ #include "common.h"
++#include "utils/const_time.h"
+ #include "crypto/sha256.h"
+ #include "crypto/crypto.h"
+ #include "eap_defs.h"
+ #include "eap_pwd_common.h"
+
++#define MAX_ECC_PRIME_LEN 66
++
++
+ /* The random function H(x) = HMAC-SHA256(0^32, x) */
+ struct crypto_hash * eap_pwd_h_init(void)
+ {
+@@ -102,6 +106,15 @@ EAP_PWD_group * get_eap_pwd_group(u16 num)
+ }
+
+
++static void buf_shift_right(u8 *buf, size_t len, size_t bits)
++{
++ size_t i;
++ for (i = len - 1; i > 0; i--)
++ buf[i] = (buf[i - 1] << (8 - bits)) | (buf[i] >> bits);
++ buf[0] >>= bits;
++}
++
++
+ /*
+ * compute a "random" secret point on an elliptic curve based
+ * on the password and identities.
+@@ -113,17 +126,27 @@ int compute_password_element(EAP_PWD_group *grp, u16 num,
+ const u8 *token)
+ {
+ struct crypto_bignum *qr = NULL, *qnr = NULL, *one = NULL;
++ struct crypto_bignum *qr_or_qnr = NULL;
++ u8 qr_bin[MAX_ECC_PRIME_LEN];
++ u8 qnr_bin[MAX_ECC_PRIME_LEN];
++ u8 qr_or_qnr_bin[MAX_ECC_PRIME_LEN];
++ u8 x_bin[MAX_ECC_PRIME_LEN];
+ struct crypto_bignum *tmp1 = NULL, *tmp2 = NULL, *pm1 = NULL;
+ struct crypto_hash *hash;
+ unsigned char pwe_digest[SHA256_MAC_LEN], *prfbuf = NULL, ctr;
+- int is_odd, ret = 0, check, found = 0;
+- size_t primebytelen, primebitlen;
+- struct crypto_bignum *x_candidate = NULL, *rnd = NULL, *cofactor = NULL;
++ int ret = 0, check, res;
++ u8 found = 0; /* 0 (false) or 0xff (true) to be used as const_time_*
++ * mask */
++ size_t primebytelen = 0, primebitlen;
++ struct crypto_bignum *x_candidate = NULL, *cofactor = NULL;
+ const struct crypto_bignum *prime;
++ u8 mask, found_ctr = 0, is_odd = 0;
+
+ if (grp->pwe)
+ return -1;
+
++ os_memset(x_bin, 0, sizeof(x_bin));
++
+ prime = crypto_ec_get_prime(grp->group);
+ cofactor = crypto_bignum_init();
+ grp->pwe = crypto_ec_point_init(grp->group);
+@@ -152,8 +175,6 @@ int compute_password_element(EAP_PWD_group *grp, u16 num,
+
+ /* get a random quadratic residue and nonresidue */
+ while (!qr || !qnr) {
+- int res;
+-
+ if (crypto_bignum_rand(tmp1, prime) < 0)
+ goto fail;
+ res = crypto_bignum_legendre(tmp1, prime);
+@@ -167,6 +188,11 @@ int compute_password_element(EAP_PWD_group *grp, u16 num,
+ if (!tmp1)
+ goto fail;
+ }
++ if (crypto_bignum_to_bin(qr, qr_bin, sizeof(qr_bin),
++ primebytelen) < 0 ||
++ crypto_bignum_to_bin(qnr, qnr_bin, sizeof(qnr_bin),
++ primebytelen) < 0)
++ goto fail;
+
+ os_memset(prfbuf, 0, primebytelen);
+ ctr = 0;
+@@ -194,17 +220,16 @@ int compute_password_element(EAP_PWD_group *grp, u16 num,
+ eap_pwd_h_update(hash, &ctr, sizeof(ctr));
+ eap_pwd_h_final(hash, pwe_digest);
+
+- crypto_bignum_deinit(rnd, 1);
+- rnd = crypto_bignum_init_set(pwe_digest, SHA256_MAC_LEN);
+- if (!rnd) {
+- wpa_printf(MSG_INFO, "EAP-pwd: unable to create rnd");
+- goto fail;
+- }
++ is_odd = const_time_select_u8(
++ found, is_odd, pwe_digest[SHA256_MAC_LEN - 1] & 0x01);
+ if (eap_pwd_kdf(pwe_digest, SHA256_MAC_LEN,
+ (u8 *) "EAP-pwd Hunting And Pecking",
+ os_strlen("EAP-pwd Hunting And Pecking"),
+ prfbuf, primebitlen) < 0)
+ goto fail;
++ if (primebitlen % 8)
++ buf_shift_right(prfbuf, primebytelen,
++ 8 - primebitlen % 8);
+
+ crypto_bignum_deinit(x_candidate, 1);
+ x_candidate = crypto_bignum_init_set(prfbuf, primebytelen);
+@@ -214,24 +239,13 @@ int compute_password_element(EAP_PWD_group *grp, u16 num,
+ goto fail;
+ }
+
+- /*
+- * eap_pwd_kdf() returns a string of bits 0..primebitlen but
+- * BN_bin2bn will treat that string of bits as a big endian
+- * number. If the primebitlen is not an even multiple of 8
+- * then excessive bits-- those _after_ primebitlen-- so now
+- * we have to shift right the amount we masked off.
+- */
+- if ((primebitlen % 8) &&
+- crypto_bignum_rshift(x_candidate,
+- (8 - (primebitlen % 8)),
+- x_candidate) < 0)
+- goto fail;
+-
+ if (crypto_bignum_cmp(x_candidate, prime) >= 0)
+ continue;
+
+- wpa_hexdump(MSG_DEBUG, "EAP-pwd: x_candidate",
+- prfbuf, primebytelen);
++ wpa_hexdump_key(MSG_DEBUG, "EAP-pwd: x_candidate",
++ prfbuf, primebytelen);
++ const_time_select_bin(found, x_bin, prfbuf, primebytelen,
++ x_bin);
+
+ /*
+ * compute y^2 using the equation of the curve
+@@ -261,13 +275,15 @@ int compute_password_element(EAP_PWD_group *grp, u16 num,
+ * Flip a coin, multiply by the random quadratic residue or the
+ * random quadratic nonresidue and record heads or tails.
+ */
+- if (crypto_bignum_is_odd(tmp1)) {
+- crypto_bignum_mulmod(tmp2, qr, prime, tmp2);
+- check = 1;
+- } else {
+- crypto_bignum_mulmod(tmp2, qnr, prime, tmp2);
+- check = -1;
+- }
++ mask = const_time_eq_u8(crypto_bignum_is_odd(tmp1), 1);
++ check = const_time_select_s8(mask, 1, -1);
++ const_time_select_bin(mask, qr_bin, qnr_bin, primebytelen,
++ qr_or_qnr_bin);
++ crypto_bignum_deinit(qr_or_qnr, 1);
++ qr_or_qnr = crypto_bignum_init_set(qr_or_qnr_bin, primebytelen);
++ if (!qr_or_qnr ||
++ crypto_bignum_mulmod(tmp2, qr_or_qnr, prime, tmp2) < 0)
++ goto fail;
+
+ /*
+ * Now it's safe to do legendre, if check is 1 then it's
+@@ -275,59 +291,12 @@ int compute_password_element(EAP_PWD_group *grp, u16 num,
+ * change result), if check is -1 then it's the opposite test
+ * (multiplying a qr by qnr would make a qnr).
+ */
+- if (crypto_bignum_legendre(tmp2, prime) == check) {
+- if (found == 1)
+- continue;
+-
+- /* need to unambiguously identify the solution */
+- is_odd = crypto_bignum_is_odd(rnd);
+-
+- /*
+- * We know x_candidate is a quadratic residue so set
+- * it here.
+- */
+- if (crypto_ec_point_solve_y_coord(grp->group, grp->pwe,
+- x_candidate,
+- is_odd) != 0) {
+- wpa_printf(MSG_INFO,
+- "EAP-pwd: Could not solve for y");
+- continue;
+- }
+-
+- /*
+- * If there's a solution to the equation then the point
+- * must be on the curve so why check again explicitly?
+- * OpenSSL code says this is required by X9.62. We're
+- * not X9.62 but it can't hurt just to be sure.
+- */
+- if (!crypto_ec_point_is_on_curve(grp->group,
+- grp->pwe)) {
+- wpa_printf(MSG_INFO,
+- "EAP-pwd: point is not on curve");
+- continue;
+- }
+-
+- if (!crypto_bignum_is_one(cofactor)) {
+- /* make sure the point is not in a small
+- * sub-group */
+- if (crypto_ec_point_mul(grp->group, grp->pwe,
+- cofactor,
+- grp->pwe) != 0) {
+- wpa_printf(MSG_INFO,
+- "EAP-pwd: cannot multiply generator by order");
+- continue;
+- }
+- if (crypto_ec_point_is_at_infinity(grp->group,
+- grp->pwe)) {
+- wpa_printf(MSG_INFO,
+- "EAP-pwd: point is at infinity");
+- continue;
+- }
+- }
+- wpa_printf(MSG_DEBUG,
+- "EAP-pwd: found a PWE in %d tries", ctr);
+- found = 1;
+- }
++ res = crypto_bignum_legendre(tmp2, prime);
++ if (res == -2)
++ goto fail;
++ mask = const_time_eq(res, check);
++ found_ctr = const_time_select_u8(found, found_ctr, ctr);
++ found |= mask;
+ }
+ if (found == 0) {
+ wpa_printf(MSG_INFO,
+@@ -335,6 +304,44 @@ int compute_password_element(EAP_PWD_group *grp, u16 num,
+ num);
+ goto fail;
+ }
++
++ /*
++ * We know x_candidate is a quadratic residue so set it here.
++ */
++ crypto_bignum_deinit(x_candidate, 1);
++ x_candidate = crypto_bignum_init_set(x_bin, primebytelen);
++ if (!x_candidate ||
++ crypto_ec_point_solve_y_coord(grp->group, grp->pwe, x_candidate,
++ is_odd) != 0) {
++ wpa_printf(MSG_INFO, "EAP-pwd: Could not solve for y");
++ goto fail;
++ }
++
++ /*
++ * If there's a solution to the equation then the point must be on the
++ * curve so why check again explicitly? OpenSSL code says this is
++ * required by X9.62. We're not X9.62 but it can't hurt just to be sure.
++ */
++ if (!crypto_ec_point_is_on_curve(grp->group, grp->pwe)) {
++ wpa_printf(MSG_INFO, "EAP-pwd: point is not on curve");
++ goto fail;
++ }
++
++ if (!crypto_bignum_is_one(cofactor)) {
++ /* make sure the point is not in a small sub-group */
++ if (crypto_ec_point_mul(grp->group, grp->pwe, cofactor,
++ grp->pwe) != 0) {
++ wpa_printf(MSG_INFO,
++ "EAP-pwd: cannot multiply generator by order");
++ goto fail;
++ }
++ if (crypto_ec_point_is_at_infinity(grp->group, grp->pwe)) {
++ wpa_printf(MSG_INFO, "EAP-pwd: point is at infinity");
++ goto fail;
++ }
++ }
++ wpa_printf(MSG_DEBUG, "EAP-pwd: found a PWE in %02d tries", found_ctr);
++
+ if (0) {
+ fail:
+ crypto_ec_point_deinit(grp->pwe, 1);
+@@ -344,14 +351,18 @@ int compute_password_element(EAP_PWD_group *grp, u16 num,
+ /* cleanliness and order.... */
+ crypto_bignum_deinit(cofactor, 1);
+ crypto_bignum_deinit(x_candidate, 1);
+- crypto_bignum_deinit(rnd, 1);
+ crypto_bignum_deinit(pm1, 0);
+ crypto_bignum_deinit(tmp1, 1);
+ crypto_bignum_deinit(tmp2, 1);
+ crypto_bignum_deinit(qr, 1);
+ crypto_bignum_deinit(qnr, 1);
++ crypto_bignum_deinit(qr_or_qnr, 1);
+ crypto_bignum_deinit(one, 0);
+- os_free(prfbuf);
++ bin_clear_free(prfbuf, primebytelen);
++ os_memset(qr_bin, 0, sizeof(qr_bin));
++ os_memset(qnr_bin, 0, sizeof(qnr_bin));
++ os_memset(qr_or_qnr_bin, 0, sizeof(qr_or_qnr_bin));
++ os_memset(pwe_digest, 0, sizeof(pwe_digest));
+
+ return ret;
+ }
+--
+2.21.0
+
diff --git a/main/hostapd/0010-EAP-pwd-server-Detect-reflection-attacks.patch b/main/hostapd/0010-EAP-pwd-server-Detect-reflection-attacks.patch
new file mode 100644
index 0000000000..9bc1447965
--- /dev/null
+++ b/main/hostapd/0010-EAP-pwd-server-Detect-reflection-attacks.patch
@@ -0,0 +1,45 @@
+From d63edfa90243e9a7de6ae5c275032f2cc79fef95 Mon Sep 17 00:00:00 2001
+From: Mathy Vanhoef <mathy.vanhoef@nyu.edu>
+Date: Sun, 31 Mar 2019 17:26:01 +0200
+Subject: [PATCH] EAP-pwd server: Detect reflection attacks
+
+When processing an EAP-pwd Commit frame, verify that the peer's scalar
+and elliptic curve element differ from the one sent by the server. This
+prevents reflection attacks where the adversary reflects the scalar and
+element sent by the server. (CVE-2019-9497)
+
+The vulnerability allows an adversary to complete the EAP-pwd handshake
+as any user. However, the adversary does not learn the negotiated
+session key, meaning the subsequent 4-way handshake would fail. As a
+result, this cannot be abused to bypass authentication unless EAP-pwd is
+used in non-WLAN cases without any following key exchange that would
+require the attacker to learn the MSK.
+
+Signed-off-by: Mathy Vanhoef <mathy.vanhoef@nyu.edu>
+---
+ src/eap_server/eap_server_pwd.c | 9 +++++++++
+ 1 file changed, 9 insertions(+)
+
+diff --git a/src/eap_server/eap_server_pwd.c b/src/eap_server/eap_server_pwd.c
+index 74979da6e..16057e94f 100644
+--- a/src/eap_server/eap_server_pwd.c
++++ b/src/eap_server/eap_server_pwd.c
+@@ -753,6 +753,15 @@ eap_pwd_process_commit_resp(struct eap_sm *sm, struct eap_pwd_data *data,
+ }
+ }
+
++ /* detect reflection attacks */
++ if (crypto_bignum_cmp(data->my_scalar, data->peer_scalar) == 0 ||
++ crypto_ec_point_cmp(data->grp->group, data->my_element,
++ data->peer_element) == 0) {
++ wpa_printf(MSG_INFO,
++ "EAP-PWD (server): detected reflection attack!");
++ goto fin;
++ }
++
+ /* compute the shared key, k */
+ if ((crypto_ec_point_mul(data->grp->group, data->grp->pwe,
+ data->peer_scalar, K) < 0) ||
+--
+2.21.0
+
diff --git a/main/hostapd/0011-EAP-pwd-client-Verify-received-scalar-and-element.patch b/main/hostapd/0011-EAP-pwd-client-Verify-received-scalar-and-element.patch
new file mode 100644
index 0000000000..83efc5cc1e
--- /dev/null
+++ b/main/hostapd/0011-EAP-pwd-client-Verify-received-scalar-and-element.patch
@@ -0,0 +1,58 @@
+From 8ad8585f91823ddcc3728155e288e0f9f872e31a Mon Sep 17 00:00:00 2001
+From: Mathy Vanhoef <mathy.vanhoef@nyu.edu>
+Date: Sun, 31 Mar 2019 17:43:44 +0200
+Subject: [PATCH] EAP-pwd client: Verify received scalar and element
+
+When processing an EAP-pwd Commit frame, the server's scalar and element
+(elliptic curve point) were not validated. This allowed an adversary to
+bypass authentication, and act as a rogue Access Point (AP) if the
+crypto implementation did not verify the validity of the EC point.
+
+Fix this vulnerability by assuring the received scalar lies within the
+valid range, and by checking that the received element is not the point
+at infinity and lies on the elliptic curve being used. (CVE-2019-9499)
+
+The vulnerability is only exploitable if OpenSSL version 1.0.2 or lower
+is used, or if LibreSSL or wolfssl is used. Newer versions of OpenSSL
+(and also BoringSSL) implicitly validate the elliptic curve point in
+EC_POINT_set_affine_coordinates_GFp(), preventing the attack.
+
+Signed-off-by: Mathy Vanhoef <mathy.vanhoef@nyu.edu>
+---
+ src/eap_peer/eap_pwd.c | 20 ++++++++++++++++++++
+ 1 file changed, 20 insertions(+)
+
+diff --git a/src/eap_peer/eap_pwd.c b/src/eap_peer/eap_pwd.c
+index 761c16af9..5a05e5432 100644
+--- a/src/eap_peer/eap_pwd.c
++++ b/src/eap_peer/eap_pwd.c
+@@ -594,6 +594,26 @@ eap_pwd_perform_commit_exchange(struct eap_sm *sm, struct eap_pwd_data *data,
+ goto fin;
+ }
+
++ /* verify received scalar */
++ if (crypto_bignum_is_zero(data->server_scalar) ||
++ crypto_bignum_is_one(data->server_scalar) ||
++ crypto_bignum_cmp(data->server_scalar,
++ crypto_ec_get_order(data->grp->group)) >= 0) {
++ wpa_printf(MSG_INFO,
++ "EAP-PWD (peer): received scalar is invalid");
++ goto fin;
++ }
++
++ /* verify received element */
++ if (!crypto_ec_point_is_on_curve(data->grp->group,
++ data->server_element) ||
++ crypto_ec_point_is_at_infinity(data->grp->group,
++ data->server_element)) {
++ wpa_printf(MSG_INFO,
++ "EAP-PWD (peer): received element is invalid");
++ goto fin;
++ }
++
+ /* check to ensure server's element is not in a small sub-group */
+ if (!crypto_bignum_is_one(cofactor)) {
+ if (crypto_ec_point_mul(data->grp->group, data->server_element,
+--
+2.21.0
+
diff --git a/main/hostapd/0012-EAP-pwd-server-Verify-received-scalar-and-element.patch b/main/hostapd/0012-EAP-pwd-server-Verify-received-scalar-and-element.patch
new file mode 100644
index 0000000000..d11f0009be
--- /dev/null
+++ b/main/hostapd/0012-EAP-pwd-server-Verify-received-scalar-and-element.patch
@@ -0,0 +1,58 @@
+From 70ff850e89fbc8bc7da515321b4d15b5eef70581 Mon Sep 17 00:00:00 2001
+From: Mathy Vanhoef <mathy.vanhoef@nyu.edu>
+Date: Sun, 31 Mar 2019 17:13:06 +0200
+Subject: [PATCH] EAP-pwd server: Verify received scalar and element
+
+When processing an EAP-pwd Commit frame, the peer's scalar and element
+(elliptic curve point) were not validated. This allowed an adversary to
+bypass authentication, and impersonate any user if the crypto
+implementation did not verify the validity of the EC point.
+
+Fix this vulnerability by assuring the received scalar lies within the
+valid range, and by checking that the received element is not the point
+at infinity and lies on the elliptic curve being used. (CVE-2019-9498)
+
+The vulnerability is only exploitable if OpenSSL version 1.0.2 or lower
+is used, or if LibreSSL or wolfssl is used. Newer versions of OpenSSL
+(and also BoringSSL) implicitly validate the elliptic curve point in
+EC_POINT_set_affine_coordinates_GFp(), preventing the attack.
+
+Signed-off-by: Mathy Vanhoef <mathy.vanhoef@nyu.edu>
+---
+ src/eap_server/eap_server_pwd.c | 20 ++++++++++++++++++++
+ 1 file changed, 20 insertions(+)
+
+diff --git a/src/eap_server/eap_server_pwd.c b/src/eap_server/eap_server_pwd.c
+index d0fa54a3a..74979da6e 100644
+--- a/src/eap_server/eap_server_pwd.c
++++ b/src/eap_server/eap_server_pwd.c
+@@ -718,6 +718,26 @@ eap_pwd_process_commit_resp(struct eap_sm *sm, struct eap_pwd_data *data,
+ goto fin;
+ }
+
++ /* verify received scalar */
++ if (crypto_bignum_is_zero(data->peer_scalar) ||
++ crypto_bignum_is_one(data->peer_scalar) ||
++ crypto_bignum_cmp(data->peer_scalar,
++ crypto_ec_get_order(data->grp->group)) >= 0) {
++ wpa_printf(MSG_INFO,
++ "EAP-PWD (server): received scalar is invalid");
++ goto fin;
++ }
++
++ /* verify received element */
++ if (!crypto_ec_point_is_on_curve(data->grp->group,
++ data->peer_element) ||
++ crypto_ec_point_is_at_infinity(data->grp->group,
++ data->peer_element)) {
++ wpa_printf(MSG_INFO,
++ "EAP-PWD (server): received element is invalid");
++ goto fin;
++ }
++
+ /* check to ensure peer's element is not in a small sub-group */
+ if (!crypto_bignum_is_one(cofactor)) {
+ if (crypto_ec_point_mul(data->grp->group, data->peer_element,
+--
+2.21.0
+
diff --git a/main/hostapd/0013-EAP-pwd-Check-element-x-y-coordinates-explicitly.patch b/main/hostapd/0013-EAP-pwd-Check-element-x-y-coordinates-explicitly.patch
new file mode 100644
index 0000000000..daea13e21a
--- /dev/null
+++ b/main/hostapd/0013-EAP-pwd-Check-element-x-y-coordinates-explicitly.patch
@@ -0,0 +1,331 @@
+From 16d4f1069118aa19bfce013493e1ac5783f92f1d Mon Sep 17 00:00:00 2001
+From: Jouni Malinen <jouni@codeaurora.org>
+Date: Fri, 5 Apr 2019 02:12:50 +0300
+Subject: [PATCH] EAP-pwd: Check element x,y coordinates explicitly
+
+This adds an explicit check for 0 < x,y < prime based on RFC 5931,
+2.8.5.2.2 requirement. The earlier checks might have covered this
+implicitly, but it is safer to avoid any dependency on implicit checks
+and specific crypto library behavior. (CVE-2019-9498 and CVE-2019-9499)
+
+Furthermore, this moves the EAP-pwd element and scalar parsing and
+validation steps into shared helper functions so that there is no need
+to maintain two separate copies of this common functionality between the
+server and peer implementations.
+
+Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
+---
+ src/eap_common/eap_pwd_common.c | 106 ++++++++++++++++++++++++++++++++
+ src/eap_common/eap_pwd_common.h | 3 +
+ src/eap_peer/eap_pwd.c | 45 ++------------
+ src/eap_server/eap_server_pwd.c | 45 ++------------
+ 4 files changed, 117 insertions(+), 82 deletions(-)
+
+diff --git a/src/eap_common/eap_pwd_common.c b/src/eap_common/eap_pwd_common.c
+index e49aaf8c7..c28b56d62 100644
+--- a/src/eap_common/eap_pwd_common.c
++++ b/src/eap_common/eap_pwd_common.c
+@@ -428,3 +428,109 @@ int compute_keys(EAP_PWD_group *grp, const struct crypto_bignum *k,
+
+ return 1;
+ }
++
++
++static int eap_pwd_element_coord_ok(const struct crypto_bignum *prime,
++ const u8 *buf, size_t len)
++{
++ struct crypto_bignum *val;
++ int ok = 1;
++
++ val = crypto_bignum_init_set(buf, len);
++ if (!val || crypto_bignum_is_zero(val) ||
++ crypto_bignum_cmp(val, prime) >= 0)
++ ok = 0;
++ crypto_bignum_deinit(val, 0);
++ return ok;
++}
++
++
++struct crypto_ec_point * eap_pwd_get_element(EAP_PWD_group *group,
++ const u8 *buf)
++{
++ struct crypto_ec_point *element;
++ const struct crypto_bignum *prime;
++ size_t prime_len;
++ struct crypto_bignum *cofactor = NULL;
++
++ prime = crypto_ec_get_prime(group->group);
++ prime_len = crypto_ec_prime_len(group->group);
++
++ /* RFC 5931, 2.8.5.2.2: 0 < x,y < p */
++ if (!eap_pwd_element_coord_ok(prime, buf, prime_len) ||
++ !eap_pwd_element_coord_ok(prime, buf + prime_len, prime_len)) {
++ wpa_printf(MSG_INFO, "EAP-pwd: Invalid coordinate in element");
++ return NULL;
++ }
++
++ element = crypto_ec_point_from_bin(group->group, buf);
++ if (!element) {
++ wpa_printf(MSG_INFO, "EAP-pwd: EC point from element failed");
++ return NULL;
++ }
++
++ /* RFC 5931, 2.8.5.2.2: on curve and not the point at infinity */
++ if (!crypto_ec_point_is_on_curve(group->group, element) ||
++ crypto_ec_point_is_at_infinity(group->group, element)) {
++ wpa_printf(MSG_INFO, "EAP-pwd: Invalid element");
++ goto fail;
++ }
++
++ cofactor = crypto_bignum_init();
++ if (!cofactor || crypto_ec_cofactor(group->group, cofactor) < 0) {
++ wpa_printf(MSG_INFO,
++ "EAP-pwd: Unable to get cofactor for curve");
++ goto fail;
++ }
++
++ if (!crypto_bignum_is_one(cofactor)) {
++ struct crypto_ec_point *point;
++ int ok = 1;
++
++ /* check to ensure peer's element is not in a small sub-group */
++ point = crypto_ec_point_init(group->group);
++ if (!point ||
++ crypto_ec_point_mul(group->group, element,
++ cofactor, point) != 0 ||
++ crypto_ec_point_is_at_infinity(group->group, point))
++ ok = 0;
++ crypto_ec_point_deinit(point, 0);
++
++ if (!ok) {
++ wpa_printf(MSG_INFO,
++ "EAP-pwd: Small sub-group check on peer element failed");
++ goto fail;
++ }
++ }
++
++out:
++ crypto_bignum_deinit(cofactor, 0);
++ return element;
++fail:
++ crypto_ec_point_deinit(element, 0);
++ element = NULL;
++ goto out;
++}
++
++
++struct crypto_bignum * eap_pwd_get_scalar(EAP_PWD_group *group, const u8 *buf)
++{
++ struct crypto_bignum *scalar;
++ const struct crypto_bignum *order;
++ size_t order_len;
++
++ order = crypto_ec_get_order(group->group);
++ order_len = crypto_ec_order_len(group->group);
++
++ /* RFC 5931, 2.8.5.2: 1 < scalar < r */
++ scalar = crypto_bignum_init_set(buf, order_len);
++ if (!scalar || crypto_bignum_is_zero(scalar) ||
++ crypto_bignum_is_one(scalar) ||
++ crypto_bignum_cmp(scalar, order) >= 0) {
++ wpa_printf(MSG_INFO, "EAP-pwd: received scalar is invalid");
++ crypto_bignum_deinit(scalar, 0);
++ scalar = NULL;
++ }
++
++ return scalar;
++}
+diff --git a/src/eap_common/eap_pwd_common.h b/src/eap_common/eap_pwd_common.h
+index 6b07cf8f7..2387e59a2 100644
+--- a/src/eap_common/eap_pwd_common.h
++++ b/src/eap_common/eap_pwd_common.h
+@@ -67,5 +67,8 @@ int compute_keys(EAP_PWD_group *grp, const struct crypto_bignum *k,
+ struct crypto_hash * eap_pwd_h_init(void);
+ void eap_pwd_h_update(struct crypto_hash *hash, const u8 *data, size_t len);
+ void eap_pwd_h_final(struct crypto_hash *hash, u8 *digest);
++struct crypto_ec_point * eap_pwd_get_element(EAP_PWD_group *group,
++ const u8 *buf);
++struct crypto_bignum * eap_pwd_get_scalar(EAP_PWD_group *group, const u8 *buf);
+
+ #endif /* EAP_PWD_COMMON_H */
+diff --git a/src/eap_peer/eap_pwd.c b/src/eap_peer/eap_pwd.c
+index 5a05e5432..f37b974eb 100644
+--- a/src/eap_peer/eap_pwd.c
++++ b/src/eap_peer/eap_pwd.c
+@@ -308,7 +308,7 @@ eap_pwd_perform_commit_exchange(struct eap_sm *sm, struct eap_pwd_data *data,
+ const struct wpabuf *reqData,
+ const u8 *payload, size_t payload_len)
+ {
+- struct crypto_ec_point *K = NULL, *point = NULL;
++ struct crypto_ec_point *K = NULL;
+ struct crypto_bignum *mask = NULL, *cofactor = NULL;
+ const u8 *ptr = payload;
+ u8 *scalar = NULL, *element = NULL;
+@@ -572,63 +572,27 @@ eap_pwd_perform_commit_exchange(struct eap_sm *sm, struct eap_pwd_data *data,
+ /* process the request */
+ data->k = crypto_bignum_init();
+ K = crypto_ec_point_init(data->grp->group);
+- point = crypto_ec_point_init(data->grp->group);
+- if (!data->k || !K || !point) {
++ if (!data->k || !K) {
+ wpa_printf(MSG_INFO, "EAP-PWD (peer): peer data allocation "
+ "fail");
+ goto fin;
+ }
+
+ /* element, x then y, followed by scalar */
+- data->server_element = crypto_ec_point_from_bin(data->grp->group, ptr);
++ data->server_element = eap_pwd_get_element(data->grp, ptr);
+ if (!data->server_element) {
+ wpa_printf(MSG_INFO, "EAP-PWD (peer): setting peer element "
+ "fail");
+ goto fin;
+ }
+ ptr += prime_len * 2;
+- data->server_scalar = crypto_bignum_init_set(ptr, order_len);
++ data->server_scalar = eap_pwd_get_scalar(data->grp, ptr);
+ if (!data->server_scalar) {
+ wpa_printf(MSG_INFO,
+ "EAP-PWD (peer): setting peer scalar fail");
+ goto fin;
+ }
+
+- /* verify received scalar */
+- if (crypto_bignum_is_zero(data->server_scalar) ||
+- crypto_bignum_is_one(data->server_scalar) ||
+- crypto_bignum_cmp(data->server_scalar,
+- crypto_ec_get_order(data->grp->group)) >= 0) {
+- wpa_printf(MSG_INFO,
+- "EAP-PWD (peer): received scalar is invalid");
+- goto fin;
+- }
+-
+- /* verify received element */
+- if (!crypto_ec_point_is_on_curve(data->grp->group,
+- data->server_element) ||
+- crypto_ec_point_is_at_infinity(data->grp->group,
+- data->server_element)) {
+- wpa_printf(MSG_INFO,
+- "EAP-PWD (peer): received element is invalid");
+- goto fin;
+- }
+-
+- /* check to ensure server's element is not in a small sub-group */
+- if (!crypto_bignum_is_one(cofactor)) {
+- if (crypto_ec_point_mul(data->grp->group, data->server_element,
+- cofactor, point) < 0) {
+- wpa_printf(MSG_INFO, "EAP-PWD (peer): cannot multiply "
+- "server element by order!\n");
+- goto fin;
+- }
+- if (crypto_ec_point_is_at_infinity(data->grp->group, point)) {
+- wpa_printf(MSG_INFO, "EAP-PWD (peer): server element "
+- "is at infinity!\n");
+- goto fin;
+- }
+- }
+-
+ /* compute the shared key, k */
+ if (crypto_ec_point_mul(data->grp->group, data->grp->pwe,
+ data->server_scalar, K) < 0 ||
+@@ -702,7 +666,6 @@ fin:
+ crypto_bignum_deinit(mask, 1);
+ crypto_bignum_deinit(cofactor, 1);
+ crypto_ec_point_deinit(K, 1);
+- crypto_ec_point_deinit(point, 1);
+ if (data->outbuf == NULL)
+ eap_pwd_state(data, FAILURE);
+ else
+diff --git a/src/eap_server/eap_server_pwd.c b/src/eap_server/eap_server_pwd.c
+index 16057e94f..f6c75cf80 100644
+--- a/src/eap_server/eap_server_pwd.c
++++ b/src/eap_server/eap_server_pwd.c
+@@ -669,7 +669,7 @@ eap_pwd_process_commit_resp(struct eap_sm *sm, struct eap_pwd_data *data,
+ {
+ const u8 *ptr;
+ struct crypto_bignum *cofactor = NULL;
+- struct crypto_ec_point *K = NULL, *point = NULL;
++ struct crypto_ec_point *K = NULL;
+ int res = 0;
+ size_t prime_len, order_len;
+
+@@ -688,9 +688,8 @@ eap_pwd_process_commit_resp(struct eap_sm *sm, struct eap_pwd_data *data,
+
+ data->k = crypto_bignum_init();
+ cofactor = crypto_bignum_init();
+- point = crypto_ec_point_init(data->grp->group);
+ K = crypto_ec_point_init(data->grp->group);
+- if (!data->k || !cofactor || !point || !K) {
++ if (!data->k || !cofactor || !K) {
+ wpa_printf(MSG_INFO, "EAP-PWD (server): peer data allocation "
+ "fail");
+ goto fin;
+@@ -704,55 +703,20 @@ eap_pwd_process_commit_resp(struct eap_sm *sm, struct eap_pwd_data *data,
+
+ /* element, x then y, followed by scalar */
+ ptr = payload;
+- data->peer_element = crypto_ec_point_from_bin(data->grp->group, ptr);
++ data->peer_element = eap_pwd_get_element(data->grp, ptr);
+ if (!data->peer_element) {
+ wpa_printf(MSG_INFO, "EAP-PWD (server): setting peer element "
+ "fail");
+ goto fin;
+ }
+ ptr += prime_len * 2;
+- data->peer_scalar = crypto_bignum_init_set(ptr, order_len);
++ data->peer_scalar = eap_pwd_get_scalar(data->grp, ptr);
+ if (!data->peer_scalar) {
+ wpa_printf(MSG_INFO, "EAP-PWD (server): peer data allocation "
+ "fail");
+ goto fin;
+ }
+
+- /* verify received scalar */
+- if (crypto_bignum_is_zero(data->peer_scalar) ||
+- crypto_bignum_is_one(data->peer_scalar) ||
+- crypto_bignum_cmp(data->peer_scalar,
+- crypto_ec_get_order(data->grp->group)) >= 0) {
+- wpa_printf(MSG_INFO,
+- "EAP-PWD (server): received scalar is invalid");
+- goto fin;
+- }
+-
+- /* verify received element */
+- if (!crypto_ec_point_is_on_curve(data->grp->group,
+- data->peer_element) ||
+- crypto_ec_point_is_at_infinity(data->grp->group,
+- data->peer_element)) {
+- wpa_printf(MSG_INFO,
+- "EAP-PWD (server): received element is invalid");
+- goto fin;
+- }
+-
+- /* check to ensure peer's element is not in a small sub-group */
+- if (!crypto_bignum_is_one(cofactor)) {
+- if (crypto_ec_point_mul(data->grp->group, data->peer_element,
+- cofactor, point) != 0) {
+- wpa_printf(MSG_INFO, "EAP-PWD (server): cannot "
+- "multiply peer element by order");
+- goto fin;
+- }
+- if (crypto_ec_point_is_at_infinity(data->grp->group, point)) {
+- wpa_printf(MSG_INFO, "EAP-PWD (server): peer element "
+- "is at infinity!\n");
+- goto fin;
+- }
+- }
+-
+ /* detect reflection attacks */
+ if (crypto_bignum_cmp(data->my_scalar, data->peer_scalar) == 0 ||
+ crypto_ec_point_cmp(data->grp->group, data->my_element,
+@@ -804,7 +768,6 @@ eap_pwd_process_commit_resp(struct eap_sm *sm, struct eap_pwd_data *data,
+
+ fin:
+ crypto_ec_point_deinit(K, 1);
+- crypto_ec_point_deinit(point, 1);
+ crypto_bignum_deinit(cofactor, 1);
+
+ if (res)
+--
+2.21.0
+
diff --git a/main/hostapd/0001-EAP-pwd-server-Fix-reassembly-buffer-handling.patch b/main/hostapd/0014-EAP-pwd-server-Fix-reassembly-buffer-handling.patch
index 620d67da02..620d67da02 100644
--- a/main/hostapd/0001-EAP-pwd-server-Fix-reassembly-buffer-handling.patch
+++ b/main/hostapd/0014-EAP-pwd-server-Fix-reassembly-buffer-handling.patch
diff --git a/main/hostapd/0003-EAP-pwd-peer-Fix-reassembly-buffer-handling.patch b/main/hostapd/0015-EAP-pwd-peer-Fix-reassembly-buffer-handling.patch
index 1a23e0fa90..1a23e0fa90 100644
--- a/main/hostapd/0003-EAP-pwd-peer-Fix-reassembly-buffer-handling.patch
+++ b/main/hostapd/0015-EAP-pwd-peer-Fix-reassembly-buffer-handling.patch
diff --git a/main/hostapd/0016-SAE-Use-const_time_memcmp-for-pwd_value-prime-compar.patch b/main/hostapd/0016-SAE-Use-const_time_memcmp-for-pwd_value-prime-compar.patch
new file mode 100644
index 0000000000..073f1e3ce1
--- /dev/null
+++ b/main/hostapd/0016-SAE-Use-const_time_memcmp-for-pwd_value-prime-compar.patch
@@ -0,0 +1,31 @@
+From e43f08991f00820c1f711ca254021d5f83b5cd7d Mon Sep 17 00:00:00 2001
+From: Jouni Malinen <jouni@codeaurora.org>
+Date: Thu, 25 Apr 2019 18:52:34 +0300
+Subject: [PATCH 1/6] SAE: Use const_time_memcmp() for pwd_value >= prime
+ comparison
+
+This reduces timing and memory access pattern differences for an
+operation that could depend on the used password.
+
+Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
+(cherry picked from commit 8e14b030e558d23f65d761895c07089404e61cf1)
+---
+ src/common/sae.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/common/sae.c b/src/common/sae.c
+index 5a50294a6..0d56e5505 100644
+--- a/src/common/sae.c
++++ b/src/common/sae.c
+@@ -317,7 +317,7 @@ static int sae_test_pwd_seed_ecc(struct sae_data *sae, const u8 *pwd_seed,
+ wpa_hexdump_key(MSG_DEBUG, "SAE: pwd-value",
+ pwd_value, sae->tmp->prime_len);
+
+- if (os_memcmp(pwd_value, prime, sae->tmp->prime_len) >= 0)
++ if (const_time_memcmp(pwd_value, prime, sae->tmp->prime_len) >= 0)
+ return 0;
+
+ x_cand = crypto_bignum_init_set(pwd_value, sae->tmp->prime_len);
+--
+2.20.1
+
diff --git a/main/hostapd/0017-EAP-pwd-Enforce-1-rand-mask-r-and-rand-mask-mod-r-1.patch b/main/hostapd/0017-EAP-pwd-Enforce-1-rand-mask-r-and-rand-mask-mod-r-1.patch
new file mode 100644
index 0000000000..2cd0aa5a27
--- /dev/null
+++ b/main/hostapd/0017-EAP-pwd-Enforce-1-rand-mask-r-and-rand-mask-mod-r-1.patch
@@ -0,0 +1,121 @@
+From 4396f74a36e16e32a51238d84bf6225b89c8b25c Mon Sep 17 00:00:00 2001
+From: Jouni Malinen <jouni@codeaurora.org>
+Date: Fri, 5 Apr 2019 12:37:21 +0300
+Subject: [PATCH] EAP-pwd: Enforce 1 < rand,mask < r and rand+mask mod r > 1
+
+RFC 5931 has these conditions as MUST requirements, so better follow
+them explicitly even if the rand,mask == 0 or rand+mask == 0 or 1 cases
+are very unlikely to occur in practice while generating random values
+locally.
+
+Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
+---
+ src/eap_common/eap_pwd_common.c | 28 ++++++++++++++++++++++++++++
+ src/eap_common/eap_pwd_common.h | 3 +++
+ src/eap_peer/eap_pwd.c | 14 ++------------
+ src/eap_server/eap_server_pwd.c | 13 ++-----------
+ 4 files changed, 35 insertions(+), 23 deletions(-)
+
+diff --git a/src/eap_common/eap_pwd_common.c b/src/eap_common/eap_pwd_common.c
+index c28b56d62..4288b5299 100644
+--- a/src/eap_common/eap_pwd_common.c
++++ b/src/eap_common/eap_pwd_common.c
+@@ -534,3 +534,31 @@ struct crypto_bignum * eap_pwd_get_scalar(EAP_PWD_group *group, const u8 *buf)
+
+ return scalar;
+ }
++
++
++int eap_pwd_get_rand_mask(EAP_PWD_group *group, struct crypto_bignum *_rand,
++ struct crypto_bignum *_mask,
++ struct crypto_bignum *scalar)
++{
++ const struct crypto_bignum *order;
++ int count;
++
++ order = crypto_ec_get_order(group->group);
++
++ /* Select two random values rand,mask such that 1 < rand,mask < r and
++ * rand + mask mod r > 1. */
++ for (count = 0; count < 100; count++) {
++ if (crypto_bignum_rand(_rand, order) == 0 &&
++ !crypto_bignum_is_zero(_rand) &&
++ crypto_bignum_rand(_mask, order) == 0 &&
++ !crypto_bignum_is_zero(_mask) &&
++ crypto_bignum_add(_rand, _mask, scalar) == 0 &&
++ crypto_bignum_mod(scalar, order, scalar) == 0 &&
++ !crypto_bignum_is_zero(scalar) &&
++ !crypto_bignum_is_one(scalar))
++ return 0;
++ }
++
++ wpa_printf(MSG_INFO, "EAP-pwd: unable to get randomness");
++ return -1;
++}
+diff --git a/src/eap_common/eap_pwd_common.h b/src/eap_common/eap_pwd_common.h
+index 2387e59a2..c48acee20 100644
+--- a/src/eap_common/eap_pwd_common.h
++++ b/src/eap_common/eap_pwd_common.h
+@@ -70,5 +70,8 @@ void eap_pwd_h_final(struct crypto_hash *hash, u8 *digest);
+ struct crypto_ec_point * eap_pwd_get_element(EAP_PWD_group *group,
+ const u8 *buf);
+ struct crypto_bignum * eap_pwd_get_scalar(EAP_PWD_group *group, const u8 *buf);
++int eap_pwd_get_rand_mask(EAP_PWD_group *group, struct crypto_bignum *_rand,
++ struct crypto_bignum *_mask,
++ struct crypto_bignum *scalar);
+
+ #endif /* EAP_PWD_COMMON_H */
+diff --git a/src/eap_peer/eap_pwd.c b/src/eap_peer/eap_pwd.c
+index f37b974eb..5f6c00218 100644
+--- a/src/eap_peer/eap_pwd.c
++++ b/src/eap_peer/eap_pwd.c
+@@ -542,19 +542,9 @@ eap_pwd_perform_commit_exchange(struct eap_sm *sm, struct eap_pwd_data *data,
+ goto fin;
+ }
+
+- if (crypto_bignum_rand(data->private_value,
+- crypto_ec_get_order(data->grp->group)) < 0 ||
+- crypto_bignum_rand(mask,
+- crypto_ec_get_order(data->grp->group)) < 0 ||
+- crypto_bignum_add(data->private_value, mask,
+- data->my_scalar) < 0 ||
+- crypto_bignum_mod(data->my_scalar,
+- crypto_ec_get_order(data->grp->group),
+- data->my_scalar) < 0) {
+- wpa_printf(MSG_INFO,
+- "EAP-pwd (peer): unable to get randomness");
++ if (eap_pwd_get_rand_mask(data->grp, data->private_value, mask,
++ data->my_scalar) < 0)
+ goto fin;
+- }
+
+ if (crypto_ec_point_mul(data->grp->group, data->grp->pwe, mask,
+ data->my_element) < 0) {
+diff --git a/src/eap_server/eap_server_pwd.c b/src/eap_server/eap_server_pwd.c
+index f6c75cf80..cf6affdaf 100644
+--- a/src/eap_server/eap_server_pwd.c
++++ b/src/eap_server/eap_server_pwd.c
+@@ -261,18 +261,9 @@ static void eap_pwd_build_commit_req(struct eap_sm *sm,
+ goto fin;
+ }
+
+- if (crypto_bignum_rand(data->private_value,
+- crypto_ec_get_order(data->grp->group)) < 0 ||
+- crypto_bignum_rand(mask,
+- crypto_ec_get_order(data->grp->group)) < 0 ||
+- crypto_bignum_add(data->private_value, mask, data->my_scalar) < 0 ||
+- crypto_bignum_mod(data->my_scalar,
+- crypto_ec_get_order(data->grp->group),
+- data->my_scalar) < 0) {
+- wpa_printf(MSG_INFO,
+- "EAP-pwd (server): unable to get randomness");
++ if (eap_pwd_get_rand_mask(data->grp, data->private_value, mask,
++ data->my_scalar) < 0)
+ goto fin;
+- }
+
+ if (crypto_ec_point_mul(data->grp->group, data->grp->pwe, mask,
+ data->my_element) < 0) {
+--
+2.22.0
+
diff --git a/main/hostapd/0018-EAP-pwd-Remove-unused-checks-for-cofactor-1-cases.patch b/main/hostapd/0018-EAP-pwd-Remove-unused-checks-for-cofactor-1-cases.patch
new file mode 100644
index 0000000000..9ffa00c1d0
--- /dev/null
+++ b/main/hostapd/0018-EAP-pwd-Remove-unused-checks-for-cofactor-1-cases.patch
@@ -0,0 +1,257 @@
+From 8b093db2c3f489a74b67f687becf750d24fcf626 Mon Sep 17 00:00:00 2001
+From: Jouni Malinen <j@w1.fi>
+Date: Sat, 13 Apr 2019 17:30:22 +0300
+Subject: [PATCH] EAP-pwd: Remove unused checks for cofactor > 1 cases
+
+None of the ECC groups supported in the implementation had a cofactor
+greater than 1, so these checks are unreachable and for all cases, the
+cofactor is known to be 1. Furthermore, RFC 5931 explicitly disallow use
+of ECC groups with cofactor larger than 1, so this checks cannot be
+needed for any curve that is compliant with the RFC.
+
+Remove the unneeded group cofactor checks to simplify the
+implementation.
+
+Signed-off-by: Jouni Malinen <j@w1.fi>
+---
+ src/eap_common/eap_pwd_common.c | 53 ++-------------------------------
+ src/eap_peer/eap_pwd.c | 23 ++------------
+ src/eap_server/eap_server_pwd.c | 23 ++------------
+ 3 files changed, 7 insertions(+), 92 deletions(-)
+
+diff --git a/src/eap_common/eap_pwd_common.c b/src/eap_common/eap_pwd_common.c
+index 00f85a390..884150e6c 100644
+--- a/src/eap_common/eap_pwd_common.c
++++ b/src/eap_common/eap_pwd_common.c
+@@ -151,7 +151,7 @@ int compute_password_element(EAP_PWD_group *grp, u16 num,
+ u8 found = 0; /* 0 (false) or 0xff (true) to be used as const_time_*
+ * mask */
+ size_t primebytelen = 0, primebitlen;
+- struct crypto_bignum *x_candidate = NULL, *cofactor = NULL;
++ struct crypto_bignum *x_candidate = NULL;
+ const struct crypto_bignum *prime;
+ u8 mask, found_ctr = 0, is_odd = 0;
+
+@@ -161,21 +161,15 @@ int compute_password_element(EAP_PWD_group *grp, u16 num,
+ os_memset(x_bin, 0, sizeof(x_bin));
+
+ prime = crypto_ec_get_prime(grp->group);
+- cofactor = crypto_bignum_init();
+ grp->pwe = crypto_ec_point_init(grp->group);
+ tmp1 = crypto_bignum_init();
+ pm1 = crypto_bignum_init();
+ one = crypto_bignum_init_set((const u8 *) "\x01", 1);
+- if (!cofactor || !grp->pwe || !tmp1 || !pm1 || !one) {
++ if (!grp->pwe || !tmp1 || !pm1 || !one) {
+ wpa_printf(MSG_INFO, "EAP-pwd: unable to create bignums");
+ goto fail;
+ }
+
+- if (crypto_ec_cofactor(grp->group, cofactor) < 0) {
+- wpa_printf(MSG_INFO, "EAP-pwd: unable to get cofactor for "
+- "curve");
+- goto fail;
+- }
+ primebitlen = crypto_ec_prime_len_bits(grp->group);
+ primebytelen = crypto_ec_prime_len(grp->group);
+ if ((prfbuf = os_malloc(primebytelen)) == NULL) {
+@@ -340,19 +334,6 @@ int compute_password_element(EAP_PWD_group *grp, u16 num,
+ goto fail;
+ }
+
+- if (!crypto_bignum_is_one(cofactor)) {
+- /* make sure the point is not in a small sub-group */
+- if (crypto_ec_point_mul(grp->group, grp->pwe, cofactor,
+- grp->pwe) != 0) {
+- wpa_printf(MSG_INFO,
+- "EAP-pwd: cannot multiply generator by order");
+- goto fail;
+- }
+- if (crypto_ec_point_is_at_infinity(grp->group, grp->pwe)) {
+- wpa_printf(MSG_INFO, "EAP-pwd: point is at infinity");
+- goto fail;
+- }
+- }
+ wpa_printf(MSG_DEBUG, "EAP-pwd: found a PWE in %02d tries", found_ctr);
+
+ if (0) {
+@@ -362,7 +343,6 @@ int compute_password_element(EAP_PWD_group *grp, u16 num,
+ ret = 1;
+ }
+ /* cleanliness and order.... */
+- crypto_bignum_deinit(cofactor, 1);
+ crypto_bignum_deinit(x_candidate, 1);
+ crypto_bignum_deinit(pm1, 0);
+ crypto_bignum_deinit(tmp1, 1);
+@@ -464,7 +444,6 @@ struct crypto_ec_point * eap_pwd_get_element(EAP_PWD_group *group,
+ struct crypto_ec_point *element;
+ const struct crypto_bignum *prime;
+ size_t prime_len;
+- struct crypto_bignum *cofactor = NULL;
+
+ prime = crypto_ec_get_prime(group->group);
+ prime_len = crypto_ec_prime_len(group->group);
+@@ -489,35 +468,7 @@ struct crypto_ec_point * eap_pwd_get_element(EAP_PWD_group *group,
+ goto fail;
+ }
+
+- cofactor = crypto_bignum_init();
+- if (!cofactor || crypto_ec_cofactor(group->group, cofactor) < 0) {
+- wpa_printf(MSG_INFO,
+- "EAP-pwd: Unable to get cofactor for curve");
+- goto fail;
+- }
+-
+- if (!crypto_bignum_is_one(cofactor)) {
+- struct crypto_ec_point *point;
+- int ok = 1;
+-
+- /* check to ensure peer's element is not in a small sub-group */
+- point = crypto_ec_point_init(group->group);
+- if (!point ||
+- crypto_ec_point_mul(group->group, element,
+- cofactor, point) != 0 ||
+- crypto_ec_point_is_at_infinity(group->group, point))
+- ok = 0;
+- crypto_ec_point_deinit(point, 0);
+-
+- if (!ok) {
+- wpa_printf(MSG_INFO,
+- "EAP-pwd: Small sub-group check on peer element failed");
+- goto fail;
+- }
+- }
+-
+ out:
+- crypto_bignum_deinit(cofactor, 0);
+ return element;
+ fail:
+ crypto_ec_point_deinit(element, 0);
+diff --git a/src/eap_peer/eap_pwd.c b/src/eap_peer/eap_pwd.c
+index 4be4fcf35..46894a52f 100644
+--- a/src/eap_peer/eap_pwd.c
++++ b/src/eap_peer/eap_pwd.c
+@@ -309,7 +309,7 @@ eap_pwd_perform_commit_exchange(struct eap_sm *sm, struct eap_pwd_data *data,
+ const u8 *payload, size_t payload_len)
+ {
+ struct crypto_ec_point *K = NULL;
+- struct crypto_bignum *mask = NULL, *cofactor = NULL;
++ struct crypto_bignum *mask = NULL;
+ const u8 *ptr = payload;
+ u8 *scalar, *element;
+ size_t prime_len, order_len;
+@@ -527,21 +527,14 @@ eap_pwd_perform_commit_exchange(struct eap_sm *sm, struct eap_pwd_data *data,
+
+ data->private_value = crypto_bignum_init();
+ data->my_element = crypto_ec_point_init(data->grp->group);
+- cofactor = crypto_bignum_init();
+ data->my_scalar = crypto_bignum_init();
+ mask = crypto_bignum_init();
+- if (!data->private_value || !data->my_element || !cofactor ||
++ if (!data->private_value || !data->my_element ||
+ !data->my_scalar || !mask) {
+ wpa_printf(MSG_INFO, "EAP-PWD (peer): scalar allocation fail");
+ goto fin;
+ }
+
+- if (crypto_ec_cofactor(data->grp->group, cofactor) < 0) {
+- wpa_printf(MSG_INFO, "EAP-pwd (peer): unable to get cofactor "
+- "for curve");
+- goto fin;
+- }
+-
+ if (eap_pwd_get_rand_mask(data->grp, data->private_value, mask,
+ data->my_scalar) < 0)
+ goto fin;
+@@ -595,17 +588,8 @@ eap_pwd_perform_commit_exchange(struct eap_sm *sm, struct eap_pwd_data *data,
+ goto fin;
+ }
+
+- /* ensure that the shared key isn't in a small sub-group */
+- if (!crypto_bignum_is_one(cofactor)) {
+- if (crypto_ec_point_mul(data->grp->group, K, cofactor, K) < 0) {
+- wpa_printf(MSG_INFO, "EAP-PWD (peer): cannot multiply "
+- "shared key point by order");
+- goto fin;
+- }
+- }
+-
+ /*
+- * This check is strictly speaking just for the case above where
++ * This check is strictly speaking just for the case where
+ * co-factor > 1 but it was suggested that even though this is probably
+ * never going to happen it is a simple and safe check "just to be
+ * sure" so let's be safe.
+@@ -644,7 +628,6 @@ eap_pwd_perform_commit_exchange(struct eap_sm *sm, struct eap_pwd_data *data,
+
+ fin:
+ crypto_bignum_deinit(mask, 1);
+- crypto_bignum_deinit(cofactor, 1);
+ crypto_ec_point_deinit(K, 1);
+ if (data->outbuf == NULL)
+ eap_pwd_state(data, FAILURE);
+diff --git a/src/eap_server/eap_server_pwd.c b/src/eap_server/eap_server_pwd.c
+index 9799c8197..81ecd773f 100644
+--- a/src/eap_server/eap_server_pwd.c
++++ b/src/eap_server/eap_server_pwd.c
+@@ -648,7 +648,6 @@ eap_pwd_process_commit_resp(struct eap_sm *sm, struct eap_pwd_data *data,
+ const u8 *payload, size_t payload_len)
+ {
+ const u8 *ptr;
+- struct crypto_bignum *cofactor = NULL;
+ struct crypto_ec_point *K = NULL;
+ int res = 0;
+ size_t prime_len, order_len;
+@@ -667,20 +666,13 @@ eap_pwd_process_commit_resp(struct eap_sm *sm, struct eap_pwd_data *data,
+ }
+
+ data->k = crypto_bignum_init();
+- cofactor = crypto_bignum_init();
+ K = crypto_ec_point_init(data->grp->group);
+- if (!data->k || !cofactor || !K) {
++ if (!data->k || !K) {
+ wpa_printf(MSG_INFO, "EAP-PWD (server): peer data allocation "
+ "fail");
+ goto fin;
+ }
+
+- if (crypto_ec_cofactor(data->grp->group, cofactor) < 0) {
+- wpa_printf(MSG_INFO, "EAP-PWD (server): unable to get "
+- "cofactor for curve");
+- goto fin;
+- }
+-
+ /* element, x then y, followed by scalar */
+ ptr = payload;
+ data->peer_element = eap_pwd_get_element(data->grp, ptr);
+@@ -718,18 +710,8 @@ eap_pwd_process_commit_resp(struct eap_sm *sm, struct eap_pwd_data *data,
+ goto fin;
+ }
+
+- /* ensure that the shared key isn't in a small sub-group */
+- if (!crypto_bignum_is_one(cofactor)) {
+- if (crypto_ec_point_mul(data->grp->group, K, cofactor,
+- K) != 0) {
+- wpa_printf(MSG_INFO, "EAP-PWD (server): cannot "
+- "multiply shared key point by order!\n");
+- goto fin;
+- }
+- }
+-
+ /*
+- * This check is strictly speaking just for the case above where
++ * This check is strictly speaking just for the case where
+ * co-factor > 1 but it was suggested that even though this is probably
+ * never going to happen it is a simple and safe check "just to be
+ * sure" so let's be safe.
+@@ -748,7 +730,6 @@ eap_pwd_process_commit_resp(struct eap_sm *sm, struct eap_pwd_data *data,
+
+ fin:
+ crypto_ec_point_deinit(K, 1);
+- crypto_bignum_deinit(cofactor, 1);
+
+ if (res)
+ eap_pwd_state(data, PWD_Confirm_Req);
+--
+2.22.0
+
diff --git a/main/hostapd/0019-EAP-pwd-Use-const_time_memcmp-for-pwd_value-prime-co.patch b/main/hostapd/0019-EAP-pwd-Use-const_time_memcmp-for-pwd_value-prime-co.patch
new file mode 100644
index 0000000000..e27cd827e8
--- /dev/null
+++ b/main/hostapd/0019-EAP-pwd-Use-const_time_memcmp-for-pwd_value-prime-co.patch
@@ -0,0 +1,70 @@
+From 20d7bd83c43fb24c4cf84d3045254d3ee1957166 Mon Sep 17 00:00:00 2001
+From: Jouni Malinen <jouni@codeaurora.org>
+Date: Thu, 25 Apr 2019 19:07:05 +0300
+Subject: [PATCH 2/6] EAP-pwd: Use const_time_memcmp() for pwd_value >= prime
+ comparison
+
+This reduces timing and memory access pattern differences for an
+operation that could depend on the used password.
+
+Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
+(cherry picked from commit 7958223fdcfe82479e6ed71019a84f6d4cbf799c)
+---
+ src/eap_common/eap_pwd_common.c | 13 ++++++++-----
+ 1 file changed, 8 insertions(+), 5 deletions(-)
+
+diff --git a/src/eap_common/eap_pwd_common.c b/src/eap_common/eap_pwd_common.c
+index 884150e6c..6ca2c8bad 100644
+--- a/src/eap_common/eap_pwd_common.c
++++ b/src/eap_common/eap_pwd_common.c
+@@ -144,6 +144,7 @@ int compute_password_element(EAP_PWD_group *grp, u16 num,
+ u8 qnr_bin[MAX_ECC_PRIME_LEN];
+ u8 qr_or_qnr_bin[MAX_ECC_PRIME_LEN];
+ u8 x_bin[MAX_ECC_PRIME_LEN];
++ u8 prime_bin[MAX_ECC_PRIME_LEN];
+ struct crypto_bignum *tmp1 = NULL, *tmp2 = NULL, *pm1 = NULL;
+ struct crypto_hash *hash;
+ unsigned char pwe_digest[SHA256_MAC_LEN], *prfbuf = NULL, ctr;
+@@ -161,6 +162,11 @@ int compute_password_element(EAP_PWD_group *grp, u16 num,
+ os_memset(x_bin, 0, sizeof(x_bin));
+
+ prime = crypto_ec_get_prime(grp->group);
++ primebitlen = crypto_ec_prime_len_bits(grp->group);
++ primebytelen = crypto_ec_prime_len(grp->group);
++ if (crypto_bignum_to_bin(prime, prime_bin, sizeof(prime_bin),
++ primebytelen) < 0)
++ return -1;
+ grp->pwe = crypto_ec_point_init(grp->group);
+ tmp1 = crypto_bignum_init();
+ pm1 = crypto_bignum_init();
+@@ -170,8 +176,6 @@ int compute_password_element(EAP_PWD_group *grp, u16 num,
+ goto fail;
+ }
+
+- primebitlen = crypto_ec_prime_len_bits(grp->group);
+- primebytelen = crypto_ec_prime_len(grp->group);
+ if ((prfbuf = os_malloc(primebytelen)) == NULL) {
+ wpa_printf(MSG_INFO, "EAP-pwd: unable to malloc space for prf "
+ "buffer");
+@@ -237,6 +241,8 @@ int compute_password_element(EAP_PWD_group *grp, u16 num,
+ if (primebitlen % 8)
+ buf_shift_right(prfbuf, primebytelen,
+ 8 - primebitlen % 8);
++ if (const_time_memcmp(prfbuf, prime_bin, primebytelen) >= 0)
++ continue;
+
+ crypto_bignum_deinit(x_candidate, 1);
+ x_candidate = crypto_bignum_init_set(prfbuf, primebytelen);
+@@ -246,9 +252,6 @@ int compute_password_element(EAP_PWD_group *grp, u16 num,
+ goto fail;
+ }
+
+- if (crypto_bignum_cmp(x_candidate, prime) >= 0)
+- continue;
+-
+ wpa_hexdump_key(MSG_DEBUG, "EAP-pwd: x_candidate",
+ prfbuf, primebytelen);
+ const_time_select_bin(found, x_bin, prfbuf, primebytelen,
+--
+2.20.1
+
diff --git a/main/hostapd/0020-OpenSSL-Use-BN_bn2binpad-or-BN_bn2bin_padded-if-avai.patch b/main/hostapd/0020-OpenSSL-Use-BN_bn2binpad-or-BN_bn2bin_padded-if-avai.patch
new file mode 100644
index 0000000000..16feeaabb4
--- /dev/null
+++ b/main/hostapd/0020-OpenSSL-Use-BN_bn2binpad-or-BN_bn2bin_padded-if-avai.patch
@@ -0,0 +1,66 @@
+From ee34d8cfbd0fbf7ba7429531d4bee1c43b074d8b Mon Sep 17 00:00:00 2001
+From: Jouni Malinen <jouni@codeaurora.org>
+Date: Thu, 25 Apr 2019 19:23:05 +0300
+Subject: [PATCH 3/6] OpenSSL: Use BN_bn2binpad() or BN_bn2bin_padded() if
+ available
+
+This converts crypto_bignum_to_bin() to use the OpenSSL/BoringSSL
+functions BN_bn2binpad()/BN_bn2bin_padded(), when available, to avoid
+differences in runtime and memory access patterns depending on the
+leading bytes of the BIGNUM value.
+
+OpenSSL 1.0.2 and LibreSSL do not include such functions, so those cases
+are still using the previous implementation where the BN_num_bytes()
+call may result in different memory access pattern.
+
+Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
+(cherry picked from commit 1e237903f5b5d3117342daf006c5878cdb45e3d3)
+---
+ src/crypto/crypto_openssl.c | 16 ++++++++++++++++
+ 1 file changed, 16 insertions(+)
+
+diff --git a/src/crypto/crypto_openssl.c b/src/crypto/crypto_openssl.c
+index 1b0c1ec96..23ae5462d 100644
+--- a/src/crypto/crypto_openssl.c
++++ b/src/crypto/crypto_openssl.c
+@@ -1295,7 +1295,13 @@ void crypto_bignum_deinit(struct crypto_bignum *n, int clear)
+ int crypto_bignum_to_bin(const struct crypto_bignum *a,
+ u8 *buf, size_t buflen, size_t padlen)
+ {
++#ifdef OPENSSL_IS_BORINGSSL
++#else /* OPENSSL_IS_BORINGSSL */
++#if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER)
++#else
+ int num_bytes, offset;
++#endif
++#endif /* OPENSSL_IS_BORINGSSL */
+
+ if (TEST_FAIL())
+ return -1;
+@@ -1303,6 +1309,14 @@ int crypto_bignum_to_bin(const struct crypto_bignum *a,
+ if (padlen > buflen)
+ return -1;
+
++#ifdef OPENSSL_IS_BORINGSSL
++ if (BN_bn2bin_padded(buf, padlen, (const BIGNUM *) a) == 0)
++ return -1;
++ return padlen;
++#else /* OPENSSL_IS_BORINGSSL */
++#if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER)
++ return BN_bn2binpad((const BIGNUM *) a, buf, padlen);
++#else
+ num_bytes = BN_num_bytes((const BIGNUM *) a);
+ if ((size_t) num_bytes > buflen)
+ return -1;
+@@ -1315,6 +1329,8 @@ int crypto_bignum_to_bin(const struct crypto_bignum *a,
+ BN_bn2bin((const BIGNUM *) a, buf + offset);
+
+ return num_bytes + offset;
++#endif
++#endif /* OPENSSL_IS_BORINGSSL */
+ }
+
+
+--
+2.20.1
+
diff --git a/main/hostapd/0021-SAE-Run-through-prf-result-processing-even-if-it-pri.patch b/main/hostapd/0021-SAE-Run-through-prf-result-processing-even-if-it-pri.patch
new file mode 100644
index 0000000000..0a2f398527
--- /dev/null
+++ b/main/hostapd/0021-SAE-Run-through-prf-result-processing-even-if-it-pri.patch
@@ -0,0 +1,59 @@
+From a25b48118d75f3c2d7cb1b2c3b4cffb13091a34c Mon Sep 17 00:00:00 2001
+From: Jouni Malinen <j@w1.fi>
+Date: Mon, 24 Jun 2019 23:01:06 +0300
+Subject: [PATCH 4/6] SAE: Run through prf result processing even if it >=
+ prime
+
+This reduces differences in timing and memory access within the
+hunting-and-pecking loop for ECC groups that have a prime that is not
+close to a power of two (e.g., Brainpool curves).
+
+Signed-off-by: Jouni Malinen <j@w1.fi>
+(cherry picked from commit 147bf7b88a9c231322b5b574263071ca6dbb0503)
+---
+ src/common/sae.c | 15 ++++++++++++---
+ 1 file changed, 12 insertions(+), 3 deletions(-)
+
+diff --git a/src/common/sae.c b/src/common/sae.c
+index 0d56e5505..759e48e22 100644
+--- a/src/common/sae.c
++++ b/src/common/sae.c
+@@ -304,6 +304,8 @@ static int sae_test_pwd_seed_ecc(struct sae_data *sae, const u8 *pwd_seed,
+ struct crypto_bignum *y_sqr, *x_cand;
+ int res;
+ size_t bits;
++ int cmp_prime;
++ unsigned int in_range;
+
+ wpa_hexdump_key(MSG_DEBUG, "SAE: pwd-seed", pwd_seed, SHA256_MAC_LEN);
+
+@@ -317,8 +319,13 @@ static int sae_test_pwd_seed_ecc(struct sae_data *sae, const u8 *pwd_seed,
+ wpa_hexdump_key(MSG_DEBUG, "SAE: pwd-value",
+ pwd_value, sae->tmp->prime_len);
+
+- if (const_time_memcmp(pwd_value, prime, sae->tmp->prime_len) >= 0)
+- return 0;
++ cmp_prime = const_time_memcmp(pwd_value, prime, sae->tmp->prime_len);
++ /* Create a const_time mask for selection based on prf result
++ * being smaller than prime. */
++ in_range = const_time_fill_msb((unsigned int) cmp_prime);
++ /* The algorithm description would skip the next steps if
++ * cmp_prime >= 0 (reutnr 0 here), but go through them regardless to
++ * minimize externally observable differences in behavior. */
+
+ x_cand = crypto_bignum_init_set(pwd_value, sae->tmp->prime_len);
+ if (!x_cand)
+@@ -330,7 +337,9 @@ static int sae_test_pwd_seed_ecc(struct sae_data *sae, const u8 *pwd_seed,
+
+ res = is_quadratic_residue_blind(sae, prime, bits, qr, qnr, y_sqr);
+ crypto_bignum_deinit(y_sqr, 1);
+- return res;
++ if (res < 0)
++ return res;
++ return const_time_select_int(in_range, res, 0);
+ }
+
+
+--
+2.20.1
+
diff --git a/main/hostapd/0022-EAP-pwd-Run-through-prf-result-processing-even-if-it.patch b/main/hostapd/0022-EAP-pwd-Run-through-prf-result-processing-even-if-it.patch
new file mode 100644
index 0000000000..d5ebe59aec
--- /dev/null
+++ b/main/hostapd/0022-EAP-pwd-Run-through-prf-result-processing-even-if-it.patch
@@ -0,0 +1,57 @@
+From 00a6cc73da61b03c146b6c341d0d1e572bcef432 Mon Sep 17 00:00:00 2001
+From: Jouni Malinen <j@w1.fi>
+Date: Mon, 24 Jun 2019 23:02:51 +0300
+Subject: [PATCH 5/6] EAP-pwd: Run through prf result processing even if it >=
+ prime
+
+This reduces differences in timing and memory access within the
+hunting-and-pecking loop for ECC groups that have a prime that is not
+close to a power of two (e.g., Brainpool curves).
+
+Signed-off-by: Jouni Malinen <j@w1.fi>
+(cherry picked from commit cd803299ca485eb857e37c88f973fccfbb8600e5)
+---
+ src/eap_common/eap_pwd_common.c | 13 ++++++++++---
+ 1 file changed, 10 insertions(+), 3 deletions(-)
+
+diff --git a/src/eap_common/eap_pwd_common.c b/src/eap_common/eap_pwd_common.c
+index 6ca2c8bad..fec251472 100644
+--- a/src/eap_common/eap_pwd_common.c
++++ b/src/eap_common/eap_pwd_common.c
+@@ -155,6 +155,8 @@ int compute_password_element(EAP_PWD_group *grp, u16 num,
+ struct crypto_bignum *x_candidate = NULL;
+ const struct crypto_bignum *prime;
+ u8 mask, found_ctr = 0, is_odd = 0;
++ int cmp_prime;
++ unsigned int in_range;
+
+ if (grp->pwe)
+ return -1;
+@@ -241,8 +243,13 @@ int compute_password_element(EAP_PWD_group *grp, u16 num,
+ if (primebitlen % 8)
+ buf_shift_right(prfbuf, primebytelen,
+ 8 - primebitlen % 8);
+- if (const_time_memcmp(prfbuf, prime_bin, primebytelen) >= 0)
+- continue;
++ cmp_prime = const_time_memcmp(prfbuf, prime_bin, primebytelen);
++ /* Create a const_time mask for selection based on prf result
++ * being smaller than prime. */
++ in_range = const_time_fill_msb((unsigned int) cmp_prime);
++ /* The algorithm description would skip the next steps if
++ * cmp_prime >= 0, but go through them regardless to minimize
++ * externally observable differences in behavior. */
+
+ crypto_bignum_deinit(x_candidate, 1);
+ x_candidate = crypto_bignum_init_set(prfbuf, primebytelen);
+@@ -306,7 +313,7 @@ int compute_password_element(EAP_PWD_group *grp, u16 num,
+ goto fail;
+ mask = const_time_eq(res, check);
+ found_ctr = const_time_select_u8(found, found_ctr, ctr);
+- found |= mask;
++ found |= mask & in_range;
+ }
+ if (found == 0) {
+ wpa_printf(MSG_INFO,
+--
+2.20.1
+
diff --git a/main/hostapd/0023-EAP-pwd-Disallow-ECC-groups-with-a-prime-under-256-b.patch b/main/hostapd/0023-EAP-pwd-Disallow-ECC-groups-with-a-prime-under-256-b.patch
new file mode 100644
index 0000000000..0ffff7ea9d
--- /dev/null
+++ b/main/hostapd/0023-EAP-pwd-Disallow-ECC-groups-with-a-prime-under-256-b.patch
@@ -0,0 +1,45 @@
+From 92e1b96c26a84e503847bdd22ebadf697c4031ad Mon Sep 17 00:00:00 2001
+From: Jouni Malinen <j@w1.fi>
+Date: Sat, 13 Apr 2019 17:20:57 +0300
+Subject: [PATCH] EAP-pwd: Disallow ECC groups with a prime under 256 bits
+
+Based on the SAE implementation guidance update to not allow ECC groups
+with a prime that is under 256 bits, reject groups 25, 26, and 27 in
+EAP-pwd.
+
+Signed-off-by: Jouni Malinen <j@w1.fi>
+---
+ src/eap_common/eap_pwd_common.c | 13 +++++++++++++
+ 1 file changed, 13 insertions(+)
+
+diff --git a/src/eap_common/eap_pwd_common.c b/src/eap_common/eap_pwd_common.c
+index 4288b5299..00f85a390 100644
+--- a/src/eap_common/eap_pwd_common.c
++++ b/src/eap_common/eap_pwd_common.c
+@@ -85,10 +85,23 @@ static int eap_pwd_kdf(const u8 *key, size_t keylen, const u8 *label,
+ }
+
+
++static int eap_pwd_suitable_group(u16 num)
++{
++ /* Do not allow ECC groups with prime under 256 bits based on guidance
++ * for the similar design in SAE. */
++ return num == 19 || num == 20 || num == 21 ||
++ num == 28 || num == 29 || num == 30;
++}
++
++
+ EAP_PWD_group * get_eap_pwd_group(u16 num)
+ {
+ EAP_PWD_group *grp;
+
++ if (!eap_pwd_suitable_group(num)) {
++ wpa_printf(MSG_INFO, "EAP-pwd: unsuitable group %u", num);
++ return NULL;
++ }
+ grp = os_zalloc(sizeof(EAP_PWD_group));
+ if (!grp)
+ return NULL;
+--
+2.22.0
+
diff --git a/main/hostapd/0024-SAE-Reject-unsuitable-groups-based-on-REVmd-changes.patch b/main/hostapd/0024-SAE-Reject-unsuitable-groups-based-on-REVmd-changes.patch
new file mode 100644
index 0000000000..a7e6d37fb1
--- /dev/null
+++ b/main/hostapd/0024-SAE-Reject-unsuitable-groups-based-on-REVmd-changes.patch
@@ -0,0 +1,59 @@
+From db54db11aec763b6fc74715c36e0f9de0d65e206 Mon Sep 17 00:00:00 2001
+From: Jouni Malinen <jouni@codeaurora.org>
+Date: Mon, 8 Apr 2019 18:01:07 +0300
+Subject: [PATCH] SAE: Reject unsuitable groups based on REVmd changes
+
+The rules defining which DH groups are suitable for SAE use were
+accepted into IEEE 802.11 REVmd based on this document:
+https://mentor.ieee.org/802.11/dcn/19/11-19-0387-02-000m-addressing-some-sae-comments.docx
+
+Enforce those rules in production builds of wpa_supplicant and hostapd.
+CONFIG_TESTING_OPTIONS=y builds can still be used to select any o the
+implemented groups to maintain testing coverage.
+
+Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
+---
+ src/common/sae.c | 23 +++++++++++++++++++++++
+ 1 file changed, 23 insertions(+)
+
+diff --git a/src/common/sae.c b/src/common/sae.c
+index 981e788dc..8129a7c15 100644
+--- a/src/common/sae.c
++++ b/src/common/sae.c
+@@ -17,10 +17,33 @@
+ #include "sae.h"
+
+
++static int sae_suitable_group(int group)
++{
++#ifdef CONFIG_TESTING_OPTIONS
++ /* Allow all groups for testing purposes in non-production builds. */
++ return 1;
++#else /* CONFIG_TESTING_OPTIONS */
++ /* Enforce REVmd rules on which SAE groups are suitable for production
++ * purposes: FFC groups whose prime is >= 3072 bits and ECC groups
++ * defined over a prime field whose prime is >= 256 bits. Furthermore,
++ * ECC groups defined over a characteristic 2 finite field and ECC
++ * groups with a co-factor greater than 1 are not suitable. */
++ return group == 19 || group == 20 || group == 21 ||
++ group == 28 || group == 29 || group == 30 ||
++ group == 15 || group == 16 || group == 17 || group == 18;
++#endif /* CONFIG_TESTING_OPTIONS */
++}
++
++
+ int sae_set_group(struct sae_data *sae, int group)
+ {
+ struct sae_temporary_data *tmp;
+
++ if (!sae_suitable_group(group)) {
++ wpa_printf(MSG_DEBUG, "SAE: Reject unsuitable group %d", group);
++ return -1;
++ }
++
+ sae_clear_data(sae);
+ tmp = sae->tmp = os_zalloc(sizeof(*tmp));
+ if (tmp == NULL)
+--
+2.22.0
+
diff --git a/main/hostapd/0025-dragonfly-Disable-use-of-groups-using-Brainpool-curv.patch b/main/hostapd/0025-dragonfly-Disable-use-of-groups-using-Brainpool-curv.patch
new file mode 100644
index 0000000000..8dce92fffc
--- /dev/null
+++ b/main/hostapd/0025-dragonfly-Disable-use-of-groups-using-Brainpool-curv.patch
@@ -0,0 +1,51 @@
+From 558518ed63202e5358116ab7e0afd5e85490f2ef Mon Sep 17 00:00:00 2001
+From: Jouni Malinen <j@w1.fi>
+Date: Sat, 27 Jul 2019 23:19:17 +0300
+Subject: [PATCH 6/6] dragonfly: Disable use of groups using Brainpool curves
+
+Disable groups that use Brainpool curves for now since they leak more
+timing information due to the prime not being close to a power of two.
+This removes use of groups 28, 29, and 30 from SAE and EAP-pwd.
+
+Signed-off-by: Jouni Malinen <j@w1.fi>
+(cherry picked from commit 876c5eaa6dae1a87a17603fc489a44c29eedc2e3)
+---
+ src/common/sae.c | 6 ++++--
+ src/eap_common/eap_pwd_common.c | 3 +--
+ 2 files changed, 5 insertions(+), 4 deletions(-)
+
+diff --git a/src/common/sae.c b/src/common/sae.c
+index 759e48e22..2dbc251a4 100644
+--- a/src/common/sae.c
++++ b/src/common/sae.c
+@@ -28,9 +28,11 @@ static int sae_suitable_group(int group)
+ * purposes: FFC groups whose prime is >= 3072 bits and ECC groups
+ * defined over a prime field whose prime is >= 256 bits. Furthermore,
+ * ECC groups defined over a characteristic 2 finite field and ECC
+- * groups with a co-factor greater than 1 are not suitable. */
++ * groups with a co-factor greater than 1 are not suitable. Disable
++ * groups that use Brainpool curves as well for now since they leak more
++ * timing information due to the prime not being close to a power of
++ * two. */
+ return group == 19 || group == 20 || group == 21 ||
+- group == 28 || group == 29 || group == 30 ||
+ group == 15 || group == 16 || group == 17 || group == 18;
+ #endif /* CONFIG_TESTING_OPTIONS */
+ }
+diff --git a/src/eap_common/eap_pwd_common.c b/src/eap_common/eap_pwd_common.c
+index fec251472..4a5eb2599 100644
+--- a/src/eap_common/eap_pwd_common.c
++++ b/src/eap_common/eap_pwd_common.c
+@@ -89,8 +89,7 @@ static int eap_pwd_suitable_group(u16 num)
+ {
+ /* Do not allow ECC groups with prime under 256 bits based on guidance
+ * for the similar design in SAE. */
+- return num == 19 || num == 20 || num == 21 ||
+- num == 28 || num == 29 || num == 30;
++ return num == 19 || num == 20 || num == 21;
+ }
+
+
+--
+2.20.1
+
diff --git a/main/hostapd/APKBUILD b/main/hostapd/APKBUILD
index 72824e2e38..8a604518ff 100644
--- a/main/hostapd/APKBUILD
+++ b/main/hostapd/APKBUILD
@@ -1,7 +1,7 @@
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=hostapd
pkgver=2.7
-pkgrel=3
+pkgrel=4
pkgdesc="daemon for wireless software access points"
url="http://hostap.epitest.fi/hostapd/"
arch="all"
@@ -10,8 +10,31 @@ makedepends="openssl-dev libnl3-dev linux-headers"
subpackages="$pkgname-doc $pkgname-openrc"
patches="CVE-2012-4445.patch
CVE-2019-9496.patch
- 0001-EAP-pwd-server-Fix-reassembly-buffer-handling.patch
- 0003-EAP-pwd-peer-Fix-reassembly-buffer-handling.patch
+ 0001-OpenSSL-Use-constant-time-operations-for-private-big.patch
+ 0002-OpenSSL-Use-constant-time-selection-for-crypto_bignu.patch
+ 0003-SAE-Minimize-timing-differences-in-PWE-derivation.patch
+ 0004-SAE-Avoid-branches-in-is_quadratic_residue_blind.patch
+ 0005-SAE-Mask-timing-of-MODP-groups-22-23-24.patch
+ 0006-SAE-Use-const_time-selection-for-PWE-in-FFC.patch
+ 0007-SAE-Use-constant-time-operations-in-sae_test_pwd_see.patch
+ 0008-Add-helper-functions-for-constant-time-operations.patch
+ 0009-EAP-pwd-Use-constant-time-and-memory-access-for-find.patch
+ 0010-EAP-pwd-server-Detect-reflection-attacks.patch
+ 0011-EAP-pwd-client-Verify-received-scalar-and-element.patch
+ 0012-EAP-pwd-server-Verify-received-scalar-and-element.patch
+ 0013-EAP-pwd-Check-element-x-y-coordinates-explicitly.patch
+ 0014-EAP-pwd-server-Fix-reassembly-buffer-handling.patch
+ 0015-EAP-pwd-peer-Fix-reassembly-buffer-handling.patch
+ 0016-SAE-Use-const_time_memcmp-for-pwd_value-prime-compar.patch
+ 0017-EAP-pwd-Enforce-1-rand-mask-r-and-rand-mask-mod-r-1.patch
+ 0018-EAP-pwd-Remove-unused-checks-for-cofactor-1-cases.patch
+ 0019-EAP-pwd-Use-const_time_memcmp-for-pwd_value-prime-co.patch
+ 0020-OpenSSL-Use-BN_bn2binpad-or-BN_bn2bin_padded-if-avai.patch
+ 0021-SAE-Run-through-prf-result-processing-even-if-it-pri.patch
+ 0022-EAP-pwd-Run-through-prf-result-processing-even-if-it.patch
+ 0023-EAP-pwd-Disallow-ECC-groups-with-a-prime-under-256-b.patch
+ 0024-SAE-Reject-unsuitable-groups-based-on-REVmd-changes.patch
+ 0025-dragonfly-Disable-use-of-groups-using-Brainpool-curv.patch
"
source="http://hostap.epitest.fi/releases/$pkgname-$pkgver.tar.gz
$patches
@@ -21,6 +44,8 @@ options="!check" #no testsuite
builddir="$srcdir"/$pkgname-$pkgver/hostapd
# secfixes:
+# 2.7-r4:
+# - CVE-2019-13377
# 2.7-r3:
# - CVE-2019-9496
# 2.7-r1:
@@ -99,7 +124,30 @@ package() {
sha512sums="1c9a210dfffb951fb667be19aa44ad8c66dccd2aed26cdab939185923550e3c1998a678ebe6975e560e1b3385bff2098f1b2cb773452ba66fb35246fdd3eb2c1 hostapd-2.7.tar.gz
619acce84516dead1e03e5da71657ea4c4b6f3ca8271574409773aeb316cbddc88095b50320804f457f001f4f3fe83053e660c008d8409f59bb4d3bfe058b601 CVE-2012-4445.patch
90981a52d6cb2e91f67a9bc830d3db02da6fde4bea0cf512b22111da6c8ab151f5dd171a2f2e409d9ff75e388e72c2314dd023a98fdabf16248b11a950bde881 CVE-2019-9496.patch
-7038044885871271ac724790663d5c0a428db83b41a691747be7a618ae893670a98f3ba52a297937249084296b0e9bcfd791edaa3928548efddb259e1a15f46c 0001-EAP-pwd-server-Fix-reassembly-buffer-handling.patch
-99c734fe395b4231aa6a097a08a00e5dab65ea9c37a7c83b1904a37c39307d9e7e95485734b0d483687126f4100c75f8a7b1420f0a2edcbfe07b454a14548822 0003-EAP-pwd-peer-Fix-reassembly-buffer-handling.patch
+92fca9bd4d8a1e63ff6b6bce35ceea385f040e475c97eb32a2d53b97030a5513c1a6df238081b5db06ef79163f3a505d0bed641cfd9125446dc0fc30b418a790 0001-OpenSSL-Use-constant-time-operations-for-private-big.patch
+396aa9df1de947d645e22d0fbfe9c8a139a9eedbaf286b0bbba5c2341d2af0a2aec072d814c84b89c01e338ebc2ad8db02dbd52c72c2699e98fd5dc14106706f 0002-OpenSSL-Use-constant-time-selection-for-crypto_bignu.patch
+0dafd95c452472e51317df4cc6ac139a10cbc130d3a3a48ce44a8a96ebfa0197ed924086ef3a2984cd84024b347137bd76fd32e834c7667712ffcb3872d75c0b 0003-SAE-Minimize-timing-differences-in-PWE-derivation.patch
+132da8732d783c0e3a4af2c93f2c3c54f832c5231ef36629a45849f9f1ff045dc791ea0727d165edc76c53f827538ab5e9d6026af384733b3008c45b47d711d8 0004-SAE-Avoid-branches-in-is_quadratic_residue_blind.patch
+c02771f2a904d9fac5c4c1c5b25d715bd18ada5a0aaea899d68348bdcd235af66db5473e364994ddf18cf081c6a8148783700ee9e4287c6de45d242e0ef73c93 0005-SAE-Mask-timing-of-MODP-groups-22-23-24.patch
+ff5621cfe8e11e3f7e3efd941b3e68c6c2714d19f69932428b3efbb166760323a9540e3840bc36f930bfcf990bfc99741d96df2edf503e1813400942629b4186 0006-SAE-Use-const_time-selection-for-PWE-in-FFC.patch
+07e57cd6509279fee021dfe290bad964088c39a181712424145f945ddc0682fa726b9bc6cc11c2fd7efb3f1d5bb7731dfee7e46351991340c715d39f536e7b6b 0007-SAE-Use-constant-time-operations-in-sae_test_pwd_see.patch
+24bd9359f2808a62af5eaeefa08a817b578cf2a88e3f77c77f43005e2e5a6526cbd96b5c01d2ddff65fd88e3a551ec771bcfbf49419759dc3bffd6dd999415b1 0008-Add-helper-functions-for-constant-time-operations.patch
+65d89c276b43766bf3e9bd6a4e6829c5ec38b59c4725c0a020ecbb9363f27cba20e82f0cebda55d264a1245b81ca545fdbe3d36eff5b5cee07d559b5e093a67c 0009-EAP-pwd-Use-constant-time-and-memory-access-for-find.patch
+c2ebe127e0d14c56b9e274a6f8f97c5fb763edc9dc7a3cab4cb1748d29a4d514c240e398ab140542e7aa088b8f17936187e263466290a8ec483534b7182b8703 0010-EAP-pwd-server-Detect-reflection-attacks.patch
+509aaef9f32eabbc3b7d257fb85d424db89a383a1708353d52f8c26f3cac602b351615c6775731193ca9403da368052482aa8294927e9d1880f567a08e3056da 0011-EAP-pwd-client-Verify-received-scalar-and-element.patch
+217714f651b489f9bc9dad1485b1ea409b0d9c40aef70a4c343f59261198175e5360e6dff99773a7a7358731e010f6c334a095f4868adc9f914a4c4085fb3092 0012-EAP-pwd-server-Verify-received-scalar-and-element.patch
+39cb011348a4723b52405bd6cd85f78da1a80e077b61ef0c489e5a0a03e21e30de38378554f1a81092b65cd923d1c3c430821812037a7607f582038d3ba26687 0013-EAP-pwd-Check-element-x-y-coordinates-explicitly.patch
+7038044885871271ac724790663d5c0a428db83b41a691747be7a618ae893670a98f3ba52a297937249084296b0e9bcfd791edaa3928548efddb259e1a15f46c 0014-EAP-pwd-server-Fix-reassembly-buffer-handling.patch
+99c734fe395b4231aa6a097a08a00e5dab65ea9c37a7c83b1904a37c39307d9e7e95485734b0d483687126f4100c75f8a7b1420f0a2edcbfe07b454a14548822 0015-EAP-pwd-peer-Fix-reassembly-buffer-handling.patch
+0dfc8728cfc3a86f7a182a7f71213b94f64880ee4470e2a939c83059df5af7a60d56ec0a8a5f2f717838995f4ef2c6a8fb909324875b0f12a52040239092d115 0016-SAE-Use-const_time_memcmp-for-pwd_value-prime-compar.patch
+abc2a40f9437280b1b0d3355f6485fd3d3b6412011e23b4699eb53eebbb761b7d6af553df5655bf5171dabf010f18bd9923a5589c295766d8b6643645b466146 0017-EAP-pwd-Enforce-1-rand-mask-r-and-rand-mask-mod-r-1.patch
+d9113a9f59cd35de88a2ef57e2f83c10986dddd3fa18652c3ddfe9f9d5db828d5fdd6385f2de9d6e8e11207c4b35fad2fb72d6698e554fc017cd369231115f44 0018-EAP-pwd-Remove-unused-checks-for-cofactor-1-cases.patch
+88b28f73267b5031417e527b4e2eea117e62649862bafbe99b83b77bade56612283279906c8d1a4c997fb8f32fc7a6cf8c88931a64e9520d1bf45fbdb0e6c381 0019-EAP-pwd-Use-const_time_memcmp-for-pwd_value-prime-co.patch
+01389b9d3951bf1148894c0f4b45d22ef8352a8fe1090721d17216506581305726f6a6c0ebff88479e5342330e75fc04db9201d7d65d4cc6b01a5f7258dc26f9 0020-OpenSSL-Use-BN_bn2binpad-or-BN_bn2bin_padded-if-avai.patch
+1fabc83a5e05ce3d09c89e37365d038bd0eec3a76683966ad172eac3c2c884dbc24fc6ca11c27a8f4582e886d0f1cde73bbede4484352b42a3f686d89d088fff 0021-SAE-Run-through-prf-result-processing-even-if-it-pri.patch
+bcae73930c35d441c5615970c305abb3dff293fdec16df50823e57419b22d1aac0e780970619e0c78b4482b7d07962bcf6162706a20e20f7b21a3a10f500eff1 0022-EAP-pwd-Run-through-prf-result-processing-even-if-it.patch
+89ac9ee8b0a3521b135ea5075fcc01ee37b111ba129e75f58e4bb863aad0e782c0e1928c91cab2ab1859a7a52d66987e14018b0552c167c05dbaeed76f1b12dd 0023-EAP-pwd-Disallow-ECC-groups-with-a-prime-under-256-b.patch
+da5f4248a0173cd7d07972b760631a8dc26f258e7b5be059c0d7de26e17f668945a62d2afce01ed1a1e9df6c55f9fd6ee344d4f006f5564b90a25e90e1e7c704 0024-SAE-Reject-unsuitable-groups-based-on-REVmd-changes.patch
+4734a8ab8ba1e91fc9e3d729f34527c14c291df238b02adea5acc04b0361b41d4bffca2fb13a4f464e9f007fa624117af4f50d755cb41a3129b4868da91bdf9a 0025-dragonfly-Disable-use-of-groups-using-Brainpool-curv.patch
b54b7c6aa17e5cb86a9b354a516eb2dbefb544df18471339c61d82776de447011a2ac290bea1e6c8beae4b6cebefafb8174683ea42fb773e9e8fe6c679f33ba3 hostapd.initd
0882263bbd7c0b05bf51f51d66e11a23a0b8ca7da2a3b8a30166d2c5f044c0c134e6bccb1d02c9e81819ca8fb0c0fb55c7121a08fe7233ccaa73ff8ab9a238fe hostapd.confd"
diff --git a/main/imagemagick/APKBUILD b/main/imagemagick/APKBUILD
index f3b1211111..d5f2277425 100644
--- a/main/imagemagick/APKBUILD
+++ b/main/imagemagick/APKBUILD
@@ -2,7 +2,8 @@
# Contributor: Carlo Landmeter <clandmeter@gmail.com>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=imagemagick
-pkgver=7.0.8.44
+_pkgname=ImageMagick
+pkgver=7.0.8.58
pkgrel=0
_pkgver=${pkgver%.*}-${pkgver##*.}
_abiver=7
@@ -16,10 +17,37 @@ makedepends="zlib-dev libpng-dev libjpeg-turbo-dev freetype-dev fontconfig-dev
libwebp-dev libxml2-dev librsvg-dev libx11-dev libxext-dev"
checkdepends="freetype fontconfig ghostscript ghostscript-fonts lcms2 graphviz"
subpackages="$pkgname-doc $pkgname-dev $pkgname-c++:_cxx $pkgname-libs"
-source="https://www.imagemagick.org/download/releases/ImageMagick-$_pkgver.tar.xz"
-builddir="$srcdir/ImageMagick-${_pkgver}"
+source="$_pkgname-$_pkgver.tar.gz::https://github.com/ImageMagick/ImageMagick/archive/$_pkgver.tar.gz
+ disable-avaraging-tests.patch"
+builddir="$srcdir/$_pkgname-$_pkgver"
# secfixes:
+# 6.9.10.56-r0:
+# - CVE-2019-13454
+# 6.9.10.53-r0:
+# - CVE-2019-13391
+# - CVE-2019-13311
+# - CVE-2019-13310
+# - CVE-2019-13309
+# - CVE-2019-13308
+# - CVE-2019-13307
+# - CVE-2019-13306
+# - CVE-2019-13305
+# - CVE-2019-13304
+# - CVE-2019-13303
+# - CVE-2019-13302
+# - CVE-2019-13301
+# - CVE-2019-13300
+# - CVE-2019-13299
+# - CVE-2019-13298
+# - CVE-2019-13297
+# - CVE-2019-13296
+# - CVE-2019-13295
+# - CVE-2019-13137
+# - CVE-2019-13136
+# - CVE-2019-13135
+# - CVE-2019-13134
+# - CVE-2019-13133
# 7.0.8.44-r0:
# - CVE-2019-11598
# - CVE-2019-11597
@@ -85,4 +113,5 @@ _cxx() {
mv "$pkgdir"/usr/lib/libMagick++*.so.* "$subpkgdir"/usr/lib/
}
-sha512sums="a18b9e78375ed1a8ab3526ead089dc39c4eed189d4aca0df87787c7ef6e4ee46cdc9a93a1fe1c2a65f0ac2f86c3651696ccd23eb82b6a96cad4c78cf8314bb96 ImageMagick-7.0.8-44.tar.xz"
+sha512sums="c77eea33e633c92f0d5033c5ccd2bb2aee02ce049c4f48fdff9043e35d4f2119bab93c9140ecc052b2bfc55e9382308a35389e06927a9895751a5b530cac418c ImageMagick-7.0.8-58.tar.gz
+58afb2da075a6208b6a990ff297b3a827d260687c3355198a8b4d987e1596c0b0cd78aff6f0be0e1896e537fbe44a3d467473183f5f149664ea6e6fb3d3291a9 disable-avaraging-tests.patch"
diff --git a/main/imagemagick/disable-avaraging-tests.patch b/main/imagemagick/disable-avaraging-tests.patch
new file mode 100644
index 0000000000..8e715f81e6
--- /dev/null
+++ b/main/imagemagick/disable-avaraging-tests.patch
@@ -0,0 +1,26 @@
+The avaraging tests seems to be flaky due to rounding errors. Test fails on
+x86 and s390x
+
+https://github.com/ImageMagick/ImageMagick/issues/1576#issuecomment-494595404
+
+diff --git a/Magick++/tests/tests.tap b/Magick++/tests/tests.tap
+index b5c15ff..bb83980 100755
+--- a/Magick++/tests/tests.tap
++++ b/Magick++/tests/tests.tap
+@@ -8,14 +8,14 @@
+ #
+ subdir=Magick++/tests
+ . ./common.shi
+-echo "1..13"
++echo "1..12"
+
+ SRCDIR=${top_srcdir}/${subdir}/
+ export SRCDIR
+
+ cd ${subdir} || exit 1
+
+-for mytest in appendImages attributes averageImages coalesceImages coderInfo color colorHistogram exceptions geometry montageImages morphImages readWriteBlob readWriteImages
++for mytest in appendImages attributes coalesceImages coderInfo color colorHistogram exceptions geometry montageImages morphImages readWriteBlob readWriteImages
+ do
+ ./${mytest} && echo "ok" || echo "not ok"
+ done
diff --git a/main/kamailio/0001-mohqueue.patch b/main/kamailio/0001-mohqueue.patch
new file mode 100644
index 0000000000..72ca36b12b
--- /dev/null
+++ b/main/kamailio/0001-mohqueue.patch
@@ -0,0 +1,17 @@
+--- a/src/modules/mohqueue/mohq_funcs.c
++++ b/src/modules/mohqueue/mohq_funcs.c
+@@ -1405,9 +1405,12 @@
+
+ {
+ call_lst *pcall = (call_lst *)*pcbp->param;
++if (pcall->call_state >= CLSTA_INQUEUE)
++ { return; }
++LM_ERR ("invite_cb: INVITE failed for call (%s), code=%x, callstate=%x!\n",
++ pcall->call_from, ntype, pcall->call_state);
+ if (ntype == TMCB_DESTROY)
+ { pcall->call_hash = pcall->call_label = 0; }
+-LM_ERR ("invite_cb: INVITE failed for call (%s)!\n", pcall->call_from);
+ delete_call (pcall);
+ return;
+ }
+
diff --git a/main/kamailio/APKBUILD b/main/kamailio/APKBUILD
index a063ed8a24..953846dcd6 100644
--- a/main/kamailio/APKBUILD
+++ b/main/kamailio/APKBUILD
@@ -250,6 +250,7 @@ done
source="${pkgname}-${pkgver}${_suffix}.tar.gz::https://github.com/kamailio/$pkgname/archive/$_gitcommit.tar.gz
0001-kamdbctl.base.patch
+ 0001-mohqueue.patch
0004-src_core_tcp_read_c.patch
dont-force-mips-revision.patch
kamailio.initd
@@ -537,9 +538,9 @@ sipdump() {
_generic_pkg "This module writes SIP traffic and some associated details into local files" \
"$_mod_list_sipdump"
}
-
sha512sums="8bd98f5b1148fe92614c4a9cb290d84e6d245b74cfead9ce43073ee61d1020fc13f79eeba88ba4139b786829999750aa049bc7e023f2e6a37eac4e6cdabb96fb kamailio-5.2.0.tar.gz
6badfb611c02ffcb4c2e9937731162ea1a4b737f042ed52120e2f96ebb80b5b7d240b5612c9ca565e693eec9b8c52c1ee5db04dfc47d204501021f984b4b11db 0001-kamdbctl.base.patch
+bbb00a3b680d2805aebf412a7cd77d5ac16e5edb45077516635101f78782dcaa779f84a3678fdd820fa7d7f021ae89271811b2e344092a8f5b7fe6eeee4c2599 0001-mohqueue.patch
af8362201957eae6b66baf7368c9ca884024209a396d77c5c52180c9aabe13772e9c6513e59721d39503e5bb7a8c1030f5c10301ea9055bddafb7f01ee2f3076 0004-src_core_tcp_read_c.patch
100a40ec63eaf62f8ac794f1bb17e8109030413617e61a7d2f55a8c8efbe26c1f0f611e6d99548638001f1af678fb7129a98db175eb02190c85d31f60af52202 dont-force-mips-revision.patch
321b1b160434150bcde3c0ad7f47ddf259791b68d4ce74ba4c35034026421a2bc6f5e86f26f393f5fcdb523d8cd75f944709473065553ce860b0ea06b3dc2a1b kamailio.initd"
diff --git a/main/libcroco/APKBUILD b/main/libcroco/APKBUILD
index 70f960a48a..c5c41c1cb4 100644
--- a/main/libcroco/APKBUILD
+++ b/main/libcroco/APKBUILD
@@ -1,7 +1,7 @@
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=libcroco
pkgver=0.6.12
-pkgrel=1
+pkgrel=2
pkgdesc="GNOME CSS2 parsing and manipulation toolkit"
url="http://www.gnome.org"
arch="all"
@@ -9,7 +9,18 @@ license="LGPL-2.1-only"
subpackages="$pkgname-dev"
depends=
makedepends="glib-dev libxml2-dev"
-source="https://download.gnome.org/sources/$pkgname/0.6/$pkgname-$pkgver.tar.xz"
+source="https://download.gnome.org/sources/$pkgname/0.6/$pkgname-$pkgver.tar.xz
+ CVE-2017-7960.patch
+ CVE-2017-7961.patch
+ CVE-2017-8871-and-CVE-2017-8834.patch
+ "
+
+# secfixes:
+# 0.6.12-r2:
+# - CVE-2017-7960
+# - CVE-2017-7961
+# - CVE-2017-8871
+# - CVE-2017-8834
build() {
cd "$builddir"
@@ -30,4 +41,7 @@ package() {
cd "$builddir"
make DESTDIR="$pkgdir" install
}
-sha512sums="af9a171d5ccded255b57f170576e67155f12fa0f61ab3e379e907975f77afc37e82e22772c6019b2897cffc15b2425faf3ccfda92b1a45b23eda2519debabeb6 libcroco-0.6.12.tar.xz"
+sha512sums="af9a171d5ccded255b57f170576e67155f12fa0f61ab3e379e907975f77afc37e82e22772c6019b2897cffc15b2425faf3ccfda92b1a45b23eda2519debabeb6 libcroco-0.6.12.tar.xz
+e6a799e5547c60a317602aa5b537b27ecbc47de84ceb9ef109586370406cd8151c7ab1e7c27f346becf3c10f0524bfc7ac98dcf3160089880c2ac189ee4e7176 CVE-2017-7960.patch
+a1820039d23793ac53ba3acb771f487fe7fed839b298734435e168fecb5cd8b2b20b2fd08b4f827d0ed7eb0b5e76c9290ba912533b95acbf1be7cda5fd604da6 CVE-2017-7961.patch
+568ad8205f5c2ab1eb949ef664671069fad5991e43992e35092738c1a741289303dba343c8002caec817d1c27fe5645dc2a861573fb4d91074aef59ff41f3d27 CVE-2017-8871-and-CVE-2017-8834.patch"
diff --git a/main/libcroco/CVE-2017-7960.patch b/main/libcroco/CVE-2017-7960.patch
new file mode 100644
index 0000000000..cd8dbaafa4
--- /dev/null
+++ b/main/libcroco/CVE-2017-7960.patch
@@ -0,0 +1,59 @@
+From 898e3a8c8c0314d2e6b106809a8e3e93cf9d4394 Mon Sep 17 00:00:00 2001
+From: Ignacio Casal Quinteiro <qignacio@amazon.com>
+Date: Sun, 16 Apr 2017 13:13:43 +0200
+Subject: [PATCH] input: check end of input before reading a byte
+
+When reading bytes we weren't check that the index wasn't
+out of bound and this could produce an invalid read which
+could deal to a security bug.
+---
+ src/cr-input.c | 11 +++++++++--
+ 1 file changed, 9 insertions(+), 2 deletions(-)
+
+diff --git a/src/cr-input.c b/src/cr-input.c
+index 49000b1..3b63a88 100644
+--- a/src/cr-input.c
++++ b/src/cr-input.c
+@@ -256,7 +256,7 @@ cr_input_new_from_uri (const gchar * a_file_uri, enum CREncoding a_enc)
+ *we should free buf here because it's own by CRInput.
+ *(see the last parameter of cr_input_new_from_buf().
+ */
+- buf = NULL ;
++ buf = NULL;
+ }
+
+ cleanup:
+@@ -404,6 +404,8 @@ cr_input_get_nb_bytes_left (CRInput const * a_this)
+ enum CRStatus
+ cr_input_read_byte (CRInput * a_this, guchar * a_byte)
+ {
++ gulong nb_bytes_left = 0;
++
+ g_return_val_if_fail (a_this && PRIVATE (a_this)
+ && a_byte, CR_BAD_PARAM_ERROR);
+
+@@ -413,6 +415,12 @@ cr_input_read_byte (CRInput * a_this, guchar * a_byte)
+ if (PRIVATE (a_this)->end_of_input == TRUE)
+ return CR_END_OF_INPUT_ERROR;
+
++ nb_bytes_left = cr_input_get_nb_bytes_left (a_this);
++
++ if (nb_bytes_left < 1) {
++ return CR_END_OF_INPUT_ERROR;
++ }
++
+ *a_byte = PRIVATE (a_this)->in_buf[PRIVATE (a_this)->next_byte_index];
+
+ if (PRIVATE (a_this)->nb_bytes -
+@@ -477,7 +485,6 @@ cr_input_read_char (CRInput * a_this, guint32 * a_char)
+ if (*a_char == '\n') {
+ PRIVATE (a_this)->end_of_line = TRUE;
+ }
+-
+ }
+
+ return status;
+--
+2.21.0
+
+
diff --git a/main/libcroco/CVE-2017-7961.patch b/main/libcroco/CVE-2017-7961.patch
new file mode 100644
index 0000000000..bb0236e6a5
--- /dev/null
+++ b/main/libcroco/CVE-2017-7961.patch
@@ -0,0 +1,43 @@
+From 9ad72875e9f08e4c519ef63d44cdbd94aa9504f7 Mon Sep 17 00:00:00 2001
+From: Ignacio Casal Quinteiro <qignacio@amazon.com>
+Date: Sun, 16 Apr 2017 13:56:09 +0200
+Subject: [PATCH] tknzr: support only max long rgb values
+
+This fixes a possible out of bound when reading rgbs which
+are longer than the support MAXLONG
+---
+ src/cr-tknzr.c | 10 ++++++++++
+ 1 file changed, 10 insertions(+)
+
+diff --git a/src/cr-tknzr.c b/src/cr-tknzr.c
+index 1a7cfeb..1548c35 100644
+--- a/src/cr-tknzr.c
++++ b/src/cr-tknzr.c
+@@ -1279,6 +1279,11 @@ cr_tknzr_parse_rgb (CRTknzr * a_this, CRRgb ** a_rgb)
+ status = cr_tknzr_parse_num (a_this, &num);
+ ENSURE_PARSING_COND ((status == CR_OK) && (num != NULL));
+
++ if (num->val > G_MAXLONG) {
++ status = CR_PARSING_ERROR;
++ goto error;
++ }
++
+ red = num->val;
+ cr_num_destroy (num);
+ num = NULL;
+@@ -1298,6 +1303,11 @@ cr_tknzr_parse_rgb (CRTknzr * a_this, CRRgb ** a_rgb)
+ status = cr_tknzr_parse_num (a_this, &num);
+ ENSURE_PARSING_COND ((status == CR_OK) && (num != NULL));
+
++ if (num->val > G_MAXLONG) {
++ status = CR_PARSING_ERROR;
++ goto error;
++ }
++
+ PEEK_BYTE (a_this, 1, &next_bytes[0]);
+ if (next_bytes[0] == '%') {
+ SKIP_CHARS (a_this, 1);
+--
+2.21.0
+
+
diff --git a/main/libcroco/CVE-2017-8871-and-CVE-2017-8834.patch b/main/libcroco/CVE-2017-8871-and-CVE-2017-8834.patch
new file mode 100644
index 0000000000..f65c6a9748
--- /dev/null
+++ b/main/libcroco/CVE-2017-8871-and-CVE-2017-8834.patch
@@ -0,0 +1,29 @@
+From deda38539f5b25616aa294d8b19d33ebf8e175ff Mon Sep 17 00:00:00 2001
+From: Mike Gorse <mgorse@alum.wpi.edu>
+Date: Thu, 2 May 2019 10:54:43 -0500
+Subject: [PATCH] cr_utils_read_char_from_utf8_buf: move past invalid UTF-8
+
+Otherwise, the offending character is never consumed, possibly leading
+to an infinite loop.
+
+https://bugzilla.gnome.org/show_bug.cgi?id=782647
+---
+ src/cr-utils.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/src/cr-utils.c b/src/cr-utils.c
+index 2420cec..6cf4849 100644
+--- a/src/cr-utils.c
++++ b/src/cr-utils.c
+@@ -505,6 +505,7 @@ cr_utils_read_char_from_utf8_buf (const guchar * a_in,
+
+ } else {
+ /*BAD ENCODING */
++ nb_bytes_2_decode = 1;
+ goto end;
+ }
+
+--
+2.20.1
+
+
diff --git a/main/libebml/APKBUILD b/main/libebml/APKBUILD
index bc788fc470..6bcc4c786d 100644
--- a/main/libebml/APKBUILD
+++ b/main/libebml/APKBUILD
@@ -13,6 +13,10 @@ makedepends="cmake"
subpackages="$pkgname-dev"
source="http://dl.matroska.org/downloads/$pkgname/$pkgname-$pkgver.tar.xz"
+# secfixes:
+# 1.3.6-r0:
+# - CVE-2019-13615
+
build() {
cd "$builddir"
if [ "$CBUILD" != "$CHOST" ]; then
diff --git a/main/libgcrypt/APKBUILD b/main/libgcrypt/APKBUILD
index a8f41d5407..155c9b5f84 100644
--- a/main/libgcrypt/APKBUILD
+++ b/main/libgcrypt/APKBUILD
@@ -1,7 +1,7 @@
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=libgcrypt
pkgver=1.8.4
-pkgrel=0
+pkgrel=1
pkgdesc="general purpose crypto library based on the code used in GnuPG"
url="http://www.gnupg.org"
arch="all"
@@ -10,15 +10,19 @@ depends=""
depends_dev="libgpg-error-dev"
makedepends="$depends_dev texinfo"
subpackages="$pkgname-dev $pkgname-doc"
-source="https://www.gnupg.org/ftp/gcrypt/libgcrypt/$pkgname-$pkgver.tar.bz2"
+source="https://www.gnupg.org/ftp/gcrypt/libgcrypt/$pkgname-$pkgver.tar.bz2
+ CVE-2019-12904.patch
+ "
builddir="$srcdir"/$pkgname-$pkgver
options="!checkroot"
# secfixes:
+# 1.8.4-r1:
+# - CVE-2019-12904
# 1.8.3-r0:
-# - CVE-2018-0495
+# - CVE-2018-0495
-build () {
+build() {
cd "$builddir"
local _arch_configure=
@@ -58,4 +62,5 @@ package() {
rm -f ${pkgdir}/usr/share/info/dir
}
-sha512sums="b831fc337eb14806897e224b0d1e78d1f8e9db91dffa818a015a4aa104144e2d971e5a855904907ee2bb9990a9d526de32d6787e1cae98e28a65c3258b2b1ea1 libgcrypt-1.8.4.tar.bz2"
+sha512sums="b831fc337eb14806897e224b0d1e78d1f8e9db91dffa818a015a4aa104144e2d971e5a855904907ee2bb9990a9d526de32d6787e1cae98e28a65c3258b2b1ea1 libgcrypt-1.8.4.tar.bz2
+36f5f7f99e2c4f28207f91a7a500c3bca81044027b6d37ed0399e395a36638b37c0dff3145854a6caa2e9383722862b37a82bde1af520f06a9f4b327df1ec0af CVE-2019-12904.patch"
diff --git a/main/libgcrypt/CVE-2019-12904.patch b/main/libgcrypt/CVE-2019-12904.patch
new file mode 100644
index 0000000000..b596a66570
--- /dev/null
+++ b/main/libgcrypt/CVE-2019-12904.patch
@@ -0,0 +1,475 @@
+Adapted from OpenSUSE patches which are adapted from upstream for 1.8.4 and previous versions.
+
+Upstream commits:
+
+https://github.com/gpg/libgcrypt/commit/a4c561aab1014c3630bc88faf6f5246fee16b020
+https://github.com/gpg/libgcrypt/commit/daedbbb5541cd8ecda1459d3b843ea4d92788762
+
+diff --git a/cipher/cipher-gcm.c b/cipher/cipher-gcm.c
+index 6169d14..4be77d2 100644
+--- a/cipher/cipher-gcm.c
++++ b/cipher/cipher-gcm.c
+@@ -30,6 +30,14 @@
+ #include "./cipher-internal.h"
+
+
++/* Helper macro to force alignment to 16 or 64 bytes. */
++#ifdef HAVE_GCC_ATTRIBUTE_ALIGNED
++# define ATTR_ALIGNED_64 __attribute__ ((aligned (64)))
++#else
++# define ATTR_ALIGNED_64
++#endif
++
++
+ #ifdef GCM_USE_INTEL_PCLMUL
+ extern void _gcry_ghash_setup_intel_pclmul (gcry_cipher_hd_t c);
+
+@@ -63,40 +71,94 @@ ghash_armv8_ce_pmull (gcry_cipher_hd_t c, byte *result, const byte *buf,
+
+
+ #ifdef GCM_USE_TABLES
+-static const u16 gcmR[256] = {
+- 0x0000, 0x01c2, 0x0384, 0x0246, 0x0708, 0x06ca, 0x048c, 0x054e,
+- 0x0e10, 0x0fd2, 0x0d94, 0x0c56, 0x0918, 0x08da, 0x0a9c, 0x0b5e,
+- 0x1c20, 0x1de2, 0x1fa4, 0x1e66, 0x1b28, 0x1aea, 0x18ac, 0x196e,
+- 0x1230, 0x13f2, 0x11b4, 0x1076, 0x1538, 0x14fa, 0x16bc, 0x177e,
+- 0x3840, 0x3982, 0x3bc4, 0x3a06, 0x3f48, 0x3e8a, 0x3ccc, 0x3d0e,
+- 0x3650, 0x3792, 0x35d4, 0x3416, 0x3158, 0x309a, 0x32dc, 0x331e,
+- 0x2460, 0x25a2, 0x27e4, 0x2626, 0x2368, 0x22aa, 0x20ec, 0x212e,
+- 0x2a70, 0x2bb2, 0x29f4, 0x2836, 0x2d78, 0x2cba, 0x2efc, 0x2f3e,
+- 0x7080, 0x7142, 0x7304, 0x72c6, 0x7788, 0x764a, 0x740c, 0x75ce,
+- 0x7e90, 0x7f52, 0x7d14, 0x7cd6, 0x7998, 0x785a, 0x7a1c, 0x7bde,
+- 0x6ca0, 0x6d62, 0x6f24, 0x6ee6, 0x6ba8, 0x6a6a, 0x682c, 0x69ee,
+- 0x62b0, 0x6372, 0x6134, 0x60f6, 0x65b8, 0x647a, 0x663c, 0x67fe,
+- 0x48c0, 0x4902, 0x4b44, 0x4a86, 0x4fc8, 0x4e0a, 0x4c4c, 0x4d8e,
+- 0x46d0, 0x4712, 0x4554, 0x4496, 0x41d8, 0x401a, 0x425c, 0x439e,
+- 0x54e0, 0x5522, 0x5764, 0x56a6, 0x53e8, 0x522a, 0x506c, 0x51ae,
+- 0x5af0, 0x5b32, 0x5974, 0x58b6, 0x5df8, 0x5c3a, 0x5e7c, 0x5fbe,
+- 0xe100, 0xe0c2, 0xe284, 0xe346, 0xe608, 0xe7ca, 0xe58c, 0xe44e,
+- 0xef10, 0xeed2, 0xec94, 0xed56, 0xe818, 0xe9da, 0xeb9c, 0xea5e,
+- 0xfd20, 0xfce2, 0xfea4, 0xff66, 0xfa28, 0xfbea, 0xf9ac, 0xf86e,
+- 0xf330, 0xf2f2, 0xf0b4, 0xf176, 0xf438, 0xf5fa, 0xf7bc, 0xf67e,
+- 0xd940, 0xd882, 0xdac4, 0xdb06, 0xde48, 0xdf8a, 0xddcc, 0xdc0e,
+- 0xd750, 0xd692, 0xd4d4, 0xd516, 0xd058, 0xd19a, 0xd3dc, 0xd21e,
+- 0xc560, 0xc4a2, 0xc6e4, 0xc726, 0xc268, 0xc3aa, 0xc1ec, 0xc02e,
+- 0xcb70, 0xcab2, 0xc8f4, 0xc936, 0xcc78, 0xcdba, 0xcffc, 0xce3e,
+- 0x9180, 0x9042, 0x9204, 0x93c6, 0x9688, 0x974a, 0x950c, 0x94ce,
+- 0x9f90, 0x9e52, 0x9c14, 0x9dd6, 0x9898, 0x995a, 0x9b1c, 0x9ade,
+- 0x8da0, 0x8c62, 0x8e24, 0x8fe6, 0x8aa8, 0x8b6a, 0x892c, 0x88ee,
+- 0x83b0, 0x8272, 0x8034, 0x81f6, 0x84b8, 0x857a, 0x873c, 0x86fe,
+- 0xa9c0, 0xa802, 0xaa44, 0xab86, 0xaec8, 0xaf0a, 0xad4c, 0xac8e,
+- 0xa7d0, 0xa612, 0xa454, 0xa596, 0xa0d8, 0xa11a, 0xa35c, 0xa29e,
+- 0xb5e0, 0xb422, 0xb664, 0xb7a6, 0xb2e8, 0xb32a, 0xb16c, 0xb0ae,
+- 0xbbf0, 0xba32, 0xb874, 0xb9b6, 0xbcf8, 0xbd3a, 0xbf7c, 0xbebe,
+-};
++static struct
++{
++ volatile u32 counter_head;
++ u32 cacheline_align[64 / 4 - 1];
++ u16 R[256];
++ volatile u32 counter_tail;
++} gcm_table ATTR_ALIGNED_64 =
++ {
++ 0,
++ { 0, },
++ {
++ 0x0000, 0x01c2, 0x0384, 0x0246, 0x0708, 0x06ca, 0x048c, 0x054e,
++ 0x0e10, 0x0fd2, 0x0d94, 0x0c56, 0x0918, 0x08da, 0x0a9c, 0x0b5e,
++ 0x1c20, 0x1de2, 0x1fa4, 0x1e66, 0x1b28, 0x1aea, 0x18ac, 0x196e,
++ 0x1230, 0x13f2, 0x11b4, 0x1076, 0x1538, 0x14fa, 0x16bc, 0x177e,
++ 0x3840, 0x3982, 0x3bc4, 0x3a06, 0x3f48, 0x3e8a, 0x3ccc, 0x3d0e,
++ 0x3650, 0x3792, 0x35d4, 0x3416, 0x3158, 0x309a, 0x32dc, 0x331e,
++ 0x2460, 0x25a2, 0x27e4, 0x2626, 0x2368, 0x22aa, 0x20ec, 0x212e,
++ 0x2a70, 0x2bb2, 0x29f4, 0x2836, 0x2d78, 0x2cba, 0x2efc, 0x2f3e,
++ 0x7080, 0x7142, 0x7304, 0x72c6, 0x7788, 0x764a, 0x740c, 0x75ce,
++ 0x7e90, 0x7f52, 0x7d14, 0x7cd6, 0x7998, 0x785a, 0x7a1c, 0x7bde,
++ 0x6ca0, 0x6d62, 0x6f24, 0x6ee6, 0x6ba8, 0x6a6a, 0x682c, 0x69ee,
++ 0x62b0, 0x6372, 0x6134, 0x60f6, 0x65b8, 0x647a, 0x663c, 0x67fe,
++ 0x48c0, 0x4902, 0x4b44, 0x4a86, 0x4fc8, 0x4e0a, 0x4c4c, 0x4d8e,
++ 0x46d0, 0x4712, 0x4554, 0x4496, 0x41d8, 0x401a, 0x425c, 0x439e,
++ 0x54e0, 0x5522, 0x5764, 0x56a6, 0x53e8, 0x522a, 0x506c, 0x51ae,
++ 0x5af0, 0x5b32, 0x5974, 0x58b6, 0x5df8, 0x5c3a, 0x5e7c, 0x5fbe,
++ 0xe100, 0xe0c2, 0xe284, 0xe346, 0xe608, 0xe7ca, 0xe58c, 0xe44e,
++ 0xef10, 0xeed2, 0xec94, 0xed56, 0xe818, 0xe9da, 0xeb9c, 0xea5e,
++ 0xfd20, 0xfce2, 0xfea4, 0xff66, 0xfa28, 0xfbea, 0xf9ac, 0xf86e,
++ 0xf330, 0xf2f2, 0xf0b4, 0xf176, 0xf438, 0xf5fa, 0xf7bc, 0xf67e,
++ 0xd940, 0xd882, 0xdac4, 0xdb06, 0xde48, 0xdf8a, 0xddcc, 0xdc0e,
++ 0xd750, 0xd692, 0xd4d4, 0xd516, 0xd058, 0xd19a, 0xd3dc, 0xd21e,
++ 0xc560, 0xc4a2, 0xc6e4, 0xc726, 0xc268, 0xc3aa, 0xc1ec, 0xc02e,
++ 0xcb70, 0xcab2, 0xc8f4, 0xc936, 0xcc78, 0xcdba, 0xcffc, 0xce3e,
++ 0x9180, 0x9042, 0x9204, 0x93c6, 0x9688, 0x974a, 0x950c, 0x94ce,
++ 0x9f90, 0x9e52, 0x9c14, 0x9dd6, 0x9898, 0x995a, 0x9b1c, 0x9ade,
++ 0x8da0, 0x8c62, 0x8e24, 0x8fe6, 0x8aa8, 0x8b6a, 0x892c, 0x88ee,
++ 0x83b0, 0x8272, 0x8034, 0x81f6, 0x84b8, 0x857a, 0x873c, 0x86fe,
++ 0xa9c0, 0xa802, 0xaa44, 0xab86, 0xaec8, 0xaf0a, 0xad4c, 0xac8e,
++ 0xa7d0, 0xa612, 0xa454, 0xa596, 0xa0d8, 0xa11a, 0xa35c, 0xa29e,
++ 0xb5e0, 0xb422, 0xb664, 0xb7a6, 0xb2e8, 0xb32a, 0xb16c, 0xb0ae,
++ 0xbbf0, 0xba32, 0xb874, 0xb9b6, 0xbcf8, 0xbd3a, 0xbf7c, 0xbebe,
++ },
++ 0
++ };
++
++#define gcmR gcm_table.R
++
++static inline
++void prefetch_table(const void *tab, size_t len)
++{
++ const volatile byte *vtab = tab;
++ size_t i;
++
++ for (i = 0; len - i >= 8 * 32; i += 8 * 32)
++ {
++ (void)vtab[i + 0 * 32];
++ (void)vtab[i + 1 * 32];
++ (void)vtab[i + 2 * 32];
++ (void)vtab[i + 3 * 32];
++ (void)vtab[i + 4 * 32];
++ (void)vtab[i + 5 * 32];
++ (void)vtab[i + 6 * 32];
++ (void)vtab[i + 7 * 32];
++ }
++ for (; i < len; i += 32)
++ {
++ (void)vtab[i];
++ }
++
++ (void)vtab[len - 1];
++}
++
++static inline void
++do_prefetch_tables (const void *gcmM, size_t gcmM_size)
++{
++ /* Modify counters to trigger copy-on-write and unsharing if physical pages
++ * of look-up table are shared between processes. Modifying counters also
++ * causes checksums for pages to change and hint same-page merging algorithm
++ * that these pages are frequently changing. */
++ gcm_table.counter_head++;
++ gcm_table.counter_tail++;
++
++ /* Prefetch look-up tables to cache. */
++ prefetch_table(gcmM, gcmM_size);
++ prefetch_table(&gcm_table, sizeof(gcm_table));
++}
+
+ #ifdef GCM_TABLES_USE_U64
+ static void
+@@ -313,6 +375,8 @@ do_ghash (unsigned char *result, const unsigned char *buf, const u32 *gcmM)
+ #define fillM(c) \
+ do_fillM (c->u_mode.gcm.u_ghash_key.key, c->u_mode.gcm.gcm_table)
+ #define GHASH(c, result, buf) do_ghash (result, buf, c->u_mode.gcm.gcm_table)
++#define prefetch_tables(c) \
++ do_prefetch_tables(c->u_mode.gcm.gcm_table, sizeof(c->u_mode.gcm.gcm_table))
+
+ #else
+
+@@ -378,6 +442,7 @@ do_ghash (unsigned char *hsub, unsigned char *result, const unsigned char *buf)
+
+ #define fillM(c) do { } while (0)
+ #define GHASH(c, result, buf) do_ghash (c->u_mode.gcm.u_ghash_key.key, result, buf)
++#define prefetch_tables(c) do {} while (0)
+
+ #endif /* !GCM_USE_TABLES */
+
+@@ -389,6 +454,8 @@ ghash_internal (gcry_cipher_hd_t c, byte *result, const byte *buf,
+ const unsigned int blocksize = GCRY_GCM_BLOCK_LEN;
+ unsigned int burn = 0;
+
++ prefetch_tables (c);
++
+ while (nblocks)
+ {
+ burn = GHASH (c, result, buf);
+diff --git a/cipher/rijndael-internal.h b/cipher/rijndael-internal.h
+index 160fb8c..a62d4b7 100644
+--- a/cipher/rijndael-internal.h
++++ b/cipher/rijndael-internal.h
+@@ -29,11 +29,13 @@
+ #define BLOCKSIZE (128/8)
+
+
+-/* Helper macro to force alignment to 16 bytes. */
++/* Helper macro to force alignment to 16 or 64 bytes. */
+ #ifdef HAVE_GCC_ATTRIBUTE_ALIGNED
+ # define ATTR_ALIGNED_16 __attribute__ ((aligned (16)))
++# define ATTR_ALIGNED_64 __attribute__ ((aligned (64)))
+ #else
+ # define ATTR_ALIGNED_16
++# define ATTR_ALIGNED_64
+ #endif
+
+
+diff --git a/cipher/rijndael-tables.h b/cipher/rijndael-tables.h
+index 8359470..b54d959 100644
+--- a/cipher/rijndael-tables.h
++++ b/cipher/rijndael-tables.h
+@@ -21,80 +21,98 @@
+ /* To keep the actual implementation at a readable size we use this
+ include file to define the tables. */
+
+-static const u32 encT[256] =
++static struct
++{
++ volatile u32 counter_head;
++ u32 cacheline_align[64 / 4 - 1];
++ u32 T[256];
++ volatile u32 counter_tail;
++} enc_tables ATTR_ALIGNED_64 =
+ {
+- 0xa56363c6, 0x847c7cf8, 0x997777ee, 0x8d7b7bf6,
+- 0x0df2f2ff, 0xbd6b6bd6, 0xb16f6fde, 0x54c5c591,
+- 0x50303060, 0x03010102, 0xa96767ce, 0x7d2b2b56,
+- 0x19fefee7, 0x62d7d7b5, 0xe6abab4d, 0x9a7676ec,
+- 0x45caca8f, 0x9d82821f, 0x40c9c989, 0x877d7dfa,
+- 0x15fafaef, 0xeb5959b2, 0xc947478e, 0x0bf0f0fb,
+- 0xecadad41, 0x67d4d4b3, 0xfda2a25f, 0xeaafaf45,
+- 0xbf9c9c23, 0xf7a4a453, 0x967272e4, 0x5bc0c09b,
+- 0xc2b7b775, 0x1cfdfde1, 0xae93933d, 0x6a26264c,
+- 0x5a36366c, 0x413f3f7e, 0x02f7f7f5, 0x4fcccc83,
+- 0x5c343468, 0xf4a5a551, 0x34e5e5d1, 0x08f1f1f9,
+- 0x937171e2, 0x73d8d8ab, 0x53313162, 0x3f15152a,
+- 0x0c040408, 0x52c7c795, 0x65232346, 0x5ec3c39d,
+- 0x28181830, 0xa1969637, 0x0f05050a, 0xb59a9a2f,
+- 0x0907070e, 0x36121224, 0x9b80801b, 0x3de2e2df,
+- 0x26ebebcd, 0x6927274e, 0xcdb2b27f, 0x9f7575ea,
+- 0x1b090912, 0x9e83831d, 0x742c2c58, 0x2e1a1a34,
+- 0x2d1b1b36, 0xb26e6edc, 0xee5a5ab4, 0xfba0a05b,
+- 0xf65252a4, 0x4d3b3b76, 0x61d6d6b7, 0xceb3b37d,
+- 0x7b292952, 0x3ee3e3dd, 0x712f2f5e, 0x97848413,
+- 0xf55353a6, 0x68d1d1b9, 0x00000000, 0x2cededc1,
+- 0x60202040, 0x1ffcfce3, 0xc8b1b179, 0xed5b5bb6,
+- 0xbe6a6ad4, 0x46cbcb8d, 0xd9bebe67, 0x4b393972,
+- 0xde4a4a94, 0xd44c4c98, 0xe85858b0, 0x4acfcf85,
+- 0x6bd0d0bb, 0x2aefefc5, 0xe5aaaa4f, 0x16fbfbed,
+- 0xc5434386, 0xd74d4d9a, 0x55333366, 0x94858511,
+- 0xcf45458a, 0x10f9f9e9, 0x06020204, 0x817f7ffe,
+- 0xf05050a0, 0x443c3c78, 0xba9f9f25, 0xe3a8a84b,
+- 0xf35151a2, 0xfea3a35d, 0xc0404080, 0x8a8f8f05,
+- 0xad92923f, 0xbc9d9d21, 0x48383870, 0x04f5f5f1,
+- 0xdfbcbc63, 0xc1b6b677, 0x75dadaaf, 0x63212142,
+- 0x30101020, 0x1affffe5, 0x0ef3f3fd, 0x6dd2d2bf,
+- 0x4ccdcd81, 0x140c0c18, 0x35131326, 0x2fececc3,
+- 0xe15f5fbe, 0xa2979735, 0xcc444488, 0x3917172e,
+- 0x57c4c493, 0xf2a7a755, 0x827e7efc, 0x473d3d7a,
+- 0xac6464c8, 0xe75d5dba, 0x2b191932, 0x957373e6,
+- 0xa06060c0, 0x98818119, 0xd14f4f9e, 0x7fdcdca3,
+- 0x66222244, 0x7e2a2a54, 0xab90903b, 0x8388880b,
+- 0xca46468c, 0x29eeeec7, 0xd3b8b86b, 0x3c141428,
+- 0x79dedea7, 0xe25e5ebc, 0x1d0b0b16, 0x76dbdbad,
+- 0x3be0e0db, 0x56323264, 0x4e3a3a74, 0x1e0a0a14,
+- 0xdb494992, 0x0a06060c, 0x6c242448, 0xe45c5cb8,
+- 0x5dc2c29f, 0x6ed3d3bd, 0xefacac43, 0xa66262c4,
+- 0xa8919139, 0xa4959531, 0x37e4e4d3, 0x8b7979f2,
+- 0x32e7e7d5, 0x43c8c88b, 0x5937376e, 0xb76d6dda,
+- 0x8c8d8d01, 0x64d5d5b1, 0xd24e4e9c, 0xe0a9a949,
+- 0xb46c6cd8, 0xfa5656ac, 0x07f4f4f3, 0x25eaeacf,
+- 0xaf6565ca, 0x8e7a7af4, 0xe9aeae47, 0x18080810,
+- 0xd5baba6f, 0x887878f0, 0x6f25254a, 0x722e2e5c,
+- 0x241c1c38, 0xf1a6a657, 0xc7b4b473, 0x51c6c697,
+- 0x23e8e8cb, 0x7cdddda1, 0x9c7474e8, 0x211f1f3e,
+- 0xdd4b4b96, 0xdcbdbd61, 0x868b8b0d, 0x858a8a0f,
+- 0x907070e0, 0x423e3e7c, 0xc4b5b571, 0xaa6666cc,
+- 0xd8484890, 0x05030306, 0x01f6f6f7, 0x120e0e1c,
+- 0xa36161c2, 0x5f35356a, 0xf95757ae, 0xd0b9b969,
+- 0x91868617, 0x58c1c199, 0x271d1d3a, 0xb99e9e27,
+- 0x38e1e1d9, 0x13f8f8eb, 0xb398982b, 0x33111122,
+- 0xbb6969d2, 0x70d9d9a9, 0x898e8e07, 0xa7949433,
+- 0xb69b9b2d, 0x221e1e3c, 0x92878715, 0x20e9e9c9,
+- 0x49cece87, 0xff5555aa, 0x78282850, 0x7adfdfa5,
+- 0x8f8c8c03, 0xf8a1a159, 0x80898909, 0x170d0d1a,
+- 0xdabfbf65, 0x31e6e6d7, 0xc6424284, 0xb86868d0,
+- 0xc3414182, 0xb0999929, 0x772d2d5a, 0x110f0f1e,
+- 0xcbb0b07b, 0xfc5454a8, 0xd6bbbb6d, 0x3a16162c
++ 0,
++ { 0, },
++ {
++ 0xa56363c6, 0x847c7cf8, 0x997777ee, 0x8d7b7bf6,
++ 0x0df2f2ff, 0xbd6b6bd6, 0xb16f6fde, 0x54c5c591,
++ 0x50303060, 0x03010102, 0xa96767ce, 0x7d2b2b56,
++ 0x19fefee7, 0x62d7d7b5, 0xe6abab4d, 0x9a7676ec,
++ 0x45caca8f, 0x9d82821f, 0x40c9c989, 0x877d7dfa,
++ 0x15fafaef, 0xeb5959b2, 0xc947478e, 0x0bf0f0fb,
++ 0xecadad41, 0x67d4d4b3, 0xfda2a25f, 0xeaafaf45,
++ 0xbf9c9c23, 0xf7a4a453, 0x967272e4, 0x5bc0c09b,
++ 0xc2b7b775, 0x1cfdfde1, 0xae93933d, 0x6a26264c,
++ 0x5a36366c, 0x413f3f7e, 0x02f7f7f5, 0x4fcccc83,
++ 0x5c343468, 0xf4a5a551, 0x34e5e5d1, 0x08f1f1f9,
++ 0x937171e2, 0x73d8d8ab, 0x53313162, 0x3f15152a,
++ 0x0c040408, 0x52c7c795, 0x65232346, 0x5ec3c39d,
++ 0x28181830, 0xa1969637, 0x0f05050a, 0xb59a9a2f,
++ 0x0907070e, 0x36121224, 0x9b80801b, 0x3de2e2df,
++ 0x26ebebcd, 0x6927274e, 0xcdb2b27f, 0x9f7575ea,
++ 0x1b090912, 0x9e83831d, 0x742c2c58, 0x2e1a1a34,
++ 0x2d1b1b36, 0xb26e6edc, 0xee5a5ab4, 0xfba0a05b,
++ 0xf65252a4, 0x4d3b3b76, 0x61d6d6b7, 0xceb3b37d,
++ 0x7b292952, 0x3ee3e3dd, 0x712f2f5e, 0x97848413,
++ 0xf55353a6, 0x68d1d1b9, 0x00000000, 0x2cededc1,
++ 0x60202040, 0x1ffcfce3, 0xc8b1b179, 0xed5b5bb6,
++ 0xbe6a6ad4, 0x46cbcb8d, 0xd9bebe67, 0x4b393972,
++ 0xde4a4a94, 0xd44c4c98, 0xe85858b0, 0x4acfcf85,
++ 0x6bd0d0bb, 0x2aefefc5, 0xe5aaaa4f, 0x16fbfbed,
++ 0xc5434386, 0xd74d4d9a, 0x55333366, 0x94858511,
++ 0xcf45458a, 0x10f9f9e9, 0x06020204, 0x817f7ffe,
++ 0xf05050a0, 0x443c3c78, 0xba9f9f25, 0xe3a8a84b,
++ 0xf35151a2, 0xfea3a35d, 0xc0404080, 0x8a8f8f05,
++ 0xad92923f, 0xbc9d9d21, 0x48383870, 0x04f5f5f1,
++ 0xdfbcbc63, 0xc1b6b677, 0x75dadaaf, 0x63212142,
++ 0x30101020, 0x1affffe5, 0x0ef3f3fd, 0x6dd2d2bf,
++ 0x4ccdcd81, 0x140c0c18, 0x35131326, 0x2fececc3,
++ 0xe15f5fbe, 0xa2979735, 0xcc444488, 0x3917172e,
++ 0x57c4c493, 0xf2a7a755, 0x827e7efc, 0x473d3d7a,
++ 0xac6464c8, 0xe75d5dba, 0x2b191932, 0x957373e6,
++ 0xa06060c0, 0x98818119, 0xd14f4f9e, 0x7fdcdca3,
++ 0x66222244, 0x7e2a2a54, 0xab90903b, 0x8388880b,
++ 0xca46468c, 0x29eeeec7, 0xd3b8b86b, 0x3c141428,
++ 0x79dedea7, 0xe25e5ebc, 0x1d0b0b16, 0x76dbdbad,
++ 0x3be0e0db, 0x56323264, 0x4e3a3a74, 0x1e0a0a14,
++ 0xdb494992, 0x0a06060c, 0x6c242448, 0xe45c5cb8,
++ 0x5dc2c29f, 0x6ed3d3bd, 0xefacac43, 0xa66262c4,
++ 0xa8919139, 0xa4959531, 0x37e4e4d3, 0x8b7979f2,
++ 0x32e7e7d5, 0x43c8c88b, 0x5937376e, 0xb76d6dda,
++ 0x8c8d8d01, 0x64d5d5b1, 0xd24e4e9c, 0xe0a9a949,
++ 0xb46c6cd8, 0xfa5656ac, 0x07f4f4f3, 0x25eaeacf,
++ 0xaf6565ca, 0x8e7a7af4, 0xe9aeae47, 0x18080810,
++ 0xd5baba6f, 0x887878f0, 0x6f25254a, 0x722e2e5c,
++ 0x241c1c38, 0xf1a6a657, 0xc7b4b473, 0x51c6c697,
++ 0x23e8e8cb, 0x7cdddda1, 0x9c7474e8, 0x211f1f3e,
++ 0xdd4b4b96, 0xdcbdbd61, 0x868b8b0d, 0x858a8a0f,
++ 0x907070e0, 0x423e3e7c, 0xc4b5b571, 0xaa6666cc,
++ 0xd8484890, 0x05030306, 0x01f6f6f7, 0x120e0e1c,
++ 0xa36161c2, 0x5f35356a, 0xf95757ae, 0xd0b9b969,
++ 0x91868617, 0x58c1c199, 0x271d1d3a, 0xb99e9e27,
++ 0x38e1e1d9, 0x13f8f8eb, 0xb398982b, 0x33111122,
++ 0xbb6969d2, 0x70d9d9a9, 0x898e8e07, 0xa7949433,
++ 0xb69b9b2d, 0x221e1e3c, 0x92878715, 0x20e9e9c9,
++ 0x49cece87, 0xff5555aa, 0x78282850, 0x7adfdfa5,
++ 0x8f8c8c03, 0xf8a1a159, 0x80898909, 0x170d0d1a,
++ 0xdabfbf65, 0x31e6e6d7, 0xc6424284, 0xb86868d0,
++ 0xc3414182, 0xb0999929, 0x772d2d5a, 0x110f0f1e,
++ 0xcbb0b07b, 0xfc5454a8, 0xd6bbbb6d, 0x3a16162c
++ },
++ 0
+ };
+
+-static const struct
++#define encT enc_tables.T
++
++static struct
+ {
++ volatile u32 counter_head;
++ u32 cacheline_align[64 / 4 - 1];
+ u32 T[256];
+ byte inv_sbox[256];
+-} dec_tables =
++ volatile u32 counter_tail;
++} dec_tables ATTR_ALIGNED_64 =
+ {
++ 0,
++ { 0, },
+ {
+ 0x50a7f451, 0x5365417e, 0xc3a4171a, 0x965e273a,
+ 0xcb6bab3b, 0xf1459d1f, 0xab58faac, 0x9303e34b,
+@@ -194,7 +212,8 @@ static const struct
+ 0xc8,0xeb,0xbb,0x3c,0x83,0x53,0x99,0x61,
+ 0x17,0x2b,0x04,0x7e,0xba,0x77,0xd6,0x26,
+ 0xe1,0x69,0x14,0x63,0x55,0x21,0x0c,0x7d
+- }
++ },
++ 0
+ };
+
+ #define decT dec_tables.T
+diff --git a/cipher/rijndael.c b/cipher/rijndael.c
+index 8637195..d0edab2 100644
+--- a/cipher/rijndael.c
++++ b/cipher/rijndael.c
+@@ -227,11 +227,11 @@ static const char *selftest(void);
+
+
+ /* Prefetching for encryption/decryption tables. */
+-static void prefetch_table(const volatile byte *tab, size_t len)
++static inline void prefetch_table(const volatile byte *tab, size_t len)
+ {
+ size_t i;
+
+- for (i = 0; i < len; i += 8 * 32)
++ for (i = 0; len - i >= 8 * 32; i += 8 * 32)
+ {
+ (void)tab[i + 0 * 32];
+ (void)tab[i + 1 * 32];
+@@ -242,17 +242,37 @@ static void prefetch_table(const volatile byte *tab, size_t len)
+ (void)tab[i + 6 * 32];
+ (void)tab[i + 7 * 32];
+ }
++ for (; i < len; i += 32)
++ {
++ (void)tab[i];
++ }
+
+ (void)tab[len - 1];
+ }
+
+ static void prefetch_enc(void)
+ {
+- prefetch_table((const void *)encT, sizeof(encT));
++ /* Modify counters to trigger copy-on-write and unsharing if physical pages
++ * of look-up table are shared between processes. Modifying counters also
++ * causes checksums for pages to change and hint same-page merging algorithm
++ * that these pages are frequently changing. */
++ enc_tables.counter_head++;
++ enc_tables.counter_tail++;
++
++ /* Prefetch look-up tables to cache. */
++ prefetch_table((const void *)&enc_tables, sizeof(enc_tables));
+ }
+
+ static void prefetch_dec(void)
+ {
++ /* Modify counters to trigger copy-on-write and unsharing if physical pages
++ * of look-up table are shared between processes. Modifying counters also
++ * causes checksums for pages to change and hint same-page merging algorithm
++ * that these pages are frequently changing. */
++ dec_tables.counter_head++;
++ dec_tables.counter_tail++;
++
++ /* Prefetch look-up tables to cache. */
+ prefetch_table((const void *)&dec_tables, sizeof(dec_tables));
+ }
+
+@@ -737,7 +757,7 @@ do_encrypt (const RIJNDAEL_context *ctx,
+ #ifdef USE_AMD64_ASM
+ # ifdef HAVE_COMPATIBLE_GCC_AMD64_PLATFORM_AS
+ return _gcry_aes_amd64_encrypt_block(ctx->keyschenc, bx, ax, ctx->rounds,
+- encT);
++ enc_tables.T);
+ # else
+ /* Call SystemV ABI function without storing non-volatile XMM registers,
+ * as target function does not use vector instruction sets. */
+@@ -757,7 +777,8 @@ do_encrypt (const RIJNDAEL_context *ctx,
+ return ret;
+ # endif /* HAVE_COMPATIBLE_GCC_AMD64_PLATFORM_AS */
+ #elif defined(USE_ARM_ASM)
+- return _gcry_aes_arm_encrypt_block(ctx->keyschenc, bx, ax, ctx->rounds, encT);
++ return _gcry_aes_arm_encrypt_block(ctx->keyschenc, bx, ax, ctx->rounds,
++ enc_tables.T);
+ #else
+ return do_encrypt_fn (ctx, bx, ax);
+ #endif /* !USE_ARM_ASM && !USE_AMD64_ASM*/
+@@ -1120,7 +1141,7 @@ do_decrypt (const RIJNDAEL_context *ctx, unsigned char *bx,
+ #ifdef USE_AMD64_ASM
+ # ifdef HAVE_COMPATIBLE_GCC_AMD64_PLATFORM_AS
+ return _gcry_aes_amd64_decrypt_block(ctx->keyschdec, bx, ax, ctx->rounds,
+- &dec_tables);
++ dec_tables.T);
+ # else
+ /* Call SystemV ABI function without storing non-volatile XMM registers,
+ * as target function does not use vector instruction sets. */
+@@ -1141,7 +1162,7 @@ do_decrypt (const RIJNDAEL_context *ctx, unsigned char *bx,
+ # endif /* HAVE_COMPATIBLE_GCC_AMD64_PLATFORM_AS */
+ #elif defined(USE_ARM_ASM)
+ return _gcry_aes_arm_decrypt_block(ctx->keyschdec, bx, ax, ctx->rounds,
+- &dec_tables);
++ dec_tables.T);
+ #else
+ return do_decrypt_fn (ctx, bx, ax);
+ #endif /*!USE_ARM_ASM && !USE_AMD64_ASM*/
+
diff --git a/main/libjpeg-turbo/APKBUILD b/main/libjpeg-turbo/APKBUILD
index c1436da699..b14a205b13 100644
--- a/main/libjpeg-turbo/APKBUILD
+++ b/main/libjpeg-turbo/APKBUILD
@@ -2,7 +2,7 @@
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=libjpeg-turbo
pkgver=1.5.3
-pkgrel=4
+pkgrel=5
pkgdesc="accelerated baseline JPEG compression and decompression library"
url="https://libjpeg-turbo.org/"
arch="all"
@@ -14,9 +14,12 @@ subpackages="$pkgname-doc $pkgname-dev $pkgname-utils"
source="https://downloads.sourceforge.net/libjpeg-turbo/libjpeg-turbo-$pkgver.tar.gz
0001-tjLoadImage-Fix-FPE-triggered-by-malformed-BMP.patch
CVE-2018-11813.patch
+ CVE-2018-14498.patch
"
# secfixes:
+# 1.5.3-r5:
+# - CVE-2018-14498
# 1.5.3-r3:
# - CVE-2018-11813
# 1.5.3-r2:
@@ -70,4 +73,5 @@ dev() {
sha512sums="b611b1cc3d1ddedddad871854b42449d053a5f910ed1bdfa45c98e0270f4ecc110fde3a10111d2b876d847a826fa634f09c0bb8c357056c9c3a91c9065eb5202 libjpeg-turbo-1.5.3.tar.gz
d6465d96427289d90c342e94316018565eb1711ea0028121ea0a962900b7c7599a7457e42201bcfd288da30019ae3b841ce319cfbe02705d49749d660ef04b74 0001-tjLoadImage-Fix-FPE-triggered-by-malformed-BMP.patch
-d32234df784ebe1cad6af114f74d14995637e494a502c171e154e1abc5aa335930d3a256fda234a85842d5c1658d2fac6474e0bc959fdf04413f69a35e3bf39a CVE-2018-11813.patch"
+d32234df784ebe1cad6af114f74d14995637e494a502c171e154e1abc5aa335930d3a256fda234a85842d5c1658d2fac6474e0bc959fdf04413f69a35e3bf39a CVE-2018-11813.patch
+315aba552a2d66cdc8d83c5602a7e47c995f6709509afd07daf3ffacaf650404dc9f7a4beeb1373cabb5afc915a3d4c704b71dfdfcad3bc25ae5361ed16980d5 CVE-2018-14498.patch"
diff --git a/main/libjpeg-turbo/CVE-2018-14498.patch b/main/libjpeg-turbo/CVE-2018-14498.patch
new file mode 100644
index 0000000000..edf9365448
--- /dev/null
+++ b/main/libjpeg-turbo/CVE-2018-14498.patch
@@ -0,0 +1,110 @@
+diff --git a/cderror.h b/cderror.h
+index 63de498..92dd2ed 100644
+--- a/cderror.h
++++ b/cderror.h
+@@ -49,6 +49,7 @@ JMESSAGE(JERR_BMP_COLORSPACE, "BMP output must be grayscale or RGB")
+ JMESSAGE(JERR_BMP_COMPRESSED, "Sorry, compressed BMPs not yet supported")
+ JMESSAGE(JERR_BMP_EMPTY, "Empty BMP image")
+ JMESSAGE(JERR_BMP_NOT, "Not a BMP file - does not start with BM")
++JMESSAGE(JERR_BMP_OUTOFRANGE, "Numeric value out of range in BMP file")
+ JMESSAGE(JTRC_BMP, "%ux%u 24-bit BMP image")
+ JMESSAGE(JTRC_BMP_MAPPED, "%ux%u 8-bit colormapped BMP image")
+ JMESSAGE(JTRC_BMP_OS2, "%ux%u 24-bit OS2 BMP image")
+@@ -77,6 +78,7 @@ JMESSAGE(JERR_PPM_COLORSPACE, "PPM output must be grayscale or RGB")
+ JMESSAGE(JERR_PPM_NONNUMERIC, "Nonnumeric data in PPM file")
+ JMESSAGE(JERR_PPM_TOOLARGE, "Integer value too large in PPM file")
+ JMESSAGE(JERR_PPM_NOT, "Not a PPM/PGM file")
++JMESSAGE(JERR_PPM_OUTOFRANGE, "Numeric value out of range in PPM file")
+ JMESSAGE(JTRC_PGM, "%ux%u PGM image")
+ JMESSAGE(JTRC_PGM_TEXT, "%ux%u text PGM image")
+ JMESSAGE(JTRC_PPM, "%ux%u PPM image")
+diff --git a/rdbmp.c b/rdbmp.c
+index eaa7086..01fa2bc 100644
+--- a/rdbmp.c
++++ b/rdbmp.c
+@@ -66,6 +66,7 @@ typedef struct _bmp_source_struct {
+ JDIMENSION row_width; /* Physical width of scanlines in file */
+
+ int bits_per_pixel; /* remembers 8- or 24-bit format */
++ int cmap_length; /* colormap length */
+ } bmp_source_struct;
+
+
+@@ -126,6 +127,7 @@ get_8bit_row (j_compress_ptr cinfo, cjpeg_source_ptr sinfo)
+ {
+ bmp_source_ptr source = (bmp_source_ptr) sinfo;
+ register JSAMPARRAY colormap = source->colormap;
++ int cmaplen = source->cmap_length;
+ JSAMPARRAY image_ptr;
+ register int t;
+ register JSAMPROW inptr, outptr;
+@@ -142,6 +144,8 @@ get_8bit_row (j_compress_ptr cinfo, cjpeg_source_ptr sinfo)
+ outptr = source->pub.buffer[0];
+ for (col = cinfo->image_width; col > 0; col--) {
+ t = GETJSAMPLE(*inptr++);
++ if (t >= cmaplen)
++ ERREXIT(cinfo, JERR_BMP_OUTOFRANGE);
+ *outptr++ = colormap[0][t]; /* can omit GETJSAMPLE() safely */
+ *outptr++ = colormap[1][t];
+ *outptr++ = colormap[2][t];
+@@ -401,6 +405,7 @@ start_input_bmp (j_compress_ptr cinfo, cjpeg_source_ptr sinfo)
+ source->colormap = (*cinfo->mem->alloc_sarray)
+ ((j_common_ptr) cinfo, JPOOL_IMAGE,
+ (JDIMENSION) biClrUsed, (JDIMENSION) 3);
++ source->cmap_length = (int)biClrUsed;
+ /* and read it from the file */
+ read_colormap(source, (int) biClrUsed, mapentrysize);
+ /* account for size of colormap */
+diff --git a/rdppm.c b/rdppm.c
+index 33ff749..c0c0962 100644
+--- a/rdppm.c
++++ b/rdppm.c
+@@ -69,7 +69,7 @@ typedef struct {
+ JSAMPROW pixrow; /* compressor input buffer */
+ size_t buffer_width; /* width of I/O buffer */
+ JSAMPLE *rescale; /* => maxval-remapping array, or NULL */
+- int maxval;
++ unsigned int maxval;
+ } ppm_source_struct;
+
+ typedef ppm_source_struct *ppm_source_ptr;
+@@ -119,7 +119,7 @@ read_pbm_integer (j_compress_ptr cinfo, FILE *infile, unsigned int maxval)
+ }
+
+ if (val > maxval)
+- ERREXIT(cinfo, JERR_PPM_TOOLARGE);
++ ERREXIT(cinfo, JERR_PPM_OUTOFRANGE);
+
+ return val;
+ }
+@@ -255,7 +255,7 @@ get_word_gray_row (j_compress_ptr cinfo, cjpeg_source_ptr sinfo)
+ temp = UCH(*bufferptr++) << 8;
+ temp |= UCH(*bufferptr++);
+ if (temp > maxval)
+- ERREXIT(cinfo, JERR_PPM_TOOLARGE);
++ ERREXIT(cinfo, JERR_PPM_OUTOFRANGE);
+ *ptr++ = rescale[temp];
+ }
+ return 1;
+@@ -282,17 +282,17 @@ get_word_rgb_row (j_compress_ptr cinfo, cjpeg_source_ptr sinfo)
+ temp = UCH(*bufferptr++) << 8;
+ temp |= UCH(*bufferptr++);
+ if (temp > maxval)
+- ERREXIT(cinfo, JERR_PPM_TOOLARGE);
++ ERREXIT(cinfo, JERR_PPM_OUTOFRANGE);
+ *ptr++ = rescale[temp];
+ temp = UCH(*bufferptr++) << 8;
+ temp |= UCH(*bufferptr++);
+ if (temp > maxval)
+- ERREXIT(cinfo, JERR_PPM_TOOLARGE);
++ ERREXIT(cinfo, JERR_PPM_OUTOFRANGE);
+ *ptr++ = rescale[temp];
+ temp = UCH(*bufferptr++) << 8;
+ temp |= UCH(*bufferptr++);
+ if (temp > maxval)
+- ERREXIT(cinfo, JERR_PPM_TOOLARGE);
++ ERREXIT(cinfo, JERR_PPM_OUTOFRANGE);
+ *ptr++ = rescale[temp];
+ }
+ return 1;
+
diff --git a/main/libmad/APKBUILD b/main/libmad/APKBUILD
index 1f4248801f..05bd1f02aa 100644
--- a/main/libmad/APKBUILD
+++ b/main/libmad/APKBUILD
@@ -2,12 +2,12 @@
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=libmad
pkgver=0.15.1b
-pkgrel=8
+pkgrel=9
pkgdesc="A high-quality MPEG audio decoder"
url="http://www.underbit.com/products/mad/"
arch="all"
options="!check" # No test suite.
-license="GPL-2.0+"
+license="GPL-2.0-or-later"
subpackages="$pkgname-dev"
depends=
makedepends="autoconf automake libtool"
@@ -17,9 +17,17 @@ source="https://downloads.sourceforge.net/sourceforge/mad/$pkgname-$pkgver.tar.g
automake.patch
libmad.thumb.patch
Provide-Thumb-2-alternative-code-for-MAD_F_MLN.patch
+ length-check.patch
+ md_size.patch
mad.pc
"
+# secfixes:
+# 0.15.1b-r9:
+# - CVE-2017-8372
+# - CVE-2017-8373
+# - CVE-2017-8374
+
prepare() {
cd "$builddir"
update_config_sub
@@ -52,4 +60,6 @@ sha512sums="2cad30347fb310dc605c46bacd9da117f447a5cabedd8fefdb24ab5de641429e5ec5
e73ec5ae3b14e8d45579b52bcc561a309b85e1e51d946e061e2f0a9252f515e48e2d818e8bdce1adf5a9801ec314be8c911914d0bb12f9113a7afc54cf385250 automake.patch
82c7e89433ceee2c9e48fc8930ea591f722b48e0a928721322a15c15e5c6a018c013d45deae583c4e583591a4cb9de50d0b2bd2ff76e18da3198609e8ea5cb33 libmad.thumb.patch
9e9af20050c922c1c2f0b55009ae0eb20c9381eaff071f0dfee8a7b3a357e58f835f69364beb99820f5672459d88ac483d2419e1f9532d763779aafad7cbf72b Provide-Thumb-2-alternative-code-for-MAD_F_MLN.patch
+dd412962246d4c9db8c07dbafcaba2f64fdc0c94cf6bcc3f4f0f88a92800f40e550cc56dc8a2324c0123d9c70a89055dc50cd714206d7886e2f6877d4cc26600 length-check.patch
+511fc4496044bc676e1957c5085aded89e33248c5ee4c965c76c609904086911dcc912a943be98244b2d7e5f140f432584722cc3b53fdb27265328322a727427 md_size.patch
ec0b14bd0c6236a216107b507b92c06e295352f1657ba5e45f37fff220a73e1454b262ac36fc715d698c4ffd210d348fca71cf0198e2c49d16fe0ec5ea839f08 mad.pc"
diff --git a/main/libmad/length-check.patch b/main/libmad/length-check.patch
new file mode 100644
index 0000000000..80e48469e6
--- /dev/null
+++ b/main/libmad/length-check.patch
@@ -0,0 +1,817 @@
+From: Kurt Roeckx <kurt@roeckx.be>
+Date: Sun, 28 Jan 2018 19:26:36 +0100
+Subject: Check the size before reading with mad_bit_read
+
+There are various cases where it attemps to read past the end of the buffer
+using mad_bit_read(). Most functions didn't even know the size of the buffer
+they were reading from.
+
+Index: libmad-0.15.1b/bit.c
+===================================================================
+--- libmad-0.15.1b.orig/bit.c
++++ libmad-0.15.1b/bit.c
+@@ -138,6 +138,9 @@ unsigned long mad_bit_read(struct mad_bi
+ {
+ register unsigned long value;
+
++ if (len == 0)
++ return 0;
++
+ if (bitptr->left == CHAR_BIT)
+ bitptr->cache = *bitptr->byte;
+
+Index: libmad-0.15.1b/frame.c
+===================================================================
+--- libmad-0.15.1b.orig/frame.c
++++ libmad-0.15.1b/frame.c
+@@ -120,11 +120,18 @@ static
+ int decode_header(struct mad_header *header, struct mad_stream *stream)
+ {
+ unsigned int index;
++ struct mad_bitptr bufend_ptr;
+
+ header->flags = 0;
+ header->private_bits = 0;
+
++ mad_bit_init(&bufend_ptr, stream->bufend);
++
+ /* header() */
++ if (mad_bit_length(&stream->ptr, &bufend_ptr) < 32) {
++ stream->error = MAD_ERROR_BUFLEN;
++ return -1;
++ }
+
+ /* syncword */
+ mad_bit_skip(&stream->ptr, 11);
+@@ -225,8 +232,13 @@ int decode_header(struct mad_header *hea
+ /* error_check() */
+
+ /* crc_check */
+- if (header->flags & MAD_FLAG_PROTECTION)
++ if (header->flags & MAD_FLAG_PROTECTION) {
++ if (mad_bit_length(&stream->ptr, &bufend_ptr) < 16) {
++ stream->error = MAD_ERROR_BUFLEN;
++ return -1;
++ }
+ header->crc_target = mad_bit_read(&stream->ptr, 16);
++ }
+
+ return 0;
+ }
+@@ -338,7 +350,7 @@ int mad_header_decode(struct mad_header
+ stream->error = MAD_ERROR_BUFLEN;
+ goto fail;
+ }
+- else if (!(ptr[0] == 0xff && (ptr[1] & 0xe0) == 0xe0)) {
++ else if ((end - ptr >= 2) && !(ptr[0] == 0xff && (ptr[1] & 0xe0) == 0xe0)) {
+ /* mark point where frame sync word was expected */
+ stream->this_frame = ptr;
+ stream->next_frame = ptr + 1;
+@@ -361,6 +373,8 @@ int mad_header_decode(struct mad_header
+ ptr = mad_bit_nextbyte(&stream->ptr);
+ }
+
++ stream->error = MAD_ERROR_NONE;
++
+ /* begin processing */
+ stream->this_frame = ptr;
+ stream->next_frame = ptr + 1; /* possibly bogus sync word */
+@@ -413,7 +427,7 @@ int mad_header_decode(struct mad_header
+ /* check that a valid frame header follows this frame */
+
+ ptr = stream->next_frame;
+- if (!(ptr[0] == 0xff && (ptr[1] & 0xe0) == 0xe0)) {
++ if ((end - ptr >= 2) && !(ptr[0] == 0xff && (ptr[1] & 0xe0) == 0xe0)) {
+ ptr = stream->next_frame = stream->this_frame + 1;
+ goto sync;
+ }
+Index: libmad-0.15.1b/layer12.c
+===================================================================
+--- libmad-0.15.1b.orig/layer12.c
++++ libmad-0.15.1b/layer12.c
+@@ -72,10 +72,18 @@ mad_fixed_t const linear_table[14] = {
+ * DESCRIPTION: decode one requantized Layer I sample from a bitstream
+ */
+ static
+-mad_fixed_t I_sample(struct mad_bitptr *ptr, unsigned int nb)
++mad_fixed_t I_sample(struct mad_bitptr *ptr, unsigned int nb, struct mad_stream *stream)
+ {
+ mad_fixed_t sample;
++ struct mad_bitptr frameend_ptr;
+
++ mad_bit_init(&frameend_ptr, stream->next_frame);
++
++ if (mad_bit_length(ptr, &frameend_ptr) < nb) {
++ stream->error = MAD_ERROR_LOSTSYNC;
++ stream->sync = 0;
++ return 0;
++ }
+ sample = mad_bit_read(ptr, nb);
+
+ /* invert most significant bit, extend sign, then scale to fixed format */
+@@ -106,6 +114,10 @@ int mad_layer_I(struct mad_stream *strea
+ struct mad_header *header = &frame->header;
+ unsigned int nch, bound, ch, s, sb, nb;
+ unsigned char allocation[2][32], scalefactor[2][32];
++ struct mad_bitptr bufend_ptr, frameend_ptr;
++
++ mad_bit_init(&bufend_ptr, stream->bufend);
++ mad_bit_init(&frameend_ptr, stream->next_frame);
+
+ nch = MAD_NCHANNELS(header);
+
+@@ -118,6 +130,11 @@ int mad_layer_I(struct mad_stream *strea
+ /* check CRC word */
+
+ if (header->flags & MAD_FLAG_PROTECTION) {
++ if (mad_bit_length(&stream->ptr, &bufend_ptr)
++ < 4 * (bound * nch + (32 - bound))) {
++ stream->error = MAD_ERROR_BADCRC;
++ return -1;
++ }
+ header->crc_check =
+ mad_bit_crc(stream->ptr, 4 * (bound * nch + (32 - bound)),
+ header->crc_check);
+@@ -133,6 +150,11 @@ int mad_layer_I(struct mad_stream *strea
+
+ for (sb = 0; sb < bound; ++sb) {
+ for (ch = 0; ch < nch; ++ch) {
++ if (mad_bit_length(&stream->ptr, &frameend_ptr) < 4) {
++ stream->error = MAD_ERROR_LOSTSYNC;
++ stream->sync = 0;
++ return -1;
++ }
+ nb = mad_bit_read(&stream->ptr, 4);
+
+ if (nb == 15) {
+@@ -145,6 +167,11 @@ int mad_layer_I(struct mad_stream *strea
+ }
+
+ for (sb = bound; sb < 32; ++sb) {
++ if (mad_bit_length(&stream->ptr, &frameend_ptr) < 4) {
++ stream->error = MAD_ERROR_LOSTSYNC;
++ stream->sync = 0;
++ return -1;
++ }
+ nb = mad_bit_read(&stream->ptr, 4);
+
+ if (nb == 15) {
+@@ -161,6 +188,11 @@ int mad_layer_I(struct mad_stream *strea
+ for (sb = 0; sb < 32; ++sb) {
+ for (ch = 0; ch < nch; ++ch) {
+ if (allocation[ch][sb]) {
++ if (mad_bit_length(&stream->ptr, &frameend_ptr) < 6) {
++ stream->error = MAD_ERROR_LOSTSYNC;
++ stream->sync = 0;
++ return -1;
++ }
+ scalefactor[ch][sb] = mad_bit_read(&stream->ptr, 6);
+
+ # if defined(OPT_STRICT)
+@@ -185,8 +217,10 @@ int mad_layer_I(struct mad_stream *strea
+ for (ch = 0; ch < nch; ++ch) {
+ nb = allocation[ch][sb];
+ frame->sbsample[ch][s][sb] = nb ?
+- mad_f_mul(I_sample(&stream->ptr, nb),
++ mad_f_mul(I_sample(&stream->ptr, nb, stream),
+ sf_table[scalefactor[ch][sb]]) : 0;
++ if (stream->error != 0)
++ return -1;
+ }
+ }
+
+@@ -194,7 +228,14 @@ int mad_layer_I(struct mad_stream *strea
+ if ((nb = allocation[0][sb])) {
+ mad_fixed_t sample;
+
+- sample = I_sample(&stream->ptr, nb);
++ if (mad_bit_length(&stream->ptr, &frameend_ptr) < nb) {
++ stream->error = MAD_ERROR_LOSTSYNC;
++ stream->sync = 0;
++ return -1;
++ }
++ sample = I_sample(&stream->ptr, nb, stream);
++ if (stream->error != 0)
++ return -1;
+
+ for (ch = 0; ch < nch; ++ch) {
+ frame->sbsample[ch][s][sb] =
+@@ -280,13 +321,21 @@ struct quantclass {
+ static
+ void II_samples(struct mad_bitptr *ptr,
+ struct quantclass const *quantclass,
+- mad_fixed_t output[3])
++ mad_fixed_t output[3], struct mad_stream *stream)
+ {
+ unsigned int nb, s, sample[3];
++ struct mad_bitptr frameend_ptr;
++
++ mad_bit_init(&frameend_ptr, stream->next_frame);
+
+ if ((nb = quantclass->group)) {
+ unsigned int c, nlevels;
+
++ if (mad_bit_length(ptr, &frameend_ptr) < quantclass->bits) {
++ stream->error = MAD_ERROR_LOSTSYNC;
++ stream->sync = 0;
++ return;
++ }
+ /* degrouping */
+ c = mad_bit_read(ptr, quantclass->bits);
+ nlevels = quantclass->nlevels;
+@@ -299,8 +348,14 @@ void II_samples(struct mad_bitptr *ptr,
+ else {
+ nb = quantclass->bits;
+
+- for (s = 0; s < 3; ++s)
++ for (s = 0; s < 3; ++s) {
++ if (mad_bit_length(ptr, &frameend_ptr) < nb) {
++ stream->error = MAD_ERROR_LOSTSYNC;
++ stream->sync = 0;
++ return;
++ }
+ sample[s] = mad_bit_read(ptr, nb);
++ }
+ }
+
+ for (s = 0; s < 3; ++s) {
+@@ -336,6 +391,9 @@ int mad_layer_II(struct mad_stream *stre
+ unsigned char const *offsets;
+ unsigned char allocation[2][32], scfsi[2][32], scalefactor[2][32][3];
+ mad_fixed_t samples[3];
++ struct mad_bitptr frameend_ptr;
++
++ mad_bit_init(&frameend_ptr, stream->next_frame);
+
+ nch = MAD_NCHANNELS(header);
+
+@@ -402,13 +460,24 @@ int mad_layer_II(struct mad_stream *stre
+ for (sb = 0; sb < bound; ++sb) {
+ nbal = bitalloc_table[offsets[sb]].nbal;
+
+- for (ch = 0; ch < nch; ++ch)
++ for (ch = 0; ch < nch; ++ch) {
++ if (mad_bit_length(&stream->ptr, &frameend_ptr) < nbal) {
++ stream->error = MAD_ERROR_LOSTSYNC;
++ stream->sync = 0;
++ return -1;
++ }
+ allocation[ch][sb] = mad_bit_read(&stream->ptr, nbal);
++ }
+ }
+
+ for (sb = bound; sb < sblimit; ++sb) {
+ nbal = bitalloc_table[offsets[sb]].nbal;
+
++ if (mad_bit_length(&stream->ptr, &frameend_ptr) < nbal) {
++ stream->error = MAD_ERROR_LOSTSYNC;
++ stream->sync = 0;
++ return -1;
++ }
+ allocation[0][sb] =
+ allocation[1][sb] = mad_bit_read(&stream->ptr, nbal);
+ }
+@@ -417,8 +486,14 @@ int mad_layer_II(struct mad_stream *stre
+
+ for (sb = 0; sb < sblimit; ++sb) {
+ for (ch = 0; ch < nch; ++ch) {
+- if (allocation[ch][sb])
++ if (allocation[ch][sb]) {
++ if (mad_bit_length(&stream->ptr, &frameend_ptr) < 2) {
++ stream->error = MAD_ERROR_LOSTSYNC;
++ stream->sync = 0;
++ return -1;
++ }
+ scfsi[ch][sb] = mad_bit_read(&stream->ptr, 2);
++ }
+ }
+ }
+
+@@ -441,6 +516,11 @@ int mad_layer_II(struct mad_stream *stre
+ for (sb = 0; sb < sblimit; ++sb) {
+ for (ch = 0; ch < nch; ++ch) {
+ if (allocation[ch][sb]) {
++ if (mad_bit_length(&stream->ptr, &frameend_ptr) < 6) {
++ stream->error = MAD_ERROR_LOSTSYNC;
++ stream->sync = 0;
++ return -1;
++ }
+ scalefactor[ch][sb][0] = mad_bit_read(&stream->ptr, 6);
+
+ switch (scfsi[ch][sb]) {
+@@ -451,11 +531,21 @@ int mad_layer_II(struct mad_stream *stre
+ break;
+
+ case 0:
++ if (mad_bit_length(&stream->ptr, &frameend_ptr) < 6) {
++ stream->error = MAD_ERROR_LOSTSYNC;
++ stream->sync = 0;
++ return -1;
++ }
+ scalefactor[ch][sb][1] = mad_bit_read(&stream->ptr, 6);
+ /* fall through */
+
+ case 1:
+ case 3:
++ if (mad_bit_length(&stream->ptr, &frameend_ptr) < 6) {
++ stream->error = MAD_ERROR_LOSTSYNC;
++ stream->sync = 0;
++ return -1;
++ }
+ scalefactor[ch][sb][2] = mad_bit_read(&stream->ptr, 6);
+ }
+
+@@ -487,7 +577,9 @@ int mad_layer_II(struct mad_stream *stre
+ if ((index = allocation[ch][sb])) {
+ index = offset_table[bitalloc_table[offsets[sb]].offset][index - 1];
+
+- II_samples(&stream->ptr, &qc_table[index], samples);
++ II_samples(&stream->ptr, &qc_table[index], samples, stream);
++ if (stream->error != 0)
++ return -1;
+
+ for (s = 0; s < 3; ++s) {
+ frame->sbsample[ch][3 * gr + s][sb] =
+@@ -505,7 +597,9 @@ int mad_layer_II(struct mad_stream *stre
+ if ((index = allocation[0][sb])) {
+ index = offset_table[bitalloc_table[offsets[sb]].offset][index - 1];
+
+- II_samples(&stream->ptr, &qc_table[index], samples);
++ II_samples(&stream->ptr, &qc_table[index], samples, stream);
++ if (stream->error != 0)
++ return -1;
+
+ for (ch = 0; ch < nch; ++ch) {
+ for (s = 0; s < 3; ++s) {
+Index: libmad-0.15.1b/layer3.c
+===================================================================
+--- libmad-0.15.1b.orig/layer3.c
++++ libmad-0.15.1b/layer3.c
+@@ -598,7 +598,8 @@ enum mad_error III_sideinfo(struct mad_b
+ static
+ unsigned int III_scalefactors_lsf(struct mad_bitptr *ptr,
+ struct channel *channel,
+- struct channel *gr1ch, int mode_extension)
++ struct channel *gr1ch, int mode_extension,
++ unsigned int bits_left, unsigned int *part2_length)
+ {
+ struct mad_bitptr start;
+ unsigned int scalefac_compress, index, slen[4], part, n, i;
+@@ -644,8 +645,12 @@ unsigned int III_scalefactors_lsf(struct
+
+ n = 0;
+ for (part = 0; part < 4; ++part) {
+- for (i = 0; i < nsfb[part]; ++i)
++ for (i = 0; i < nsfb[part]; ++i) {
++ if (bits_left < slen[part])
++ return MAD_ERROR_BADSCFSI;
+ channel->scalefac[n++] = mad_bit_read(ptr, slen[part]);
++ bits_left -= slen[part];
++ }
+ }
+
+ while (n < 39)
+@@ -690,7 +695,10 @@ unsigned int III_scalefactors_lsf(struct
+ max = (1 << slen[part]) - 1;
+
+ for (i = 0; i < nsfb[part]; ++i) {
++ if (bits_left < slen[part])
++ return MAD_ERROR_BADSCFSI;
+ is_pos = mad_bit_read(ptr, slen[part]);
++ bits_left -= slen[part];
+
+ channel->scalefac[n] = is_pos;
+ gr1ch->scalefac[n++] = (is_pos == max);
+@@ -703,7 +711,8 @@ unsigned int III_scalefactors_lsf(struct
+ }
+ }
+
+- return mad_bit_length(&start, ptr);
++ *part2_length = mad_bit_length(&start, ptr);
++ return MAD_ERROR_NONE;
+ }
+
+ /*
+@@ -712,7 +721,8 @@ unsigned int III_scalefactors_lsf(struct
+ */
+ static
+ unsigned int III_scalefactors(struct mad_bitptr *ptr, struct channel *channel,
+- struct channel const *gr0ch, unsigned int scfsi)
++ struct channel const *gr0ch, unsigned int scfsi,
++ unsigned int bits_left, unsigned int *part2_length)
+ {
+ struct mad_bitptr start;
+ unsigned int slen1, slen2, sfbi;
+@@ -728,12 +738,20 @@ unsigned int III_scalefactors(struct mad
+ sfbi = 0;
+
+ nsfb = (channel->flags & mixed_block_flag) ? 8 + 3 * 3 : 6 * 3;
+- while (nsfb--)
++ while (nsfb--) {
++ if (bits_left < slen1)
++ return MAD_ERROR_BADSCFSI;
+ channel->scalefac[sfbi++] = mad_bit_read(ptr, slen1);
++ bits_left -= slen1;
++ }
+
+ nsfb = 6 * 3;
+- while (nsfb--)
++ while (nsfb--) {
++ if (bits_left < slen2)
++ return MAD_ERROR_BADSCFSI;
+ channel->scalefac[sfbi++] = mad_bit_read(ptr, slen2);
++ bits_left -= slen2;
++ }
+
+ nsfb = 1 * 3;
+ while (nsfb--)
+@@ -745,8 +763,12 @@ unsigned int III_scalefactors(struct mad
+ channel->scalefac[sfbi] = gr0ch->scalefac[sfbi];
+ }
+ else {
+- for (sfbi = 0; sfbi < 6; ++sfbi)
++ for (sfbi = 0; sfbi < 6; ++sfbi) {
++ if (bits_left < slen1)
++ return MAD_ERROR_BADSCFSI;
+ channel->scalefac[sfbi] = mad_bit_read(ptr, slen1);
++ bits_left -= slen1;
++ }
+ }
+
+ if (scfsi & 0x4) {
+@@ -754,8 +776,12 @@ unsigned int III_scalefactors(struct mad
+ channel->scalefac[sfbi] = gr0ch->scalefac[sfbi];
+ }
+ else {
+- for (sfbi = 6; sfbi < 11; ++sfbi)
++ for (sfbi = 6; sfbi < 11; ++sfbi) {
++ if (bits_left < slen1)
++ return MAD_ERROR_BADSCFSI;
+ channel->scalefac[sfbi] = mad_bit_read(ptr, slen1);
++ bits_left -= slen1;
++ }
+ }
+
+ if (scfsi & 0x2) {
+@@ -763,8 +789,12 @@ unsigned int III_scalefactors(struct mad
+ channel->scalefac[sfbi] = gr0ch->scalefac[sfbi];
+ }
+ else {
+- for (sfbi = 11; sfbi < 16; ++sfbi)
++ for (sfbi = 11; sfbi < 16; ++sfbi) {
++ if (bits_left < slen2)
++ return MAD_ERROR_BADSCFSI;
+ channel->scalefac[sfbi] = mad_bit_read(ptr, slen2);
++ bits_left -= slen2;
++ }
+ }
+
+ if (scfsi & 0x1) {
+@@ -772,14 +802,19 @@ unsigned int III_scalefactors(struct mad
+ channel->scalefac[sfbi] = gr0ch->scalefac[sfbi];
+ }
+ else {
+- for (sfbi = 16; sfbi < 21; ++sfbi)
++ for (sfbi = 16; sfbi < 21; ++sfbi) {
++ if (bits_left < slen2)
++ return MAD_ERROR_BADSCFSI;
+ channel->scalefac[sfbi] = mad_bit_read(ptr, slen2);
++ bits_left -= slen2;
++ }
+ }
+
+ channel->scalefac[21] = 0;
+ }
+
+- return mad_bit_length(&start, ptr);
++ *part2_length = mad_bit_length(&start, ptr);
++ return MAD_ERROR_NONE;
+ }
+
+ /*
+@@ -933,19 +968,17 @@ static
+ enum mad_error III_huffdecode(struct mad_bitptr *ptr, mad_fixed_t xr[576],
+ struct channel *channel,
+ unsigned char const *sfbwidth,
+- unsigned int part2_length)
++ signed int part3_length)
+ {
+ signed int exponents[39], exp;
+ signed int const *expptr;
+ struct mad_bitptr peek;
+- signed int bits_left, cachesz;
++ signed int bits_left, cachesz, fakebits;
+ register mad_fixed_t *xrptr;
+ mad_fixed_t const *sfbound;
+ register unsigned long bitcache;
+
+- bits_left = (signed) channel->part2_3_length - (signed) part2_length;
+- if (bits_left < 0)
+- return MAD_ERROR_BADPART3LEN;
++ bits_left = part3_length;
+
+ III_exponents(channel, sfbwidth, exponents);
+
+@@ -956,8 +989,12 @@ enum mad_error III_huffdecode(struct mad
+ cachesz = mad_bit_bitsleft(&peek);
+ cachesz += ((32 - 1 - 24) + (24 - cachesz)) & ~7;
+
++ if (bits_left < cachesz) {
++ cachesz = bits_left;
++ }
+ bitcache = mad_bit_read(&peek, cachesz);
+ bits_left -= cachesz;
++ fakebits = 0;
+
+ xrptr = &xr[0];
+
+@@ -986,7 +1023,7 @@ enum mad_error III_huffdecode(struct mad
+
+ big_values = channel->big_values;
+
+- while (big_values-- && cachesz + bits_left > 0) {
++ while (big_values-- && cachesz + bits_left - fakebits > 0) {
+ union huffpair const *pair;
+ unsigned int clumpsz, value;
+ register mad_fixed_t requantized;
+@@ -1023,10 +1060,19 @@ enum mad_error III_huffdecode(struct mad
+ unsigned int bits;
+
+ bits = ((32 - 1 - 21) + (21 - cachesz)) & ~7;
++ if (bits_left < bits) {
++ bits = bits_left;
++ }
+ bitcache = (bitcache << bits) | mad_bit_read(&peek, bits);
+ cachesz += bits;
+ bits_left -= bits;
+ }
++ if (cachesz < 21) {
++ unsigned int bits = 21 - cachesz;
++ bitcache <<= bits;
++ cachesz += bits;
++ fakebits += bits;
++ }
+
+ /* hcod (0..19) */
+
+@@ -1041,6 +1087,8 @@ enum mad_error III_huffdecode(struct mad
+ }
+
+ cachesz -= pair->value.hlen;
++ if (cachesz < fakebits)
++ return MAD_ERROR_BADHUFFDATA;
+
+ if (linbits) {
+ /* x (0..14) */
+@@ -1054,10 +1102,15 @@ enum mad_error III_huffdecode(struct mad
+
+ case 15:
+ if (cachesz < linbits + 2) {
+- bitcache = (bitcache << 16) | mad_bit_read(&peek, 16);
+- cachesz += 16;
+- bits_left -= 16;
++ unsigned int bits = 16;
++ if (bits_left < 16)
++ bits = bits_left;
++ bitcache = (bitcache << bits) | mad_bit_read(&peek, bits);
++ cachesz += bits;
++ bits_left -= bits;
+ }
++ if (cachesz - fakebits < linbits)
++ return MAD_ERROR_BADHUFFDATA;
+
+ value += MASK(bitcache, cachesz, linbits);
+ cachesz -= linbits;
+@@ -1074,6 +1127,8 @@ enum mad_error III_huffdecode(struct mad
+ }
+
+ x_final:
++ if (cachesz - fakebits < 1)
++ return MAD_ERROR_BADHUFFDATA;
+ xrptr[0] = MASK1BIT(bitcache, cachesz--) ?
+ -requantized : requantized;
+ }
+@@ -1089,10 +1144,15 @@ enum mad_error III_huffdecode(struct mad
+
+ case 15:
+ if (cachesz < linbits + 1) {
+- bitcache = (bitcache << 16) | mad_bit_read(&peek, 16);
+- cachesz += 16;
+- bits_left -= 16;
++ unsigned int bits = 16;
++ if (bits_left < 16)
++ bits = bits_left;
++ bitcache = (bitcache << bits) | mad_bit_read(&peek, bits);
++ cachesz += bits;
++ bits_left -= bits;
+ }
++ if (cachesz - fakebits < linbits)
++ return MAD_ERROR_BADHUFFDATA;
+
+ value += MASK(bitcache, cachesz, linbits);
+ cachesz -= linbits;
+@@ -1109,6 +1169,8 @@ enum mad_error III_huffdecode(struct mad
+ }
+
+ y_final:
++ if (cachesz - fakebits < 1)
++ return MAD_ERROR_BADHUFFDATA;
+ xrptr[1] = MASK1BIT(bitcache, cachesz--) ?
+ -requantized : requantized;
+ }
+@@ -1128,6 +1190,8 @@ enum mad_error III_huffdecode(struct mad
+ requantized = reqcache[value] = III_requantize(value, exp);
+ }
+
++ if (cachesz - fakebits < 1)
++ return MAD_ERROR_BADHUFFDATA;
+ xrptr[0] = MASK1BIT(bitcache, cachesz--) ?
+ -requantized : requantized;
+ }
+@@ -1146,6 +1210,8 @@ enum mad_error III_huffdecode(struct mad
+ requantized = reqcache[value] = III_requantize(value, exp);
+ }
+
++ if (cachesz - fakebits < 1)
++ return MAD_ERROR_BADHUFFDATA;
+ xrptr[1] = MASK1BIT(bitcache, cachesz--) ?
+ -requantized : requantized;
+ }
+@@ -1155,9 +1221,6 @@ enum mad_error III_huffdecode(struct mad
+ }
+ }
+
+- if (cachesz + bits_left < 0)
+- return MAD_ERROR_BADHUFFDATA; /* big_values overrun */
+-
+ /* count1 */
+ {
+ union huffquad const *table;
+@@ -1167,15 +1230,24 @@ enum mad_error III_huffdecode(struct mad
+
+ requantized = III_requantize(1, exp);
+
+- while (cachesz + bits_left > 0 && xrptr <= &xr[572]) {
++ while (cachesz + bits_left - fakebits > 0 && xrptr <= &xr[572]) {
+ union huffquad const *quad;
+
+ /* hcod (1..6) */
+
+ if (cachesz < 10) {
+- bitcache = (bitcache << 16) | mad_bit_read(&peek, 16);
+- cachesz += 16;
+- bits_left -= 16;
++ unsigned int bits = 16;
++ if (bits_left < 16)
++ bits = bits_left;
++ bitcache = (bitcache << bits) | mad_bit_read(&peek, bits);
++ cachesz += bits;
++ bits_left -= bits;
++ }
++ if (cachesz < 10) {
++ unsigned int bits = 10 - cachesz;
++ bitcache <<= bits;
++ cachesz += bits;
++ fakebits += bits;
+ }
+
+ quad = &table[MASK(bitcache, cachesz, 4)];
+@@ -1188,6 +1260,11 @@ enum mad_error III_huffdecode(struct mad
+ MASK(bitcache, cachesz, quad->ptr.bits)];
+ }
+
++ if (cachesz - fakebits < quad->value.hlen + quad->value.v
++ + quad->value.w + quad->value.x + quad->value.y)
++ /* We don't have enough bits to read one more entry, consider them
++ * stuffing bits. */
++ break;
+ cachesz -= quad->value.hlen;
+
+ if (xrptr == sfbound) {
+@@ -1236,22 +1313,8 @@ enum mad_error III_huffdecode(struct mad
+
+ xrptr += 2;
+ }
+-
+- if (cachesz + bits_left < 0) {
+-# if 0 && defined(DEBUG)
+- fprintf(stderr, "huffman count1 overrun (%d bits)\n",
+- -(cachesz + bits_left));
+-# endif
+-
+- /* technically the bitstream is misformatted, but apparently
+- some encoders are just a bit sloppy with stuffing bits */
+-
+- xrptr -= 4;
+- }
+ }
+
+- assert(-bits_left <= MAD_BUFFER_GUARD * CHAR_BIT);
+-
+ # if 0 && defined(DEBUG)
+ if (bits_left < 0)
+ fprintf(stderr, "read %d bits too many\n", -bits_left);
+@@ -2348,10 +2411,11 @@ void III_freqinver(mad_fixed_t sample[18
+ */
+ static
+ enum mad_error III_decode(struct mad_bitptr *ptr, struct mad_frame *frame,
+- struct sideinfo *si, unsigned int nch)
++ struct sideinfo *si, unsigned int nch, unsigned int md_len)
+ {
+ struct mad_header *header = &frame->header;
+ unsigned int sfreqi, ngr, gr;
++ int bits_left = md_len * CHAR_BIT;
+
+ {
+ unsigned int sfreq;
+@@ -2383,6 +2447,7 @@ enum mad_error III_decode(struct mad_bit
+ for (ch = 0; ch < nch; ++ch) {
+ struct channel *channel = &granule->ch[ch];
+ unsigned int part2_length;
++ unsigned int part3_length;
+
+ sfbwidth[ch] = sfbwidth_table[sfreqi].l;
+ if (channel->block_type == 2) {
+@@ -2391,18 +2456,30 @@ enum mad_error III_decode(struct mad_bit
+ }
+
+ if (header->flags & MAD_FLAG_LSF_EXT) {
+- part2_length = III_scalefactors_lsf(ptr, channel,
++ error = III_scalefactors_lsf(ptr, channel,
+ ch == 0 ? 0 : &si->gr[1].ch[1],
+- header->mode_extension);
++ header->mode_extension, bits_left, &part2_length);
+ }
+ else {
+- part2_length = III_scalefactors(ptr, channel, &si->gr[0].ch[ch],
+- gr == 0 ? 0 : si->scfsi[ch]);
++ error = III_scalefactors(ptr, channel, &si->gr[0].ch[ch],
++ gr == 0 ? 0 : si->scfsi[ch], bits_left, &part2_length);
+ }
++ if (error)
++ return error;
++
++ bits_left -= part2_length;
+
+- error = III_huffdecode(ptr, xr[ch], channel, sfbwidth[ch], part2_length);
++ if (part2_length > channel->part2_3_length)
++ return MAD_ERROR_BADPART3LEN;
++
++ part3_length = channel->part2_3_length - part2_length;
++ if (part3_length > bits_left)
++ return MAD_ERROR_BADPART3LEN;
++
++ error = III_huffdecode(ptr, xr[ch], channel, sfbwidth[ch], part3_length);
+ if (error)
+ return error;
++ bits_left -= part3_length;
+ }
+
+ /* joint stereo processing */
+@@ -2519,11 +2596,13 @@ int mad_layer_III(struct mad_stream *str
+ unsigned int nch, priv_bitlen, next_md_begin = 0;
+ unsigned int si_len, data_bitlen, md_len;
+ unsigned int frame_space, frame_used, frame_free;
+- struct mad_bitptr ptr;
++ struct mad_bitptr ptr, bufend_ptr;
+ struct sideinfo si;
+ enum mad_error error;
+ int result = 0;
+
++ mad_bit_init(&bufend_ptr, stream->bufend);
++
+ /* allocate Layer III dynamic structures */
+
+ if (stream->main_data == 0) {
+@@ -2587,14 +2666,15 @@ int mad_layer_III(struct mad_stream *str
+ unsigned long header;
+
+ mad_bit_init(&peek, stream->next_frame);
++ if (mad_bit_length(&peek, &bufend_ptr) >= 57) {
++ header = mad_bit_read(&peek, 32);
++ if ((header & 0xffe60000L) /* syncword | layer */ == 0xffe20000L) {
++ if (!(header & 0x00010000L)) /* protection_bit */
++ mad_bit_skip(&peek, 16); /* crc_check */
+
+- header = mad_bit_read(&peek, 32);
+- if ((header & 0xffe60000L) /* syncword | layer */ == 0xffe20000L) {
+- if (!(header & 0x00010000L)) /* protection_bit */
+- mad_bit_skip(&peek, 16); /* crc_check */
+-
+- next_md_begin =
+- mad_bit_read(&peek, (header & 0x00080000L) /* ID */ ? 9 : 8);
++ next_md_begin =
++ mad_bit_read(&peek, (header & 0x00080000L) /* ID */ ? 9 : 8);
++ }
+ }
+
+ mad_bit_finish(&peek);
+@@ -2653,7 +2733,7 @@ int mad_layer_III(struct mad_stream *str
+ /* decode main_data */
+
+ if (result == 0) {
+- error = III_decode(&ptr, frame, &si, nch);
++ error = III_decode(&ptr, frame, &si, nch, md_len);
+ if (error) {
+ stream->error = error;
+ result = -1;
diff --git a/main/libmad/md_size.patch b/main/libmad/md_size.patch
new file mode 100644
index 0000000000..657b5ffdb9
--- /dev/null
+++ b/main/libmad/md_size.patch
@@ -0,0 +1,58 @@
+From: Kurt Roeckx <kurt@roeckx.be>
+Date: Sun, 28 Jan 2018 15:44:08 +0100
+Subject: Check the size of the main data
+
+The main data to decode a frame can come from the current frame and part of the
+previous frame, the so called bit reservoir. si.main_data_begin is the part of
+the previous frame we need for this frame. frame_space is the amount of main
+data that can be in this frame, and next_md_begin is the part of this frame that
+is going to be used for the next frame.
+
+The maximum amount of data from a previous frame that the format allows is 511
+bytes. The maximum frame size for the defined bitrates is at MPEG 2.5 layer 2
+at 320 kbit/s and 8 kHz sample rate which gives 72 * (320000 / 8000) + 1 = 2881.
+So those defines are not large enough:
+ # define MAD_BUFFER_GUARD 8
+ # define MAD_BUFFER_MDLEN (511 + 2048 + MAD_BUFFER_GUARD)
+
+There is also support for a "free" bitrate which allows you to create any frame
+size, which can be larger than the buffer.
+
+Changing the defines is not an option since it's part of the ABI, so we check
+that the main data fits in the bufer.
+
+The previous frame data is stored in *stream->main_data and contains
+stream->md_len bytes. If stream->md_len is larger than the data we
+need from the previous frame (si.main_data_begin) it still wouldn't fit
+in the buffer, so just keep the data that we need.
+
+Index: libmad-0.15.1b/layer3.c
+===================================================================
+--- libmad-0.15.1b.orig/layer3.c
++++ libmad-0.15.1b/layer3.c
+@@ -2608,6 +2608,11 @@ int mad_layer_III(struct mad_stream *str
+ next_md_begin = 0;
+
+ md_len = si.main_data_begin + frame_space - next_md_begin;
++ if (md_len + MAD_BUFFER_GUARD > MAD_BUFFER_MDLEN) {
++ stream->error = MAD_ERROR_LOSTSYNC;
++ stream->sync = 0;
++ return -1;
++ }
+
+ frame_used = 0;
+
+@@ -2625,8 +2630,11 @@ int mad_layer_III(struct mad_stream *str
+ }
+ }
+ else {
+- mad_bit_init(&ptr,
+- *stream->main_data + stream->md_len - si.main_data_begin);
++ memmove(stream->main_data,
++ *stream->main_data + stream->md_len - si.main_data_begin,
++ si.main_data_begin);
++ stream->md_len = si.main_data_begin;
++ mad_bit_init(&ptr, *stream->main_data);
+
+ if (md_len > si.main_data_begin) {
+ assert(stream->md_len + md_len -
diff --git a/main/libtasn1/APKBUILD b/main/libtasn1/APKBUILD
index 7ce580d08f..315cd9f69f 100644
--- a/main/libtasn1/APKBUILD
+++ b/main/libtasn1/APKBUILD
@@ -1,23 +1,24 @@
# Contributor: Sören Tempel <soeren+alpine@soeren-tempel.net>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=libtasn1
-pkgver=4.13
+pkgver=4.14
pkgrel=0
pkgdesc="The ASN.1 library used in GNUTLS"
url="https://www.gnu.org/software/gnutls/"
arch="all"
license="GPL-3.0 LGPL"
makedepends="texinfo"
+checkdepends="diffutils"
subpackages="$pkgname-dev $pkgname-doc"
-source="ftp://ftp.gnu.org/gnu/$pkgname/$pkgname-$pkgver.tar.gz
- "
-builddir="$srcdir/$pkgname-$pkgver"
+source="http://ftp.gnu.org/gnu/$pkgname/$pkgname-$pkgver.tar.gz"
# secfixes:
+# 4.14-r0:
+# - CVE-2018-1000654
# 4.13-r0:
-# - CVE-2018-6003
+# - CVE-2018-6003
# 4.12-r1:
-# - CVE-2017-10790
+# - CVE-2017-10790
build() {
cd "$builddir"
@@ -40,4 +41,4 @@ package() {
cd "$builddir"
make DESTDIR="$pkgdir" install
}
-sha512sums="bf5b60a296795e0a8a4a658c0106492393aa7ce698e785256b3427c17215c2a5b6178a61a2043c93ea4334f754eabece20221ac8fef0fd5644086a3891d98a9f libtasn1-4.13.tar.gz"
+sha512sums="efdcf3729e9e057cafbfdc9929f08531de03cf3b64e7db62cb53c26bf34c8db4d73786fd853620ab1a10dbafe55e119ad17bfeb40e191071945c7b4db9c9e223 libtasn1-4.14.tar.gz"
diff --git a/main/libtasn1/CVE-2017-10790.patch b/main/libtasn1/CVE-2017-10790.patch
deleted file mode 100644
index eb752c20a9..0000000000
--- a/main/libtasn1/CVE-2017-10790.patch
+++ /dev/null
@@ -1,55 +0,0 @@
-From d8d805e1f2e6799bb2dff4871a8598dc83088a39 Mon Sep 17 00:00:00 2001
-From: Nikos Mavrogiannopoulos <nmav@redhat.com>
-Date: Thu, 22 Jun 2017 16:31:37 +0200
-Subject: [PATCH] _asn1_check_identifier: safer access to values read
-
-Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
----
- lib/parser_aux.c | 17 ++++++++++++-----
- 1 file changed, 12 insertions(+), 5 deletions(-)
-
-diff --git a/lib/parser_aux.c b/lib/parser_aux.c
-index 976ab38..786ea64 100644
---- a/lib/parser_aux.c
-+++ b/lib/parser_aux.c
-@@ -955,7 +955,7 @@ _asn1_check_identifier (asn1_node node)
- if (p2 == NULL)
- {
- if (p->value)
-- _asn1_strcpy (_asn1_identifierMissing, p->value);
-+ _asn1_str_cpy (_asn1_identifierMissing, sizeof(_asn1_identifierMissing), (char*)p->value);
- else
- _asn1_strcpy (_asn1_identifierMissing, "(null)");
- return ASN1_IDENTIFIER_NOT_FOUND;
-@@ -968,9 +968,15 @@ _asn1_check_identifier (asn1_node node)
- if (p2 && (type_field (p2->type) == ASN1_ETYPE_DEFAULT))
- {
- _asn1_str_cpy (name2, sizeof (name2), node->name);
-- _asn1_str_cat (name2, sizeof (name2), ".");
-- _asn1_str_cat (name2, sizeof (name2), (char *) p2->value);
-- _asn1_strcpy (_asn1_identifierMissing, p2->value);
-+ if (p2->value)
-+ {
-+ _asn1_str_cat (name2, sizeof (name2), ".");
-+ _asn1_str_cat (name2, sizeof (name2), (char *) p2->value);
-+ _asn1_str_cpy (_asn1_identifierMissing, sizeof(_asn1_identifierMissing), (char*)p2->value);
-+ }
-+ else
-+ _asn1_strcpy (_asn1_identifierMissing, "(null)");
-+
- p2 = asn1_find_node (node, name2);
- if (!p2 || (type_field (p2->type) != ASN1_ETYPE_OBJECT_ID) ||
- !(p2->type & CONST_ASSIGN))
-@@ -990,7 +996,8 @@ _asn1_check_identifier (asn1_node node)
- _asn1_str_cpy (name2, sizeof (name2), node->name);
- _asn1_str_cat (name2, sizeof (name2), ".");
- _asn1_str_cat (name2, sizeof (name2), (char *) p2->value);
-- _asn1_strcpy (_asn1_identifierMissing, p2->value);
-+ _asn1_str_cpy (_asn1_identifierMissing, sizeof(_asn1_identifierMissing), (char*)p2->value);
-+
- p2 = asn1_find_node (node, name2);
- if (!p2 || (type_field (p2->type) != ASN1_ETYPE_OBJECT_ID)
- || !(p2->type & CONST_ASSIGN))
---
-1.9.1
-
diff --git a/main/mariadb/APKBUILD b/main/mariadb/APKBUILD
index 04b9d5a858..d6782d02cc 100644
--- a/main/mariadb/APKBUILD
+++ b/main/mariadb/APKBUILD
@@ -6,10 +6,10 @@
# Contributor: Marcel Haazen <marcel@haazen.xyz>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=mariadb
-pkgver=10.3.15
+pkgver=10.3.17
pkgrel=0
pkgdesc="A fast SQL database server"
-url="https://www.mariadb.org"
+url="https://www.mariadb.org/"
pkgusers="mysql"
pkggroups="mysql"
arch="all"
@@ -49,6 +49,12 @@ source="https://downloads.mariadb.org/interstitial/mariadb-$pkgver/source/mariad
builddir="$srcdir/$pkgname-$pkgver"
# secfixes:
+# 10.3.17-r0:
+# - CVE-2019-2805
+# - CVE-2019-2740
+# - CVE-2019-2739
+# - CVE-2019-2737
+# - CVE-2019-2758
# 10.3.15-r0:
# - CVE-2019-2614
# - CVE-2019-2627
@@ -425,8 +431,8 @@ _plugin_rocksdb() {
"$subpkgdir"/usr/lib/mariadb/plugin/ha_rocksdb.so
}
-sha512sums="35332ac32cba27fef1b4ddd2209236853f4309756fd121fbdbd2b6be0651e817cedc80e276b89ccfa4bc76760811434fab45a4d380d0ebd500c7d9bd7377fe93 mariadb-10.3.15.tar.gz
+sha512sums="6fba995d8c284a12f19ee5635f5d69d8fa89fc314f512cd1764b2c4593933baf71a472ddce630463debd3bfbafa1cf5afee3f40d3c4062242f58cea16259561e mariadb-10.3.17.tar.gz
c352969f6665b0ffa387f7b185a5dea7751f4b16c12c809627857b27321efa09159369d7dd5c852d6159a9f173cb895fb601f0c52a1fa6e3527899520030964c mariadb.initd
-b4469f2f0299e71c09b65c91373f2d72b7fe9a9cd58ad24737a78a8097473b29c32b7267e173a2dfe1158f2f7d40a7fb02fb1b35caeda44d16ae3b9e2602a75f fix-c11-atomics-check.patch
+ecfea6503edd301bb628e2a44f36315079efa70e7615ff06b27714397332034f02e68ef40d4d5c761942e024ed1993621127c9df80b7e2327c68b1d839a7a322 fix-c11-atomics-check.patch
e9ae4613f1d8c5f0a59b39a3548c46e50674ae78e7457d0e64c49f7e1573125c13634bbce7e29179bb8865a423171f852f43b96f7ef95619a95f02edcfc71efd ppc-remove-glibc-dep.patch
70da971aa78815495098205bcbd28428430aa83c3f1050fec0231ca86af9d9def2d2108a48ee08d86812c8dc5ad8ab1ef4e17a49b4936ed5187ae0f6a7ef8f63 pcre.cmake.patch"
diff --git a/main/mariadb/fix-c11-atomics-check.patch b/main/mariadb/fix-c11-atomics-check.patch
index f98c0a20fd..0566cb8cea 100644
--- a/main/mariadb/fix-c11-atomics-check.patch
+++ b/main/mariadb/fix-c11-atomics-check.patch
@@ -45,10 +45,10 @@
SET(HAVE_valgrind 1)
--- a/mysys/CMakeLists.txt
+++ b/mysys/CMakeLists.txt
-@@ -74,7 +74,7 @@
+@@ -75,7 +75,7 @@
ADD_CONVENIENCE_LIBRARY(mysys ${MYSYS_SOURCES})
- TARGET_LINK_LIBRARIES(mysys dbug strings mysys_ssl ${ZLIB_LIBRARY}
+ TARGET_LINK_LIBRARIES(mysys dbug strings ${ZLIB_LIBRARY}
- ${LIBNSL} ${LIBM} ${LIBRT} ${LIBDL} ${LIBSOCKET} ${LIBEXECINFO} ${CRC32_LIBRARY})
+ ${LIBNSL} ${LIBM} ${LIBRT} ${LIBDL} ${LIBATOMIC} ${LIBSOCKET} ${LIBEXECINFO} ${CRC32_LIBRARY})
DTRACE_INSTRUMENT(mysys)
@@ -56,12 +56,12 @@
IF(HAVE_BFD_H)
--- a/storage/rocksdb/build_rocksdb.cmake
+++ b/storage/rocksdb/build_rocksdb.cmake
-@@ -142,7 +142,7 @@
+@@ -162,7 +162,7 @@
if(WIN32)
set(SYSTEM_LIBS ${SYSTEM_LIBS} Shlwapi.lib Rpcrt4.lib)
else()
-- set(SYSTEM_LIBS ${CMAKE_THREAD_LIBS_INIT} ${LIBRT})
-+ set(SYSTEM_LIBS ${LIBATOMIC} ${CMAKE_THREAD_LIBS_INIT} ${LIBRT})
+- set(SYSTEM_LIBS ${CMAKE_THREAD_LIBS_INIT} ${LIBRT} ${LIBDL})
++ set(SYSTEM_LIBS ${LIBATOMIC} ${CMAKE_THREAD_LIBS_INIT} ${LIBRT} ${LIBDL})
endif()
set(ROCKSDB_LIBS rocksdblib})
diff --git a/main/musl/APKBUILD b/main/musl/APKBUILD
index e4556fff49..390644b80f 100644
--- a/main/musl/APKBUILD
+++ b/main/musl/APKBUILD
@@ -2,7 +2,7 @@
# Maintainer: Timo Teräs <timo.teras@iki.fi>
pkgname=musl
pkgver=1.1.20
-pkgrel=4
+pkgrel=5
pkgdesc="the musl c library (libc) implementation"
url="http://www.musl-libc.org/"
arch="all"
@@ -14,6 +14,7 @@ nolibc) ;;
*) subpackages="$subpackages $pkgname-utils";;
esac
source="http://www.musl-libc.org/releases/musl-$pkgver.tar.gz
+ CVE-2019-14697.patch
2000-pthread-internals-increase-DEFAULT_GUARD_SIZE-to-2-p.patch
handle-aux-at_base.patch
0001-fix-race-condition-in-file-locking.patch
@@ -28,6 +29,8 @@ source="http://www.musl-libc.org/releases/musl-$pkgver.tar.gz
"
# secfixes:
+# 1.1.20-r5:
+# - CVE-2019-14697
# 1.1.15-r4:
# - CVE-2016-8859
@@ -148,6 +151,7 @@ compat() {
}
sha512sums="d3a7a30aa375ca50d7dcfbd618581d59e1aa5378417f50a0ca5510099336fd74cc9db468e05c93dda3067abd890f6bd47af226c3446bb833adf0a5054bff2e5d musl-1.1.20.tar.gz
+37ab61c96b940848e4114de105d87754c7039f52eb2fc19d8bf59c27f484bffbac8b4740e9478207eae03bd7416f7036e04197d0efe30ee5293b17d6d5c1cc15 CVE-2019-14697.patch
2c8e1dde1834238097b2ee8a7bfb53471a0d9cff4a5e38b55f048b567deff1cdd47c170d0578a67b1a039f95a6c5fbb8cff369c75b6a3e4d7ed171e8e86ebb8c 2000-pthread-internals-increase-DEFAULT_GUARD_SIZE-to-2-p.patch
6a7ff16d95b5d1be77e0a0fbb245491817db192176496a57b22ab037637d97a185ea0b0d19da687da66c2a2f5578e4343d230f399d49fe377d8f008410974238 handle-aux-at_base.patch
ab34509cec7419c11352094ed6acf14e5766b314bd2b96506a0d0203e61e90e85ea9a121f1fefc0d00bcba381778d579ea2c02325605344530420305fcf1a0d0 0001-fix-race-condition-in-file-locking.patch
diff --git a/main/musl/CVE-2019-14697.patch b/main/musl/CVE-2019-14697.patch
new file mode 100644
index 0000000000..eae91a00f9
--- /dev/null
+++ b/main/musl/CVE-2019-14697.patch
@@ -0,0 +1,233 @@
+From f3ed8bfe8a82af1870ddc8696ed4cc1d5aa6b441 Mon Sep 17 00:00:00 2001
+From: Rich Felker <dalias@aerifal.cx>
+Date: Mon, 5 Aug 2019 18:41:47 -0400
+Subject: fix x87 stack imbalance in corner cases of i386 math asm
+
+commit 31c5fb80b9eae86f801be4f46025bc6532a554c5 introduced underflow
+code paths for the i386 math asm, along with checks on the fpu status
+word to skip the underflow-generation instructions if the underflow
+flag was already raised. unfortunately, at least one such path, in
+log1p, returned with 2 items on the x87 stack rather than just 1 item
+for the return value. this is a violation of the ABI's calling
+convention, and could cause subsequent floating point code to produce
+NANs due to x87 stack overflow. if floating point results are used in
+flow control, this can lead to runaway wrong code execution.
+
+rather than reviewing each "underflow already raised" code path for
+correctness, remove them all. they're likely slower than just
+performing the underflow code unconditionally, and significantly more
+complex.
+
+all of this code should be ripped out and replaced by C source files
+with inline asm. doing so would preclude this kind of error by having
+the compiler perform all x87 stack register allocation and stack
+manipulation, and would produce comparable or better code. however
+such a change is a much larger project.
+---
+ src/math/i386/asin.s | 10 ++--------
+ src/math/i386/atan.s | 7 ++-----
+ src/math/i386/atan2.s | 5 +----
+ src/math/i386/atan2f.s | 5 +----
+ src/math/i386/atanf.s | 7 ++-----
+ src/math/i386/exp.s | 10 ++--------
+ src/math/i386/log1p.s | 7 ++-----
+ src/math/i386/log1pf.s | 7 ++-----
+ 8 files changed, 14 insertions(+), 44 deletions(-)
+
+diff --git a/src/math/i386/asin.s b/src/math/i386/asin.s
+index a9f691bf..920d967a 100644
+--- a/src/math/i386/asin.s
++++ b/src/math/i386/asin.s
+@@ -7,13 +7,10 @@ asinf:
+ cmp $0x01000000,%eax
+ jae 1f
+ # subnormal x, return x with underflow
+- fnstsw %ax
+- and $16,%ax
+- jnz 2f
+ fld %st(0)
+ fmul %st(1)
+ fstps 4(%esp)
+-2: ret
++ ret
+
+ .global asinl
+ .type asinl,@function
+@@ -30,11 +27,8 @@ asin:
+ cmp $0x00200000,%eax
+ jae 1f
+ # subnormal x, return x with underflow
+- fnstsw %ax
+- and $16,%ax
+- jnz 2f
+ fsts 4(%esp)
+-2: ret
++ ret
+ 1: fld %st(0)
+ fld1
+ fsub %st(0),%st(1)
+diff --git a/src/math/i386/atan.s b/src/math/i386/atan.s
+index d73137b2..a26feae1 100644
+--- a/src/math/i386/atan.s
++++ b/src/math/i386/atan.s
+@@ -10,8 +10,5 @@ atan:
+ fpatan
+ ret
+ # subnormal x, return x with underflow
+-1: fnstsw %ax
+- and $16,%ax
+- jnz 2f
+- fsts 4(%esp)
+-2: ret
++1: fsts 4(%esp)
++ ret
+diff --git a/src/math/i386/atan2.s b/src/math/i386/atan2.s
+index a7d2979b..1fa0524d 100644
+--- a/src/math/i386/atan2.s
++++ b/src/math/i386/atan2.s
+@@ -10,8 +10,5 @@ atan2:
+ cmp $0x00200000,%eax
+ jae 1f
+ # subnormal x, return x with underflow
+- fnstsw %ax
+- and $16,%ax
+- jnz 1f
+ fsts 4(%esp)
+-1: ret
++ ret
+diff --git a/src/math/i386/atan2f.s b/src/math/i386/atan2f.s
+index 14b88ce5..0b264726 100644
+--- a/src/math/i386/atan2f.s
++++ b/src/math/i386/atan2f.s
+@@ -10,10 +10,7 @@ atan2f:
+ cmp $0x01000000,%eax
+ jae 1f
+ # subnormal x, return x with underflow
+- fnstsw %ax
+- and $16,%ax
+- jnz 1f
+ fld %st(0)
+ fmul %st(1)
+ fstps 4(%esp)
+-1: ret
++ ret
+diff --git a/src/math/i386/atanf.s b/src/math/i386/atanf.s
+index 8caddefa..893beac5 100644
+--- a/src/math/i386/atanf.s
++++ b/src/math/i386/atanf.s
+@@ -10,10 +10,7 @@ atanf:
+ fpatan
+ ret
+ # subnormal x, return x with underflow
+-1: fnstsw %ax
+- and $16,%ax
+- jnz 2f
+- fld %st(0)
++1: fld %st(0)
+ fmul %st(1)
+ fstps 4(%esp)
+-2: ret
++ ret
+diff --git a/src/math/i386/exp.s b/src/math/i386/exp.s
+index c7aa5b6e..df87c497 100644
+--- a/src/math/i386/exp.s
++++ b/src/math/i386/exp.s
+@@ -7,13 +7,10 @@ expm1f:
+ cmp $0x01000000,%eax
+ jae 1f
+ # subnormal x, return x with underflow
+- fnstsw %ax
+- and $16,%ax
+- jnz 2f
+ fld %st(0)
+ fmul %st(1)
+ fstps 4(%esp)
+-2: ret
++ ret
+
+ .global expm1l
+ .type expm1l,@function
+@@ -30,11 +27,8 @@ expm1:
+ cmp $0x00200000,%eax
+ jae 1f
+ # subnormal x, return x with underflow
+- fnstsw %ax
+- and $16,%ax
+- jnz 2f
+ fsts 4(%esp)
+-2: ret
++ ret
+ 1: fldl2e
+ fmulp
+ mov $0xc2820000,%eax
+diff --git a/src/math/i386/log1p.s b/src/math/i386/log1p.s
+index 6b6929c7..354f391a 100644
+--- a/src/math/i386/log1p.s
++++ b/src/math/i386/log1p.s
+@@ -16,9 +16,6 @@ log1p:
+ fyl2x
+ ret
+ # subnormal x, return x with underflow
+-2: fnstsw %ax
+- and $16,%ax
+- jnz 1f
+- fsts 4(%esp)
++2: fsts 4(%esp)
+ fstp %st(1)
+-1: ret
++ ret
+diff --git a/src/math/i386/log1pf.s b/src/math/i386/log1pf.s
+index c0bcd30f..4d3484cd 100644
+--- a/src/math/i386/log1pf.s
++++ b/src/math/i386/log1pf.s
+@@ -16,10 +16,7 @@ log1pf:
+ fyl2x
+ ret
+ # subnormal x, return x with underflow
+-2: fnstsw %ax
+- and $16,%ax
+- jnz 1f
+- fxch
++2: fxch
+ fmul %st(1)
+ fstps 4(%esp)
+-1: ret
++ ret
+--
+cgit v1.2.1
+
+From 6818c31c9bc4bbad5357f1de14bedf781e5b349e Mon Sep 17 00:00:00 2001
+From: Rich Felker <dalias@aerifal.cx>
+Date: Mon, 5 Aug 2019 19:57:07 -0400
+Subject: fix build regression in i386 asm for atan2, atan2f
+
+commit f3ed8bfe8a82af1870ddc8696ed4cc1d5aa6b441 inadvertently removed
+labels that were still needed.
+---
+ src/math/i386/atan2.s | 2 +-
+ src/math/i386/atan2f.s | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/math/i386/atan2.s b/src/math/i386/atan2.s
+index 1fa0524d..76b95f31 100644
+--- a/src/math/i386/atan2.s
++++ b/src/math/i386/atan2.s
+@@ -11,4 +11,4 @@ atan2:
+ jae 1f
+ # subnormal x, return x with underflow
+ fsts 4(%esp)
+- ret
++1: ret
+diff --git a/src/math/i386/atan2f.s b/src/math/i386/atan2f.s
+index 0b264726..c9408a90 100644
+--- a/src/math/i386/atan2f.s
++++ b/src/math/i386/atan2f.s
+@@ -13,4 +13,4 @@ atan2f:
+ fld %st(0)
+ fmul %st(1)
+ fstps 4(%esp)
+- ret
++1: ret
+--
+cgit v1.2.1
+
diff --git a/main/pango/APKBUILD b/main/pango/APKBUILD
index e5d1bb807e..7b1017cefb 100644
--- a/main/pango/APKBUILD
+++ b/main/pango/APKBUILD
@@ -1,7 +1,7 @@
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=pango
pkgver=1.42.4
-pkgrel=0
+pkgrel=1
pkgdesc="A library for layout and rendering of text"
url="http://www.pango.org/"
arch="all"
@@ -12,7 +12,14 @@ makedepends="$depends_dev cairo-dev expat-dev gobject-introspection-dev
fontconfig-dev freetype-dev glib-dev harfbuzz-dev libxft-dev fribidi-dev"
install="$pkgname.pre-deinstall"
triggers="$pkgname.trigger=/usr/lib/pango/*/modules"
-source="https://download.gnome.org/sources/$pkgname/${pkgver%.*}/$pkgname-$pkgver.tar.xz"
+subpackages="$pkgname-dev $pkgname-doc"
+source="https://download.gnome.org/sources/$pkgname/${pkgver%.*}/$pkgname-$pkgver.tar.xz
+ CVE-2019-1010238.patch
+ "
+
+# secfixes:
+# 1.42.4-r1:
+# - CVE-2019-1010238
build () {
cd "$srcdir"/$pkgname-$pkgver
@@ -31,4 +38,5 @@ package() {
make DESTDIR="$pkgdir" install
}
-sha512sums="993e97f647eba0c5ed90bcfcb8228bf67fa3f20b1f4331e4e40a30788d7c3ac55eee1209471bf21df125cb8fc6121acc8062a9da2f8a7d6cbe8e9ad13a9320dc pango-1.42.4.tar.xz"
+sha512sums="993e97f647eba0c5ed90bcfcb8228bf67fa3f20b1f4331e4e40a30788d7c3ac55eee1209471bf21df125cb8fc6121acc8062a9da2f8a7d6cbe8e9ad13a9320dc pango-1.42.4.tar.xz
+24f46b5d14dd589b0d5ca992169fb46a696d0251c63cf3c0210bfded534f4f35d20bcd158c4397d6ebe828ae995a5321daca4ecc634f0d5f38bc7f5ccf8f2fee CVE-2019-1010238.patch"
diff --git a/main/pango/CVE-2019-1010238.patch b/main/pango/CVE-2019-1010238.patch
new file mode 100644
index 0000000000..eaf0784c1b
--- /dev/null
+++ b/main/pango/CVE-2019-1010238.patch
@@ -0,0 +1,34 @@
+From 490f8979a260c16b1df055eab386345da18a2d54 Mon Sep 17 00:00:00 2001
+From: Matthias Clasen <mclasen@redhat.com>
+Date: Wed, 10 Jul 2019 20:26:23 -0400
+Subject: [PATCH] bidi: Be safer against bad input
+
+Don't run off the end of an array that we
+allocated to certain length.
+
+Closes: https://gitlab.gnome.org/GNOME/pango/issues/342
+---
+ pango/pango-bidi-type.c | 7 +++++--
+ 1 file changed, 5 insertions(+), 2 deletions(-)
+
+diff --git a/pango/pango-bidi-type.c b/pango/pango-bidi-type.c
+index 3e46b66c..5c02dbbb 100644
+--- a/pango/pango-bidi-type.c
++++ b/pango/pango-bidi-type.c
+@@ -181,8 +181,11 @@ pango_log2vis_get_embedding_levels (const gchar *text,
+ for (i = 0, p = text; p < text + length; p = g_utf8_next_char(p), i++)
+ {
+ gunichar ch = g_utf8_get_char (p);
+- FriBidiCharType char_type;
+- char_type = fribidi_get_bidi_type (ch);
++ FriBidiCharType char_type = fribidi_get_bidi_type (ch);
++
++ if (i == n_chars)
++ break;
++
+ bidi_types[i] = char_type;
+ ored_types |= char_type;
+ if (FRIBIDI_IS_STRONG (char_type))
+--
+2.21.0
+
diff --git a/main/patch/0001-Allow-input-files-to-be-missing-for-ed-style-patches.patch b/main/patch/0001-Allow-input-files-to-be-missing-for-ed-style-patches.patch
new file mode 100644
index 0000000000..b26651ab05
--- /dev/null
+++ b/main/patch/0001-Allow-input-files-to-be-missing-for-ed-style-patches.patch
@@ -0,0 +1,33 @@
+From b5a91a01e5d0897facdd0f49d64b76b0f02b43e1 Mon Sep 17 00:00:00 2001
+From: Andreas Gruenbacher <agruen@gnu.org>
+Date: Fri, 6 Apr 2018 11:34:51 +0200
+Subject: [PATCH] Allow input files to be missing for ed-style patches
+
+* src/pch.c (do_ed_script): Allow input files to be missing so that new
+files will be created as with non-ed-style patches.
+---
+ src/pch.c | 8 +++++---
+ 1 file changed, 5 insertions(+), 3 deletions(-)
+
+diff --git a/src/pch.c b/src/pch.c
+index bc6278c..0c5cc26 100644
+--- a/src/pch.c
++++ b/src/pch.c
+@@ -2394,9 +2394,11 @@ do_ed_script (char const *inname, char const *outname,
+
+ if (! dry_run && ! skip_rest_of_patch) {
+ int exclusive = *outname_needs_removal ? 0 : O_EXCL;
+- assert (! inerrno);
+- *outname_needs_removal = true;
+- copy_file (inname, outname, 0, exclusive, instat.st_mode, true);
++ if (inerrno != ENOENT)
++ {
++ *outname_needs_removal = true;
++ copy_file (inname, outname, 0, exclusive, instat.st_mode, true);
++ }
+ sprintf (buf, "%s %s%s", editor_program,
+ verbosity == VERBOSE ? "" : "- ",
+ outname);
+--
+2.22.0
+
diff --git a/main/patch/0002-Fix-arbitrary-command-execution-in-ed-style-patches-.patch b/main/patch/0002-Fix-arbitrary-command-execution-in-ed-style-patches-.patch
new file mode 100644
index 0000000000..6b65e2dd48
--- /dev/null
+++ b/main/patch/0002-Fix-arbitrary-command-execution-in-ed-style-patches-.patch
@@ -0,0 +1,211 @@
+From 123eaff0d5d1aebe128295959435b9ca5909c26d Mon Sep 17 00:00:00 2001
+From: Andreas Gruenbacher <agruen@gnu.org>
+Date: Fri, 6 Apr 2018 12:14:49 +0200
+Subject: [PATCH] Fix arbitrary command execution in ed-style patches
+ (CVE-2018-1000156)
+
+* src/pch.c (do_ed_script): Write ed script to a temporary file instead
+of piping it to ed: this will cause ed to abort on invalid commands
+instead of rejecting them and carrying on.
+* tests/ed-style: New test case.
+* tests/Makefile.am (TESTS): Add test case.
+---
+ src/pch.c | 91 ++++++++++++++++++++++++++++++++++-------------
+ tests/Makefile.am | 1 +
+ tests/ed-style | 41 +++++++++++++++++++++
+ 3 files changed, 108 insertions(+), 25 deletions(-)
+ create mode 100644 tests/ed-style
+
+diff --git a/src/pch.c b/src/pch.c
+index 0c5cc26..4fd5a05 100644
+--- a/src/pch.c
++++ b/src/pch.c
+@@ -33,6 +33,7 @@
+ # include <io.h>
+ #endif
+ #include <safe.h>
++#include <sys/wait.h>
+
+ #define INITHUNKMAX 125 /* initial dynamic allocation size */
+
+@@ -2389,24 +2390,28 @@ do_ed_script (char const *inname, char const *outname,
+ static char const editor_program[] = EDITOR_PROGRAM;
+
+ file_offset beginning_of_this_line;
+- FILE *pipefp = 0;
+ size_t chars_read;
++ FILE *tmpfp = 0;
++ char const *tmpname;
++ int tmpfd;
++ pid_t pid;
++
++ if (! dry_run && ! skip_rest_of_patch)
++ {
++ /* Write ed script to a temporary file. This causes ed to abort on
++ invalid commands such as when line numbers or ranges exceed the
++ number of available lines. When ed reads from a pipe, it rejects
++ invalid commands and treats the next line as a new command, which
++ can lead to arbitrary command execution. */
++
++ tmpfd = make_tempfile (&tmpname, 'e', NULL, O_RDWR | O_BINARY, 0);
++ if (tmpfd == -1)
++ pfatal ("Can't create temporary file %s", quotearg (tmpname));
++ tmpfp = fdopen (tmpfd, "w+b");
++ if (! tmpfp)
++ pfatal ("Can't open stream for file %s", quotearg (tmpname));
++ }
+
+- if (! dry_run && ! skip_rest_of_patch) {
+- int exclusive = *outname_needs_removal ? 0 : O_EXCL;
+- if (inerrno != ENOENT)
+- {
+- *outname_needs_removal = true;
+- copy_file (inname, outname, 0, exclusive, instat.st_mode, true);
+- }
+- sprintf (buf, "%s %s%s", editor_program,
+- verbosity == VERBOSE ? "" : "- ",
+- outname);
+- fflush (stdout);
+- pipefp = popen(buf, binary_transput ? "wb" : "w");
+- if (!pipefp)
+- pfatal ("Can't open pipe to %s", quotearg (buf));
+- }
+ for (;;) {
+ char ed_command_letter;
+ beginning_of_this_line = file_tell (pfp);
+@@ -2417,14 +2422,14 @@ do_ed_script (char const *inname, char const *outname,
+ }
+ ed_command_letter = get_ed_command_letter (buf);
+ if (ed_command_letter) {
+- if (pipefp)
+- if (! fwrite (buf, sizeof *buf, chars_read, pipefp))
++ if (tmpfp)
++ if (! fwrite (buf, sizeof *buf, chars_read, tmpfp))
+ write_fatal ();
+ if (ed_command_letter != 'd' && ed_command_letter != 's') {
+ p_pass_comments_through = true;
+ while ((chars_read = get_line ()) != 0) {
+- if (pipefp)
+- if (! fwrite (buf, sizeof *buf, chars_read, pipefp))
++ if (tmpfp)
++ if (! fwrite (buf, sizeof *buf, chars_read, tmpfp))
+ write_fatal ();
+ if (chars_read == 2 && strEQ (buf, ".\n"))
+ break;
+@@ -2437,13 +2442,49 @@ do_ed_script (char const *inname, char const *outname,
+ break;
+ }
+ }
+- if (!pipefp)
++ if (!tmpfp)
+ return;
+- if (fwrite ("w\nq\n", sizeof (char), (size_t) 4, pipefp) == 0
+- || fflush (pipefp) != 0)
++ if (fwrite ("w\nq\n", sizeof (char), (size_t) 4, tmpfp) == 0
++ || fflush (tmpfp) != 0)
+ write_fatal ();
+- if (pclose (pipefp) != 0)
+- fatal ("%s FAILED", editor_program);
++
++ if (lseek (tmpfd, 0, SEEK_SET) == -1)
++ pfatal ("Can't rewind to the beginning of file %s", quotearg (tmpname));
++
++ if (! dry_run && ! skip_rest_of_patch) {
++ int exclusive = *outname_needs_removal ? 0 : O_EXCL;
++ *outname_needs_removal = true;
++ if (inerrno != ENOENT)
++ {
++ *outname_needs_removal = true;
++ copy_file (inname, outname, 0, exclusive, instat.st_mode, true);
++ }
++ sprintf (buf, "%s %s%s", editor_program,
++ verbosity == VERBOSE ? "" : "- ",
++ outname);
++ fflush (stdout);
++
++ pid = fork();
++ if (pid == -1)
++ pfatal ("Can't fork");
++ else if (pid == 0)
++ {
++ dup2 (tmpfd, 0);
++ execl ("/bin/sh", "sh", "-c", buf, (char *) 0);
++ _exit (2);
++ }
++ else
++ {
++ int wstatus;
++ if (waitpid (pid, &wstatus, 0) == -1
++ || ! WIFEXITED (wstatus)
++ || WEXITSTATUS (wstatus) != 0)
++ fatal ("%s FAILED", editor_program);
++ }
++ }
++
++ fclose (tmpfp);
++ safe_unlink (tmpname);
+
+ if (ofp)
+ {
+diff --git a/tests/Makefile.am b/tests/Makefile.am
+index 6b6df63..16f8693 100644
+--- a/tests/Makefile.am
++++ b/tests/Makefile.am
+@@ -32,6 +32,7 @@ TESTS = \
+ crlf-handling \
+ dash-o-append \
+ deep-directories \
++ ed-style \
+ empty-files \
+ false-match \
+ fifo \
+diff --git a/tests/ed-style b/tests/ed-style
+new file mode 100644
+index 0000000..d8c0689
+--- /dev/null
++++ b/tests/ed-style
+@@ -0,0 +1,41 @@
++# Copyright (C) 2018 Free Software Foundation, Inc.
++#
++# Copying and distribution of this file, with or without modification,
++# in any medium, are permitted without royalty provided the copyright
++# notice and this notice are preserved.
++
++. $srcdir/test-lib.sh
++
++require cat
++use_local_patch
++use_tmpdir
++
++# ==============================================================
++
++cat > ed1.diff <<EOF
++0a
++foo
++.
++EOF
++
++check 'patch -e foo -i ed1.diff' <<EOF
++EOF
++
++check 'cat foo' <<EOF
++foo
++EOF
++
++cat > ed2.diff <<EOF
++1337a
++r !echo bar
++,p
++EOF
++
++check 'patch -e foo -i ed2.diff 2> /dev/null || echo "Status: $?"' <<EOF
++?
++Status: 2
++EOF
++
++check 'cat foo' <<EOF
++foo
++EOF
+--
+2.22.0
+
diff --git a/main/patch/APKBUILD b/main/patch/APKBUILD
index c39397a51d..0e02115e46 100644
--- a/main/patch/APKBUILD
+++ b/main/patch/APKBUILD
@@ -2,32 +2,44 @@
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=patch
pkgver=2.7.6
-pkgrel=4
+pkgrel=6
pkgdesc="Utility to apply diffs to files"
url="https://www.gnu.org/software/patch/patch.html"
arch="all"
-license="GPL-3.0+"
+license="GPL-3.0-or-later"
depends=""
-makedepends=""
+makedepends="autoconf automake"
# testsuite needs coreutils due to bug in busybox `cat -ve`
# http://lists.busybox.net/pipermail/busybox/2018-April/086401.html
checkdepends="coreutils bash ed"
-install=""
subpackages="$pkgname-doc"
source="ftp://ftp.gnu.org/gnu/$pkgname/$pkgname-$pkgver.tar.xz
CVE-2018-6951.patch
CVE-2018-6952.patch
+ 0001-Allow-input-files-to-be-missing-for-ed-style-patches.patch
+ 0002-Fix-arbitrary-command-execution-in-ed-style-patches-.patch
+ CVE-2019-13636.patch
+ CVE-2019-13638.patch
"
builddir="$srcdir"/$pkgname-$pkgver
# secfixes:
+# 2.7.6-r6:
+# - CVE-2018-1000156
+# - CVE-2019-13638
+# 2.7.6-r5:
+# - CVE-2019-13636
# 2.7.6-r2:
# - CVE-2018-6951
# 2.7.6-r4:
# - CVE-2018-6952
+prepare() {
+ default_prepare
+ aclocal && autoheader && autoconf && automake --add-missing
+}
+
build() {
- cd "$builddir"
gl_cv_func_gettimeofday_clobber=no \
gl_cv_func_tzset_clobber=no \
./configure \
@@ -36,13 +48,11 @@ build() {
--prefix=/usr \
--sysconfdir=/etc \
--mandir=/usr/share/man \
- --localstatedir=/var \
- --disable-nls
+ --localstatedir=/var
make
}
check() {
- cd "$builddir"
make SHELL=bash check
}
@@ -57,4 +67,8 @@ package() {
sha512sums="fcca87bdb67a88685a8a25597f9e015f5e60197b9a269fa350ae35a7991ed8da553939b4bbc7f7d3cfd863c67142af403b04165633acbce4339056a905e87fbd patch-2.7.6.tar.xz
db51d0b791d38dd4f1b373621ee18620ae339b172f58a79420fdaa4a4b1b1d9df239cf61bbddc4e6a4896b28b8cffc7c99161eb5e2facaec8df86a1bf7755bc0 CVE-2018-6951.patch
-5d2eaef629bae92e5b4e5e57d140c24a73e2811306d5f2854858f846646b034d2da315071f478bcf6f8d856a065b9bb073f76322e8e3a42616bc212281ce6945 CVE-2018-6952.patch"
+5d2eaef629bae92e5b4e5e57d140c24a73e2811306d5f2854858f846646b034d2da315071f478bcf6f8d856a065b9bb073f76322e8e3a42616bc212281ce6945 CVE-2018-6952.patch
+33e8a82f5ee6b896fd434e7de1ca9e16e8d317941a021bea8c53afd5bf210774e8727df22f8d8f63f255de10de5a26428047bc710b033423d1e7a459cbbaf83a 0001-Allow-input-files-to-be-missing-for-ed-style-patches.patch
+d0d46e28c5fdcd5fe16826cbcf39d5a74fdf2593375d5206aa7bad759f16dbebeca3bf259239f99c13344579044a3de1000d705065cc19e917266bca6e5c0630 0002-Fix-arbitrary-command-execution-in-ed-style-patches-.patch
+029b92bb899d0b1165cfe7f55b5a4c2d7090852f52e5c85a6bb1cf5913c914a5c68c6c34517e84f0a020a56d21814f8c18b934c8ebe059ba4eddece78a3a258c CVE-2019-13636.patch
+d60f8c2364fca9b73aa73b5914cfd6571d11528d13fa7703ccfa93730cbdf8a6e4c9ca04cb7d02a40d33c38075890790b490052d5217e728b0948991da937980 CVE-2019-13638.patch"
diff --git a/main/patch/CVE-2019-13636.patch b/main/patch/CVE-2019-13636.patch
new file mode 100644
index 0000000000..ea4a98d330
--- /dev/null
+++ b/main/patch/CVE-2019-13636.patch
@@ -0,0 +1,109 @@
+From dce4683cbbe107a95f1f0d45fabc304acfb5d71a Mon Sep 17 00:00:00 2001
+From: Andreas Gruenbacher <agruen@gnu.org>
+Date: Mon, 15 Jul 2019 16:21:48 +0200
+Subject: Don't follow symlinks unless --follow-symlinks is given
+
+* src/inp.c (plan_a, plan_b), src/util.c (copy_to_fd, copy_file,
+append_to_file): Unless the --follow-symlinks option is given, open files with
+the O_NOFOLLOW flag to avoid following symlinks. So far, we were only doing
+that consistently for input files.
+* src/util.c (create_backup): When creating empty backup files, (re)create them
+with O_CREAT | O_EXCL to avoid following symlinks in that case as well.
+---
+ src/inp.c | 12 ++++++++++--
+ src/util.c | 14 +++++++++++---
+ 2 files changed, 21 insertions(+), 5 deletions(-)
+
+diff --git a/src/inp.c b/src/inp.c
+index 32d0919..22d7473 100644
+--- a/src/inp.c
++++ b/src/inp.c
+@@ -238,8 +238,13 @@ plan_a (char const *filename)
+ {
+ if (S_ISREG (instat.st_mode))
+ {
+- int ifd = safe_open (filename, O_RDONLY|binary_transput, 0);
++ int flags = O_RDONLY | binary_transput;
+ size_t buffered = 0, n;
++ int ifd;
++
++ if (! follow_symlinks)
++ flags |= O_NOFOLLOW;
++ ifd = safe_open (filename, flags, 0);
+ if (ifd < 0)
+ pfatal ("can't open file %s", quotearg (filename));
+
+@@ -340,6 +345,7 @@ plan_a (char const *filename)
+ static void
+ plan_b (char const *filename)
+ {
++ int flags = O_RDONLY | binary_transput;
+ int ifd;
+ FILE *ifp;
+ int c;
+@@ -353,7 +359,9 @@ plan_b (char const *filename)
+
+ if (instat.st_size == 0)
+ filename = NULL_DEVICE;
+- if ((ifd = safe_open (filename, O_RDONLY | binary_transput, 0)) < 0
++ if (! follow_symlinks)
++ flags |= O_NOFOLLOW;
++ if ((ifd = safe_open (filename, flags, 0)) < 0
+ || ! (ifp = fdopen (ifd, binary_transput ? "rb" : "r")))
+ pfatal ("Can't open file %s", quotearg (filename));
+ if (TMPINNAME_needs_removal)
+diff --git a/src/util.c b/src/util.c
+index 1cc08ba..fb38307 100644
+--- a/src/util.c
++++ b/src/util.c
+@@ -388,7 +388,7 @@ create_backup (char const *to, const struct stat *to_st, bool leave_original)
+
+ try_makedirs_errno = ENOENT;
+ safe_unlink (bakname);
+- while ((fd = safe_open (bakname, O_CREAT | O_WRONLY | O_TRUNC, 0666)) < 0)
++ while ((fd = safe_open (bakname, O_CREAT | O_EXCL | O_WRONLY | O_TRUNC, 0666)) < 0)
+ {
+ if (errno != try_makedirs_errno)
+ pfatal ("Can't create file %s", quotearg (bakname));
+@@ -579,10 +579,13 @@ create_file (char const *file, int open_flags, mode_t mode,
+ static void
+ copy_to_fd (const char *from, int tofd)
+ {
++ int from_flags = O_RDONLY | O_BINARY;
+ int fromfd;
+ ssize_t i;
+
+- if ((fromfd = safe_open (from, O_RDONLY | O_BINARY, 0)) < 0)
++ if (! follow_symlinks)
++ from_flags |= O_NOFOLLOW;
++ if ((fromfd = safe_open (from, from_flags, 0)) < 0)
+ pfatal ("Can't reopen file %s", quotearg (from));
+ while ((i = read (fromfd, buf, bufsize)) != 0)
+ {
+@@ -625,6 +628,8 @@ copy_file (char const *from, char const *to, struct stat *tost,
+ else
+ {
+ assert (S_ISREG (mode));
++ if (! follow_symlinks)
++ to_flags |= O_NOFOLLOW;
+ tofd = create_file (to, O_WRONLY | O_BINARY | to_flags, mode,
+ to_dir_known_to_exist);
+ copy_to_fd (from, tofd);
+@@ -640,9 +645,12 @@ copy_file (char const *from, char const *to, struct stat *tost,
+ void
+ append_to_file (char const *from, char const *to)
+ {
++ int to_flags = O_WRONLY | O_APPEND | O_BINARY;
+ int tofd;
+
+- if ((tofd = safe_open (to, O_WRONLY | O_BINARY | O_APPEND, 0)) < 0)
++ if (! follow_symlinks)
++ to_flags |= O_NOFOLLOW;
++ if ((tofd = safe_open (to, to_flags, 0)) < 0)
+ pfatal ("Can't reopen file %s", quotearg (to));
+ copy_to_fd (from, tofd);
+ if (close (tofd) != 0)
+--
+cgit v1.0-41-gc330
+
+
diff --git a/main/patch/CVE-2019-13638.patch b/main/patch/CVE-2019-13638.patch
new file mode 100644
index 0000000000..38caff628a
--- /dev/null
+++ b/main/patch/CVE-2019-13638.patch
@@ -0,0 +1,38 @@
+From 3fcd042d26d70856e826a42b5f93dc4854d80bf0 Mon Sep 17 00:00:00 2001
+From: Andreas Gruenbacher <agruen@gnu.org>
+Date: Fri, 6 Apr 2018 19:36:15 +0200
+Subject: Invoke ed directly instead of using the shell
+
+* src/pch.c (do_ed_script): Invoke ed directly instead of using a shell
+command to avoid quoting vulnerabilities.
+---
+ src/pch.c | 6 ++----
+ 1 file changed, 2 insertions(+), 4 deletions(-)
+
+diff --git a/src/pch.c b/src/pch.c
+index 4fd5a05..16e001a 100644
+--- a/src/pch.c
++++ b/src/pch.c
+@@ -2459,9 +2459,6 @@ do_ed_script (char const *inname, char const *outname,
+ *outname_needs_removal = true;
+ copy_file (inname, outname, 0, exclusive, instat.st_mode, true);
+ }
+- sprintf (buf, "%s %s%s", editor_program,
+- verbosity == VERBOSE ? "" : "- ",
+- outname);
+ fflush (stdout);
+
+ pid = fork();
+@@ -2470,7 +2467,8 @@ do_ed_script (char const *inname, char const *outname,
+ else if (pid == 0)
+ {
+ dup2 (tmpfd, 0);
+- execl ("/bin/sh", "sh", "-c", buf, (char *) 0);
++ assert (outname[0] != '!' && outname[0] != '-');
++ execlp (editor_program, editor_program, "-", outname, (char *) NULL);
+ _exit (2);
+ }
+ else
+--
+cgit v1.0-41-gc330
+
diff --git a/main/polkit/APKBUILD b/main/polkit/APKBUILD
index 203081a6b2..deda49749f 100644
--- a/main/polkit/APKBUILD
+++ b/main/polkit/APKBUILD
@@ -2,7 +2,7 @@
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=polkit
pkgver=0.105
-pkgrel=9
+pkgrel=10
pkgdesc="Application development toolkit for controlling system-wide privileges"
url="http://www.freedesktop.org/wiki/Software/polkit/"
arch="all"
@@ -29,6 +29,8 @@ source="https://www.freedesktop.org/software/polkit/releases/polkit-$pkgver.tar.
"
# secfixes:
+# 0.105-r10:
+# - CVE-2019-6133
# 0.105-r9:
# - CVE-2018-19788
diff --git a/main/polkit/CVE-2019-6133.patch b/main/polkit/CVE-2019-6133.patch
new file mode 100644
index 0000000000..9cdf220624
--- /dev/null
+++ b/main/polkit/CVE-2019-6133.patch
@@ -0,0 +1,159 @@
+diff --git a/src/polkit/polkitsubject.c b/src/polkit/polkitsubject.c
+index d2c4c20..3d86022 100644
+--- a/src/polkit/polkitsubject.c
++++ b/src/polkit/polkitsubject.c
+@@ -97,6 +97,8 @@ polkit_subject_hash (PolkitSubject *subject)
+ * @b: A #PolkitSubject.
+ *
+ * Checks if @a and @b are equal, ie. represent the same subject.
++ * However, avoid calling polkit_subject_equal() to compare two processes;
++ * for more information see the `PolkitUnixProcess` documentation.
+ *
+ * This function can be used in e.g. g_hash_table_new().
+ *
+diff --git a/src/polkit/polkitunixprocess.c b/src/polkit/polkitunixprocess.c
+index 913be3a..ceaf145 100644
+--- a/src/polkit/polkitunixprocess.c
++++ b/src/polkit/polkitunixprocess.c
+@@ -44,13 +44,82 @@
+ * @title: PolkitUnixProcess
+ * @short_description: Unix processs
+ *
+- * An object for representing a UNIX process.
++ * An object for representing a UNIX process. NOTE: This object as
++ * designed is now known broken; a mechanism to exploit a delay in
++ * start time in the Linux kernel was identified. Avoid
++ * calling polkit_subject_equal() to compare two processes.
+ *
+ * To uniquely identify processes, both the process id and the start
+ * time of the process (a monotonic increasing value representing the
+ * time since the kernel was started) is used.
+ */
+
++/* See https://gitlab.freedesktop.org/polkit/polkit/issues/75
++
++ But quoting the original email in full here to ensure it's preserved:
++
++ From: Jann Horn <jannh@google.com>
++ Subject: [SECURITY] polkit: temporary auth hijacking via PID reuse and non-atomic fork
++ Date: Wednesday, October 10, 2018 5:34 PM
++
++When a (non-root) user attempts to e.g. control systemd units in the system
++instance from an active session over DBus, the access is gated by a polkit
++policy that requires "auth_admin_keep" auth. This results in an auth prompt
++being shown to the user, asking the user to confirm the action by entering the
++password of an administrator account.
++
++After the action has been confirmed, the auth decision for "auth_admin_keep" is
++cached for up to five minutes. Subject to some restrictions, similar actions can
++then be performed in this timespan without requiring re-auth:
++
++ - The PID of the DBus client requesting the new action must match the PID of
++ the DBus client requesting the old action (based on SO_PEERCRED information
++ forwarded by the DBus daemon).
++ - The "start time" of the client's PID (as seen in /proc/$pid/stat, field 22)
++ must not have changed. The granularity of this timestamp is in the
++ millisecond range.
++ - polkit polls every two seconds whether a process with the expected start time
++ still exists. If not, the temporary auth entry is purged.
++
++Without the start time check, this would obviously be buggy because an attacker
++could simply wait for the legitimate client to disappear, then create a new
++client with the same PID.
++
++Unfortunately, the start time check is bypassable because fork() is not atomic.
++Looking at the source code of copy_process() in the kernel:
++
++ p->start_time = ktime_get_ns();
++ p->real_start_time = ktime_get_boot_ns();
++ [...]
++ retval = copy_thread_tls(clone_flags, stack_start, stack_size, p, tls);
++ if (retval)
++ goto bad_fork_cleanup_io;
++
++ if (pid != &init_struct_pid) {
++ pid = alloc_pid(p->nsproxy->pid_ns_for_children);
++ if (IS_ERR(pid)) {
++ retval = PTR_ERR(pid);
++ goto bad_fork_cleanup_thread;
++ }
++ }
++
++The ktime_get_boot_ns() call is where the "start time" of the process is
++recorded. The alloc_pid() call is where a free PID is allocated. In between
++these, some time passes; and because the copy_thread_tls() call between them can
++access userspace memory when sys_clone() is invoked through the 32-bit syscall
++entry point, an attacker can even stall the kernel arbitrarily long at this
++point (by supplying a pointer into userspace memory that is associated with a
++userfaultfd or is backed by a custom FUSE filesystem).
++
++This means that an attacker can immediately call sys_clone() when the victim
++process is created, often resulting in a process that has the exact same start
++time reported in procfs; and then the attacker can delay the alloc_pid() call
++until after the victim process has died and the PID assignment has cycled
++around. This results in an attacker process that polkit can't distinguish from
++the victim process.
++*/
++
++
+ /**
+ * PolkitUnixProcess:
+ *
+diff --git a/src/polkitbackend/polkitbackendinteractiveauthority.c b/src/polkitbackend/polkitbackendinteractiveauthority.c
+index b237e9d..e2200ef 100644
+--- a/src/polkitbackend/polkitbackendinteractiveauthority.c
++++ b/src/polkitbackend/polkitbackendinteractiveauthority.c
+@@ -2755,6 +2755,43 @@ temporary_authorization_store_free (TemporaryAuthorizationStore *store)
+ g_free (store);
+ }
+
++/* See the comment at the top of polkitunixprocess.c */
++static gboolean
++subject_equal_for_authz (PolkitSubject *a,
++ PolkitSubject *b)
++{
++ if (!polkit_subject_equal (a, b))
++ return FALSE;
++
++ /* Now special case unix processes, as we want to protect against
++ * pid reuse by including the UID.
++ */
++ if (POLKIT_IS_UNIX_PROCESS (a) && POLKIT_IS_UNIX_PROCESS (b)) {
++ PolkitUnixProcess *ap = (PolkitUnixProcess*)a;
++ int uid_a = polkit_unix_process_get_uid ((PolkitUnixProcess*)a);
++ PolkitUnixProcess *bp = (PolkitUnixProcess*)b;
++ int uid_b = polkit_unix_process_get_uid ((PolkitUnixProcess*)b);
++
++ if (uid_a != -1 && uid_b != -1)
++ {
++ if (uid_a == uid_b)
++ {
++ return TRUE;
++ }
++ else
++ {
++ g_printerr ("denying slowfork; pid %d uid %d != %d!\n",
++ polkit_unix_process_get_pid (ap),
++ uid_a, uid_b);
++ return FALSE;
++ }
++ }
++ /* Fall through; one of the uids is unset so we can't reliably compare */
++ }
++
++ return TRUE;
++}
++
+ static gboolean
+ temporary_authorization_store_has_authorization (TemporaryAuthorizationStore *store,
+ PolkitSubject *subject,
+@@ -2797,7 +2834,7 @@ temporary_authorization_store_has_authorization (TemporaryAuthorizationStore *st
+ TemporaryAuthorization *authorization = l->data;
+
+ if (strcmp (action_id, authorization->action_id) == 0 &&
+- polkit_subject_equal (subject_to_use, authorization->subject))
++ subject_equal_for_authz (subject_to_use, authorization->subject))
+ {
+ ret = TRUE;
+ if (out_tmp_authz_id != NULL)
+
diff --git a/main/postgresql/APKBUILD b/main/postgresql/APKBUILD
index c8d5e044f5..38327e8b0a 100644
--- a/main/postgresql/APKBUILD
+++ b/main/postgresql/APKBUILD
@@ -2,7 +2,7 @@
# Contributor: G.J.R. Timmer <gjr.timmer@gmail.com>
# Contributor: Jakub Jirutka <jakub@jirutka.cz>
pkgname=postgresql
-pkgver=11.4
+pkgver=11.5
pkgrel=0
pkgdesc="A sophisticated object-relational DBMS"
url="https://www.postgresql.org/"
@@ -36,6 +36,9 @@ builddir="$srcdir/$pkgname-$pkgver"
options="!checkroot"
# secfixes:
+# 11.5-r0:
+# - CVE-2019-10208
+# - CVE-2019-10209
# 11.4-r0:
# - CVE-2019-10164
# 11.3-r0:
@@ -304,7 +307,7 @@ _submv() {
done
}
-sha512sums="159fb84134e05ddc58e40a879ca52ed4d58ced7bcd1e7310d59bda84f9055339a31a92cfaab2c063a88685f7417b9a828534394bf9a2477fc33d1fb6cd26186b postgresql-11.4.tar.bz2
+sha512sums="537148079dc6c33cfb9bf9722171e524707b42ef01369deb968d0d6e8fa9b7f16f6ce67139d9dc45fb7385defbf56aa2c0affe5ee9d76e996f31e47486192141 postgresql-11.5.tar.bz2
1f8e7dc58f5b0a12427cf2fd904ffa898a34f23f3332c8382b94e0d991c007289e7913a69e04498f3d93fc5701855796c207b4b1cc4a0b366f586050124d7fcc initdb.patch
5f9d8bb4957194069d01af8ab3abc6d4d83a7e7f8bd7ebe1caae5361d621a3e58f91b14b952958138a794e0a80bc154fbb7e3e78d211e2a95b9b7901335de854 perl-rpath.patch
8439a6fdfdea0a4867daeb8bc23d6c825f30c00d91d4c39f48653f5ee77341f23282ce03a77aad94b5369700f11d2cb28d5aee360e59138352a9ab331a9f9d0f conf-unix_socket_directories.patch
diff --git a/main/py-django/APKBUILD b/main/py-django/APKBUILD
index b41f208a87..aa686a8e73 100644
--- a/main/py-django/APKBUILD
+++ b/main/py-django/APKBUILD
@@ -2,7 +2,7 @@
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=py-django
_pkgname=Django
-pkgver=1.11.21
+pkgver=1.11.23
pkgrel=0
pkgdesc="A high-level Python Web framework"
url="http://djangoproject.com/"
@@ -16,6 +16,13 @@ source="https://files.pythonhosted.org/packages/source/${_pkgname:0:1}/$_pkgname
builddir="$srcdir"/$_pkgname-$pkgver
# secfixes:
+# 1.11.23-r0:
+# - CVE-2019-14232
+# - CVE-2019-14233
+# - CVE-2019-14234
+# - CVE-2019-14235
+# 1.11.22-r0:
+# - CVE-2019-12781
# 1.8.16-r0:
# - CVE-2016-9013
# - CVE-2016-9014
@@ -86,4 +93,4 @@ _py() {
done
}
-sha512sums="c91a1189b6b8fbbb1470f870b09c1c553e860d3b8c0977240399524a830d5403929f14b4e4b689354080748aab1c70587ad56e265f4ac0b3bdc2714d01adbbc4 Django-1.11.21.tar.gz"
+sha512sums="c4c5d82e4ecf1a100637ac32eafd3fb0d7690ba5c0cb884846f31c434c0cb1282d94149e031c577d676570f3b331c2a320d58f34f40ac02deae089c4b61c65ea Django-1.11.23.tar.gz"
diff --git a/main/redis/APKBUILD b/main/redis/APKBUILD
index af1ab9091e..fe91675d15 100644
--- a/main/redis/APKBUILD
+++ b/main/redis/APKBUILD
@@ -1,7 +1,7 @@
# Contributor: V.Krishn <vkrishn4@gmail.com>
# Maintainer: TBK <alpine@jjtc.eu>
pkgname=redis
-pkgver=4.0.12
+pkgver=4.0.14
pkgrel=0
pkgdesc="Advanced key-value store"
url="https://redis.io/"
@@ -24,6 +24,11 @@ source="http://download.redis.io/releases/$pkgname-$pkgver.tar.gz
"
builddir="$srcdir/$pkgname-$pkgver"
+# secfixes:
+# 4.0.14-r0:
+# - CVE-2019-10192
+# - CVE-2019-10193
+
prepare() {
default_prepare
cd "$builddir"
@@ -73,7 +78,7 @@ package() {
var/log/redis
}
-sha512sums="d19020f7ebed9ad5d04c6e1cb7e2a49dd1e226fe17d86e860df11bcb798c61c09f6f9fc3572a7ee32232ac34ec5eb1d6189f8139b5991bd87297c5243c3b54d2 redis-4.0.12.tar.gz
+sha512sums="7730a4083962046f8fee674a8ce95e1d3e8c8dcc2d64a65491dc3b851413b2d745942be7a94ee77074aa530da5f3d458c4e7388d7950a8495d8ee9f4862b7e06 redis-4.0.14.tar.gz
5fd8a478771642b9c0dc285f1d95896f7680b94c7edab0ce60ad19ba0c2979028c7d9b0afb846dbf3e1be146ec5ded52ebb059a5b25b0a8e52bf8e57f18c0cf4 makefile-dont-duplicate-binary.patch
c8a35e3c30be99fef8678acb2502f424bcca478dcc1ef1750f8c8c8e9e9c462f97586159f32ebba84b6a4eb398a9d568e3200241fb0de1f96293c9fdaafb06c9 redis.conf.patch
d9bbb3fcc69022633d7fea3227c41d8777422ce9778623efb6aa539468fc51d2d1de09d364e21c7c8b45c61e7bbc7aaaf22745257d60ea937f77a8673facf286 sentinel.conf.patch
diff --git a/main/sdl/0001-CVE-2019-7572.patch b/main/sdl/0001-CVE-2019-7572.patch
new file mode 100644
index 0000000000..2c17831dfc
--- /dev/null
+++ b/main/sdl/0001-CVE-2019-7572.patch
@@ -0,0 +1,64 @@
+From 6086741bda4d43cc227500bc7645a829380e6326 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
+Date: Fri, 15 Feb 2019 09:21:45 +0100
+Subject: [PATCH] CVE-2019-7572: Fix a buffer overwrite in IMA_ADPCM_decode
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+If data chunk was longer than expected based on a WAV format
+definition, IMA_ADPCM_decode() tried to write past the output
+buffer. This patch fixes it.
+
+Based on patch from
+<https://bugzilla.libsdl.org/show_bug.cgi?id=4496>.
+
+CVE-2019-7572
+https://bugzilla.libsdl.org/show_bug.cgi?id=4495
+
+Signed-off-by: Petr Písař <ppisar@redhat.com>
+---
+ src/audio/SDL_wave.c | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/src/audio/SDL_wave.c b/src/audio/SDL_wave.c
+index 69d62dc..91e89e8 100644
+--- a/src/audio/SDL_wave.c
++++ b/src/audio/SDL_wave.c
+@@ -336,7 +336,7 @@ static void Fill_IMA_ADPCM_block(Uint8 *decoded, Uint8 *encoded,
+ static int IMA_ADPCM_decode(Uint8 **audio_buf, Uint32 *audio_len)
+ {
+ struct IMA_ADPCM_decodestate *state;
+- Uint8 *freeable, *encoded, *encoded_end, *decoded;
++ Uint8 *freeable, *encoded, *encoded_end, *decoded, *decoded_end;
+ Sint32 encoded_len, samplesleft;
+ unsigned int c, channels;
+
+@@ -363,6 +363,7 @@ static int IMA_ADPCM_decode(Uint8 **audio_buf, Uint32 *audio_len)
+ return(-1);
+ }
+ decoded = *audio_buf;
++ decoded_end = decoded + *audio_len;
+
+ /* Get ready... Go! */
+ while ( encoded_len >= IMA_ADPCM_state.wavefmt.blockalign ) {
+@@ -382,6 +383,7 @@ static int IMA_ADPCM_decode(Uint8 **audio_buf, Uint32 *audio_len)
+ }
+
+ /* Store the initial sample we start with */
++ if (decoded + 2 > decoded_end) goto invalid_size;
+ decoded[0] = (Uint8)(state[c].sample&0xFF);
+ decoded[1] = (Uint8)(state[c].sample>>8);
+ decoded += 2;
+@@ -392,6 +394,8 @@ static int IMA_ADPCM_decode(Uint8 **audio_buf, Uint32 *audio_len)
+ while ( samplesleft > 0 ) {
+ for ( c=0; c<channels; ++c ) {
+ if (encoded + 4 > encoded_end) goto invalid_size;
++ if (decoded + 4 * 4 * channels > decoded_end)
++ goto invalid_size;
+ Fill_IMA_ADPCM_block(decoded, encoded,
+ c, channels, &state[c]);
+ encoded += 4;
+--
+2.20.1
+
diff --git a/main/sdl/0001-CVE-2019-7573.patch b/main/sdl/0001-CVE-2019-7573.patch
new file mode 100644
index 0000000000..767a3b2074
--- /dev/null
+++ b/main/sdl/0001-CVE-2019-7573.patch
@@ -0,0 +1,83 @@
+From 3e2c89e516701f3586dfeadec13932f665371d2a Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
+Date: Fri, 15 Feb 2019 10:36:13 +0100
+Subject: [PATCH] CVE-2019-7573, CVE-2019-7576: Fix buffer overreads in
+ InitMS_ADPCM
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+If MS ADPCM format chunk was too short, InitMS_ADPCM() parsing it
+could read past the end of chunk data. This patch fixes it.
+
+CVE-2019-7573
+https://bugzilla.libsdl.org/show_bug.cgi?id=4491
+CVE-2019-7576
+https://bugzilla.libsdl.org/show_bug.cgi?id=4490
+
+Signed-off-by: Petr Písař <ppisar@redhat.com>
+---
+ src/audio/SDL_wave.c | 13 ++++++++++---
+ 1 file changed, 10 insertions(+), 3 deletions(-)
+
+diff --git a/src/audio/SDL_wave.c b/src/audio/SDL_wave.c
+index 91e89e8..1d446ed 100644
+--- a/src/audio/SDL_wave.c
++++ b/src/audio/SDL_wave.c
+@@ -44,12 +44,13 @@ static struct MS_ADPCM_decoder {
+ struct MS_ADPCM_decodestate state[2];
+ } MS_ADPCM_state;
+
+-static int InitMS_ADPCM(WaveFMT *format)
++static int InitMS_ADPCM(WaveFMT *format, int length)
+ {
+- Uint8 *rogue_feel;
++ Uint8 *rogue_feel, *rogue_feel_end;
+ int i;
+
+ /* Set the rogue pointer to the MS_ADPCM specific data */
++ if (length < sizeof(*format)) goto too_short;
+ MS_ADPCM_state.wavefmt.encoding = SDL_SwapLE16(format->encoding);
+ MS_ADPCM_state.wavefmt.channels = SDL_SwapLE16(format->channels);
+ MS_ADPCM_state.wavefmt.frequency = SDL_SwapLE32(format->frequency);
+@@ -58,9 +59,11 @@ static int InitMS_ADPCM(WaveFMT *format)
+ MS_ADPCM_state.wavefmt.bitspersample =
+ SDL_SwapLE16(format->bitspersample);
+ rogue_feel = (Uint8 *)format+sizeof(*format);
++ rogue_feel_end = (Uint8 *)format + length;
+ if ( sizeof(*format) == 16 ) {
+ rogue_feel += sizeof(Uint16);
+ }
++ if (rogue_feel + 4 > rogue_feel_end) goto too_short;
+ MS_ADPCM_state.wSamplesPerBlock = ((rogue_feel[1]<<8)|rogue_feel[0]);
+ rogue_feel += sizeof(Uint16);
+ MS_ADPCM_state.wNumCoef = ((rogue_feel[1]<<8)|rogue_feel[0]);
+@@ -70,12 +73,16 @@ static int InitMS_ADPCM(WaveFMT *format)
+ return(-1);
+ }
+ for ( i=0; i<MS_ADPCM_state.wNumCoef; ++i ) {
++ if (rogue_feel + 4 > rogue_feel_end) goto too_short;
+ MS_ADPCM_state.aCoeff[i][0] = ((rogue_feel[1]<<8)|rogue_feel[0]);
+ rogue_feel += sizeof(Uint16);
+ MS_ADPCM_state.aCoeff[i][1] = ((rogue_feel[1]<<8)|rogue_feel[0]);
+ rogue_feel += sizeof(Uint16);
+ }
+ return(0);
++too_short:
++ SDL_SetError("Unexpected length of a chunk with a MS ADPCM format");
++ return(-1);
+ }
+
+ static Sint32 MS_ADPCM_nibble(struct MS_ADPCM_decodestate *state,
+@@ -485,7 +492,7 @@ SDL_AudioSpec * SDL_LoadWAV_RW (SDL_RWops *src, int freesrc,
+ break;
+ case MS_ADPCM_CODE:
+ /* Try to understand this */
+- if ( InitMS_ADPCM(format) < 0 ) {
++ if ( InitMS_ADPCM(format, lenread) < 0 ) {
+ was_error = 1;
+ goto done;
+ }
+--
+2.20.1
+
diff --git a/main/sdl/0001-CVE-2019-7574.patch b/main/sdl/0001-CVE-2019-7574.patch
new file mode 100644
index 0000000000..0bae80ff87
--- /dev/null
+++ b/main/sdl/0001-CVE-2019-7574.patch
@@ -0,0 +1,71 @@
+From 9b2eee24768889378032077423cb6a3221a8ad18 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
+Date: Thu, 14 Feb 2019 15:41:47 +0100
+Subject: [PATCH] CVE-2019-7574: Fix a buffer overread in IMA_ADPCM_decode
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+If data chunk was shorter than expected based on a WAV format
+definition, IMA_ADPCM_decode() tried to read past the data chunk
+buffer. This patch fixes it.
+
+CVE-2019-7574
+https://bugzilla.libsdl.org/show_bug.cgi?id=4496
+
+Signed-off-by: Petr Písař <ppisar@redhat.com>
+---
+ src/audio/SDL_wave.c | 9 ++++++++-
+ 1 file changed, 8 insertions(+), 1 deletion(-)
+
+diff --git a/src/audio/SDL_wave.c b/src/audio/SDL_wave.c
+index b6c49de..2968b3d 100644
+--- a/src/audio/SDL_wave.c
++++ b/src/audio/SDL_wave.c
+@@ -334,7 +334,7 @@ static void Fill_IMA_ADPCM_block(Uint8 *decoded, Uint8 *encoded,
+ static int IMA_ADPCM_decode(Uint8 **audio_buf, Uint32 *audio_len)
+ {
+ struct IMA_ADPCM_decodestate *state;
+- Uint8 *freeable, *encoded, *decoded;
++ Uint8 *freeable, *encoded, *encoded_end, *decoded;
+ Sint32 encoded_len, samplesleft;
+ unsigned int c, channels;
+
+@@ -350,6 +350,7 @@ static int IMA_ADPCM_decode(Uint8 **audio_buf, Uint32 *audio_len)
+ /* Allocate the proper sized output buffer */
+ encoded_len = *audio_len;
+ encoded = *audio_buf;
++ encoded_end = encoded + encoded_len;
+ freeable = *audio_buf;
+ *audio_len = (encoded_len/IMA_ADPCM_state.wavefmt.blockalign) *
+ IMA_ADPCM_state.wSamplesPerBlock*
+@@ -365,6 +366,7 @@ static int IMA_ADPCM_decode(Uint8 **audio_buf, Uint32 *audio_len)
+ while ( encoded_len >= IMA_ADPCM_state.wavefmt.blockalign ) {
+ /* Grab the initial information for this block */
+ for ( c=0; c<channels; ++c ) {
++ if (encoded + 4 > encoded_end) goto invalid_size;
+ /* Fill the state information for this block */
+ state[c].sample = ((encoded[1]<<8)|encoded[0]);
+ encoded += 2;
+@@ -387,6 +389,7 @@ static int IMA_ADPCM_decode(Uint8 **audio_buf, Uint32 *audio_len)
+ samplesleft = (IMA_ADPCM_state.wSamplesPerBlock-1)*channels;
+ while ( samplesleft > 0 ) {
+ for ( c=0; c<channels; ++c ) {
++ if (encoded + 4 > encoded_end) goto invalid_size;
+ Fill_IMA_ADPCM_block(decoded, encoded,
+ c, channels, &state[c]);
+ encoded += 4;
+@@ -398,6 +401,10 @@ static int IMA_ADPCM_decode(Uint8 **audio_buf, Uint32 *audio_len)
+ }
+ SDL_free(freeable);
+ return(0);
++invalid_size:
++ SDL_SetError("Unexpected chunk length for an IMA ADPCM decoder");
++ SDL_free(freeable);
++ return(-1);
+ }
+
+ SDL_AudioSpec * SDL_LoadWAV_RW (SDL_RWops *src, int freesrc,
+--
+2.20.1
+
diff --git a/main/sdl/0001-CVE-2019-7575.patch b/main/sdl/0001-CVE-2019-7575.patch
new file mode 100644
index 0000000000..53965aa2f2
--- /dev/null
+++ b/main/sdl/0001-CVE-2019-7575.patch
@@ -0,0 +1,84 @@
+From e1f80cadb079e35103e6eebf160a818815c823df Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
+Date: Thu, 14 Feb 2019 14:51:52 +0100
+Subject: [PATCH] CVE-2019-7575: Fix a buffer overwrite in MS_ADPCM_decode
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+If a WAV format defines shorter audio stream and decoded MS ADPCM data chunk
+is longer, decoding continued past the output audio buffer.
+
+This fix is based on a patch from
+<https://bugzilla.libsdl.org/show_bug.cgi?id=4492>.
+
+https://bugzilla.libsdl.org/show_bug.cgi?id=4493
+CVE-2019-7575
+
+Signed-off-by: Petr Písař <ppisar@redhat.com>
+---
+ src/audio/SDL_wave.c | 13 ++++++++-----
+ 1 file changed, 8 insertions(+), 5 deletions(-)
+
+diff --git a/src/audio/SDL_wave.c b/src/audio/SDL_wave.c
+index e42d01c..b6c49de 100644
+--- a/src/audio/SDL_wave.c
++++ b/src/audio/SDL_wave.c
+@@ -115,7 +115,7 @@ static Sint32 MS_ADPCM_nibble(struct MS_ADPCM_decodestate *state,
+ static int MS_ADPCM_decode(Uint8 **audio_buf, Uint32 *audio_len)
+ {
+ struct MS_ADPCM_decodestate *state[2];
+- Uint8 *freeable, *encoded, *encoded_end, *decoded;
++ Uint8 *freeable, *encoded, *encoded_end, *decoded, *decoded_end;
+ Sint32 encoded_len, samplesleft;
+ Sint8 nybble, stereo;
+ Sint16 *coeff[2];
+@@ -135,6 +135,7 @@ static int MS_ADPCM_decode(Uint8 **audio_buf, Uint32 *audio_len)
+ return(-1);
+ }
+ decoded = *audio_buf;
++ decoded_end = decoded + *audio_len;
+
+ /* Get ready... Go! */
+ stereo = (MS_ADPCM_state.wavefmt.channels == 2);
+@@ -142,7 +143,7 @@ static int MS_ADPCM_decode(Uint8 **audio_buf, Uint32 *audio_len)
+ state[1] = &MS_ADPCM_state.state[stereo];
+ while ( encoded_len >= MS_ADPCM_state.wavefmt.blockalign ) {
+ /* Grab the initial information for this block */
+- if (encoded + 7 + (stereo ? 7 : 0) > encoded_end) goto too_short;
++ if (encoded + 7 + (stereo ? 7 : 0) > encoded_end) goto invalid_size;
+ state[0]->hPredictor = *encoded++;
+ if ( stereo ) {
+ state[1]->hPredictor = *encoded++;
+@@ -169,6 +170,7 @@ static int MS_ADPCM_decode(Uint8 **audio_buf, Uint32 *audio_len)
+ coeff[1] = MS_ADPCM_state.aCoeff[state[1]->hPredictor];
+
+ /* Store the two initial samples we start with */
++ if (decoded + 4 + (stereo ? 4 : 0) > decoded_end) goto invalid_size;
+ decoded[0] = state[0]->iSamp2&0xFF;
+ decoded[1] = state[0]->iSamp2>>8;
+ decoded += 2;
+@@ -190,7 +192,8 @@ static int MS_ADPCM_decode(Uint8 **audio_buf, Uint32 *audio_len)
+ samplesleft = (MS_ADPCM_state.wSamplesPerBlock-2)*
+ MS_ADPCM_state.wavefmt.channels;
+ while ( samplesleft > 0 ) {
+- if (encoded + 1 > encoded_end) goto too_short;
++ if (encoded + 1 > encoded_end) goto invalid_size;
++ if (decoded + 4 > decoded_end) goto invalid_size;
+
+ nybble = (*encoded)>>4;
+ new_sample = MS_ADPCM_nibble(state[0],nybble,coeff[0]);
+@@ -213,8 +216,8 @@ static int MS_ADPCM_decode(Uint8 **audio_buf, Uint32 *audio_len)
+ }
+ SDL_free(freeable);
+ return(0);
+-too_short:
+- SDL_SetError("Too short chunk for a MS ADPCM decoder");
++invalid_size:
++ SDL_SetError("Unexpected chunk length for a MS ADPCM decoder");
+ SDL_free(freeable);
+ return(-1);
+ }
+--
+2.20.1
+
diff --git a/main/sdl/0001-CVE-2019-7577.patch b/main/sdl/0001-CVE-2019-7577.patch
new file mode 100644
index 0000000000..23cbf98192
--- /dev/null
+++ b/main/sdl/0001-CVE-2019-7577.patch
@@ -0,0 +1,75 @@
+From ac3d0d365b1f01a6782565feda0c7432a5795671 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
+Date: Thu, 14 Feb 2019 14:12:22 +0100
+Subject: [PATCH] CVE-2019-7577: Fix a buffer overread in MS_ADPCM_decode
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+If RIFF/WAV data chunk length is shorter then expected for an audio
+format defined in preceeding RIFF/WAV format headers, a buffer
+overread can happen.
+
+This patch fixes it by checking a MS ADPCM data to be decoded are not
+past the initialized buffer.
+
+CVE-2019-7577
+Reproducer: https://bugzilla.libsdl.org/show_bug.cgi?id=4492
+
+Signed-off-by: Petr Písař <ppisar@redhat.com>
+---
+ src/audio/SDL_wave.c | 10 +++++++++-
+ 1 file changed, 9 insertions(+), 1 deletion(-)
+
+diff --git a/src/audio/SDL_wave.c b/src/audio/SDL_wave.c
+index b4ad6c7..e42d01c 100644
+--- a/src/audio/SDL_wave.c
++++ b/src/audio/SDL_wave.c
+@@ -115,7 +115,7 @@ static Sint32 MS_ADPCM_nibble(struct MS_ADPCM_decodestate *state,
+ static int MS_ADPCM_decode(Uint8 **audio_buf, Uint32 *audio_len)
+ {
+ struct MS_ADPCM_decodestate *state[2];
+- Uint8 *freeable, *encoded, *decoded;
++ Uint8 *freeable, *encoded, *encoded_end, *decoded;
+ Sint32 encoded_len, samplesleft;
+ Sint8 nybble, stereo;
+ Sint16 *coeff[2];
+@@ -124,6 +124,7 @@ static int MS_ADPCM_decode(Uint8 **audio_buf, Uint32 *audio_len)
+ /* Allocate the proper sized output buffer */
+ encoded_len = *audio_len;
+ encoded = *audio_buf;
++ encoded_end = encoded + encoded_len;
+ freeable = *audio_buf;
+ *audio_len = (encoded_len/MS_ADPCM_state.wavefmt.blockalign) *
+ MS_ADPCM_state.wSamplesPerBlock*
+@@ -141,6 +142,7 @@ static int MS_ADPCM_decode(Uint8 **audio_buf, Uint32 *audio_len)
+ state[1] = &MS_ADPCM_state.state[stereo];
+ while ( encoded_len >= MS_ADPCM_state.wavefmt.blockalign ) {
+ /* Grab the initial information for this block */
++ if (encoded + 7 + (stereo ? 7 : 0) > encoded_end) goto too_short;
+ state[0]->hPredictor = *encoded++;
+ if ( stereo ) {
+ state[1]->hPredictor = *encoded++;
+@@ -188,6 +190,8 @@ static int MS_ADPCM_decode(Uint8 **audio_buf, Uint32 *audio_len)
+ samplesleft = (MS_ADPCM_state.wSamplesPerBlock-2)*
+ MS_ADPCM_state.wavefmt.channels;
+ while ( samplesleft > 0 ) {
++ if (encoded + 1 > encoded_end) goto too_short;
++
+ nybble = (*encoded)>>4;
+ new_sample = MS_ADPCM_nibble(state[0],nybble,coeff[0]);
+ decoded[0] = new_sample&0xFF;
+@@ -209,6 +213,10 @@ static int MS_ADPCM_decode(Uint8 **audio_buf, Uint32 *audio_len)
+ }
+ SDL_free(freeable);
+ return(0);
++too_short:
++ SDL_SetError("Too short chunk for a MS ADPCM decoder");
++ SDL_free(freeable);
++ return(-1);
+ }
+
+ struct IMA_ADPCM_decodestate {
+--
+2.20.1
+
diff --git a/main/sdl/0001-CVE-2019-7578.patch b/main/sdl/0001-CVE-2019-7578.patch
new file mode 100644
index 0000000000..b0a89de20d
--- /dev/null
+++ b/main/sdl/0001-CVE-2019-7578.patch
@@ -0,0 +1,67 @@
+From 0eb76f6cabcffa2104e34c26e0f41e6de95356ff Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
+Date: Fri, 15 Feb 2019 10:56:59 +0100
+Subject: [PATCH] CVE-2019-7578: Fix a buffer overread in InitIMA_ADPCM
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+If IMA ADPCM format chunk was too short, InitIMA_ADPCM() parsing it
+could read past the end of chunk data. This patch fixes it.
+
+CVE-2019-7578
+https://bugzilla.libsdl.org/show_bug.cgi?id=4494
+
+Signed-off-by: Petr Písař <ppisar@redhat.com>
+---
+ src/audio/SDL_wave.c | 12 +++++++++---
+ 1 file changed, 9 insertions(+), 3 deletions(-)
+
+diff --git a/src/audio/SDL_wave.c b/src/audio/SDL_wave.c
+index 1d446ed..08f65cb 100644
+--- a/src/audio/SDL_wave.c
++++ b/src/audio/SDL_wave.c
+@@ -240,11 +240,12 @@ static struct IMA_ADPCM_decoder {
+ struct IMA_ADPCM_decodestate state[2];
+ } IMA_ADPCM_state;
+
+-static int InitIMA_ADPCM(WaveFMT *format)
++static int InitIMA_ADPCM(WaveFMT *format, int length)
+ {
+- Uint8 *rogue_feel;
++ Uint8 *rogue_feel, *rogue_feel_end;
+
+ /* Set the rogue pointer to the IMA_ADPCM specific data */
++ if (length < sizeof(*format)) goto too_short;
+ IMA_ADPCM_state.wavefmt.encoding = SDL_SwapLE16(format->encoding);
+ IMA_ADPCM_state.wavefmt.channels = SDL_SwapLE16(format->channels);
+ IMA_ADPCM_state.wavefmt.frequency = SDL_SwapLE32(format->frequency);
+@@ -253,11 +254,16 @@ static int InitIMA_ADPCM(WaveFMT *format)
+ IMA_ADPCM_state.wavefmt.bitspersample =
+ SDL_SwapLE16(format->bitspersample);
+ rogue_feel = (Uint8 *)format+sizeof(*format);
++ rogue_feel_end = (Uint8 *)format + length;
+ if ( sizeof(*format) == 16 ) {
+ rogue_feel += sizeof(Uint16);
+ }
++ if (rogue_feel + 2 > rogue_feel_end) goto too_short;
+ IMA_ADPCM_state.wSamplesPerBlock = ((rogue_feel[1]<<8)|rogue_feel[0]);
+ return(0);
++too_short:
++ SDL_SetError("Unexpected length of a chunk with an IMA ADPCM format");
++ return(-1);
+ }
+
+ static Sint32 IMA_ADPCM_nibble(struct IMA_ADPCM_decodestate *state,Uint8 nybble)
+@@ -500,7 +506,7 @@ SDL_AudioSpec * SDL_LoadWAV_RW (SDL_RWops *src, int freesrc,
+ break;
+ case IMA_ADPCM_CODE:
+ /* Try to understand this */
+- if ( InitIMA_ADPCM(format) < 0 ) {
++ if ( InitIMA_ADPCM(format, lenread) < 0 ) {
+ was_error = 1;
+ goto done;
+ }
+--
+2.20.1
+
diff --git a/main/sdl/0001-CVE-2019-7635.patch b/main/sdl/0001-CVE-2019-7635.patch
new file mode 100644
index 0000000000..ebf8b91e7f
--- /dev/null
+++ b/main/sdl/0001-CVE-2019-7635.patch
@@ -0,0 +1,53 @@
+CVE-2019-7635: Reject BMP images with pixel colors out the palette
+If a 1-, 4-, or 8-bit per pixel BMP image declares less used colors
+than the palette offers an SDL_Surface with a palette of the indicated
+number of used colors is created. If some of the image's pixel
+refer to a color number higher then the maximal used colors, a subsequent
+bliting operation on the surface will look up a color past a blit map
+(that is based on the palette) memory. I.e. passing such SDL_Surface
+to e.g. an SDL_DisplayFormat() function will result in a buffer overread in
+a blit function.
+
+This patch fixes it by validing each pixel's color to be less than the
+maximal color number in the palette. A validation failure raises an
+error from a SDL_LoadBMP_RW() function.
+
+CVE-2019-7635
+https://bugzilla.libsdl.org/show_bug.cgi?id=4498
+
+Signed-off-by: Petr Písař <ppisar@redhat.com>
+
+diff -r a936f9bd3e38 -r f1f5878be5db src/video/SDL_bmp.c
+--- a/src/video/SDL_bmp.c Mon Jun 10 09:25:05 2019 -0700
++++ b/src/video/SDL_bmp.c Tue Jun 11 06:28:12 2019 -0700
+@@ -308,6 +308,12 @@
+ }
+ *(bits+i) = (pixel>>shift);
+ pixel <<= ExpandBMP;
++ if ( bits[i] >= biClrUsed ) {
++ SDL_SetError(
++ "A BMP image contains a pixel with a color out of the palette");
++ was_error = SDL_TRUE;
++ goto done;
++ }
+ } }
+ break;
+
+@@ -318,6 +324,16 @@
+ was_error = SDL_TRUE;
+ goto done;
+ }
++ if ( 8 == biBitCount && palette && biClrUsed < (1 << biBitCount ) ) {
++ for ( i=0; i<surface->w; ++i ) {
++ if ( bits[i] >= biClrUsed ) {
++ SDL_SetError(
++ "A BMP image contains a pixel with a color out of the palette");
++ was_error = SDL_TRUE;
++ goto done;
++ }
++ }
++ }
+ #if SDL_BYTEORDER == SDL_BIG_ENDIAN
+ /* Byte-swap the pixels if needed. Note that the 24bpp
+ case has already been taken care of above. */
+
diff --git a/main/sdl/0001-CVE-2019-7636.patch b/main/sdl/0001-CVE-2019-7636.patch
new file mode 100644
index 0000000000..51e40ef1ce
--- /dev/null
+++ b/main/sdl/0001-CVE-2019-7636.patch
@@ -0,0 +1,29 @@
+Fixed bug 4500 - Heap-Buffer Overflow in Map1toN pertaining to SDL_pixels.c
+
+Petr Pisar
+
+The reproducer has these data in BITMAPINFOHEADER:
+
+biSize = 40
+biBitCount = 8
+biClrUsed = 131075
+
+SDL_LoadBMP_RW() function passes biBitCount as a color depth to SDL_CreateRGBSurface(), thus 256-color pallete is allocated. But then biClrUsed colors are read from a file and stored into the palette. SDL_LoadBMP_RW should report an error if biClrUsed is greater than 2^biBitCount.
+
+Also fixes CVE-2019-7638
+
+diff -r 8586f153eede -r 19d8c3b9c251 src/video/SDL_bmp.c
+--- a/src/video/SDL_bmp.c Sun Jan 13 15:27:50 2019 +0100
++++ b/src/video/SDL_bmp.c Mon Feb 18 07:48:23 2019 -0800
+@@ -233,6 +233,10 @@
+ if ( palette ) {
+ if ( biClrUsed == 0 ) {
+ biClrUsed = 1 << biBitCount;
++ } else if ( biClrUsed > (1 << biBitCount) ) {
++ SDL_SetError("BMP file has an invalid number of colors");
++ was_error = SDL_TRUE;
++ goto done;
+ }
+ if ( biSize == 12 ) {
+ for ( i = 0; i < (int)biClrUsed; ++i ) {
+
diff --git a/main/sdl/0001-CVE-2019-7637.patch b/main/sdl/0001-CVE-2019-7637.patch
new file mode 100644
index 0000000000..90a734f8ae
--- /dev/null
+++ b/main/sdl/0001-CVE-2019-7637.patch
@@ -0,0 +1,182 @@
+CVE-2019-7637: Fix in integer overflow in SDL_CalculatePitch
+If a too large width is passed to SDL_SetVideoMode() the width travels
+to SDL_CalculatePitch() where the width (e.g. 65535) is multiplied by
+BytesPerPixel (e.g. 4) and the result is stored into Uint16 pitch
+variable. During this arithmetics an integer overflow can happen (e.g.
+the value is clamped as 65532). As a result SDL_Surface with a pitch
+smaller than width * BytesPerPixel is created, too small pixel buffer
+is allocated and when the SDL_Surface is processed in SDL_FillRect()
+a buffer overflow occurs.
+
+This can be reproduced with "./graywin -width 21312312313123213213213"
+command.
+
+This patch fixes is by using a very careful arithmetics in
+SDL_CalculatePitch(). If an overflow is detected, an error is reported
+back as a special 0 value. We assume that 0-width surfaces do not
+occur in the wild. Since SDL_CalculatePitch() is a private function,
+we can change the semantics.
+
+CVE-2019-7637
+https://bugzilla.libsdl.org/show_bug.cgi?id=4497
+
+Signed-off-by: Petr Písař <ppisar@redhat.com>
+
+diff -r 4646533663ae -r 9b0e5c555c0f src/video/SDL_pixels.c
+--- a/src/video/SDL_pixels.c Sat Mar 16 18:35:33 2019 -0700
++++ b/src/video/SDL_pixels.c Sat Mar 16 19:16:24 2019 -0700
+@@ -286,26 +286,53 @@
+ }
+ }
+ /*
+- * Calculate the pad-aligned scanline width of a surface
++ * Calculate the pad-aligned scanline width of a surface. Return 0 in case of
++ * an error.
+ */
+ Uint16 SDL_CalculatePitch(SDL_Surface *surface)
+ {
+- Uint16 pitch;
++ unsigned int pitch = 0;
+
+ /* Surface should be 4-byte aligned for speed */
+- pitch = surface->w*surface->format->BytesPerPixel;
++ /* The code tries to prevent from an Uint16 overflow. */;
++ for (Uint8 byte = surface->format->BytesPerPixel; byte; byte--) {
++ pitch += (unsigned int)surface->w;
++ if (pitch < surface->w) {
++ SDL_SetError("A scanline is too wide");
++ return(0);
++ }
++ }
+ switch (surface->format->BitsPerPixel) {
+ case 1:
+- pitch = (pitch+7)/8;
++ if (pitch % 8) {
++ pitch = pitch / 8 + 1;
++ } else {
++ pitch = pitch / 8;
++ }
+ break;
+ case 4:
+- pitch = (pitch+1)/2;
++ if (pitch % 2) {
++ pitch = pitch / 2 + 1;
++ } else {
++ pitch = pitch / 2;
++ }
+ break;
+ default:
+ break;
+ }
+- pitch = (pitch + 3) & ~3; /* 4-byte aligning */
+- return(pitch);
++ /* 4-byte aligning */
++ if (pitch & 3) {
++ if (pitch + 3 < pitch) {
++ SDL_SetError("A scanline is too wide");
++ return(0);
++ }
++ pitch = (pitch + 3) & ~3;
++ }
++ if (pitch > 0xFFFF) {
++ SDL_SetError("A scanline is too wide");
++ return(0);
++ }
++ return((Uint16)pitch);
+ }
+ /*
+ * Match an RGB value to a particular palette index
+diff -r 4646533663ae -r 9b0e5c555c0f src/video/gapi/SDL_gapivideo.c
+--- a/src/video/gapi/SDL_gapivideo.c Sat Mar 16 18:35:33 2019 -0700
++++ b/src/video/gapi/SDL_gapivideo.c Sat Mar 16 19:16:24 2019 -0700
+@@ -733,6 +733,9 @@
+ video->w = gapi->w = width;
+ video->h = gapi->h = height;
+ video->pitch = SDL_CalculatePitch(video);
++ if (!current->pitch) {
++ return(NULL);
++ }
+
+ /* Small fix for WinCE/Win32 - when activating window
+ SDL_VideoSurface is equal to zero, so activating code
+diff -r 4646533663ae -r 9b0e5c555c0f src/video/nanox/SDL_nxvideo.c
+--- a/src/video/nanox/SDL_nxvideo.c Sat Mar 16 18:35:33 2019 -0700
++++ b/src/video/nanox/SDL_nxvideo.c Sat Mar 16 19:16:24 2019 -0700
+@@ -378,6 +378,10 @@
+ current -> w = width ;
+ current -> h = height ;
+ current -> pitch = SDL_CalculatePitch (current) ;
++ if (!current->pitch) {
++ current = NULL;
++ goto done;
++ }
+ NX_ResizeImage (this, current, flags) ;
+ }
+
+diff -r 4646533663ae -r 9b0e5c555c0f src/video/ps2gs/SDL_gsvideo.c
+--- a/src/video/ps2gs/SDL_gsvideo.c Sat Mar 16 18:35:33 2019 -0700
++++ b/src/video/ps2gs/SDL_gsvideo.c Sat Mar 16 19:16:24 2019 -0700
+@@ -479,6 +479,9 @@
+ current->w = width;
+ current->h = height;
+ current->pitch = SDL_CalculatePitch(current);
++ if (!current->pitch) {
++ return(NULL);
++ }
+
+ /* Memory map the DMA area for block memory transfer */
+ if ( ! mapped_mem ) {
+diff -r 4646533663ae -r 9b0e5c555c0f src/video/ps3/SDL_ps3video.c
+--- a/src/video/ps3/SDL_ps3video.c Sat Mar 16 18:35:33 2019 -0700
++++ b/src/video/ps3/SDL_ps3video.c Sat Mar 16 19:16:24 2019 -0700
+@@ -339,6 +339,9 @@
+ current->w = width;
+ current->h = height;
+ current->pitch = SDL_CalculatePitch(current);
++ if (!current->pitch) {
++ return(NULL);
++ }
+
+ /* Alloc aligned mem for current->pixels */
+ s_pixels = memalign(16, current->h * current->pitch);
+diff -r 4646533663ae -r 9b0e5c555c0f src/video/windib/SDL_dibvideo.c
+--- a/src/video/windib/SDL_dibvideo.c Sat Mar 16 18:35:33 2019 -0700
++++ b/src/video/windib/SDL_dibvideo.c Sat Mar 16 19:16:24 2019 -0700
+@@ -675,6 +675,9 @@
+ video->w = width;
+ video->h = height;
+ video->pitch = SDL_CalculatePitch(video);
++ if (!current->pitch) {
++ return(NULL);
++ }
+
+ /* Small fix for WinCE/Win32 - when activating window
+ SDL_VideoSurface is equal to zero, so activating code
+diff -r 4646533663ae -r 9b0e5c555c0f src/video/windx5/SDL_dx5video.c
+--- a/src/video/windx5/SDL_dx5video.c Sat Mar 16 18:35:33 2019 -0700
++++ b/src/video/windx5/SDL_dx5video.c Sat Mar 16 19:16:24 2019 -0700
+@@ -1127,6 +1127,9 @@
+ video->w = width;
+ video->h = height;
+ video->pitch = SDL_CalculatePitch(video);
++ if (!current->pitch) {
++ return(NULL);
++ }
+
+ #ifndef NO_CHANGEDISPLAYSETTINGS
+ /* Set fullscreen mode if appropriate.
+diff -r 4646533663ae -r 9b0e5c555c0f src/video/x11/SDL_x11video.c
+--- a/src/video/x11/SDL_x11video.c Sat Mar 16 18:35:33 2019 -0700
++++ b/src/video/x11/SDL_x11video.c Sat Mar 16 19:16:24 2019 -0700
+@@ -1225,6 +1225,10 @@
+ current->w = width;
+ current->h = height;
+ current->pitch = SDL_CalculatePitch(current);
++ if (!current->pitch) {
++ current = NULL;
++ goto done;
++ }
+ if (X11_ResizeImage(this, current, flags) < 0) {
+ current = NULL;
+ goto done;
+
diff --git a/main/sdl/0002-CVE-2019-7572.patch b/main/sdl/0002-CVE-2019-7572.patch
new file mode 100644
index 0000000000..0f242be4e4
--- /dev/null
+++ b/main/sdl/0002-CVE-2019-7572.patch
@@ -0,0 +1,59 @@
+From bb11ffcff5ae2f25bead921c2a299e7e63d8a759 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
+Date: Thu, 14 Feb 2019 16:51:54 +0100
+Subject: [PATCH] CVE-2019-7572: Fix a buffer overread in IMA_ADPCM_nibble
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+If an IMA ADPCM block contained an initial index out of step table
+range (loaded in IMA_ADPCM_decode()), IMA_ADPCM_nibble() blindly used
+this bogus value and that lead to a buffer overread.
+
+This patch fixes it by moving clamping the index value at the
+beginning of IMA_ADPCM_nibble() function instead of the end after
+an update.
+
+CVE-2019-7572
+https://bugzilla.libsdl.org/show_bug.cgi?id=4495
+
+Signed-off-by: Petr Písař <ppisar@redhat.com>
+---
+ src/audio/SDL_wave.c | 14 ++++++++------
+ 1 file changed, 8 insertions(+), 6 deletions(-)
+
+diff --git a/src/audio/SDL_wave.c b/src/audio/SDL_wave.c
+index 2968b3d..69d62dc 100644
+--- a/src/audio/SDL_wave.c
++++ b/src/audio/SDL_wave.c
+@@ -275,6 +275,14 @@ static Sint32 IMA_ADPCM_nibble(struct IMA_ADPCM_decodestate *state,Uint8 nybble)
+ };
+ Sint32 delta, step;
+
++ /* Clamp index value. The inital value can be invalid. */
++ if ( state->index > 88 ) {
++ state->index = 88;
++ } else
++ if ( state->index < 0 ) {
++ state->index = 0;
++ }
++
+ /* Compute difference and new sample value */
+ step = step_table[state->index];
+ delta = step >> 3;
+@@ -286,12 +294,6 @@ static Sint32 IMA_ADPCM_nibble(struct IMA_ADPCM_decodestate *state,Uint8 nybble)
+
+ /* Update index value */
+ state->index += index_table[nybble];
+- if ( state->index > 88 ) {
+- state->index = 88;
+- } else
+- if ( state->index < 0 ) {
+- state->index = 0;
+- }
+
+ /* Clamp output sample */
+ if ( state->sample > max_audioval ) {
+--
+2.20.1
+
diff --git a/main/sdl/0002-CVE-2019-7577.patch b/main/sdl/0002-CVE-2019-7577.patch
new file mode 100644
index 0000000000..06b429cb6d
--- /dev/null
+++ b/main/sdl/0002-CVE-2019-7577.patch
@@ -0,0 +1,57 @@
+From 69cd6157644cb0a5c9edd7b5920232c2ca31c151 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
+Date: Tue, 12 Mar 2019 16:21:41 +0100
+Subject: [PATCH] CVE-2019-7577: Fix a buffer overread in MS_ADPCM_nibble and
+ MS_ADPCM_decode
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+If a chunk of RIFF/WAV file with MS ADPCM encoding contains an invalid
+predictor (a valid predictor's value is between 0 and 6 inclusive),
+a buffer overread can happen when the predictor is used as an index
+into an array of MS ADPCM coefficients.
+
+The overead happens when indexing MS_ADPCM_state.aCoeff[] array in
+MS_ADPCM_decode() and later when dereferencing a coef pointer in
+MS_ADPCM_nibble().
+
+This patch fixes it by checking the MS ADPCM predictor values fit
+into the valid range.
+
+CVE-2019-7577
+Reproducer: https://bugzilla.libsdl.org/show_bug.cgi?id=4492
+
+Signed-off-by: Petr Písař <ppisar@redhat.com>
+---
+ src/audio/SDL_wave.c | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
+diff --git a/src/audio/SDL_wave.c b/src/audio/SDL_wave.c
+index 08f65cb..5f93651 100644
+--- a/src/audio/SDL_wave.c
++++ b/src/audio/SDL_wave.c
+@@ -155,6 +155,9 @@ static int MS_ADPCM_decode(Uint8 **audio_buf, Uint32 *audio_len)
+ if ( stereo ) {
+ state[1]->hPredictor = *encoded++;
+ }
++ if (state[0]->hPredictor >= 7 || state[1]->hPredictor >= 7) {
++ goto invalid_predictor;
++ }
+ state[0]->iDelta = ((encoded[1]<<8)|encoded[0]);
+ encoded += sizeof(Sint16);
+ if ( stereo ) {
+@@ -227,6 +230,10 @@ invalid_size:
+ SDL_SetError("Unexpected chunk length for a MS ADPCM decoder");
+ SDL_free(freeable);
+ return(-1);
++invalid_predictor:
++ SDL_SetError("Invalid predictor value for a MS ADPCM decoder");
++ SDL_free(freeable);
++ return(-1);
+ }
+
+ struct IMA_ADPCM_decodestate {
+--
+2.20.1
+
diff --git a/main/sdl/0002-CVE-2019-7635.patch b/main/sdl/0002-CVE-2019-7635.patch
new file mode 100644
index 0000000000..01a111ccc4
--- /dev/null
+++ b/main/sdl/0002-CVE-2019-7635.patch
@@ -0,0 +1,21 @@
+diff -r 19d8c3b9c251 -r 08f3b4992538 src/video/SDL_bmp.c
+--- a/src/video/SDL_bmp.c Mon Feb 18 07:48:23 2019 -0800
++++ b/src/video/SDL_bmp.c Sat Mar 16 18:35:11 2019 -0700
+@@ -163,6 +163,14 @@
+ ExpandBMP = biBitCount;
+ biBitCount = 8;
+ break;
++ case 2:
++ case 3:
++ case 5:
++ case 6:
++ case 7:
++ SDL_SetError("%d-bpp BMP images are not supported", biBitCount);
++ was_error = SDL_TRUE;
++ goto done;
+ default:
+ ExpandBMP = 0;
+ break;
+
+
+
diff --git a/main/sdl/0002-CVE-2019-7637.patch b/main/sdl/0002-CVE-2019-7637.patch
new file mode 100644
index 0000000000..bf28310d5e
--- /dev/null
+++ b/main/sdl/0002-CVE-2019-7637.patch
@@ -0,0 +1,42 @@
+fix copy+paste mistakes in commit 9b0e5c555c0f (CVE-2019-7637 fix):
+
+http://hg.libsdl.org/SDL/rev/9b0e5c555c0f made copy+paste mistakes which
+resulted in windows versions failing to set video mode.
+
+diff -r 37d0eba8fa17 -r 32075e9e2135 src/video/gapi/SDL_gapivideo.c
+--- a/src/video/gapi/SDL_gapivideo.c Wed Jul 31 23:50:10 2019 +0300
++++ b/src/video/gapi/SDL_gapivideo.c Fri Aug 02 00:35:05 2019 +0300
+@@ -733,7 +733,7 @@
+ video->w = gapi->w = width;
+ video->h = gapi->h = height;
+ video->pitch = SDL_CalculatePitch(video);
+- if (!current->pitch) {
++ if (!video->pitch) {
+ return(NULL);
+ }
+
+diff -r 37d0eba8fa17 -r 32075e9e2135 src/video/windib/SDL_dibvideo.c
+--- a/src/video/windib/SDL_dibvideo.c Wed Jul 31 23:50:10 2019 +0300
++++ b/src/video/windib/SDL_dibvideo.c Fri Aug 02 00:35:05 2019 +0300
+@@ -675,7 +675,7 @@
+ video->w = width;
+ video->h = height;
+ video->pitch = SDL_CalculatePitch(video);
+- if (!current->pitch) {
++ if (!video->pitch) {
+ return(NULL);
+ }
+
+diff -r 37d0eba8fa17 -r 32075e9e2135 src/video/windx5/SDL_dx5video.c
+--- a/src/video/windx5/SDL_dx5video.c Wed Jul 31 23:50:10 2019 +0300
++++ b/src/video/windx5/SDL_dx5video.c Fri Aug 02 00:35:05 2019 +0300
+@@ -1127,7 +1127,7 @@
+ video->w = width;
+ video->h = height;
+ video->pitch = SDL_CalculatePitch(video);
+- if (!current->pitch) {
++ if (!video->pitch) {
+ return(NULL);
+ }
+
+
diff --git a/main/sdl/APKBUILD b/main/sdl/APKBUILD
index 228ed5e7e5..5176d28b42 100644
--- a/main/sdl/APKBUILD
+++ b/main/sdl/APKBUILD
@@ -1,7 +1,7 @@
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=sdl
pkgver=1.2.15
-pkgrel=9
+pkgrel=10
pkgdesc="A library for portable low-level access to a video framebuffer, audio output, mouse, and keyboard"
url="http://www.libsdl.org"
arch="all"
@@ -15,9 +15,37 @@ makedepends="$depends_dev libxext-dev libxrender-dev libx11-dev libice-dev
source="https://www.libsdl.org/release/SDL-$pkgver.tar.gz
SDL-1.2.10-GrabNotViewable.patch
SDL-1.2.15-const_XData32.patch
+ 0001-CVE-2019-7574.patch
+ 0001-CVE-2019-7572.patch
+ 0002-CVE-2019-7572.patch
+ 0001-CVE-2019-7573.patch
+ 0001-CVE-2019-7577.patch
+ 0002-CVE-2019-7577.patch
+ 0001-CVE-2019-7575.patch
+ 0001-CVE-2019-7578.patch
+ 0001-CVE-2019-7635.patch
+ 0002-CVE-2019-7635.patch
+ 0001-CVE-2019-7636.patch
+ 0001-CVE-2019-7637.patch
+ 0002-CVE-2019-7637.patch
"
builddir="$srcdir"/SDL-$pkgver
+# secfixes:
+# 1.2.15-r10:
+# - CVE-2019-7572
+# - CVE-2019-7573
+# - CVE-2019-7574
+# - CVE-2019-7575
+# - CVE-2019-7576
+# - CVE-2019-7577
+# - CVE-2019-7577
+# - CVE-2019-7578
+# - CVE-2019-7635
+# - CVE-2019-7636
+# - CVE-2019-7637
+# - CVE-2019-7638
+
prepare() {
cd "$builddir"
update_config_sub
@@ -48,4 +76,17 @@ package() {
sha512sums="ac392d916e6953b0925a7cbb0f232affea33339ef69b47a0a7898492afb9784b93138986df53d6da6d3e2ad79af1e9482df565ecca30f89428be0ae6851b1adc SDL-1.2.15.tar.gz
20049408d4c00d895c39a7901d889d1874ebcd382e93b2e8df38bd3726e2236f4e9a980720724cf176a35d05fb0db5dbcabd42089423adeb404f2dba16d52b7b SDL-1.2.10-GrabNotViewable.patch
-c414a088350e4b039edf46b109721bea01300ad959b84c313f34d5bc085cab97107abb55a71cb8343f092546e4a36c52febf029ffa7d5bacbd580aee43c07bf3 SDL-1.2.15-const_XData32.patch"
+c414a088350e4b039edf46b109721bea01300ad959b84c313f34d5bc085cab97107abb55a71cb8343f092546e4a36c52febf029ffa7d5bacbd580aee43c07bf3 SDL-1.2.15-const_XData32.patch
+8c287d6ffcc159f19d934d560e073a716325b6a62d9dea974b92b2d4a417defc4f8441769b4761c5a2600b10a45ff401b0afbab6823880e3d54eab09e22f9859 0001-CVE-2019-7574.patch
+e713d0f3d24d73831d9f116d4e15e965c5f09e19b15634e8cbf92714612b0172f24a5c542b3fde09732d17b03d7dac3aaac0d8f4e359a45c1c538970413d6e7c 0001-CVE-2019-7572.patch
+3274f91e41b72cd98b6d7962013dd45289952b7af78cc7bc5fe99d4f143434243c8ef0743117d3ec6b090784dfcba8dd460679cc5b49f298ebd8b5afab78a108 0002-CVE-2019-7572.patch
+3bf62a71988feff2329e298cee8ce48c636c65100959385b73953c95eea21cb069a7ed096165c252e5ef1db133330da5d095cf5ad145d9875b1197d3b5517b81 0001-CVE-2019-7573.patch
+f364161069ceb5d05d329ff04f6e72d2c52baff68d0d3f2203f8a7ee3ace1efe8fc63676ea7d097ccc8eb696dcc20c6b141319ddf0c2bb6efc4fd92cb1dba038 0001-CVE-2019-7577.patch
+d2f0664cc0388908ec621c84e7f889ef5abda31dc4e4d23e6e379e26475ed73863ad47b2f13d282c96ba269bdbc77e7effaf5f01032d0683ad991b506063ef19 0002-CVE-2019-7577.patch
+abe54d9f29b5e6c1a91cba2bb44e0988b7ceb5a94c3f63569f436f49f282b80280cecd79ee48b9926fff458efbdf0fff019b0fdbf6530692a11a68dbec73e7ca 0001-CVE-2019-7575.patch
+a31d5c685fafbca72fdc5336343b74b90b1bfd5af4b6f632b4d8271bb1a218ec6419a7994290f65e7a5fc36d921c2d3c1a25ddf0cdf29bffb7229229415eaa9f 0001-CVE-2019-7578.patch
+47729b56a7d323fecd4e4cccddce06061c4f53b723cb08108e1800897da54bae0bede862a09d219dce515696d9e270d062c7aa0af1ba445cc3160cdac8e3d3f7 0001-CVE-2019-7635.patch
+8e2c04d8a8167c479f56aa2b363bd3b5ee302c473642717445385210871e0c7b6bfb3020c553c4b0ca849b8a290602b20e7e398d396fdbf47980c38b0969f230 0002-CVE-2019-7635.patch
+8e9fa28015e64f08d7d8124398ee5b268546105b73313490cfffdd547e67e729455535407177827e485c4132badfc48a73cce18c0ff7ff8a1c8706613acf180c 0001-CVE-2019-7636.patch
+0ad1e445a067afb726df48eac55d593075c945199bd718b4116af84c15df6f5c095f541a5c8a008aef4474dda874e68517236f2f37e1539e0e5684240b058231 0001-CVE-2019-7637.patch
+105378cf7609872198c83b8824a1c36463b01f5696cda6c184252b728cdd1054cdc2e68a338f5d728facd182628d2a8b29b961664e89d7f9022abc0268c9afc1 0002-CVE-2019-7637.patch"
diff --git a/main/sdl2/APKBUILD b/main/sdl2/APKBUILD
index 57364da98d..fa6821855a 100644
--- a/main/sdl2/APKBUILD
+++ b/main/sdl2/APKBUILD
@@ -1,7 +1,7 @@
# Contributor: August Klein <amatcoder@gmail.com>
# Maintainer: August Klein <amatcoder@gmail.com>
pkgname=sdl2
-pkgver=2.0.9
+pkgver=2.0.10
pkgrel=0
pkgdesc="A development library designed to provide low level access to audio, keyboard, mouse, joystick and graphics"
url="http://www.libsdl.org"
@@ -15,6 +15,19 @@ subpackages="$pkgname-dev"
source="https://www.libsdl.org/release/SDL2-$pkgver.tar.gz"
builddir="$srcdir/SDL2-$pkgver"
+# secfixes:
+# 2.0.10-r0:
+# - CVE-2019-7572
+# - CVE-2019-7573
+# - CVE-2019-7574
+# - CVE-2019-7575
+# - CVE-2019-7576
+# - CVE-2019-7578
+# - CVE-2019-7635
+# - CVE-2019-7636
+# - CVE-2019-7637
+# - CVE-2019-7638
+
build() {
cd "$builddir"
# NOTE: Please do not remove the --enable-video-directfb flag.
@@ -43,4 +56,4 @@ package() {
make DESTDIR="$pkgdir" install
}
-sha512sums="a78a4708b2bb5b35a7c7b7501eb3bd60a9aa3bb95a3d84e57763df4a377185e7312a94b66321eef7ca0d17255e4b402fc950e83ef0dbbd08f14ff1194107dc10 SDL2-2.0.9.tar.gz"
+sha512sums="f49b869362699b3282f6e82920e59c7fac581bcbf955f18a81cc126293c08093a90df7fcb39517cc8bc32708d2213fe645a42b655d6d811c1386efebb3d3c798 SDL2-2.0.10.tar.gz"
diff --git a/main/subversion/APKBUILD b/main/subversion/APKBUILD
index 987ace0ef4..e230b577ef 100644
--- a/main/subversion/APKBUILD
+++ b/main/subversion/APKBUILD
@@ -1,10 +1,10 @@
# Contributor: Łukasz Jendrysik <scadu@yandex.com>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=subversion
-pkgver=1.11.1
+pkgver=1.12.2
pkgrel=0
pkgdesc="Replacement for CVS, another versioning system (svn)"
-url="https://subversion.apache.org"
+url="https://subversion.apache.org/"
arch="all"
license="Apache-2.0 BSD"
depends=
@@ -21,6 +21,9 @@ source="https://archive.apache.org/dist/subversion/$pkgname-$pkgver.tar.bz2
svnserve.initd"
# secfixes:
+# 1.12.2-r0:
+# - CVE-2019-0203
+# - CVE-2018-11782
# 1.11.1-r0:
# - CVE-2018-11803
# 1.9.7-r0:
@@ -112,7 +115,7 @@ py() {
mv "$pkgdir"/usr/lib/*py* "${subpkgdir}${pypath}"
}
-sha512sums="2d082f715bf592ffc6a19311a9320dbae2ff0ee126b0472ce1c3f10e9aee670f43d894889430e6d093620f7b69c611e9a26773bc7a2f8b599ec37540ecd84a8d subversion-1.11.1.tar.bz2
+sha512sums="b1f859b460afa54598778d8633f648acb4fa46138f7d6f0c1451e3c6a1de71df859233cd9ac7f19f0f20d7237ed3988f0a38da7552ffa58391e19d957bc7c136 subversion-1.12.2.tar.bz2
fb219c45b80602d919176cc191394df09f90d0f5c7d24e6a36b166bd92777ecae67eeac1e49c0ffbb0e724396b3d2094dbb0bef17d01dc87d418b1cd554bd7c4 subversion-1.7.0-deplibs.patch
fd6e5f45cff4d3cf0d885a34c822b32141b13b199d99ad8e1b04d641c9c1ee27e73f5c556a4ad54a900b6d39cc14afad17b6738d8af44c76758f1a27b4d49f9a subversion-perl-deplibs.patch
7fe993443d4d3ef5e1e75f60e85036ee0b2bb2636c2c830210e64f525f95ae4c10ca1dc4504fc36915ec9391815becbe7cbf5f589c28609386d8d079ed02c630 svnserve.confd
diff --git a/main/tcl-tls/APKBUILD b/main/tcl-tls/APKBUILD
index 18f97c9ea3..aa1444a4a6 100644
--- a/main/tcl-tls/APKBUILD
+++ b/main/tcl-tls/APKBUILD
@@ -2,7 +2,7 @@
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=tcl-tls
pkgver=1.7.16
-pkgrel=0
+pkgrel=1
pkgdesc="OpenSSL extension to Tcl"
url="https://core.tcl.tk/tcltls/"
arch="all"
diff --git a/main/wpa_supplicant/0016-SAE-Use-const_time_memcmp-for-pwd_value-prime-compar.patch b/main/wpa_supplicant/0016-SAE-Use-const_time_memcmp-for-pwd_value-prime-compar.patch
new file mode 100644
index 0000000000..073f1e3ce1
--- /dev/null
+++ b/main/wpa_supplicant/0016-SAE-Use-const_time_memcmp-for-pwd_value-prime-compar.patch
@@ -0,0 +1,31 @@
+From e43f08991f00820c1f711ca254021d5f83b5cd7d Mon Sep 17 00:00:00 2001
+From: Jouni Malinen <jouni@codeaurora.org>
+Date: Thu, 25 Apr 2019 18:52:34 +0300
+Subject: [PATCH 1/6] SAE: Use const_time_memcmp() for pwd_value >= prime
+ comparison
+
+This reduces timing and memory access pattern differences for an
+operation that could depend on the used password.
+
+Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
+(cherry picked from commit 8e14b030e558d23f65d761895c07089404e61cf1)
+---
+ src/common/sae.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/common/sae.c b/src/common/sae.c
+index 5a50294a6..0d56e5505 100644
+--- a/src/common/sae.c
++++ b/src/common/sae.c
+@@ -317,7 +317,7 @@ static int sae_test_pwd_seed_ecc(struct sae_data *sae, const u8 *pwd_seed,
+ wpa_hexdump_key(MSG_DEBUG, "SAE: pwd-value",
+ pwd_value, sae->tmp->prime_len);
+
+- if (os_memcmp(pwd_value, prime, sae->tmp->prime_len) >= 0)
++ if (const_time_memcmp(pwd_value, prime, sae->tmp->prime_len) >= 0)
+ return 0;
+
+ x_cand = crypto_bignum_init_set(pwd_value, sae->tmp->prime_len);
+--
+2.20.1
+
diff --git a/main/wpa_supplicant/0017-EAP-pwd-Enforce-1-rand-mask-r-and-rand-mask-mod-r-1.patch b/main/wpa_supplicant/0017-EAP-pwd-Enforce-1-rand-mask-r-and-rand-mask-mod-r-1.patch
new file mode 100644
index 0000000000..2cd0aa5a27
--- /dev/null
+++ b/main/wpa_supplicant/0017-EAP-pwd-Enforce-1-rand-mask-r-and-rand-mask-mod-r-1.patch
@@ -0,0 +1,121 @@
+From 4396f74a36e16e32a51238d84bf6225b89c8b25c Mon Sep 17 00:00:00 2001
+From: Jouni Malinen <jouni@codeaurora.org>
+Date: Fri, 5 Apr 2019 12:37:21 +0300
+Subject: [PATCH] EAP-pwd: Enforce 1 < rand,mask < r and rand+mask mod r > 1
+
+RFC 5931 has these conditions as MUST requirements, so better follow
+them explicitly even if the rand,mask == 0 or rand+mask == 0 or 1 cases
+are very unlikely to occur in practice while generating random values
+locally.
+
+Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
+---
+ src/eap_common/eap_pwd_common.c | 28 ++++++++++++++++++++++++++++
+ src/eap_common/eap_pwd_common.h | 3 +++
+ src/eap_peer/eap_pwd.c | 14 ++------------
+ src/eap_server/eap_server_pwd.c | 13 ++-----------
+ 4 files changed, 35 insertions(+), 23 deletions(-)
+
+diff --git a/src/eap_common/eap_pwd_common.c b/src/eap_common/eap_pwd_common.c
+index c28b56d62..4288b5299 100644
+--- a/src/eap_common/eap_pwd_common.c
++++ b/src/eap_common/eap_pwd_common.c
+@@ -534,3 +534,31 @@ struct crypto_bignum * eap_pwd_get_scalar(EAP_PWD_group *group, const u8 *buf)
+
+ return scalar;
+ }
++
++
++int eap_pwd_get_rand_mask(EAP_PWD_group *group, struct crypto_bignum *_rand,
++ struct crypto_bignum *_mask,
++ struct crypto_bignum *scalar)
++{
++ const struct crypto_bignum *order;
++ int count;
++
++ order = crypto_ec_get_order(group->group);
++
++ /* Select two random values rand,mask such that 1 < rand,mask < r and
++ * rand + mask mod r > 1. */
++ for (count = 0; count < 100; count++) {
++ if (crypto_bignum_rand(_rand, order) == 0 &&
++ !crypto_bignum_is_zero(_rand) &&
++ crypto_bignum_rand(_mask, order) == 0 &&
++ !crypto_bignum_is_zero(_mask) &&
++ crypto_bignum_add(_rand, _mask, scalar) == 0 &&
++ crypto_bignum_mod(scalar, order, scalar) == 0 &&
++ !crypto_bignum_is_zero(scalar) &&
++ !crypto_bignum_is_one(scalar))
++ return 0;
++ }
++
++ wpa_printf(MSG_INFO, "EAP-pwd: unable to get randomness");
++ return -1;
++}
+diff --git a/src/eap_common/eap_pwd_common.h b/src/eap_common/eap_pwd_common.h
+index 2387e59a2..c48acee20 100644
+--- a/src/eap_common/eap_pwd_common.h
++++ b/src/eap_common/eap_pwd_common.h
+@@ -70,5 +70,8 @@ void eap_pwd_h_final(struct crypto_hash *hash, u8 *digest);
+ struct crypto_ec_point * eap_pwd_get_element(EAP_PWD_group *group,
+ const u8 *buf);
+ struct crypto_bignum * eap_pwd_get_scalar(EAP_PWD_group *group, const u8 *buf);
++int eap_pwd_get_rand_mask(EAP_PWD_group *group, struct crypto_bignum *_rand,
++ struct crypto_bignum *_mask,
++ struct crypto_bignum *scalar);
+
+ #endif /* EAP_PWD_COMMON_H */
+diff --git a/src/eap_peer/eap_pwd.c b/src/eap_peer/eap_pwd.c
+index f37b974eb..5f6c00218 100644
+--- a/src/eap_peer/eap_pwd.c
++++ b/src/eap_peer/eap_pwd.c
+@@ -542,19 +542,9 @@ eap_pwd_perform_commit_exchange(struct eap_sm *sm, struct eap_pwd_data *data,
+ goto fin;
+ }
+
+- if (crypto_bignum_rand(data->private_value,
+- crypto_ec_get_order(data->grp->group)) < 0 ||
+- crypto_bignum_rand(mask,
+- crypto_ec_get_order(data->grp->group)) < 0 ||
+- crypto_bignum_add(data->private_value, mask,
+- data->my_scalar) < 0 ||
+- crypto_bignum_mod(data->my_scalar,
+- crypto_ec_get_order(data->grp->group),
+- data->my_scalar) < 0) {
+- wpa_printf(MSG_INFO,
+- "EAP-pwd (peer): unable to get randomness");
++ if (eap_pwd_get_rand_mask(data->grp, data->private_value, mask,
++ data->my_scalar) < 0)
+ goto fin;
+- }
+
+ if (crypto_ec_point_mul(data->grp->group, data->grp->pwe, mask,
+ data->my_element) < 0) {
+diff --git a/src/eap_server/eap_server_pwd.c b/src/eap_server/eap_server_pwd.c
+index f6c75cf80..cf6affdaf 100644
+--- a/src/eap_server/eap_server_pwd.c
++++ b/src/eap_server/eap_server_pwd.c
+@@ -261,18 +261,9 @@ static void eap_pwd_build_commit_req(struct eap_sm *sm,
+ goto fin;
+ }
+
+- if (crypto_bignum_rand(data->private_value,
+- crypto_ec_get_order(data->grp->group)) < 0 ||
+- crypto_bignum_rand(mask,
+- crypto_ec_get_order(data->grp->group)) < 0 ||
+- crypto_bignum_add(data->private_value, mask, data->my_scalar) < 0 ||
+- crypto_bignum_mod(data->my_scalar,
+- crypto_ec_get_order(data->grp->group),
+- data->my_scalar) < 0) {
+- wpa_printf(MSG_INFO,
+- "EAP-pwd (server): unable to get randomness");
++ if (eap_pwd_get_rand_mask(data->grp, data->private_value, mask,
++ data->my_scalar) < 0)
+ goto fin;
+- }
+
+ if (crypto_ec_point_mul(data->grp->group, data->grp->pwe, mask,
+ data->my_element) < 0) {
+--
+2.22.0
+
diff --git a/main/wpa_supplicant/0018-EAP-pwd-Remove-unused-checks-for-cofactor-1-cases.patch b/main/wpa_supplicant/0018-EAP-pwd-Remove-unused-checks-for-cofactor-1-cases.patch
new file mode 100644
index 0000000000..9ffa00c1d0
--- /dev/null
+++ b/main/wpa_supplicant/0018-EAP-pwd-Remove-unused-checks-for-cofactor-1-cases.patch
@@ -0,0 +1,257 @@
+From 8b093db2c3f489a74b67f687becf750d24fcf626 Mon Sep 17 00:00:00 2001
+From: Jouni Malinen <j@w1.fi>
+Date: Sat, 13 Apr 2019 17:30:22 +0300
+Subject: [PATCH] EAP-pwd: Remove unused checks for cofactor > 1 cases
+
+None of the ECC groups supported in the implementation had a cofactor
+greater than 1, so these checks are unreachable and for all cases, the
+cofactor is known to be 1. Furthermore, RFC 5931 explicitly disallow use
+of ECC groups with cofactor larger than 1, so this checks cannot be
+needed for any curve that is compliant with the RFC.
+
+Remove the unneeded group cofactor checks to simplify the
+implementation.
+
+Signed-off-by: Jouni Malinen <j@w1.fi>
+---
+ src/eap_common/eap_pwd_common.c | 53 ++-------------------------------
+ src/eap_peer/eap_pwd.c | 23 ++------------
+ src/eap_server/eap_server_pwd.c | 23 ++------------
+ 3 files changed, 7 insertions(+), 92 deletions(-)
+
+diff --git a/src/eap_common/eap_pwd_common.c b/src/eap_common/eap_pwd_common.c
+index 00f85a390..884150e6c 100644
+--- a/src/eap_common/eap_pwd_common.c
++++ b/src/eap_common/eap_pwd_common.c
+@@ -151,7 +151,7 @@ int compute_password_element(EAP_PWD_group *grp, u16 num,
+ u8 found = 0; /* 0 (false) or 0xff (true) to be used as const_time_*
+ * mask */
+ size_t primebytelen = 0, primebitlen;
+- struct crypto_bignum *x_candidate = NULL, *cofactor = NULL;
++ struct crypto_bignum *x_candidate = NULL;
+ const struct crypto_bignum *prime;
+ u8 mask, found_ctr = 0, is_odd = 0;
+
+@@ -161,21 +161,15 @@ int compute_password_element(EAP_PWD_group *grp, u16 num,
+ os_memset(x_bin, 0, sizeof(x_bin));
+
+ prime = crypto_ec_get_prime(grp->group);
+- cofactor = crypto_bignum_init();
+ grp->pwe = crypto_ec_point_init(grp->group);
+ tmp1 = crypto_bignum_init();
+ pm1 = crypto_bignum_init();
+ one = crypto_bignum_init_set((const u8 *) "\x01", 1);
+- if (!cofactor || !grp->pwe || !tmp1 || !pm1 || !one) {
++ if (!grp->pwe || !tmp1 || !pm1 || !one) {
+ wpa_printf(MSG_INFO, "EAP-pwd: unable to create bignums");
+ goto fail;
+ }
+
+- if (crypto_ec_cofactor(grp->group, cofactor) < 0) {
+- wpa_printf(MSG_INFO, "EAP-pwd: unable to get cofactor for "
+- "curve");
+- goto fail;
+- }
+ primebitlen = crypto_ec_prime_len_bits(grp->group);
+ primebytelen = crypto_ec_prime_len(grp->group);
+ if ((prfbuf = os_malloc(primebytelen)) == NULL) {
+@@ -340,19 +334,6 @@ int compute_password_element(EAP_PWD_group *grp, u16 num,
+ goto fail;
+ }
+
+- if (!crypto_bignum_is_one(cofactor)) {
+- /* make sure the point is not in a small sub-group */
+- if (crypto_ec_point_mul(grp->group, grp->pwe, cofactor,
+- grp->pwe) != 0) {
+- wpa_printf(MSG_INFO,
+- "EAP-pwd: cannot multiply generator by order");
+- goto fail;
+- }
+- if (crypto_ec_point_is_at_infinity(grp->group, grp->pwe)) {
+- wpa_printf(MSG_INFO, "EAP-pwd: point is at infinity");
+- goto fail;
+- }
+- }
+ wpa_printf(MSG_DEBUG, "EAP-pwd: found a PWE in %02d tries", found_ctr);
+
+ if (0) {
+@@ -362,7 +343,6 @@ int compute_password_element(EAP_PWD_group *grp, u16 num,
+ ret = 1;
+ }
+ /* cleanliness and order.... */
+- crypto_bignum_deinit(cofactor, 1);
+ crypto_bignum_deinit(x_candidate, 1);
+ crypto_bignum_deinit(pm1, 0);
+ crypto_bignum_deinit(tmp1, 1);
+@@ -464,7 +444,6 @@ struct crypto_ec_point * eap_pwd_get_element(EAP_PWD_group *group,
+ struct crypto_ec_point *element;
+ const struct crypto_bignum *prime;
+ size_t prime_len;
+- struct crypto_bignum *cofactor = NULL;
+
+ prime = crypto_ec_get_prime(group->group);
+ prime_len = crypto_ec_prime_len(group->group);
+@@ -489,35 +468,7 @@ struct crypto_ec_point * eap_pwd_get_element(EAP_PWD_group *group,
+ goto fail;
+ }
+
+- cofactor = crypto_bignum_init();
+- if (!cofactor || crypto_ec_cofactor(group->group, cofactor) < 0) {
+- wpa_printf(MSG_INFO,
+- "EAP-pwd: Unable to get cofactor for curve");
+- goto fail;
+- }
+-
+- if (!crypto_bignum_is_one(cofactor)) {
+- struct crypto_ec_point *point;
+- int ok = 1;
+-
+- /* check to ensure peer's element is not in a small sub-group */
+- point = crypto_ec_point_init(group->group);
+- if (!point ||
+- crypto_ec_point_mul(group->group, element,
+- cofactor, point) != 0 ||
+- crypto_ec_point_is_at_infinity(group->group, point))
+- ok = 0;
+- crypto_ec_point_deinit(point, 0);
+-
+- if (!ok) {
+- wpa_printf(MSG_INFO,
+- "EAP-pwd: Small sub-group check on peer element failed");
+- goto fail;
+- }
+- }
+-
+ out:
+- crypto_bignum_deinit(cofactor, 0);
+ return element;
+ fail:
+ crypto_ec_point_deinit(element, 0);
+diff --git a/src/eap_peer/eap_pwd.c b/src/eap_peer/eap_pwd.c
+index 4be4fcf35..46894a52f 100644
+--- a/src/eap_peer/eap_pwd.c
++++ b/src/eap_peer/eap_pwd.c
+@@ -309,7 +309,7 @@ eap_pwd_perform_commit_exchange(struct eap_sm *sm, struct eap_pwd_data *data,
+ const u8 *payload, size_t payload_len)
+ {
+ struct crypto_ec_point *K = NULL;
+- struct crypto_bignum *mask = NULL, *cofactor = NULL;
++ struct crypto_bignum *mask = NULL;
+ const u8 *ptr = payload;
+ u8 *scalar, *element;
+ size_t prime_len, order_len;
+@@ -527,21 +527,14 @@ eap_pwd_perform_commit_exchange(struct eap_sm *sm, struct eap_pwd_data *data,
+
+ data->private_value = crypto_bignum_init();
+ data->my_element = crypto_ec_point_init(data->grp->group);
+- cofactor = crypto_bignum_init();
+ data->my_scalar = crypto_bignum_init();
+ mask = crypto_bignum_init();
+- if (!data->private_value || !data->my_element || !cofactor ||
++ if (!data->private_value || !data->my_element ||
+ !data->my_scalar || !mask) {
+ wpa_printf(MSG_INFO, "EAP-PWD (peer): scalar allocation fail");
+ goto fin;
+ }
+
+- if (crypto_ec_cofactor(data->grp->group, cofactor) < 0) {
+- wpa_printf(MSG_INFO, "EAP-pwd (peer): unable to get cofactor "
+- "for curve");
+- goto fin;
+- }
+-
+ if (eap_pwd_get_rand_mask(data->grp, data->private_value, mask,
+ data->my_scalar) < 0)
+ goto fin;
+@@ -595,17 +588,8 @@ eap_pwd_perform_commit_exchange(struct eap_sm *sm, struct eap_pwd_data *data,
+ goto fin;
+ }
+
+- /* ensure that the shared key isn't in a small sub-group */
+- if (!crypto_bignum_is_one(cofactor)) {
+- if (crypto_ec_point_mul(data->grp->group, K, cofactor, K) < 0) {
+- wpa_printf(MSG_INFO, "EAP-PWD (peer): cannot multiply "
+- "shared key point by order");
+- goto fin;
+- }
+- }
+-
+ /*
+- * This check is strictly speaking just for the case above where
++ * This check is strictly speaking just for the case where
+ * co-factor > 1 but it was suggested that even though this is probably
+ * never going to happen it is a simple and safe check "just to be
+ * sure" so let's be safe.
+@@ -644,7 +628,6 @@ eap_pwd_perform_commit_exchange(struct eap_sm *sm, struct eap_pwd_data *data,
+
+ fin:
+ crypto_bignum_deinit(mask, 1);
+- crypto_bignum_deinit(cofactor, 1);
+ crypto_ec_point_deinit(K, 1);
+ if (data->outbuf == NULL)
+ eap_pwd_state(data, FAILURE);
+diff --git a/src/eap_server/eap_server_pwd.c b/src/eap_server/eap_server_pwd.c
+index 9799c8197..81ecd773f 100644
+--- a/src/eap_server/eap_server_pwd.c
++++ b/src/eap_server/eap_server_pwd.c
+@@ -648,7 +648,6 @@ eap_pwd_process_commit_resp(struct eap_sm *sm, struct eap_pwd_data *data,
+ const u8 *payload, size_t payload_len)
+ {
+ const u8 *ptr;
+- struct crypto_bignum *cofactor = NULL;
+ struct crypto_ec_point *K = NULL;
+ int res = 0;
+ size_t prime_len, order_len;
+@@ -667,20 +666,13 @@ eap_pwd_process_commit_resp(struct eap_sm *sm, struct eap_pwd_data *data,
+ }
+
+ data->k = crypto_bignum_init();
+- cofactor = crypto_bignum_init();
+ K = crypto_ec_point_init(data->grp->group);
+- if (!data->k || !cofactor || !K) {
++ if (!data->k || !K) {
+ wpa_printf(MSG_INFO, "EAP-PWD (server): peer data allocation "
+ "fail");
+ goto fin;
+ }
+
+- if (crypto_ec_cofactor(data->grp->group, cofactor) < 0) {
+- wpa_printf(MSG_INFO, "EAP-PWD (server): unable to get "
+- "cofactor for curve");
+- goto fin;
+- }
+-
+ /* element, x then y, followed by scalar */
+ ptr = payload;
+ data->peer_element = eap_pwd_get_element(data->grp, ptr);
+@@ -718,18 +710,8 @@ eap_pwd_process_commit_resp(struct eap_sm *sm, struct eap_pwd_data *data,
+ goto fin;
+ }
+
+- /* ensure that the shared key isn't in a small sub-group */
+- if (!crypto_bignum_is_one(cofactor)) {
+- if (crypto_ec_point_mul(data->grp->group, K, cofactor,
+- K) != 0) {
+- wpa_printf(MSG_INFO, "EAP-PWD (server): cannot "
+- "multiply shared key point by order!\n");
+- goto fin;
+- }
+- }
+-
+ /*
+- * This check is strictly speaking just for the case above where
++ * This check is strictly speaking just for the case where
+ * co-factor > 1 but it was suggested that even though this is probably
+ * never going to happen it is a simple and safe check "just to be
+ * sure" so let's be safe.
+@@ -748,7 +730,6 @@ eap_pwd_process_commit_resp(struct eap_sm *sm, struct eap_pwd_data *data,
+
+ fin:
+ crypto_ec_point_deinit(K, 1);
+- crypto_bignum_deinit(cofactor, 1);
+
+ if (res)
+ eap_pwd_state(data, PWD_Confirm_Req);
+--
+2.22.0
+
diff --git a/main/wpa_supplicant/0019-EAP-pwd-Use-const_time_memcmp-for-pwd_value-prime-co.patch b/main/wpa_supplicant/0019-EAP-pwd-Use-const_time_memcmp-for-pwd_value-prime-co.patch
new file mode 100644
index 0000000000..e27cd827e8
--- /dev/null
+++ b/main/wpa_supplicant/0019-EAP-pwd-Use-const_time_memcmp-for-pwd_value-prime-co.patch
@@ -0,0 +1,70 @@
+From 20d7bd83c43fb24c4cf84d3045254d3ee1957166 Mon Sep 17 00:00:00 2001
+From: Jouni Malinen <jouni@codeaurora.org>
+Date: Thu, 25 Apr 2019 19:07:05 +0300
+Subject: [PATCH 2/6] EAP-pwd: Use const_time_memcmp() for pwd_value >= prime
+ comparison
+
+This reduces timing and memory access pattern differences for an
+operation that could depend on the used password.
+
+Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
+(cherry picked from commit 7958223fdcfe82479e6ed71019a84f6d4cbf799c)
+---
+ src/eap_common/eap_pwd_common.c | 13 ++++++++-----
+ 1 file changed, 8 insertions(+), 5 deletions(-)
+
+diff --git a/src/eap_common/eap_pwd_common.c b/src/eap_common/eap_pwd_common.c
+index 884150e6c..6ca2c8bad 100644
+--- a/src/eap_common/eap_pwd_common.c
++++ b/src/eap_common/eap_pwd_common.c
+@@ -144,6 +144,7 @@ int compute_password_element(EAP_PWD_group *grp, u16 num,
+ u8 qnr_bin[MAX_ECC_PRIME_LEN];
+ u8 qr_or_qnr_bin[MAX_ECC_PRIME_LEN];
+ u8 x_bin[MAX_ECC_PRIME_LEN];
++ u8 prime_bin[MAX_ECC_PRIME_LEN];
+ struct crypto_bignum *tmp1 = NULL, *tmp2 = NULL, *pm1 = NULL;
+ struct crypto_hash *hash;
+ unsigned char pwe_digest[SHA256_MAC_LEN], *prfbuf = NULL, ctr;
+@@ -161,6 +162,11 @@ int compute_password_element(EAP_PWD_group *grp, u16 num,
+ os_memset(x_bin, 0, sizeof(x_bin));
+
+ prime = crypto_ec_get_prime(grp->group);
++ primebitlen = crypto_ec_prime_len_bits(grp->group);
++ primebytelen = crypto_ec_prime_len(grp->group);
++ if (crypto_bignum_to_bin(prime, prime_bin, sizeof(prime_bin),
++ primebytelen) < 0)
++ return -1;
+ grp->pwe = crypto_ec_point_init(grp->group);
+ tmp1 = crypto_bignum_init();
+ pm1 = crypto_bignum_init();
+@@ -170,8 +176,6 @@ int compute_password_element(EAP_PWD_group *grp, u16 num,
+ goto fail;
+ }
+
+- primebitlen = crypto_ec_prime_len_bits(grp->group);
+- primebytelen = crypto_ec_prime_len(grp->group);
+ if ((prfbuf = os_malloc(primebytelen)) == NULL) {
+ wpa_printf(MSG_INFO, "EAP-pwd: unable to malloc space for prf "
+ "buffer");
+@@ -237,6 +241,8 @@ int compute_password_element(EAP_PWD_group *grp, u16 num,
+ if (primebitlen % 8)
+ buf_shift_right(prfbuf, primebytelen,
+ 8 - primebitlen % 8);
++ if (const_time_memcmp(prfbuf, prime_bin, primebytelen) >= 0)
++ continue;
+
+ crypto_bignum_deinit(x_candidate, 1);
+ x_candidate = crypto_bignum_init_set(prfbuf, primebytelen);
+@@ -246,9 +252,6 @@ int compute_password_element(EAP_PWD_group *grp, u16 num,
+ goto fail;
+ }
+
+- if (crypto_bignum_cmp(x_candidate, prime) >= 0)
+- continue;
+-
+ wpa_hexdump_key(MSG_DEBUG, "EAP-pwd: x_candidate",
+ prfbuf, primebytelen);
+ const_time_select_bin(found, x_bin, prfbuf, primebytelen,
+--
+2.20.1
+
diff --git a/main/wpa_supplicant/0020-OpenSSL-Use-BN_bn2binpad-or-BN_bn2bin_padded-if-avai.patch b/main/wpa_supplicant/0020-OpenSSL-Use-BN_bn2binpad-or-BN_bn2bin_padded-if-avai.patch
new file mode 100644
index 0000000000..16feeaabb4
--- /dev/null
+++ b/main/wpa_supplicant/0020-OpenSSL-Use-BN_bn2binpad-or-BN_bn2bin_padded-if-avai.patch
@@ -0,0 +1,66 @@
+From ee34d8cfbd0fbf7ba7429531d4bee1c43b074d8b Mon Sep 17 00:00:00 2001
+From: Jouni Malinen <jouni@codeaurora.org>
+Date: Thu, 25 Apr 2019 19:23:05 +0300
+Subject: [PATCH 3/6] OpenSSL: Use BN_bn2binpad() or BN_bn2bin_padded() if
+ available
+
+This converts crypto_bignum_to_bin() to use the OpenSSL/BoringSSL
+functions BN_bn2binpad()/BN_bn2bin_padded(), when available, to avoid
+differences in runtime and memory access patterns depending on the
+leading bytes of the BIGNUM value.
+
+OpenSSL 1.0.2 and LibreSSL do not include such functions, so those cases
+are still using the previous implementation where the BN_num_bytes()
+call may result in different memory access pattern.
+
+Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
+(cherry picked from commit 1e237903f5b5d3117342daf006c5878cdb45e3d3)
+---
+ src/crypto/crypto_openssl.c | 16 ++++++++++++++++
+ 1 file changed, 16 insertions(+)
+
+diff --git a/src/crypto/crypto_openssl.c b/src/crypto/crypto_openssl.c
+index 1b0c1ec96..23ae5462d 100644
+--- a/src/crypto/crypto_openssl.c
++++ b/src/crypto/crypto_openssl.c
+@@ -1295,7 +1295,13 @@ void crypto_bignum_deinit(struct crypto_bignum *n, int clear)
+ int crypto_bignum_to_bin(const struct crypto_bignum *a,
+ u8 *buf, size_t buflen, size_t padlen)
+ {
++#ifdef OPENSSL_IS_BORINGSSL
++#else /* OPENSSL_IS_BORINGSSL */
++#if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER)
++#else
+ int num_bytes, offset;
++#endif
++#endif /* OPENSSL_IS_BORINGSSL */
+
+ if (TEST_FAIL())
+ return -1;
+@@ -1303,6 +1309,14 @@ int crypto_bignum_to_bin(const struct crypto_bignum *a,
+ if (padlen > buflen)
+ return -1;
+
++#ifdef OPENSSL_IS_BORINGSSL
++ if (BN_bn2bin_padded(buf, padlen, (const BIGNUM *) a) == 0)
++ return -1;
++ return padlen;
++#else /* OPENSSL_IS_BORINGSSL */
++#if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER)
++ return BN_bn2binpad((const BIGNUM *) a, buf, padlen);
++#else
+ num_bytes = BN_num_bytes((const BIGNUM *) a);
+ if ((size_t) num_bytes > buflen)
+ return -1;
+@@ -1315,6 +1329,8 @@ int crypto_bignum_to_bin(const struct crypto_bignum *a,
+ BN_bn2bin((const BIGNUM *) a, buf + offset);
+
+ return num_bytes + offset;
++#endif
++#endif /* OPENSSL_IS_BORINGSSL */
+ }
+
+
+--
+2.20.1
+
diff --git a/main/wpa_supplicant/0021-SAE-Run-through-prf-result-processing-even-if-it-pri.patch b/main/wpa_supplicant/0021-SAE-Run-through-prf-result-processing-even-if-it-pri.patch
new file mode 100644
index 0000000000..0a2f398527
--- /dev/null
+++ b/main/wpa_supplicant/0021-SAE-Run-through-prf-result-processing-even-if-it-pri.patch
@@ -0,0 +1,59 @@
+From a25b48118d75f3c2d7cb1b2c3b4cffb13091a34c Mon Sep 17 00:00:00 2001
+From: Jouni Malinen <j@w1.fi>
+Date: Mon, 24 Jun 2019 23:01:06 +0300
+Subject: [PATCH 4/6] SAE: Run through prf result processing even if it >=
+ prime
+
+This reduces differences in timing and memory access within the
+hunting-and-pecking loop for ECC groups that have a prime that is not
+close to a power of two (e.g., Brainpool curves).
+
+Signed-off-by: Jouni Malinen <j@w1.fi>
+(cherry picked from commit 147bf7b88a9c231322b5b574263071ca6dbb0503)
+---
+ src/common/sae.c | 15 ++++++++++++---
+ 1 file changed, 12 insertions(+), 3 deletions(-)
+
+diff --git a/src/common/sae.c b/src/common/sae.c
+index 0d56e5505..759e48e22 100644
+--- a/src/common/sae.c
++++ b/src/common/sae.c
+@@ -304,6 +304,8 @@ static int sae_test_pwd_seed_ecc(struct sae_data *sae, const u8 *pwd_seed,
+ struct crypto_bignum *y_sqr, *x_cand;
+ int res;
+ size_t bits;
++ int cmp_prime;
++ unsigned int in_range;
+
+ wpa_hexdump_key(MSG_DEBUG, "SAE: pwd-seed", pwd_seed, SHA256_MAC_LEN);
+
+@@ -317,8 +319,13 @@ static int sae_test_pwd_seed_ecc(struct sae_data *sae, const u8 *pwd_seed,
+ wpa_hexdump_key(MSG_DEBUG, "SAE: pwd-value",
+ pwd_value, sae->tmp->prime_len);
+
+- if (const_time_memcmp(pwd_value, prime, sae->tmp->prime_len) >= 0)
+- return 0;
++ cmp_prime = const_time_memcmp(pwd_value, prime, sae->tmp->prime_len);
++ /* Create a const_time mask for selection based on prf result
++ * being smaller than prime. */
++ in_range = const_time_fill_msb((unsigned int) cmp_prime);
++ /* The algorithm description would skip the next steps if
++ * cmp_prime >= 0 (reutnr 0 here), but go through them regardless to
++ * minimize externally observable differences in behavior. */
+
+ x_cand = crypto_bignum_init_set(pwd_value, sae->tmp->prime_len);
+ if (!x_cand)
+@@ -330,7 +337,9 @@ static int sae_test_pwd_seed_ecc(struct sae_data *sae, const u8 *pwd_seed,
+
+ res = is_quadratic_residue_blind(sae, prime, bits, qr, qnr, y_sqr);
+ crypto_bignum_deinit(y_sqr, 1);
+- return res;
++ if (res < 0)
++ return res;
++ return const_time_select_int(in_range, res, 0);
+ }
+
+
+--
+2.20.1
+
diff --git a/main/wpa_supplicant/0022-EAP-pwd-Run-through-prf-result-processing-even-if-it.patch b/main/wpa_supplicant/0022-EAP-pwd-Run-through-prf-result-processing-even-if-it.patch
new file mode 100644
index 0000000000..d5ebe59aec
--- /dev/null
+++ b/main/wpa_supplicant/0022-EAP-pwd-Run-through-prf-result-processing-even-if-it.patch
@@ -0,0 +1,57 @@
+From 00a6cc73da61b03c146b6c341d0d1e572bcef432 Mon Sep 17 00:00:00 2001
+From: Jouni Malinen <j@w1.fi>
+Date: Mon, 24 Jun 2019 23:02:51 +0300
+Subject: [PATCH 5/6] EAP-pwd: Run through prf result processing even if it >=
+ prime
+
+This reduces differences in timing and memory access within the
+hunting-and-pecking loop for ECC groups that have a prime that is not
+close to a power of two (e.g., Brainpool curves).
+
+Signed-off-by: Jouni Malinen <j@w1.fi>
+(cherry picked from commit cd803299ca485eb857e37c88f973fccfbb8600e5)
+---
+ src/eap_common/eap_pwd_common.c | 13 ++++++++++---
+ 1 file changed, 10 insertions(+), 3 deletions(-)
+
+diff --git a/src/eap_common/eap_pwd_common.c b/src/eap_common/eap_pwd_common.c
+index 6ca2c8bad..fec251472 100644
+--- a/src/eap_common/eap_pwd_common.c
++++ b/src/eap_common/eap_pwd_common.c
+@@ -155,6 +155,8 @@ int compute_password_element(EAP_PWD_group *grp, u16 num,
+ struct crypto_bignum *x_candidate = NULL;
+ const struct crypto_bignum *prime;
+ u8 mask, found_ctr = 0, is_odd = 0;
++ int cmp_prime;
++ unsigned int in_range;
+
+ if (grp->pwe)
+ return -1;
+@@ -241,8 +243,13 @@ int compute_password_element(EAP_PWD_group *grp, u16 num,
+ if (primebitlen % 8)
+ buf_shift_right(prfbuf, primebytelen,
+ 8 - primebitlen % 8);
+- if (const_time_memcmp(prfbuf, prime_bin, primebytelen) >= 0)
+- continue;
++ cmp_prime = const_time_memcmp(prfbuf, prime_bin, primebytelen);
++ /* Create a const_time mask for selection based on prf result
++ * being smaller than prime. */
++ in_range = const_time_fill_msb((unsigned int) cmp_prime);
++ /* The algorithm description would skip the next steps if
++ * cmp_prime >= 0, but go through them regardless to minimize
++ * externally observable differences in behavior. */
+
+ crypto_bignum_deinit(x_candidate, 1);
+ x_candidate = crypto_bignum_init_set(prfbuf, primebytelen);
+@@ -306,7 +313,7 @@ int compute_password_element(EAP_PWD_group *grp, u16 num,
+ goto fail;
+ mask = const_time_eq(res, check);
+ found_ctr = const_time_select_u8(found, found_ctr, ctr);
+- found |= mask;
++ found |= mask & in_range;
+ }
+ if (found == 0) {
+ wpa_printf(MSG_INFO,
+--
+2.20.1
+
diff --git a/main/wpa_supplicant/0023-EAP-pwd-Disallow-ECC-groups-with-a-prime-under-256-b.patch b/main/wpa_supplicant/0023-EAP-pwd-Disallow-ECC-groups-with-a-prime-under-256-b.patch
new file mode 100644
index 0000000000..0ffff7ea9d
--- /dev/null
+++ b/main/wpa_supplicant/0023-EAP-pwd-Disallow-ECC-groups-with-a-prime-under-256-b.patch
@@ -0,0 +1,45 @@
+From 92e1b96c26a84e503847bdd22ebadf697c4031ad Mon Sep 17 00:00:00 2001
+From: Jouni Malinen <j@w1.fi>
+Date: Sat, 13 Apr 2019 17:20:57 +0300
+Subject: [PATCH] EAP-pwd: Disallow ECC groups with a prime under 256 bits
+
+Based on the SAE implementation guidance update to not allow ECC groups
+with a prime that is under 256 bits, reject groups 25, 26, and 27 in
+EAP-pwd.
+
+Signed-off-by: Jouni Malinen <j@w1.fi>
+---
+ src/eap_common/eap_pwd_common.c | 13 +++++++++++++
+ 1 file changed, 13 insertions(+)
+
+diff --git a/src/eap_common/eap_pwd_common.c b/src/eap_common/eap_pwd_common.c
+index 4288b5299..00f85a390 100644
+--- a/src/eap_common/eap_pwd_common.c
++++ b/src/eap_common/eap_pwd_common.c
+@@ -85,10 +85,23 @@ static int eap_pwd_kdf(const u8 *key, size_t keylen, const u8 *label,
+ }
+
+
++static int eap_pwd_suitable_group(u16 num)
++{
++ /* Do not allow ECC groups with prime under 256 bits based on guidance
++ * for the similar design in SAE. */
++ return num == 19 || num == 20 || num == 21 ||
++ num == 28 || num == 29 || num == 30;
++}
++
++
+ EAP_PWD_group * get_eap_pwd_group(u16 num)
+ {
+ EAP_PWD_group *grp;
+
++ if (!eap_pwd_suitable_group(num)) {
++ wpa_printf(MSG_INFO, "EAP-pwd: unsuitable group %u", num);
++ return NULL;
++ }
+ grp = os_zalloc(sizeof(EAP_PWD_group));
+ if (!grp)
+ return NULL;
+--
+2.22.0
+
diff --git a/main/wpa_supplicant/0024-SAE-Reject-unsuitable-groups-based-on-REVmd-changes.patch b/main/wpa_supplicant/0024-SAE-Reject-unsuitable-groups-based-on-REVmd-changes.patch
new file mode 100644
index 0000000000..a7e6d37fb1
--- /dev/null
+++ b/main/wpa_supplicant/0024-SAE-Reject-unsuitable-groups-based-on-REVmd-changes.patch
@@ -0,0 +1,59 @@
+From db54db11aec763b6fc74715c36e0f9de0d65e206 Mon Sep 17 00:00:00 2001
+From: Jouni Malinen <jouni@codeaurora.org>
+Date: Mon, 8 Apr 2019 18:01:07 +0300
+Subject: [PATCH] SAE: Reject unsuitable groups based on REVmd changes
+
+The rules defining which DH groups are suitable for SAE use were
+accepted into IEEE 802.11 REVmd based on this document:
+https://mentor.ieee.org/802.11/dcn/19/11-19-0387-02-000m-addressing-some-sae-comments.docx
+
+Enforce those rules in production builds of wpa_supplicant and hostapd.
+CONFIG_TESTING_OPTIONS=y builds can still be used to select any o the
+implemented groups to maintain testing coverage.
+
+Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
+---
+ src/common/sae.c | 23 +++++++++++++++++++++++
+ 1 file changed, 23 insertions(+)
+
+diff --git a/src/common/sae.c b/src/common/sae.c
+index 981e788dc..8129a7c15 100644
+--- a/src/common/sae.c
++++ b/src/common/sae.c
+@@ -17,10 +17,33 @@
+ #include "sae.h"
+
+
++static int sae_suitable_group(int group)
++{
++#ifdef CONFIG_TESTING_OPTIONS
++ /* Allow all groups for testing purposes in non-production builds. */
++ return 1;
++#else /* CONFIG_TESTING_OPTIONS */
++ /* Enforce REVmd rules on which SAE groups are suitable for production
++ * purposes: FFC groups whose prime is >= 3072 bits and ECC groups
++ * defined over a prime field whose prime is >= 256 bits. Furthermore,
++ * ECC groups defined over a characteristic 2 finite field and ECC
++ * groups with a co-factor greater than 1 are not suitable. */
++ return group == 19 || group == 20 || group == 21 ||
++ group == 28 || group == 29 || group == 30 ||
++ group == 15 || group == 16 || group == 17 || group == 18;
++#endif /* CONFIG_TESTING_OPTIONS */
++}
++
++
+ int sae_set_group(struct sae_data *sae, int group)
+ {
+ struct sae_temporary_data *tmp;
+
++ if (!sae_suitable_group(group)) {
++ wpa_printf(MSG_DEBUG, "SAE: Reject unsuitable group %d", group);
++ return -1;
++ }
++
+ sae_clear_data(sae);
+ tmp = sae->tmp = os_zalloc(sizeof(*tmp));
+ if (tmp == NULL)
+--
+2.22.0
+
diff --git a/main/wpa_supplicant/0025-dragonfly-Disable-use-of-groups-using-Brainpool-curv.patch b/main/wpa_supplicant/0025-dragonfly-Disable-use-of-groups-using-Brainpool-curv.patch
new file mode 100644
index 0000000000..8dce92fffc
--- /dev/null
+++ b/main/wpa_supplicant/0025-dragonfly-Disable-use-of-groups-using-Brainpool-curv.patch
@@ -0,0 +1,51 @@
+From 558518ed63202e5358116ab7e0afd5e85490f2ef Mon Sep 17 00:00:00 2001
+From: Jouni Malinen <j@w1.fi>
+Date: Sat, 27 Jul 2019 23:19:17 +0300
+Subject: [PATCH 6/6] dragonfly: Disable use of groups using Brainpool curves
+
+Disable groups that use Brainpool curves for now since they leak more
+timing information due to the prime not being close to a power of two.
+This removes use of groups 28, 29, and 30 from SAE and EAP-pwd.
+
+Signed-off-by: Jouni Malinen <j@w1.fi>
+(cherry picked from commit 876c5eaa6dae1a87a17603fc489a44c29eedc2e3)
+---
+ src/common/sae.c | 6 ++++--
+ src/eap_common/eap_pwd_common.c | 3 +--
+ 2 files changed, 5 insertions(+), 4 deletions(-)
+
+diff --git a/src/common/sae.c b/src/common/sae.c
+index 759e48e22..2dbc251a4 100644
+--- a/src/common/sae.c
++++ b/src/common/sae.c
+@@ -28,9 +28,11 @@ static int sae_suitable_group(int group)
+ * purposes: FFC groups whose prime is >= 3072 bits and ECC groups
+ * defined over a prime field whose prime is >= 256 bits. Furthermore,
+ * ECC groups defined over a characteristic 2 finite field and ECC
+- * groups with a co-factor greater than 1 are not suitable. */
++ * groups with a co-factor greater than 1 are not suitable. Disable
++ * groups that use Brainpool curves as well for now since they leak more
++ * timing information due to the prime not being close to a power of
++ * two. */
+ return group == 19 || group == 20 || group == 21 ||
+- group == 28 || group == 29 || group == 30 ||
+ group == 15 || group == 16 || group == 17 || group == 18;
+ #endif /* CONFIG_TESTING_OPTIONS */
+ }
+diff --git a/src/eap_common/eap_pwd_common.c b/src/eap_common/eap_pwd_common.c
+index fec251472..4a5eb2599 100644
+--- a/src/eap_common/eap_pwd_common.c
++++ b/src/eap_common/eap_pwd_common.c
+@@ -89,8 +89,7 @@ static int eap_pwd_suitable_group(u16 num)
+ {
+ /* Do not allow ECC groups with prime under 256 bits based on guidance
+ * for the similar design in SAE. */
+- return num == 19 || num == 20 || num == 21 ||
+- num == 28 || num == 29 || num == 30;
++ return num == 19 || num == 20 || num == 21;
+ }
+
+
+--
+2.20.1
+
diff --git a/main/wpa_supplicant/APKBUILD b/main/wpa_supplicant/APKBUILD
index 0d232d9c87..6a13b28fdd 100644
--- a/main/wpa_supplicant/APKBUILD
+++ b/main/wpa_supplicant/APKBUILD
@@ -2,7 +2,7 @@
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=wpa_supplicant
pkgver=2.7
-pkgrel=3
+pkgrel=4
pkgdesc="A utility providing key negotiation for WPA wireless networks"
url="https://w1.fi/wpa_supplicant/"
arch="all"
@@ -32,11 +32,23 @@ source="https://w1.fi/releases/$pkgname-$pkgver.tar.gz
0013-EAP-pwd-Check-element-x-y-coordinates-explicitly.patch
0014-EAP-pwd-server-Fix-reassembly-buffer-handling.patch
0015-EAP-pwd-peer-Fix-reassembly-buffer-handling.patch
+ 0016-SAE-Use-const_time_memcmp-for-pwd_value-prime-compar.patch
+ 0017-EAP-pwd-Enforce-1-rand-mask-r-and-rand-mask-mod-r-1.patch
+ 0018-EAP-pwd-Remove-unused-checks-for-cofactor-1-cases.patch
+ 0019-EAP-pwd-Use-const_time_memcmp-for-pwd_value-prime-co.patch
+ 0020-OpenSSL-Use-BN_bn2binpad-or-BN_bn2bin_padded-if-avai.patch
+ 0021-SAE-Run-through-prf-result-processing-even-if-it-pri.patch
+ 0022-EAP-pwd-Run-through-prf-result-processing-even-if-it.patch
+ 0023-EAP-pwd-Disallow-ECC-groups-with-a-prime-under-256-b.patch
+ 0024-SAE-Reject-unsuitable-groups-based-on-REVmd-changes.patch
+ 0025-dragonfly-Disable-use-of-groups-using-Brainpool-curv.patch
config
wpa_cli.sh"
# secfixes:
+# 2.7-r4:
+# - CVE-2019-13377
# 2.7-r3:
# - CVE-2019-11555
# 2.7-r2:
@@ -144,5 +156,15 @@ c2ebe127e0d14c56b9e274a6f8f97c5fb763edc9dc7a3cab4cb1748d29a4d514c240e398ab140542
39cb011348a4723b52405bd6cd85f78da1a80e077b61ef0c489e5a0a03e21e30de38378554f1a81092b65cd923d1c3c430821812037a7607f582038d3ba26687 0013-EAP-pwd-Check-element-x-y-coordinates-explicitly.patch
7038044885871271ac724790663d5c0a428db83b41a691747be7a618ae893670a98f3ba52a297937249084296b0e9bcfd791edaa3928548efddb259e1a15f46c 0014-EAP-pwd-server-Fix-reassembly-buffer-handling.patch
99c734fe395b4231aa6a097a08a00e5dab65ea9c37a7c83b1904a37c39307d9e7e95485734b0d483687126f4100c75f8a7b1420f0a2edcbfe07b454a14548822 0015-EAP-pwd-peer-Fix-reassembly-buffer-handling.patch
+0dfc8728cfc3a86f7a182a7f71213b94f64880ee4470e2a939c83059df5af7a60d56ec0a8a5f2f717838995f4ef2c6a8fb909324875b0f12a52040239092d115 0016-SAE-Use-const_time_memcmp-for-pwd_value-prime-compar.patch
+abc2a40f9437280b1b0d3355f6485fd3d3b6412011e23b4699eb53eebbb761b7d6af553df5655bf5171dabf010f18bd9923a5589c295766d8b6643645b466146 0017-EAP-pwd-Enforce-1-rand-mask-r-and-rand-mask-mod-r-1.patch
+d9113a9f59cd35de88a2ef57e2f83c10986dddd3fa18652c3ddfe9f9d5db828d5fdd6385f2de9d6e8e11207c4b35fad2fb72d6698e554fc017cd369231115f44 0018-EAP-pwd-Remove-unused-checks-for-cofactor-1-cases.patch
+88b28f73267b5031417e527b4e2eea117e62649862bafbe99b83b77bade56612283279906c8d1a4c997fb8f32fc7a6cf8c88931a64e9520d1bf45fbdb0e6c381 0019-EAP-pwd-Use-const_time_memcmp-for-pwd_value-prime-co.patch
+01389b9d3951bf1148894c0f4b45d22ef8352a8fe1090721d17216506581305726f6a6c0ebff88479e5342330e75fc04db9201d7d65d4cc6b01a5f7258dc26f9 0020-OpenSSL-Use-BN_bn2binpad-or-BN_bn2bin_padded-if-avai.patch
+1fabc83a5e05ce3d09c89e37365d038bd0eec3a76683966ad172eac3c2c884dbc24fc6ca11c27a8f4582e886d0f1cde73bbede4484352b42a3f686d89d088fff 0021-SAE-Run-through-prf-result-processing-even-if-it-pri.patch
+bcae73930c35d441c5615970c305abb3dff293fdec16df50823e57419b22d1aac0e780970619e0c78b4482b7d07962bcf6162706a20e20f7b21a3a10f500eff1 0022-EAP-pwd-Run-through-prf-result-processing-even-if-it.patch
+89ac9ee8b0a3521b135ea5075fcc01ee37b111ba129e75f58e4bb863aad0e782c0e1928c91cab2ab1859a7a52d66987e14018b0552c167c05dbaeed76f1b12dd 0023-EAP-pwd-Disallow-ECC-groups-with-a-prime-under-256-b.patch
+da5f4248a0173cd7d07972b760631a8dc26f258e7b5be059c0d7de26e17f668945a62d2afce01ed1a1e9df6c55f9fd6ee344d4f006f5564b90a25e90e1e7c704 0024-SAE-Reject-unsuitable-groups-based-on-REVmd-changes.patch
+4734a8ab8ba1e91fc9e3d729f34527c14c291df238b02adea5acc04b0361b41d4bffca2fb13a4f464e9f007fa624117af4f50d755cb41a3129b4868da91bdf9a 0025-dragonfly-Disable-use-of-groups-using-Brainpool-curv.patch
6707991f9a071f2fcb09d164d31d12b1f52b91fbb5574b70b8d6f9727f72bbe42b03dd66d10fcc2126f5b7e49ac785657dec90e88b4bf54a9aa5638582f6e505 config
212c4265afce2e72b95a32cd785612d6c3e821b47101ead154136d184ac4add01434ada6c87edbb9a98496552e76e1a4d79c6b5840e3a5cfe5e6d602fceae576 wpa_cli.sh"
diff --git a/main/xen/APKBUILD b/main/xen/APKBUILD
index 5e014fa2e6..e62b69efa8 100644
--- a/main/xen/APKBUILD
+++ b/main/xen/APKBUILD
@@ -2,8 +2,8 @@
# Contributor: Roger Pau Monne <roger.pau@entel.upc.edu>
# Maintainer: William Pitcock <nenolod@dereferenced.org>
pkgname=xen
-pkgver=4.11.1
-pkgrel=2
+pkgver=4.11.2
+pkgrel=0
pkgdesc="Xen hypervisor"
url="https://www.xenproject.org/"
arch="x86_64 armhf aarch64" # enable armv7 when builds with gcc8
@@ -144,6 +144,19 @@ options="!strip"
# - CVE-2018-12127 XSA-297
# - CVE-2018-12130 XSA-297
# - CVE-2019-11091 XSA-297
+# 4.11.2-r0:
+# - CVE-????-????? XSA-284
+# - CVE-????-????? XSA-285
+# - CVE-????-????? XSA-286
+# - CVE-????-????? XSA-287
+# - CVE-????-????? XSA-288
+# - CVE-????-????? XSA-290
+# - CVE-????-????? XSA-291
+# - CVE-????-????? XSA-292
+# - CVE-????-????? XSA-293
+# - CVE-????-????? XSA-294
+# - CVE-????-????? XSA-295
+# - CVE-????-????? XSA-296
case "$CARCH" in
x86*)
@@ -178,7 +191,7 @@ _POLARSSL_VERSION="1.1.4"
_TPMEMU_VERSION="0.7.4"
# grep ^IPXE_GIT_TAG tools/firmware/etherboot/Makefile
-_IPXE_GIT_TAG=d2063b7693e0e35db97b2264aa987eb6341ae779
+_IPXE_GIT_TAG=356f6c1b64d7a97746d1816cef8ca22bdd8d0b5d
source="https://downloads.xenproject.org/release/$pkgname/$pkgver/$pkgname-$pkgver.tar.gz
https://xenbits.xen.org/xen-extfiles/gmp-$_GMP_VERSION.tar.bz2
@@ -211,20 +224,6 @@ source="https://downloads.xenproject.org/release/$pkgname/$pkgver/$pkgname-$pkgv
hotplug-Linux-iscsi-block-handle-lun-1.patch
- x86-msr-Shorten-ARCH_CAPABILITIES_-constants.patch
- x86-spec-ctrl-Extend-repoline-safey-calcuations-for-.patch
- xen-cmdline-Fix-buggy-strncmp-s-LITERAL-ss-s-constru.patch
- xen-Fix-backport-of-xen-cmdline-Fix-buggy-strncmp-s-.patch
- x86-tsx-Implement-controls-for-RTM-force-abort-mode.patch
- xen-Fix-backport-of-x86-tsx-Implement-controls-for-R.patch
- xsa297-4.11-1.patch
- xsa297-4.11-2.patch
- xsa297-4.11-3.patch
- xsa297-4.11-4.patch
- xsa297-4.11-5.patch
- xsa297-4.11-6.patch
- xsa297-4.11-7.patch
-
xenstored.initd
xenstored.confd
xenconsoled.initd
@@ -458,7 +457,7 @@ EOF
}
-sha512sums="c1655c5decdaed95a2b9a99652318cfc72f6cfdae957cfe60d635f7787e8850f33e8fafc4c4b8d61fb579c9b9d93028a6382903e71808a0418b931e76d72a649 xen-4.11.1.tar.gz
+sha512sums="48d3d926d35eb56c79c06d0abc6e6be2564fadb43367cc7f46881c669a75016707672179c2cca1c4cfb14af2cefd46e2e7f99470cddf7df2886d8435a2de814e xen-4.11.2.tar.gz
2e0b0fd23e6f10742a5517981e5171c6e88b0a93c83da701b296f5c0861d72c19782daab589a7eac3f9032152a0fc7eff7f5362db8fccc4859564a9aa82329cf gmp-4.3.2.tar.bz2
c2bc9ffc8583aeae71cee9ddcc4418969768d4e3764d47307da54f93981c0109fb07d84b061b3a3628bd00ba4d14a54742bc04848110eb3ae8ca25dbfbaabadb grub-0.97.tar.gz
1465b58279af1647f909450e394fe002ca165f0ff4a0254bfa9fe0e64316f50facdde2729d79a4e632565b4500cf4d6c74192ac0dd3bc9fe09129bbd67ba089d lwip-1.3.0.tar.gz
@@ -467,7 +466,7 @@ c2bc9ffc8583aeae71cee9ddcc4418969768d4e3764d47307da54f93981c0109fb07d84b061b3a36
88da614e4d3f4409c4fd3bb3e44c7587ba051e3fed4e33d526069a67e8180212e1ea22da984656f50e290049f60ddca65383e5983c0f8884f648d71f698303ad polarssl-1.1.4-gpl.tgz
4928b5b82f57645be9408362706ff2c4d9baa635b21b0d41b1c82930e8c60a759b1ea4fa74d7e6c7cae1b7692d006aa5cb72df0c3b88bf049779aa2b566f9d35 tpm_emulator-0.7.4.tar.gz
021b958fcd0d346c4ba761bcf0cc40f3522de6186cf5a0a6ea34a70504ce9622b1c2626fce40675bc8282cf5f5ade18473656abc38050f72f5d6480507a2106e zlib-1.2.3.tar.gz
-2b4ae8e65cd678dbb376f24001294eb54aead8d66456e06fc270dec178d90b282c1eb19731234d8b458054e49c5b8b8c4a89345c63ed0a4dafaf205e642b00b7 ipxe-git-d2063b7693e0e35db97b2264aa987eb6341ae779.tar.gz
+bbcce5e55040e7e29adebd4a5253a046016a6e2e7ff34cf801a42d147e1ec1af57e0297318249bfa9c5bbeac969fe4b37c18cbf845a80b2136d65387a4fc31da ipxe-git-356f6c1b64d7a97746d1816cef8ca22bdd8d0b5d.tar.gz
2d5a2fa1eec7f666db1b1748570076c252bf03023f354b46c12d9acfc796778f0bdb6ee2fe57ffd4b617283ae53005372c65d2762b759dd3749567dc6a0621dd fuzz-test-x86_emulator_disable_sse_before_including_always_inline.patch
df51f4d90b9ff0bf52506270ca9acfb51320de45a64714d03adf8f370ab070a5d9e458f21c93cac563d3d046afddd732c33252a6a1c7423093ec29843cf50255 tools-update-ipxe-changeset.patch
b9c754220187955d01ffbb6e030dace9d9aaae755db1765d07e407858c71a2cb0de04e0ab2099cd121d9e1bc1978af06c7dbd2fd805e06eca12ac5d527f15a52 mini-os-__divmoddi4.patch
@@ -481,19 +480,6 @@ e76816c6ad0e91dc5f81947f266da3429b20e6d976c3e8c41202c6179532eec878a3f0913921ef3a
69dfa60628ca838678862383528654ecbdf4269cbb5c9cfb6b84d976202a8dea85d711aa65a52fa1b477fb0b30604ca70cf1337192d6fb9388a08bbe7fe56077 xenstore_client_transaction_fix.patch
2094ea964fa610b2bf72fd2c7ede7e954899a75c0f5b08030cf1d74460fb759ade84866176e32f8fe29c921dfdc6dafd2b31e23ab9b0a3874d3dceeabdd1913b xenqemu-xattr-size-max.patch
8c9cfc6afca325df1d8026e21ed03fa8cd2c7e1a21a56cc1968301c5ab634bfe849951899e75d328951d7a41273d1e49a2448edbadec0029ed410c43c0549812 hotplug-Linux-iscsi-block-handle-lun-1.patch
-a74683f3f69b27ad19e6d50f829e5c4bc0cfdc572a5c02c655a2dff7f11aa835b348ed293a35a48c6d93310d40cb0ba9dcfd63289df89684a448fed100abdc1d x86-msr-Shorten-ARCH_CAPABILITIES_-constants.patch
-79f4fa555c3c575d2fc93d8421bb4dcb26a0eecf644193498b351dc145027293eb7bab34064ae5b2903f95b0651997d3c1ce63e22e91ae341b4ab9c87340a29a x86-spec-ctrl-Extend-repoline-safey-calcuations-for-.patch
-404b67fee48aea9d93152a911c8dd59b1aef9085780b9d848acac09ea70a009a57a888aa3fe2c26ce5f176731336c5eb0faf4e42255b1d64ef53ce9af82cde9a xen-cmdline-Fix-buggy-strncmp-s-LITERAL-ss-s-constru.patch
-a99890aebf1dacf0687bec794c1e4230be73ff7b9a44a83f0d761b2f5cbfb370b954ad6c32f54c029f9671e03c81660dbd0ca0a10b176240ad650a3ba68cae81 xen-Fix-backport-of-xen-cmdline-Fix-buggy-strncmp-s-.patch
-7809eb2b777684a8adc6866def8c3c6f6c835ff8a3161ae321a52e803525c1122f1253bf1522ec057f3f7f817335e7e2da242dc6884a6811dac40c4fed00abb1 x86-tsx-Implement-controls-for-RTM-force-abort-mode.patch
-3b34c063565b70f4aa84b2bd3ef450d549cd54e623d20b793a080e439e86622d50287583612a78f0f4dd7b2ba578011fd414364ea23e9ccf7af2eb22a62933e6 xen-Fix-backport-of-x86-tsx-Implement-controls-for-R.patch
-3d6d10039ffa87b47755b4fed8ba055078a5d0cd2681edf96dfd48683d62fb4bfd6634d8b204396ee6dfe4399558b8c1824a341c53b5f810bc1db916794edda2 xsa297-4.11-1.patch
-4d09e53dd839a46ee9a50cedc4c7ed6e308e7a6b579d686f9ce44b774cdbfcc0f914b4eda62c2ba5c795d1e31e8566ee250efad141d5a02b9c2e87bbf26b4365 xsa297-4.11-2.patch
-1b6b02823a4c2328390a290a0af5bf0642b8d89d8491ca8ce1df968b36aad76e11a0af5243ce13d8ae4ee40e97d93e7ea515c655c9bdca85c77dcaeb90a27b43 xsa297-4.11-3.patch
-de773e10d1c9fa223f89c030a2095cf476852c5339329a972780908d916a25c3687e0ac6eaf491f14d93679589c9c7d4ba287855d27fef2a82cca5313e0a9597 xsa297-4.11-4.patch
-0106761bbeaa60d556552677bd8e2a08ca1b06cc672d74ebf25eec063f97ee200c6edfc84bab154b6f156b8a06688525aaa6900cc9a8ab8b71bc65a50c052654 xsa297-4.11-5.patch
-d0a68c1f7be1a258fd147e7644a2cdfa8be576f5b81e1dbf4cd9f453152336e778e30969905300bd32d6cde65ad939069f2b4ee3e0ad1da3d3d29e7fd90682c5 xsa297-4.11-6.patch
-52ae2654bfa8864e5631b7a47abb552af388d88a46f307bf2c257f3189e25edb9699454ba1b3af22cf950fbe0252531dff470751ccec04a4b2c492cc3d2c344b xsa297-4.11-7.patch
52c43beb2596d645934d0f909f2d21f7587b6898ed5e5e7046799a8ed6d58f7a09c5809e1634fa26152f3fd4f3e7cfa07da7076f01b4a20cc8f5df8b9cb77e50 xenstored.initd
093f7fbd43faf0a16a226486a0776bade5dc1681d281c5946a3191c32d74f9699c6bf5d0ab8de9d1195a2461165d1660788e92a3156c9b3c7054d7b2d52d7ff0 xenstored.confd
3c86ed48fbee0af4051c65c4a3893f131fa66e47bf083caf20c9b6aa4b63fdead8832f84a58d0e27964bc49ec8397251b34e5be5c212c139f556916dc8da9523 xenconsoled.initd
diff --git a/main/xen/x86-msr-Shorten-ARCH_CAPABILITIES_-constants.patch b/main/xen/x86-msr-Shorten-ARCH_CAPABILITIES_-constants.patch
deleted file mode 100644
index 14a92178bc..0000000000
--- a/main/xen/x86-msr-Shorten-ARCH_CAPABILITIES_-constants.patch
+++ /dev/null
@@ -1,71 +0,0 @@
-From 0825fbdd62724577febeff11ae50d440992a8f11 Mon Sep 17 00:00:00 2001
-From: Andrew Cooper <andrew.cooper3@citrix.com>
-Date: Fri, 3 May 2019 10:55:10 +0200
-Subject: [PATCH 1/2] x86/msr: Shorten ARCH_CAPABILITIES_* constants
-
-They are unnecesserily verbose, and ARCH_CAPS_* is already the more common
-version.
-
-Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
-Acked-by: Jan Beulich <jbeulich@suse.com>
-master commit: ba27aaa88548c824a47dcf5609288ee1c05d2946
-master date: 2019-03-18 16:26:40 +0000
----
- xen/arch/x86/spec_ctrl.c | 10 +++++-----
- xen/include/asm-x86/msr-index.h | 4 ++--
- 2 files changed, 7 insertions(+), 7 deletions(-)
-
-diff --git a/xen/arch/x86/spec_ctrl.c b/xen/arch/x86/spec_ctrl.c
-index e641894f17..27b1158d84 100644
---- a/xen/arch/x86/spec_ctrl.c
-+++ b/xen/arch/x86/spec_ctrl.c
-@@ -286,8 +286,8 @@ static void __init print_details(enum ind_thunk thunk, uint64_t caps)
- (_7d0 & cpufeat_mask(X86_FEATURE_L1D_FLUSH)) ? " L1D_FLUSH" : "",
- (_7d0 & cpufeat_mask(X86_FEATURE_SSBD)) ? " SSBD" : "",
- (e8b & cpufeat_mask(X86_FEATURE_IBPB)) ? " IBPB" : "",
-- (caps & ARCH_CAPABILITIES_IBRS_ALL) ? " IBRS_ALL" : "",
-- (caps & ARCH_CAPABILITIES_RDCL_NO) ? " RDCL_NO" : "",
-+ (caps & ARCH_CAPS_IBRS_ALL) ? " IBRS_ALL" : "",
-+ (caps & ARCH_CAPS_RDCL_NO) ? " RDCL_NO" : "",
- (caps & ARCH_CAPS_RSBA) ? " RSBA" : "",
- (caps & ARCH_CAPS_SKIP_L1DFL) ? " SKIP_L1DFL": "",
- (caps & ARCH_CAPS_SSB_NO) ? " SSB_NO" : "");
-@@ -598,7 +598,7 @@ static __init void l1tf_calculations(uint64_t caps)
- }
-
- /* Any processor advertising RDCL_NO should be not vulnerable to L1TF. */
-- if ( caps & ARCH_CAPABILITIES_RDCL_NO )
-+ if ( caps & ARCH_CAPS_RDCL_NO )
- cpu_has_bug_l1tf = false;
-
- if ( cpu_has_bug_l1tf && hit_default )
-@@ -662,9 +662,9 @@ int8_t __read_mostly opt_xpti_domu = -1;
- static __init void xpti_init_default(uint64_t caps)
- {
- if ( boot_cpu_data.x86_vendor == X86_VENDOR_AMD )
-- caps = ARCH_CAPABILITIES_RDCL_NO;
-+ caps = ARCH_CAPS_RDCL_NO;
-
-- if ( caps & ARCH_CAPABILITIES_RDCL_NO )
-+ if ( caps & ARCH_CAPS_RDCL_NO )
- {
- if ( opt_xpti_hwdom < 0 )
- opt_xpti_hwdom = 0;
-diff --git a/xen/include/asm-x86/msr-index.h b/xen/include/asm-x86/msr-index.h
-index d13308ffe0..7588fc1567 100644
---- a/xen/include/asm-x86/msr-index.h
-+++ b/xen/include/asm-x86/msr-index.h
-@@ -44,8 +44,8 @@
- #define PRED_CMD_IBPB (_AC(1, ULL) << 0)
-
- #define MSR_ARCH_CAPABILITIES 0x0000010a
--#define ARCH_CAPABILITIES_RDCL_NO (_AC(1, ULL) << 0)
--#define ARCH_CAPABILITIES_IBRS_ALL (_AC(1, ULL) << 1)
-+#define ARCH_CAPS_RDCL_NO (_AC(1, ULL) << 0)
-+#define ARCH_CAPS_IBRS_ALL (_AC(1, ULL) << 1)
- #define ARCH_CAPS_RSBA (_AC(1, ULL) << 2)
- #define ARCH_CAPS_SKIP_L1DFL (_AC(1, ULL) << 3)
- #define ARCH_CAPS_SSB_NO (_AC(1, ULL) << 4)
---
-2.20.1
-
diff --git a/main/xen/x86-spec-ctrl-Extend-repoline-safey-calcuations-for-.patch b/main/xen/x86-spec-ctrl-Extend-repoline-safey-calcuations-for-.patch
deleted file mode 100644
index e311f8cec6..0000000000
--- a/main/xen/x86-spec-ctrl-Extend-repoline-safey-calcuations-for-.patch
+++ /dev/null
@@ -1,68 +0,0 @@
-From 3b062f5040a103d86b44c5e8412ff9555b00d06c Mon Sep 17 00:00:00 2001
-From: Andrew Cooper <andrew.cooper3@citrix.com>
-Date: Fri, 3 May 2019 10:55:55 +0200
-Subject: [PATCH 2/2] x86/spec-ctrl: Extend repoline safey calcuations for
- eIBRS and Atom parts
-
-All currently-released Atom processors are in practice retpoline-safe, because
-they don't fall back to a BTB prediction on RSB underflow.
-
-However, an additional meaning of Enhanced IRBS is that the processor may not
-be retpoline-safe. The Gemini Lake platform, based on the Goldmont Plus
-microarchitecture is the first Atom processor to support eIBRS.
-
-Until Xen gets full eIBRS support, Gemini Lake will still be safe using
-regular IBRS.
-
-Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
-Acked-by: Jan Beulich <jbeulich@suse.com>
-master commit: 17f74242ccf0ce6e51c03a5860947865c0ef0dc2
-master date: 2019-03-18 16:26:40 +0000
----
- xen/arch/x86/spec_ctrl.c | 22 +++++++++++++++++++++-
- 1 file changed, 21 insertions(+), 1 deletion(-)
-
-diff --git a/xen/arch/x86/spec_ctrl.c b/xen/arch/x86/spec_ctrl.c
-index 27b1158d84..8fa6c10528 100644
---- a/xen/arch/x86/spec_ctrl.c
-+++ b/xen/arch/x86/spec_ctrl.c
-@@ -365,8 +365,11 @@ static bool __init retpoline_safe(uint64_t caps)
- /*
- * RSBA may be set by a hypervisor to indicate that we may move to a
- * processor which isn't retpoline-safe.
-+ *
-+ * Processors offering Enhanced IBRS are not guarenteed to be
-+ * repoline-safe.
- */
-- if ( caps & ARCH_CAPS_RSBA )
-+ if ( caps & (ARCH_CAPS_RSBA | ARCH_CAPS_IBRS_ALL) )
- return false;
-
- switch ( boot_cpu_data.x86_model )
-@@ -426,6 +429,23 @@ static bool __init retpoline_safe(uint64_t caps)
- case 0x9e:
- return false;
-
-+ /*
-+ * Atom processors before Goldmont Plus/Gemini Lake are retpoline-safe.
-+ */
-+ case 0x1c: /* Pineview */
-+ case 0x26: /* Lincroft */
-+ case 0x27: /* Penwell */
-+ case 0x35: /* Cloverview */
-+ case 0x36: /* Cedarview */
-+ case 0x37: /* Baytrail / Valleyview (Silvermont) */
-+ case 0x4d: /* Avaton / Rangely (Silvermont) */
-+ case 0x4c: /* Cherrytrail / Brasswell */
-+ case 0x4a: /* Merrifield */
-+ case 0x5a: /* Moorefield */
-+ case 0x5c: /* Goldmont */
-+ case 0x5f: /* Denverton */
-+ return true;
-+
- default:
- printk("Unrecognised CPU model %#x - assuming not reptpoline safe\n",
- boot_cpu_data.x86_model);
---
-2.20.1
-
diff --git a/main/xen/x86-tsx-Implement-controls-for-RTM-force-abort-mode.patch b/main/xen/x86-tsx-Implement-controls-for-RTM-force-abort-mode.patch
deleted file mode 100644
index 880fc54f3c..0000000000
--- a/main/xen/x86-tsx-Implement-controls-for-RTM-force-abort-mode.patch
+++ /dev/null
@@ -1,194 +0,0 @@
-From fc46e159a6b1c379a0dac918120267b606d4defd Mon Sep 17 00:00:00 2001
-From: Andrew Cooper <andrew.cooper3@citrix.com>
-Date: Mon, 18 Mar 2019 17:08:25 +0100
-Subject: [PATCH] x86/tsx: Implement controls for RTM force-abort mode
-
-The CPUID bit and MSR are deliberately not exposed to guests, because they
-won't exist on newer processors. As vPMU isn't security supported, the
-misbehaviour of PCR3 isn't expected to impact production deployments.
-
-Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
-Reviewed-by: Jan Beulich <jbeulich@suse.com>
-master commit: 6be613f29b4205349275d24367bd4c82fb2960dd
-master date: 2019-03-12 17:05:21 +0000
----
- docs/misc/xen-command-line.markdown | 17 ++++++++++++++++-
- tools/misc/xen-cpuid.c | 2 ++
- xen/arch/x86/cpu/intel.c | 3 +++
- xen/arch/x86/cpu/vpmu.c | 5 +++++
- xen/arch/x86/msr.c | 4 ++++
- xen/include/asm-x86/cpufeature.h | 3 +++
- xen/include/asm-x86/msr-index.h | 3 +++
- xen/include/asm-x86/vpmu.h | 1 +
- xen/include/public/arch-x86/cpufeatureset.h | 1 +
- 9 files changed, 38 insertions(+), 1 deletion(-)
-
-diff --git a/docs/misc/xen-command-line.markdown b/docs/misc/xen-command-line.markdown
-index 8046cc8333..8e243808a1 100644
---- a/docs/misc/xen-command-line.markdown
-+++ b/docs/misc/xen-command-line.markdown
-@@ -2008,7 +2008,7 @@ Use Virtual Processor ID support if available. This prevents the need for TLB
- flushes on VM entry and exit, increasing performance.
-
- ### vpmu (x86)
--> `= ( <boolean> | { bts | ipc | arch [, ...] } )`
-+> `= ( <boolean> | { bts | ipc | arch | rtm-abort=<bool> [, ...] } )`
-
- > Default: `off`
-
-@@ -2034,6 +2034,21 @@ in the Pre-Defined Architectural Performance Events table from the Intel 64
- and IA-32 Architectures Software Developer's Manual, Volume 3B, System
- Programming Guide, Part 2.
-
-+vpmu=rtm-abort controls a trade-off between working Restricted Transactional
-+Memory, and working performance counters.
-+
-+All processors released to date (Q1 2019) supporting Transactional Memory
-+Extensions suffer an erratum which has been addressed in microcode.
-+
-+Processors based on the Skylake microarchitecture with up-to-date
-+microcode internally use performance counter 3 to work around the erratum.
-+A consequence is that the counter gets reprogrammed whenever an `XBEGIN`
-+instruction is executed.
-+
-+An alternative mode exists where PCR3 behaves as before, at the cost of
-+`XBEGIN` unconditionally aborting. Enabling `rtm-abort` mode will
-+activate this alternative mode.
-+
- If a boolean is not used, combinations of flags are allowed, comma separated.
- For example, vpmu=arch,bts.
-
-diff --git a/tools/misc/xen-cpuid.c b/tools/misc/xen-cpuid.c
-index 3888b4e158..0ac903a931 100644
---- a/tools/misc/xen-cpuid.c
-+++ b/tools/misc/xen-cpuid.c
-@@ -142,6 +142,8 @@ static const char *str_7d0[32] =
- {
- [ 2] = "avx512_4vnniw", [ 3] = "avx512_4fmaps",
-
-+ /* 12 */ [13] = "tsx-force-abort",
-+
- [26] = "ibrsb", [27] = "stibp",
- [28] = "l1d_flush", [29] = "arch_caps",
- /* 30 */ [31] = "ssbd",
-diff --git a/xen/arch/x86/cpu/intel.c b/xen/arch/x86/cpu/intel.c
-index 9477965321..8e23ed6379 100644
---- a/xen/arch/x86/cpu/intel.c
-+++ b/xen/arch/x86/cpu/intel.c
-@@ -287,6 +287,9 @@ static void Intel_errata_workarounds(struct cpuinfo_x86 *c)
- if (c->x86 == 6 && cpu_has_clflush &&
- (c->x86_model == 29 || c->x86_model == 46 || c->x86_model == 47))
- __set_bit(X86_FEATURE_CLFLUSH_MONITOR, c->x86_capability);
-+
-+ if (cpu_has_tsx_force_abort && opt_rtm_abort)
-+ wrmsrl(MSR_TSX_FORCE_ABORT, TSX_FORCE_ABORT_RTM);
- }
-
-
-diff --git a/xen/arch/x86/cpu/vpmu.c b/xen/arch/x86/cpu/vpmu.c
-index 2be61606b4..639ae0ca63 100644
---- a/xen/arch/x86/cpu/vpmu.c
-+++ b/xen/arch/x86/cpu/vpmu.c
-@@ -53,6 +53,7 @@ CHECK_pmu_params;
- static unsigned int __read_mostly opt_vpmu_enabled;
- unsigned int __read_mostly vpmu_mode = XENPMU_MODE_OFF;
- unsigned int __read_mostly vpmu_features = 0;
-+bool __read_mostly opt_rtm_abort;
- static int parse_vpmu_params(const char *s);
- custom_param("vpmu", parse_vpmu_params);
-
-@@ -71,6 +72,8 @@ static int __init parse_vpmu_params(const char *s)
- break;
- default:
- do {
-+ int val;
-+
- ss = strchr(s, ',');
- if ( !ss )
- ss = strchr(s, '\0');
-@@ -81,6 +84,8 @@ static int __init parse_vpmu_params(const char *s)
- vpmu_features |= XENPMU_FEATURE_IPC_ONLY;
- else if ( !cmdline_strcmp(s, "arch") )
- vpmu_features |= XENPMU_FEATURE_ARCH_ONLY;
-+ else if ( (val = parse_boolean("rtm-abort", s, ss)) >= 0 )
-+ opt_rtm_abort = val;
- else
- return -EINVAL;
-
-diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c
-index 1a591dd2b5..b49fbd8077 100644
---- a/xen/arch/x86/msr.c
-+++ b/xen/arch/x86/msr.c
-@@ -152,6 +152,8 @@ int guest_rdmsr(const struct vcpu *v, uint32_t msr, uint64_t *val)
- case MSR_PRED_CMD:
- case MSR_FLUSH_CMD:
- /* Write-only */
-+ case MSR_TSX_FORCE_ABORT:
-+ /* Not offered to guests. */
- goto gp_fault;
-
- case MSR_SPEC_CTRL:
-@@ -203,6 +205,8 @@ int guest_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val)
- case MSR_INTEL_PLATFORM_INFO:
- case MSR_ARCH_CAPABILITIES:
- /* Read-only */
-+ case MSR_TSX_FORCE_ABORT:
-+ /* Not offered to guests. */
- goto gp_fault;
-
- case MSR_AMD_PATCHLOADER:
-diff --git a/xen/include/asm-x86/cpufeature.h b/xen/include/asm-x86/cpufeature.h
-index 861cb0af93..1c699a8def 100644
---- a/xen/include/asm-x86/cpufeature.h
-+++ b/xen/include/asm-x86/cpufeature.h
-@@ -106,6 +106,9 @@
- /* CPUID level 0x80000007.edx */
- #define cpu_has_itsc boot_cpu_has(X86_FEATURE_ITSC)
-
-+/* CPUID level 0x00000007:0.edx */
-+#define cpu_has_tsx_force_abort boot_cpu_has(X86_FEATURE_TSX_FORCE_ABORT)
-+
- /* Synthesized. */
- #define cpu_has_arch_perfmon boot_cpu_has(X86_FEATURE_ARCH_PERFMON)
- #define cpu_has_cpuid_faulting boot_cpu_has(X86_FEATURE_CPUID_FAULTING)
-diff --git a/xen/include/asm-x86/msr-index.h b/xen/include/asm-x86/msr-index.h
-index 7235623c86..d13308ffe0 100644
---- a/xen/include/asm-x86/msr-index.h
-+++ b/xen/include/asm-x86/msr-index.h
-@@ -53,6 +53,9 @@
- #define MSR_FLUSH_CMD 0x0000010b
- #define FLUSH_CMD_L1D (_AC(1, ULL) << 0)
-
-+#define MSR_TSX_FORCE_ABORT 0x0000010f
-+#define TSX_FORCE_ABORT_RTM (_AC(1, ULL) << 0)
-+
- /* Intel MSRs. Some also available on other CPUs */
- #define MSR_IA32_PERFCTR0 0x000000c1
- #define MSR_IA32_A_PERFCTR0 0x000004c1
-diff --git a/xen/include/asm-x86/vpmu.h b/xen/include/asm-x86/vpmu.h
-index 5e778ab7ba..1287b9fb6e 100644
---- a/xen/include/asm-x86/vpmu.h
-+++ b/xen/include/asm-x86/vpmu.h
-@@ -125,6 +125,7 @@ static inline int vpmu_do_rdmsr(unsigned int msr, uint64_t *msr_content)
-
- extern unsigned int vpmu_mode;
- extern unsigned int vpmu_features;
-+extern bool opt_rtm_abort;
-
- /* Context switch */
- static inline void vpmu_switch_from(struct vcpu *prev)
-diff --git a/xen/include/public/arch-x86/cpufeatureset.h b/xen/include/public/arch-x86/cpufeatureset.h
-index 6c82816fd3..aa2656d792 100644
---- a/xen/include/public/arch-x86/cpufeatureset.h
-+++ b/xen/include/public/arch-x86/cpufeatureset.h
-@@ -242,6 +242,7 @@ XEN_CPUFEATURE(IBPB, 8*32+12) /*A IBPB support only (no IBRS, used by
- /* Intel-defined CPU features, CPUID level 0x00000007:0.edx, word 9 */
- XEN_CPUFEATURE(AVX512_4VNNIW, 9*32+ 2) /*A AVX512 Neural Network Instructions */
- XEN_CPUFEATURE(AVX512_4FMAPS, 9*32+ 3) /*A AVX512 Multiply Accumulation Single Precision */
-+XEN_CPUFEATURE(TSX_FORCE_ABORT, 9*32+13) /* MSR_TSX_FORCE_ABORT.RTM_ABORT */
- XEN_CPUFEATURE(IBRSB, 9*32+26) /*A IBRS and IBPB support (used by Intel) */
- XEN_CPUFEATURE(STIBP, 9*32+27) /*A STIBP */
- XEN_CPUFEATURE(L1D_FLUSH, 9*32+28) /*S MSR_FLUSH_CMD and L1D flush. */
---
-2.20.1
-
diff --git a/main/xen/xen-Fix-backport-of-x86-tsx-Implement-controls-for-R.patch b/main/xen/xen-Fix-backport-of-x86-tsx-Implement-controls-for-R.patch
deleted file mode 100644
index 4b50d3c469..0000000000
--- a/main/xen/xen-Fix-backport-of-x86-tsx-Implement-controls-for-R.patch
+++ /dev/null
@@ -1,34 +0,0 @@
-From 0ebfc81c091be150343d6ce948841a1e6cf89361 Mon Sep 17 00:00:00 2001
-From: Andrew Cooper <andrew.cooper3@citrix.com>
-Date: Fri, 3 May 2019 10:51:31 +0200
-Subject: [PATCH] xen: Fix backport of "x86/tsx: Implement controls for RTM
- force-abort mode"
-
-The posted version of this patch depends on c/s 3c555295 "x86/vpmu: Improve
-documentation and parsing for vpmu=" (Xen 4.12 and later) to prevent
-`vpmu=rtm-abort` impliying `vpmu=1`, which is outside of security support.
-
-Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
-Reviewed-by: Jan Beulich <jbeulich@suse.com>
----
- xen/arch/x86/cpu/vpmu.c | 4 ++++
- 1 file changed, 4 insertions(+)
-
-diff --git a/xen/arch/x86/cpu/vpmu.c b/xen/arch/x86/cpu/vpmu.c
-index 639ae0ca63..9a42e09a11 100644
---- a/xen/arch/x86/cpu/vpmu.c
-+++ b/xen/arch/x86/cpu/vpmu.c
-@@ -91,6 +91,10 @@ static int __init parse_vpmu_params(const char *s)
-
- s = ss + 1;
- } while ( *ss );
-+
-+ if ( !vpmu_features ) /* rtm-abort doesn't imply vpmu=1 */
-+ break;
-+
- /* fall through */
- case 1:
- /* Default VPMU mode */
---
-2.20.1
-
diff --git a/main/xen/xen-Fix-backport-of-xen-cmdline-Fix-buggy-strncmp-s-.patch b/main/xen/xen-Fix-backport-of-xen-cmdline-Fix-buggy-strncmp-s-.patch
deleted file mode 100644
index 4a822e6227..0000000000
--- a/main/xen/xen-Fix-backport-of-xen-cmdline-Fix-buggy-strncmp-s-.patch
+++ /dev/null
@@ -1,52 +0,0 @@
-From eb8acba82ad00cf3499de8dbd52cdc813b2d64e2 Mon Sep 17 00:00:00 2001
-From: Andrew Cooper <andrew.cooper3@citrix.com>
-Date: Fri, 3 May 2019 10:52:32 +0200
-Subject: [PATCH] xen: Fix backport of "xen/cmdline: Fix buggy strncmp(s,
- LITERAL, ss - s) construct"
-
-These were missed as a consequence of being rebased over other cmdline
-cleanup.
-
-Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
-Reviewed-by: Jan Beulich <jbeulich@suse.com>
----
- xen/arch/x86/dom0_build.c | 4 ++--
- xen/arch/x86/hvm/vmx/vmcs.c | 4 ++--
- 2 files changed, 4 insertions(+), 4 deletions(-)
-
-diff --git a/xen/arch/x86/dom0_build.c b/xen/arch/x86/dom0_build.c
-index b744791c38..dbd7d0d393 100644
---- a/xen/arch/x86/dom0_build.c
-+++ b/xen/arch/x86/dom0_build.c
-@@ -237,10 +237,10 @@ static int __init parse_dom0_param(const char *s)
- if ( !ss )
- ss = strchr(s, '\0');
-
-- if ( !strncmp(s, "pvh", ss - s) )
-+ if ( !cmdline_strcmp(s, "pvh") )
- dom0_pvh = true;
- #ifdef CONFIG_SHADOW_PAGING
-- else if ( !strncmp(s, "shadow", ss - s) )
-+ else if ( !cmdline_strcmp(s, "shadow") )
- opt_dom0_shadow = true;
- #endif
- else
-diff --git a/xen/arch/x86/hvm/vmx/vmcs.c b/xen/arch/x86/hvm/vmx/vmcs.c
-index 49c916b82d..19755f2716 100644
---- a/xen/arch/x86/hvm/vmx/vmcs.c
-+++ b/xen/arch/x86/hvm/vmx/vmcs.c
-@@ -90,9 +90,9 @@ static int __init parse_ept_param(const char *s)
- if ( !ss )
- ss = strchr(s, '\0');
-
-- if ( !strncmp(s, "pml", ss - s) )
-+ if ( !cmdline_strcmp(s, "pml") )
- opt_pml_enabled = val;
-- else if ( !strncmp(s, "ad", ss - s) )
-+ else if ( !cmdline_strcmp(s, "ad") )
- opt_ept_ad = val;
- else
- rc = -EINVAL;
---
-2.20.1
-
diff --git a/main/xen/xen-cmdline-Fix-buggy-strncmp-s-LITERAL-ss-s-constru.patch b/main/xen/xen-cmdline-Fix-buggy-strncmp-s-LITERAL-ss-s-constru.patch
deleted file mode 100644
index bbcc3a299f..0000000000
--- a/main/xen/xen-cmdline-Fix-buggy-strncmp-s-LITERAL-ss-s-constru.patch
+++ /dev/null
@@ -1,464 +0,0 @@
-From e202feb7131e66ed9186ad8766c9582502c98998 Mon Sep 17 00:00:00 2001
-From: Andrew Cooper <andrew.cooper3@citrix.com>
-Date: Fri, 1 Feb 2019 11:34:35 +0100
-Subject: [PATCH] xen/cmdline: Fix buggy strncmp(s, LITERAL, ss - s) construct
-
-When the command line parsing was updated to use const strings and no longer
-tokenise with NUL characters, string matches could no longer be made with
-strcmp().
-
-Unfortunately, the replacement was buggy. strncmp(s, "opt", ss - s) matches
-"o", "op" and "opt" on the command line, as ss - s may be shorter than the
-passed literal. Furthermore, parse_bool() is affected by this, so substrings
-such as "d", "e" and "o" are considered valid, with the latter being ambiguous
-between "on" and "off".
-
-Introduce a new strcmp-like function for the task, which looks for exact
-string matches, but declares success when the NUL of the literal matches a
-comma, colon or semicolon in the command line fragment.
-
-No change to the intended parsing functionality, but fixes cases where a
-partial string on the command line will inadvertently trigger options.
-
-A few areas were more than just a trivial change:
-
- * parse_irq_vector_map_param() gained some style corrections.
- * parse_vpmu_params() was rewritten to use the normal list-of-options form,
- rather than just fixing up parse_vpmu_param() and leaving the parsing being
- hard to follow.
- * Instead of making the trivial fix of adding an explicit length check in
- parse_bool(), use the length to select which token to we search for, which
- is more efficient than the previous linear search over all possible tokens.
-
-Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
-Reviewed-by: Jan Beulich <jbeulich@suse.com>
-Acked-by: Julien Grall <julien.grall@arm.com>
-master commit: 2ddf7e3e341df3ccf21613ff7ffd4b7693abe9e9
-master date: 2019-01-15 12:58:34 +0000
----
- xen/arch/x86/cpu/vpmu.c | 49 ++++++-----------
- xen/arch/x86/irq.c | 12 ++--
- xen/arch/x86/psr.c | 4 +-
- xen/arch/x86/spec_ctrl.c | 12 ++--
- xen/arch/x86/x86_64/mmconfig-shared.c | 4 +-
- xen/common/efi/boot.c | 4 +-
- xen/common/kernel.c | 79 +++++++++++++++++++++------
- xen/drivers/cpufreq/cpufreq.c | 6 +-
- xen/drivers/passthrough/iommu.c | 28 +++++-----
- xen/drivers/passthrough/pci.c | 4 +-
- xen/include/xen/lib.h | 7 +++
- 11 files changed, 124 insertions(+), 85 deletions(-)
-
-diff --git a/xen/arch/x86/cpu/vpmu.c b/xen/arch/x86/cpu/vpmu.c
-index b978e05613..2be61606b4 100644
---- a/xen/arch/x86/cpu/vpmu.c
-+++ b/xen/arch/x86/cpu/vpmu.c
-@@ -61,42 +61,31 @@ static unsigned vpmu_count;
-
- static DEFINE_PER_CPU(struct vcpu *, last_vcpu);
-
--static int parse_vpmu_param(const char *s, unsigned int len)
--{
-- if ( !*s || !len )
-- return 0;
-- if ( !strncmp(s, "bts", len) )
-- vpmu_features |= XENPMU_FEATURE_INTEL_BTS;
-- else if ( !strncmp(s, "ipc", len) )
-- vpmu_features |= XENPMU_FEATURE_IPC_ONLY;
-- else if ( !strncmp(s, "arch", len) )
-- vpmu_features |= XENPMU_FEATURE_ARCH_ONLY;
-- else
-- return 1;
-- return 0;
--}
--
- static int __init parse_vpmu_params(const char *s)
- {
-- const char *sep, *p = s;
-+ const char *ss;
-
- switch ( parse_bool(s, NULL) )
- {
- case 0:
- break;
- default:
-- for ( ; ; )
-- {
-- sep = strchr(p, ',');
-- if ( sep == NULL )
-- sep = strchr(p, 0);
-- if ( parse_vpmu_param(p, sep - p) )
-- goto error;
-- if ( !*sep )
-- /* reached end of flags */
-- break;
-- p = sep + 1;
-- }
-+ do {
-+ ss = strchr(s, ',');
-+ if ( !ss )
-+ ss = strchr(s, '\0');
-+
-+ if ( !cmdline_strcmp(s, "bts") )
-+ vpmu_features |= XENPMU_FEATURE_INTEL_BTS;
-+ else if ( !cmdline_strcmp(s, "ipc") )
-+ vpmu_features |= XENPMU_FEATURE_IPC_ONLY;
-+ else if ( !cmdline_strcmp(s, "arch") )
-+ vpmu_features |= XENPMU_FEATURE_ARCH_ONLY;
-+ else
-+ return -EINVAL;
-+
-+ s = ss + 1;
-+ } while ( *ss );
- /* fall through */
- case 1:
- /* Default VPMU mode */
-@@ -105,10 +94,6 @@ static int __init parse_vpmu_params(const char *s)
- break;
- }
- return 0;
--
-- error:
-- printk("VPMU: unknown flags: %s - vpmu disabled!\n", s);
-- return -EINVAL;
- }
-
- void vpmu_lvtpc_update(uint32_t val)
-diff --git a/xen/arch/x86/irq.c b/xen/arch/x86/irq.c
-index 87ef2e801f..0ceb9b9a1c 100644
---- a/xen/arch/x86/irq.c
-+++ b/xen/arch/x86/irq.c
-@@ -70,12 +70,12 @@ static int __init parse_irq_vector_map_param(const char *s)
- if ( !ss )
- ss = strchr(s, '\0');
-
-- if ( !strncmp(s, "none", ss - s))
-- opt_irq_vector_map=OPT_IRQ_VECTOR_MAP_NONE;
-- else if ( !strncmp(s, "global", ss - s))
-- opt_irq_vector_map=OPT_IRQ_VECTOR_MAP_GLOBAL;
-- else if ( !strncmp(s, "per-device", ss - s))
-- opt_irq_vector_map=OPT_IRQ_VECTOR_MAP_PERDEV;
-+ if ( !cmdline_strcmp(s, "none") )
-+ opt_irq_vector_map = OPT_IRQ_VECTOR_MAP_NONE;
-+ else if ( !cmdline_strcmp(s, "global") )
-+ opt_irq_vector_map = OPT_IRQ_VECTOR_MAP_GLOBAL;
-+ else if ( !cmdline_strcmp(s, "per-device") )
-+ opt_irq_vector_map = OPT_IRQ_VECTOR_MAP_PERDEV;
- else
- rc = -EINVAL;
-
-diff --git a/xen/arch/x86/psr.c b/xen/arch/x86/psr.c
-index 0ba8ef88d4..5866a261e3 100644
---- a/xen/arch/x86/psr.c
-+++ b/xen/arch/x86/psr.c
-@@ -591,13 +591,13 @@ static int __init parse_psr_param(const char *s)
- if ( val_delim > ss )
- val_delim = ss;
-
-- if ( *val_delim && !strncmp(s, "rmid_max", val_delim - s) )
-+ if ( *val_delim && !cmdline_strcmp(s, "rmid_max") )
- {
- opt_rmid_max = simple_strtoul(val_delim + 1, &q, 0);
- if ( *q && *q != ',' )
- rc = -EINVAL;
- }
-- else if ( *val_delim && !strncmp(s, "cos_max", val_delim - s) )
-+ else if ( *val_delim && !cmdline_strcmp(s, "cos_max") )
- {
- opt_cos_max = simple_strtoul(val_delim + 1, &q, 0);
- if ( *q && *q != ',' )
-diff --git a/xen/arch/x86/spec_ctrl.c b/xen/arch/x86/spec_ctrl.c
-index eb480c1f08..e641894f17 100644
---- a/xen/arch/x86/spec_ctrl.c
-+++ b/xen/arch/x86/spec_ctrl.c
-@@ -83,11 +83,11 @@ static int __init parse_bti(const char *s)
- {
- s += 6;
-
-- if ( !strncmp(s, "retpoline", ss - s) )
-+ if ( !cmdline_strcmp(s, "retpoline") )
- opt_thunk = THUNK_RETPOLINE;
-- else if ( !strncmp(s, "lfence", ss - s) )
-+ else if ( !cmdline_strcmp(s, "lfence") )
- opt_thunk = THUNK_LFENCE;
-- else if ( !strncmp(s, "jmp", ss - s) )
-+ else if ( !cmdline_strcmp(s, "jmp") )
- opt_thunk = THUNK_JMP;
- else
- rc = -EINVAL;
-@@ -194,11 +194,11 @@ static int __init parse_spec_ctrl(const char *s)
- {
- s += 10;
-
-- if ( !strncmp(s, "retpoline", ss - s) )
-+ if ( !cmdline_strcmp(s, "retpoline") )
- opt_thunk = THUNK_RETPOLINE;
-- else if ( !strncmp(s, "lfence", ss - s) )
-+ else if ( !cmdline_strcmp(s, "lfence") )
- opt_thunk = THUNK_LFENCE;
-- else if ( !strncmp(s, "jmp", ss - s) )
-+ else if ( !cmdline_strcmp(s, "jmp") )
- opt_thunk = THUNK_JMP;
- else
- rc = -EINVAL;
-diff --git a/xen/arch/x86/x86_64/mmconfig-shared.c b/xen/arch/x86/x86_64/mmconfig-shared.c
-index 7c3b7fd30b..01b5720445 100644
---- a/xen/arch/x86/x86_64/mmconfig-shared.c
-+++ b/xen/arch/x86/x86_64/mmconfig-shared.c
-@@ -46,8 +46,8 @@ static int __init parse_mmcfg(const char *s)
- case 1:
- break;
- default:
-- if ( !strncmp(s, "amd_fam10", ss - s) ||
-- !strncmp(s, "amd-fam10", ss - s) )
-+ if ( !cmdline_strcmp(s, "amd_fam10") ||
-+ !cmdline_strcmp(s, "amd-fam10") )
- pci_probe |= PCI_CHECK_ENABLE_AMD_MMCONF;
- else
- rc = -EINVAL;
-diff --git a/xen/common/efi/boot.c b/xen/common/efi/boot.c
-index 6be0b3986f..a9917f31f1 100644
---- a/xen/common/efi/boot.c
-+++ b/xen/common/efi/boot.c
-@@ -1323,14 +1323,14 @@ static int __init parse_efi_param(const char *s)
- if ( !ss )
- ss = strchr(s, '\0');
-
-- if ( !strncmp(s, "rs", ss - s) )
-+ if ( !cmdline_strcmp(s, "rs") )
- {
- if ( val )
- __set_bit(EFI_RS, &efi_flags);
- else
- __clear_bit(EFI_RS, &efi_flags);
- }
-- else if ( !strncmp(s, "attr=uc", ss - s) )
-+ else if ( !cmdline_strcmp(s, "attr=uc") )
- efi_map_uc = val;
- else
- rc = -EINVAL;
-diff --git a/xen/common/kernel.c b/xen/common/kernel.c
-index 5766a0f784..053c31d391 100644
---- a/xen/common/kernel.c
-+++ b/xen/common/kernel.c
-@@ -221,25 +221,51 @@ void __init cmdline_parse(const char *cmdline)
-
- int parse_bool(const char *s, const char *e)
- {
-- unsigned int len;
-+ size_t len = e ? ({ ASSERT(e >= s); e - s; }) : strlen(s);
-
-- len = e ? ({ ASSERT(e >= s); e - s; }) : strlen(s);
-- if ( !len )
-- return -1;
-+ switch ( len )
-+ {
-+ case 1:
-+ if ( *s == '1' )
-+ return 1;
-+ if ( *s == '0' )
-+ return 0;
-+ break;
-
-- if ( !strncmp("no", s, len) ||
-- !strncmp("off", s, len) ||
-- !strncmp("false", s, len) ||
-- !strncmp("disable", s, len) ||
-- !strncmp("0", s, len) )
-- return 0;
-+ case 2:
-+ if ( !strncmp("on", s, 2) )
-+ return 1;
-+ if ( !strncmp("no", s, 2) )
-+ return 0;
-+ break;
-+
-+ case 3:
-+ if ( !strncmp("yes", s, 3) )
-+ return 1;
-+ if ( !strncmp("off", s, 3) )
-+ return 0;
-+ break;
-+
-+ case 4:
-+ if ( !strncmp("true", s, 4) )
-+ return 1;
-+ break;
-+
-+ case 5:
-+ if ( !strncmp("false", s, 5) )
-+ return 0;
-+ break;
-
-- if ( !strncmp("yes", s, len) ||
-- !strncmp("on", s, len) ||
-- !strncmp("true", s, len) ||
-- !strncmp("enable", s, len) ||
-- !strncmp("1", s, len) )
-- return 1;
-+ case 6:
-+ if ( !strncmp("enable", s, 6) )
-+ return 1;
-+ break;
-+
-+ case 7:
-+ if ( !strncmp("disable", s, 7) )
-+ return 0;
-+ break;
-+ }
-
- return -1;
- }
-@@ -271,6 +297,27 @@ int parse_boolean(const char *name, const char *s, const char *e)
- return -1;
- }
-
-+int cmdline_strcmp(const char *frag, const char *name)
-+{
-+ for ( ; ; frag++, name++ )
-+ {
-+ unsigned char f = *frag, n = *name;
-+ int res = f - n;
-+
-+ if ( res || n == '\0' )
-+ {
-+ /*
-+ * NUL in 'name' matching a comma, colon or semicolon in 'frag'
-+ * implies success.
-+ */
-+ if ( n == '\0' && (f == ',' || f == ':' || f == ';') )
-+ res = 0;
-+
-+ return res;
-+ }
-+ }
-+}
-+
- unsigned int tainted;
-
- /**
-diff --git a/xen/drivers/cpufreq/cpufreq.c b/xen/drivers/cpufreq/cpufreq.c
-index 212f48f9f4..6152a045d9 100644
---- a/xen/drivers/cpufreq/cpufreq.c
-+++ b/xen/drivers/cpufreq/cpufreq.c
-@@ -73,7 +73,7 @@ static int __init setup_cpufreq_option(const char *str)
- arg = strchr(str, '\0');
- choice = parse_bool(str, arg);
-
-- if ( choice < 0 && !strncmp(str, "dom0-kernel", arg - str) )
-+ if ( choice < 0 && !cmdline_strcmp(str, "dom0-kernel") )
- {
- xen_processor_pmbits &= ~XEN_PROCESSOR_PM_PX;
- cpufreq_controller = FREQCTL_dom0_kernel;
-@@ -81,14 +81,14 @@ static int __init setup_cpufreq_option(const char *str)
- return 0;
- }
-
-- if ( choice == 0 || !strncmp(str, "none", arg - str) )
-+ if ( choice == 0 || !cmdline_strcmp(str, "none") )
- {
- xen_processor_pmbits &= ~XEN_PROCESSOR_PM_PX;
- cpufreq_controller = FREQCTL_none;
- return 0;
- }
-
-- if ( choice > 0 || !strncmp(str, "xen", arg - str) )
-+ if ( choice > 0 || !cmdline_strcmp(str, "xen") )
- {
- xen_processor_pmbits |= XEN_PROCESSOR_PM_PX;
- cpufreq_controller = FREQCTL_xen;
-diff --git a/xen/drivers/passthrough/iommu.c b/xen/drivers/passthrough/iommu.c
-index 2c44fabf99..f9b13b018c 100644
---- a/xen/drivers/passthrough/iommu.c
-+++ b/xen/drivers/passthrough/iommu.c
-@@ -95,36 +95,36 @@ static int __init parse_iommu_param(const char *s)
- b = parse_bool(s, ss);
- if ( b >= 0 )
- iommu_enable = b;
-- else if ( !strncmp(s, "force", ss - s) ||
-- !strncmp(s, "required", ss - s) )
-+ else if ( !cmdline_strcmp(s, "force") ||
-+ !cmdline_strcmp(s, "required") )
- force_iommu = val;
-- else if ( !strncmp(s, "workaround_bios_bug", ss - s) )
-+ else if ( !cmdline_strcmp(s, "workaround_bios_bug") )
- iommu_workaround_bios_bug = val;
-- else if ( !strncmp(s, "igfx", ss - s) )
-+ else if ( !cmdline_strcmp(s, "igfx") )
- iommu_igfx = val;
-- else if ( !strncmp(s, "verbose", ss - s) )
-+ else if ( !cmdline_strcmp(s, "verbose") )
- iommu_verbose = val;
-- else if ( !strncmp(s, "snoop", ss - s) )
-+ else if ( !cmdline_strcmp(s, "snoop") )
- iommu_snoop = val;
-- else if ( !strncmp(s, "qinval", ss - s) )
-+ else if ( !cmdline_strcmp(s, "qinval") )
- iommu_qinval = val;
-- else if ( !strncmp(s, "intremap", ss - s) )
-+ else if ( !cmdline_strcmp(s, "intremap") )
- iommu_intremap = val;
-- else if ( !strncmp(s, "intpost", ss - s) )
-+ else if ( !cmdline_strcmp(s, "intpost") )
- iommu_intpost = val;
-- else if ( !strncmp(s, "debug", ss - s) )
-+ else if ( !cmdline_strcmp(s, "debug") )
- {
- iommu_debug = val;
- if ( val )
- iommu_verbose = 1;
- }
-- else if ( !strncmp(s, "amd-iommu-perdev-intremap", ss - s) )
-+ else if ( !cmdline_strcmp(s, "amd-iommu-perdev-intremap") )
- amd_iommu_perdev_intremap = val;
-- else if ( !strncmp(s, "dom0-passthrough", ss - s) )
-+ else if ( !cmdline_strcmp(s, "dom0-passthrough") )
- iommu_passthrough = val;
-- else if ( !strncmp(s, "dom0-strict", ss - s) )
-+ else if ( !cmdline_strcmp(s, "dom0-strict") )
- iommu_dom0_strict = val;
-- else if ( !strncmp(s, "sharept", ss - s) )
-+ else if ( !cmdline_strcmp(s, "sharept") )
- iommu_hap_pt_share = val;
- else
- rc = -EINVAL;
-diff --git a/xen/drivers/passthrough/pci.c b/xen/drivers/passthrough/pci.c
-index 1db69d5b99..f51cae7f4e 100644
---- a/xen/drivers/passthrough/pci.c
-+++ b/xen/drivers/passthrough/pci.c
-@@ -212,12 +212,12 @@ static int __init parse_pci_param(const char *s)
- if ( !ss )
- ss = strchr(s, '\0');
-
-- if ( !strncmp(s, "serr", ss - s) )
-+ if ( !cmdline_strcmp(s, "serr") )
- {
- cmd_mask = PCI_COMMAND_SERR;
- brctl_mask = PCI_BRIDGE_CTL_SERR | PCI_BRIDGE_CTL_DTMR_SERR;
- }
-- else if ( !strncmp(s, "perr", ss - s) )
-+ else if ( !cmdline_strcmp(s, "perr") )
- {
- cmd_mask = PCI_COMMAND_PARITY;
- brctl_mask = PCI_BRIDGE_CTL_PARITY;
-diff --git a/xen/include/xen/lib.h b/xen/include/xen/lib.h
-index 1d9771340c..750f809968 100644
---- a/xen/include/xen/lib.h
-+++ b/xen/include/xen/lib.h
-@@ -81,6 +81,13 @@ int parse_bool(const char *s, const char *e);
- */
- int parse_boolean(const char *name, const char *s, const char *e);
-
-+/**
-+ * Very similar to strcmp(), but will declare a match if the NUL in 'name'
-+ * lines up with comma, colon or semicolon in 'frag'. Designed for picking
-+ * exact string matches out of a delimited command line list.
-+ */
-+int cmdline_strcmp(const char *frag, const char *name);
-+
- /*#define DEBUG_TRACE_DUMP*/
- #ifdef DEBUG_TRACE_DUMP
- extern void debugtrace_dump(void);
---
-2.20.1
-
diff --git a/main/xen/xsa297-4.11-1.patch b/main/xen/xsa297-4.11-1.patch
deleted file mode 100644
index 5dd503587f..0000000000
--- a/main/xen/xsa297-4.11-1.patch
+++ /dev/null
@@ -1,163 +0,0 @@
-From: Andrew Cooper <andrew.cooper3@citrix.com>
-Subject: x86/spec-ctrl: Reposition the XPTI command line parsing logic
-
-It has ended up in the middle of the mitigation calculation logic. Move it to
-be beside the other command line parsing.
-
-No functional change.
-
-Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
-Acked-by: Jan Beulich <jbeulich@suse.com>
-
-diff --git a/xen/arch/x86/spec_ctrl.c b/xen/arch/x86/spec_ctrl.c
-index 8fa6c10..949bbda 100644
---- a/xen/arch/x86/spec_ctrl.c
-+++ b/xen/arch/x86/spec_ctrl.c
-@@ -223,6 +223,73 @@ static int __init parse_spec_ctrl(const char *s)
- }
- custom_param("spec-ctrl", parse_spec_ctrl);
-
-+int8_t __read_mostly opt_xpti_hwdom = -1;
-+int8_t __read_mostly opt_xpti_domu = -1;
-+
-+static __init void xpti_init_default(uint64_t caps)
-+{
-+ if ( boot_cpu_data.x86_vendor == X86_VENDOR_AMD )
-+ caps = ARCH_CAPS_RDCL_NO;
-+
-+ if ( caps & ARCH_CAPS_RDCL_NO )
-+ {
-+ if ( opt_xpti_hwdom < 0 )
-+ opt_xpti_hwdom = 0;
-+ if ( opt_xpti_domu < 0 )
-+ opt_xpti_domu = 0;
-+ }
-+ else
-+ {
-+ if ( opt_xpti_hwdom < 0 )
-+ opt_xpti_hwdom = 1;
-+ if ( opt_xpti_domu < 0 )
-+ opt_xpti_domu = 1;
-+ }
-+}
-+
-+static __init int parse_xpti(const char *s)
-+{
-+ const char *ss;
-+ int val, rc = 0;
-+
-+ /* Interpret 'xpti' alone in its positive boolean form. */
-+ if ( *s == '\0' )
-+ opt_xpti_hwdom = opt_xpti_domu = 1;
-+
-+ do {
-+ ss = strchr(s, ',');
-+ if ( !ss )
-+ ss = strchr(s, '\0');
-+
-+ switch ( parse_bool(s, ss) )
-+ {
-+ case 0:
-+ opt_xpti_hwdom = opt_xpti_domu = 0;
-+ break;
-+
-+ case 1:
-+ opt_xpti_hwdom = opt_xpti_domu = 1;
-+ break;
-+
-+ default:
-+ if ( !strcmp(s, "default") )
-+ opt_xpti_hwdom = opt_xpti_domu = -1;
-+ else if ( (val = parse_boolean("dom0", s, ss)) >= 0 )
-+ opt_xpti_hwdom = val;
-+ else if ( (val = parse_boolean("domu", s, ss)) >= 0 )
-+ opt_xpti_domu = val;
-+ else if ( *s )
-+ rc = -EINVAL;
-+ break;
-+ }
-+
-+ s = ss + 1;
-+ } while ( *ss );
-+
-+ return rc;
-+}
-+custom_param("xpti", parse_xpti);
-+
- int8_t __read_mostly opt_pv_l1tf_hwdom = -1;
- int8_t __read_mostly opt_pv_l1tf_domu = -1;
-
-@@ -676,73 +743,6 @@ static __init void l1tf_calculations(uint64_t caps)
- : (3ul << (paddr_bits - 2))));
- }
-
--int8_t __read_mostly opt_xpti_hwdom = -1;
--int8_t __read_mostly opt_xpti_domu = -1;
--
--static __init void xpti_init_default(uint64_t caps)
--{
-- if ( boot_cpu_data.x86_vendor == X86_VENDOR_AMD )
-- caps = ARCH_CAPS_RDCL_NO;
--
-- if ( caps & ARCH_CAPS_RDCL_NO )
-- {
-- if ( opt_xpti_hwdom < 0 )
-- opt_xpti_hwdom = 0;
-- if ( opt_xpti_domu < 0 )
-- opt_xpti_domu = 0;
-- }
-- else
-- {
-- if ( opt_xpti_hwdom < 0 )
-- opt_xpti_hwdom = 1;
-- if ( opt_xpti_domu < 0 )
-- opt_xpti_domu = 1;
-- }
--}
--
--static __init int parse_xpti(const char *s)
--{
-- const char *ss;
-- int val, rc = 0;
--
-- /* Interpret 'xpti' alone in its positive boolean form. */
-- if ( *s == '\0' )
-- opt_xpti_hwdom = opt_xpti_domu = 1;
--
-- do {
-- ss = strchr(s, ',');
-- if ( !ss )
-- ss = strchr(s, '\0');
--
-- switch ( parse_bool(s, ss) )
-- {
-- case 0:
-- opt_xpti_hwdom = opt_xpti_domu = 0;
-- break;
--
-- case 1:
-- opt_xpti_hwdom = opt_xpti_domu = 1;
-- break;
--
-- default:
-- if ( !strcmp(s, "default") )
-- opt_xpti_hwdom = opt_xpti_domu = -1;
-- else if ( (val = parse_boolean("dom0", s, ss)) >= 0 )
-- opt_xpti_hwdom = val;
-- else if ( (val = parse_boolean("domu", s, ss)) >= 0 )
-- opt_xpti_domu = val;
-- else if ( *s )
-- rc = -EINVAL;
-- break;
-- }
--
-- s = ss + 1;
-- } while ( *ss );
--
-- return rc;
--}
--custom_param("xpti", parse_xpti);
--
- void __init init_speculation_mitigations(void)
- {
- enum ind_thunk thunk = THUNK_DEFAULT;
diff --git a/main/xen/xsa297-4.11-2.patch b/main/xen/xsa297-4.11-2.patch
deleted file mode 100644
index 7c6c006223..0000000000
--- a/main/xen/xsa297-4.11-2.patch
+++ /dev/null
@@ -1,54 +0,0 @@
-From: Andrew Cooper <andrew.cooper3@citrix.com>
-Subject: x86/msr: Definitions for MSR_INTEL_CORE_THREAD_COUNT
-
-This is a model specific register which details the current configuration
-cores and threads in the package. Because of how Hyperthread and Core
-configuration works works in firmware, the MSR it is de-facto constant and
-will remain unchanged until the next system reset.
-
-It is a read only MSR (so unilaterally reject writes), but for now retain its
-leaky-on-read properties. Further CPUID/MSR work is required before we can
-start virtualising a consistent topology to the guest, and retaining the old
-behaviour is the safest course of action.
-
-Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
-Acked-by: Jan Beulich <jbeulich@suse.com>
-
-diff --git a/xen/arch/x86/msr.c b/xen/arch/x86/msr.c
-index b49fbd8..153f36b 100644
---- a/xen/arch/x86/msr.c
-+++ b/xen/arch/x86/msr.c
-@@ -180,6 +180,10 @@ int guest_rdmsr(const struct vcpu *v, uint32_t msr, uint64_t *val)
- _MSR_MISC_FEATURES_CPUID_FAULTING;
- break;
-
-+ /*
-+ * TODO: Implement when we have better topology representation.
-+ case MSR_INTEL_CORE_THREAD_COUNT:
-+ */
- default:
- return X86EMUL_UNHANDLEABLE;
- }
-@@ -202,6 +206,7 @@ int guest_wrmsr(struct vcpu *v, uint32_t msr, uint64_t val)
- {
- uint64_t rsvd;
-
-+ case MSR_INTEL_CORE_THREAD_COUNT:
- case MSR_INTEL_PLATFORM_INFO:
- case MSR_ARCH_CAPABILITIES:
- /* Read-only */
-diff --git a/xen/include/asm-x86/msr-index.h b/xen/include/asm-x86/msr-index.h
-index 7588fc1..7cddfca 100644
---- a/xen/include/asm-x86/msr-index.h
-+++ b/xen/include/asm-x86/msr-index.h
-@@ -34,6 +34,10 @@
- #define EFER_KNOWN_MASK (EFER_SCE | EFER_LME | EFER_LMA | EFER_NX | \
- EFER_SVME | EFER_LMSLE | EFER_FFXSE)
-
-+#define MSR_INTEL_CORE_THREAD_COUNT 0x00000035
-+#define MSR_CTC_THREAD_MASK 0x0000ffff
-+#define MSR_CTC_CORE_MASK 0xffff0000
-+
- /* Speculation Controls. */
- #define MSR_SPEC_CTRL 0x00000048
- #define SPEC_CTRL_IBRS (_AC(1, ULL) << 0)
diff --git a/main/xen/xsa297-4.11-3.patch b/main/xen/xsa297-4.11-3.patch
deleted file mode 100644
index a6e59efaca..0000000000
--- a/main/xen/xsa297-4.11-3.patch
+++ /dev/null
@@ -1,109 +0,0 @@
-From: Andrew Cooper <andrew.cooper3@citrix.com>
-Subject: x86/boot: Detect the firmware SMT setting correctly on Intel hardware
-
-While boot_cpu_data.x86_num_siblings is an accurate value to use on AMD
-hardware, it isn't on Intel when the user has disabled Hyperthreading in the
-firmware. As a result, a user which has chosen to disable HT still gets
-nagged on L1TF-vulnerable hardware when they haven't chosen an explicit
-smt=<bool> setting.
-
-Make use of the largely-undocumented MSR_INTEL_CORE_THREAD_COUNT which in
-practice exists since Nehalem, when booting on real hardware. Fall back to
-using the ACPI table APIC IDs.
-
-While adjusting this logic, fix a latent bug in amd_get_topology(). The
-thread count field in CPUID.0x8000001e.ebx is documented as 8 bits wide,
-rather than 2 bits wide.
-
-Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
-Acked-by: Jan Beulich <jbeulich@suse.com>
-
-diff --git a/xen/arch/x86/cpu/amd.c b/xen/arch/x86/cpu/amd.c
-index 76078b5..894b892 100644
---- a/xen/arch/x86/cpu/amd.c
-+++ b/xen/arch/x86/cpu/amd.c
-@@ -505,7 +505,7 @@ static void amd_get_topology(struct cpuinfo_x86 *c)
- u32 eax, ebx, ecx, edx;
-
- cpuid(0x8000001e, &eax, &ebx, &ecx, &edx);
-- c->x86_num_siblings = ((ebx >> 8) & 0x3) + 1;
-+ c->x86_num_siblings = ((ebx >> 8) & 0xff) + 1;
-
- if (c->x86 < 0x17)
- c->compute_unit_id = ebx & 0xFF;
-diff --git a/xen/arch/x86/spec_ctrl.c b/xen/arch/x86/spec_ctrl.c
-index 949bbda..ac1be4a 100644
---- a/xen/arch/x86/spec_ctrl.c
-+++ b/xen/arch/x86/spec_ctrl.c
-@@ -417,6 +417,45 @@ static void __init print_details(enum ind_thunk thunk, uint64_t caps)
- opt_pv_l1tf_domu ? "enabled" : "disabled");
- }
-
-+static bool __init check_smt_enabled(void)
-+{
-+ uint64_t val;
-+ unsigned int cpu;
-+
-+ /*
-+ * x86_num_siblings defaults to 1 in the absence of other information, and
-+ * is adjusted based on other topology information found in CPUID leaves.
-+ *
-+ * On AMD hardware, it will be the current SMT configuration. On Intel
-+ * hardware, it will represent the maximum capability, rather than the
-+ * current configuration.
-+ */
-+ if ( boot_cpu_data.x86_num_siblings < 2 )
-+ return false;
-+
-+ /*
-+ * Intel Nehalem and later hardware does have an MSR which reports the
-+ * current count of cores/threads in the package.
-+ *
-+ * At the time of writing, it is almost completely undocumented, so isn't
-+ * virtualised reliably.
-+ */
-+ if ( boot_cpu_data.x86_vendor == X86_VENDOR_INTEL && !cpu_has_hypervisor &&
-+ !rdmsr_safe(MSR_INTEL_CORE_THREAD_COUNT, val) )
-+ return (MASK_EXTR(val, MSR_CTC_CORE_MASK) !=
-+ MASK_EXTR(val, MSR_CTC_THREAD_MASK));
-+
-+ /*
-+ * Search over the CPUs reported in the ACPI tables. Any whose APIC ID
-+ * has a non-zero thread id component indicates that SMT is active.
-+ */
-+ for_each_present_cpu ( cpu )
-+ if ( x86_cpu_to_apicid[cpu] & (boot_cpu_data.x86_num_siblings - 1) )
-+ return true;
-+
-+ return false;
-+}
-+
- /* Calculate whether Retpoline is known-safe on this CPU. */
- static bool __init retpoline_safe(uint64_t caps)
- {
-@@ -746,12 +785,14 @@ static __init void l1tf_calculations(uint64_t caps)
- void __init init_speculation_mitigations(void)
- {
- enum ind_thunk thunk = THUNK_DEFAULT;
-- bool use_spec_ctrl = false, ibrs = false;
-+ bool use_spec_ctrl = false, ibrs = false, hw_smt_enabled;
- uint64_t caps = 0;
-
- if ( boot_cpu_has(X86_FEATURE_ARCH_CAPS) )
- rdmsrl(MSR_ARCH_CAPABILITIES, caps);
-
-+ hw_smt_enabled = check_smt_enabled();
-+
- /*
- * Has the user specified any custom BTI mitigations? If so, follow their
- * instructions exactly and disable all heuristics.
-@@ -927,8 +968,7 @@ void __init init_speculation_mitigations(void)
- * However, if we are on affected hardware, with HT enabled, and the user
- * hasn't explicitly chosen whether to use HT or not, nag them to do so.
- */
-- if ( opt_smt == -1 && cpu_has_bug_l1tf && !pv_shim &&
-- boot_cpu_data.x86_num_siblings > 1 )
-+ if ( opt_smt == -1 && cpu_has_bug_l1tf && !pv_shim && hw_smt_enabled )
- warning_add(
- "Booted on L1TF-vulnerable hardware with SMT/Hyperthreading\n"
- "enabled. Please assess your configuration and choose an\n"
diff --git a/main/xen/xsa297-4.11-4.patch b/main/xen/xsa297-4.11-4.patch
deleted file mode 100644
index e6acc9ed52..0000000000
--- a/main/xen/xsa297-4.11-4.patch
+++ /dev/null
@@ -1,55 +0,0 @@
-From: Andrew Cooper <andrew.cooper3@citrix.com>
-Subject: x86/spec-ctrl: Misc non-functional cleanup
-
- * Identify BTI in the spec_ctrl_{enter,exit}_idle() comments, as other
- mitigations will shortly appear.
- * Use alternative_input() and cover the lack of memory cobber with a further
- barrier.
-
-Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
-Reviewed-by: Jan Beulich <jbeulich@suse.com>
-
-diff --git a/xen/include/asm-x86/spec_ctrl.h b/xen/include/asm-x86/spec_ctrl.h
-index c846354..4983071 100644
---- a/xen/include/asm-x86/spec_ctrl.h
-+++ b/xen/include/asm-x86/spec_ctrl.h
-@@ -61,6 +61,8 @@ static always_inline void spec_ctrl_enter_idle(struct cpu_info *info)
- uint32_t val = 0;
-
- /*
-+ * Branch Target Injection:
-+ *
- * Latch the new shadow value, then enable shadowing, then update the MSR.
- * There are no SMP issues here; only local processor ordering concerns.
- */
-@@ -68,8 +70,9 @@ static always_inline void spec_ctrl_enter_idle(struct cpu_info *info)
- barrier();
- info->spec_ctrl_flags |= SCF_use_shadow;
- barrier();
-- asm volatile ( ALTERNATIVE(ASM_NOP3, "wrmsr", X86_FEATURE_SC_MSR_IDLE)
-- :: "a" (val), "c" (MSR_SPEC_CTRL), "d" (0) : "memory" );
-+ alternative_input(ASM_NOP3, "wrmsr", X86_FEATURE_SC_MSR_IDLE,
-+ "a" (val), "c" (MSR_SPEC_CTRL), "d" (0));
-+ barrier();
- }
-
- /* WARNING! `ret`, `call *`, `jmp *` not safe before this call. */
-@@ -78,13 +81,16 @@ static always_inline void spec_ctrl_exit_idle(struct cpu_info *info)
- uint32_t val = info->xen_spec_ctrl;
-
- /*
-+ * Branch Target Injection:
-+ *
- * Disable shadowing before updating the MSR. There are no SMP issues
- * here; only local processor ordering concerns.
- */
- info->spec_ctrl_flags &= ~SCF_use_shadow;
- barrier();
-- asm volatile ( ALTERNATIVE(ASM_NOP3, "wrmsr", X86_FEATURE_SC_MSR_IDLE)
-- :: "a" (val), "c" (MSR_SPEC_CTRL), "d" (0) : "memory" );
-+ alternative_input(ASM_NOP3, "wrmsr", X86_FEATURE_SC_MSR_IDLE,
-+ "a" (val), "c" (MSR_SPEC_CTRL), "d" (0));
-+ barrier();
- }
-
- #endif /* !__X86_SPEC_CTRL_H__ */
diff --git a/main/xen/xsa297-4.11-5.patch b/main/xen/xsa297-4.11-5.patch
deleted file mode 100644
index f03c3d838a..0000000000
--- a/main/xen/xsa297-4.11-5.patch
+++ /dev/null
@@ -1,141 +0,0 @@
-From: Andrew Cooper <andrew.cooper3@citrix.com>
-Subject: x86/spec-ctrl: CPUID/MSR definitions for Microarchitectural Data
- Sampling
-
-The MD_CLEAR feature can be automatically offered to guests. No
-infrastructure is needed in Xen to support the guest making use of it.
-
-This is part of XSA-297, CVE-2018-12126, CVE-2018-12127, CVE-2018-12130, CVE-2019-11091.
-
-Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
-Reviewed-by: Jan Beulich <jbeulich@suse.com>
-
-diff --git a/docs/misc/xen-command-line.markdown b/docs/misc/xen-command-line.markdown
-index 8e24380..8260dfb 100644
---- a/docs/misc/xen-command-line.markdown
-+++ b/docs/misc/xen-command-line.markdown
-@@ -489,7 +489,7 @@ accounting for hardware capabilities as enumerated via CPUID.
-
- Currently accepted:
-
--The Speculation Control hardware features `ibrsb`, `stibp`, `ibpb`,
-+The Speculation Control hardware features `md-clear`, `ibrsb`, `stibp`, `ibpb`,
- `l1d-flush` and `ssbd` are used by default if available and applicable. They can
- be ignored, e.g. `no-ibrsb`, at which point Xen won't use them itself, and
- won't offer them to guests.
-diff --git a/tools/libxl/libxl_cpuid.c b/tools/libxl/libxl_cpuid.c
-index 52e16c2..5a1702d 100644
---- a/tools/libxl/libxl_cpuid.c
-+++ b/tools/libxl/libxl_cpuid.c
-@@ -202,6 +202,7 @@ int libxl_cpuid_parse_config(libxl_cpuid_policy_list *cpuid, const char* str)
-
- {"avx512-4vnniw",0x00000007, 0, CPUID_REG_EDX, 2, 1},
- {"avx512-4fmaps",0x00000007, 0, CPUID_REG_EDX, 3, 1},
-+ {"md-clear", 0x00000007, 0, CPUID_REG_EDX, 10, 1},
- {"ibrsb", 0x00000007, 0, CPUID_REG_EDX, 26, 1},
- {"stibp", 0x00000007, 0, CPUID_REG_EDX, 27, 1},
- {"l1d-flush", 0x00000007, 0, CPUID_REG_EDX, 28, 1},
-diff --git a/tools/misc/xen-cpuid.c b/tools/misc/xen-cpuid.c
-index 0ac903a..16697c4 100644
---- a/tools/misc/xen-cpuid.c
-+++ b/tools/misc/xen-cpuid.c
-@@ -142,6 +142,7 @@ static const char *str_7d0[32] =
- {
- [ 2] = "avx512_4vnniw", [ 3] = "avx512_4fmaps",
-
-+ [10] = "md-clear",
- /* 12 */ [13] = "tsx-force-abort",
-
- [26] = "ibrsb", [27] = "stibp",
-diff --git a/xen/arch/x86/cpuid.c b/xen/arch/x86/cpuid.c
-index 5cc89e2..497bd2a 100644
---- a/xen/arch/x86/cpuid.c
-+++ b/xen/arch/x86/cpuid.c
-@@ -28,7 +28,12 @@ static int __init parse_xen_cpuid(const char *s)
- if ( !ss )
- ss = strchr(s, '\0');
-
-- if ( (val = parse_boolean("ibpb", s, ss)) >= 0 )
-+ if ( (val = parse_boolean("md-clear", s, ss)) >= 0 )
-+ {
-+ if ( !val )
-+ setup_clear_cpu_cap(X86_FEATURE_MD_CLEAR);
-+ }
-+ else if ( (val = parse_boolean("ibpb", s, ss)) >= 0 )
- {
- if ( !val )
- setup_clear_cpu_cap(X86_FEATURE_IBPB);
-diff --git a/xen/arch/x86/spec_ctrl.c b/xen/arch/x86/spec_ctrl.c
-index ac1be4a..fdd90a8 100644
---- a/xen/arch/x86/spec_ctrl.c
-+++ b/xen/arch/x86/spec_ctrl.c
-@@ -347,17 +347,19 @@ static void __init print_details(enum ind_thunk thunk, uint64_t caps)
- printk("Speculative mitigation facilities:\n");
-
- /* Hardware features which pertain to speculative mitigations. */
-- printk(" Hardware features:%s%s%s%s%s%s%s%s%s%s\n",
-+ printk(" Hardware features:%s%s%s%s%s%s%s%s%s%s%s%s\n",
- (_7d0 & cpufeat_mask(X86_FEATURE_IBRSB)) ? " IBRS/IBPB" : "",
- (_7d0 & cpufeat_mask(X86_FEATURE_STIBP)) ? " STIBP" : "",
- (_7d0 & cpufeat_mask(X86_FEATURE_L1D_FLUSH)) ? " L1D_FLUSH" : "",
- (_7d0 & cpufeat_mask(X86_FEATURE_SSBD)) ? " SSBD" : "",
-+ (_7d0 & cpufeat_mask(X86_FEATURE_MD_CLEAR)) ? " MD_CLEAR" : "",
- (e8b & cpufeat_mask(X86_FEATURE_IBPB)) ? " IBPB" : "",
- (caps & ARCH_CAPS_IBRS_ALL) ? " IBRS_ALL" : "",
- (caps & ARCH_CAPS_RDCL_NO) ? " RDCL_NO" : "",
- (caps & ARCH_CAPS_RSBA) ? " RSBA" : "",
- (caps & ARCH_CAPS_SKIP_L1DFL) ? " SKIP_L1DFL": "",
-- (caps & ARCH_CAPS_SSB_NO) ? " SSB_NO" : "");
-+ (caps & ARCH_CAPS_SSB_NO) ? " SSB_NO" : "",
-+ (caps & ARCH_CAPS_MDS_NO) ? " MDS_NO" : "");
-
- /* Compiled-in support which pertains to mitigations. */
- if ( IS_ENABLED(CONFIG_INDIRECT_THUNK) || IS_ENABLED(CONFIG_SHADOW_PAGING) )
-@@ -394,19 +396,21 @@ static void __init print_details(enum ind_thunk thunk, uint64_t caps)
- * Alternatives blocks for protecting against and/or virtualising
- * mitigation support for guests.
- */
-- printk(" Support for VMs: PV:%s%s%s%s, HVM:%s%s%s%s\n",
-+ printk(" Support for VMs: PV:%s%s%s%s%s, HVM:%s%s%s%s%s\n",
- (boot_cpu_has(X86_FEATURE_SC_MSR_PV) ||
- boot_cpu_has(X86_FEATURE_SC_RSB_PV) ||
- opt_eager_fpu) ? "" : " None",
- boot_cpu_has(X86_FEATURE_SC_MSR_PV) ? " MSR_SPEC_CTRL" : "",
- boot_cpu_has(X86_FEATURE_SC_RSB_PV) ? " RSB" : "",
- opt_eager_fpu ? " EAGER_FPU" : "",
-+ boot_cpu_has(X86_FEATURE_MD_CLEAR) ? " MD_CLEAR" : "",
- (boot_cpu_has(X86_FEATURE_SC_MSR_HVM) ||
- boot_cpu_has(X86_FEATURE_SC_RSB_HVM) ||
- opt_eager_fpu) ? "" : " None",
- boot_cpu_has(X86_FEATURE_SC_MSR_HVM) ? " MSR_SPEC_CTRL" : "",
- boot_cpu_has(X86_FEATURE_SC_RSB_HVM) ? " RSB" : "",
-- opt_eager_fpu ? " EAGER_FPU" : "");
-+ opt_eager_fpu ? " EAGER_FPU" : "",
-+ boot_cpu_has(X86_FEATURE_MD_CLEAR) ? " MD_CLEAR" : "");
-
- printk(" XPTI (64-bit PV only): Dom0 %s, DomU %s\n",
- opt_xpti_hwdom ? "enabled" : "disabled",
-diff --git a/xen/include/asm-x86/msr-index.h b/xen/include/asm-x86/msr-index.h
-index 7cddfca..b8151d2 100644
---- a/xen/include/asm-x86/msr-index.h
-+++ b/xen/include/asm-x86/msr-index.h
-@@ -53,6 +53,7 @@
- #define ARCH_CAPS_RSBA (_AC(1, ULL) << 2)
- #define ARCH_CAPS_SKIP_L1DFL (_AC(1, ULL) << 3)
- #define ARCH_CAPS_SSB_NO (_AC(1, ULL) << 4)
-+#define ARCH_CAPS_MDS_NO (_AC(1, ULL) << 5)
-
- #define MSR_FLUSH_CMD 0x0000010b
- #define FLUSH_CMD_L1D (_AC(1, ULL) << 0)
-diff --git a/xen/include/public/arch-x86/cpufeatureset.h b/xen/include/public/arch-x86/cpufeatureset.h
-index aa2656d..a14d8a7 100644
---- a/xen/include/public/arch-x86/cpufeatureset.h
-+++ b/xen/include/public/arch-x86/cpufeatureset.h
-@@ -242,6 +242,7 @@ XEN_CPUFEATURE(IBPB, 8*32+12) /*A IBPB support only (no IBRS, used by
- /* Intel-defined CPU features, CPUID level 0x00000007:0.edx, word 9 */
- XEN_CPUFEATURE(AVX512_4VNNIW, 9*32+ 2) /*A AVX512 Neural Network Instructions */
- XEN_CPUFEATURE(AVX512_4FMAPS, 9*32+ 3) /*A AVX512 Multiply Accumulation Single Precision */
-+XEN_CPUFEATURE(MD_CLEAR, 9*32+10) /*A VERW clears microarchitectural buffers */
- XEN_CPUFEATURE(TSX_FORCE_ABORT, 9*32+13) /* MSR_TSX_FORCE_ABORT.RTM_ABORT */
- XEN_CPUFEATURE(IBRSB, 9*32+26) /*A IBRS and IBPB support (used by Intel) */
- XEN_CPUFEATURE(STIBP, 9*32+27) /*A STIBP */
diff --git a/main/xen/xsa297-4.11-6.patch b/main/xen/xsa297-4.11-6.patch
deleted file mode 100644
index 5d153a90e9..0000000000
--- a/main/xen/xsa297-4.11-6.patch
+++ /dev/null
@@ -1,134 +0,0 @@
-From: Andrew Cooper <andrew.cooper3@citrix.com>
-Subject: x86/spec-ctrl: Infrastructure to use VERW to flush pipeline buffers
-
-Three synthetic features are introduced, as we need individual control of
-each, depending on circumstances. A later change will enable them at
-appropriate points.
-
-The verw_sel field doesn't strictly need to live in struct cpu_info. It lives
-there because there is a convenient hole it can fill, and it reduces the
-complexity of the SPEC_CTRL_EXIT_TO_{PV,HVM} assembly by avoiding the need for
-any temporary stack maintenance.
-
-This is part of XSA-297, CVE-2018-12126, CVE-2018-12127, CVE-2018-12130, CVE-2019-11091.
-
-Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
-Reviewed-by: Jan Beulich <jbeulich@suse.com>
-
-diff --git a/xen/arch/x86/x86_64/asm-offsets.c b/xen/arch/x86/x86_64/asm-offsets.c
-index 5957c76..97cff49 100644
---- a/xen/arch/x86/x86_64/asm-offsets.c
-+++ b/xen/arch/x86/x86_64/asm-offsets.c
-@@ -129,6 +129,7 @@ void __dummy__(void)
-
- OFFSET(CPUINFO_guest_cpu_user_regs, struct cpu_info, guest_cpu_user_regs);
- OFFSET(CPUINFO_processor_id, struct cpu_info, processor_id);
-+ OFFSET(CPUINFO_verw_sel, struct cpu_info, verw_sel);
- OFFSET(CPUINFO_current_vcpu, struct cpu_info, current_vcpu);
- OFFSET(CPUINFO_cr4, struct cpu_info, cr4);
- OFFSET(CPUINFO_xen_cr3, struct cpu_info, xen_cr3);
-diff --git a/xen/include/asm-x86/cpufeatures.h b/xen/include/asm-x86/cpufeatures.h
-index 8e5cc53..96a5a01 100644
---- a/xen/include/asm-x86/cpufeatures.h
-+++ b/xen/include/asm-x86/cpufeatures.h
-@@ -33,3 +33,6 @@ XEN_CPUFEATURE(SC_RSB_HVM, (FSCAPINTS+0)*32+19) /* RSB overwrite needed for
- XEN_CPUFEATURE(NO_XPTI, (FSCAPINTS+0)*32+20) /* XPTI mitigation not in use */
- XEN_CPUFEATURE(SC_MSR_IDLE, (FSCAPINTS+0)*32+21) /* (SC_MSR_PV || SC_MSR_HVM) && default_xen_spec_ctrl */
- XEN_CPUFEATURE(XEN_LBR, (FSCAPINTS+0)*32+22) /* Xen uses MSR_DEBUGCTL.LBR */
-+XEN_CPUFEATURE(SC_VERW_PV, (FSCAPINTS+0)*32+23) /* VERW used by Xen for PV */
-+XEN_CPUFEATURE(SC_VERW_HVM, (FSCAPINTS+0)*32+24) /* VERW used by Xen for HVM */
-+XEN_CPUFEATURE(SC_VERW_IDLE, (FSCAPINTS+0)*32+25) /* VERW used by Xen for idle */
-diff --git a/xen/include/asm-x86/current.h b/xen/include/asm-x86/current.h
-index 5bd64b2..f3508c3 100644
---- a/xen/include/asm-x86/current.h
-+++ b/xen/include/asm-x86/current.h
-@@ -38,6 +38,7 @@ struct vcpu;
- struct cpu_info {
- struct cpu_user_regs guest_cpu_user_regs;
- unsigned int processor_id;
-+ unsigned int verw_sel;
- struct vcpu *current_vcpu;
- unsigned long per_cpu_offset;
- unsigned long cr4;
-diff --git a/xen/include/asm-x86/spec_ctrl.h b/xen/include/asm-x86/spec_ctrl.h
-index 4983071..333d180 100644
---- a/xen/include/asm-x86/spec_ctrl.h
-+++ b/xen/include/asm-x86/spec_ctrl.h
-@@ -53,6 +53,13 @@ static inline void init_shadow_spec_ctrl_state(void)
- info->shadow_spec_ctrl = 0;
- info->xen_spec_ctrl = default_xen_spec_ctrl;
- info->spec_ctrl_flags = default_spec_ctrl_flags;
-+
-+ /*
-+ * For least latency, the VERW selector should be a writeable data
-+ * descriptor resident in the cache. __HYPERVISOR_DS32 shares a cache
-+ * line with __HYPERVISOR_CS, so is expected to be very cache-hot.
-+ */
-+ info->verw_sel = __HYPERVISOR_DS32;
- }
-
- /* WARNING! `ret`, `call *`, `jmp *` not safe after this call. */
-@@ -73,6 +80,22 @@ static always_inline void spec_ctrl_enter_idle(struct cpu_info *info)
- alternative_input(ASM_NOP3, "wrmsr", X86_FEATURE_SC_MSR_IDLE,
- "a" (val), "c" (MSR_SPEC_CTRL), "d" (0));
- barrier();
-+
-+ /*
-+ * Microarchitectural Store Buffer Data Sampling:
-+ *
-+ * On vulnerable systems, store buffer entries are statically partitioned
-+ * between active threads. When entering idle, our store buffer entries
-+ * are re-partitioned to allow the other threads to use them.
-+ *
-+ * Flush the buffers to ensure that no sensitive data of ours can be
-+ * leaked by a sibling after it gets our store buffer entries.
-+ *
-+ * Note: VERW must be encoded with a memory operand, as it is only that
-+ * form which causes a flush.
-+ */
-+ alternative_input("", "verw %[sel]", X86_FEATURE_SC_VERW_IDLE,
-+ [sel] "m" (info->verw_sel));
- }
-
- /* WARNING! `ret`, `call *`, `jmp *` not safe before this call. */
-@@ -91,6 +114,17 @@ static always_inline void spec_ctrl_exit_idle(struct cpu_info *info)
- alternative_input(ASM_NOP3, "wrmsr", X86_FEATURE_SC_MSR_IDLE,
- "a" (val), "c" (MSR_SPEC_CTRL), "d" (0));
- barrier();
-+
-+ /*
-+ * Microarchitectural Store Buffer Data Sampling:
-+ *
-+ * On vulnerable systems, store buffer entries are statically partitioned
-+ * between active threads. When exiting idle, the other threads store
-+ * buffer entries are re-partitioned to give us some.
-+ *
-+ * We now have store buffer entries with stale data from sibling threads.
-+ * A flush if necessary will be performed on the return to guest path.
-+ */
- }
-
- #endif /* !__X86_SPEC_CTRL_H__ */
-diff --git a/xen/include/asm-x86/spec_ctrl_asm.h b/xen/include/asm-x86/spec_ctrl_asm.h
-index edace2a..9cc15e7 100644
---- a/xen/include/asm-x86/spec_ctrl_asm.h
-+++ b/xen/include/asm-x86/spec_ctrl_asm.h
-@@ -245,12 +245,16 @@
- /* Use when exiting to PV guest context. */
- #define SPEC_CTRL_EXIT_TO_PV \
- ALTERNATIVE "", \
-- DO_SPEC_CTRL_EXIT_TO_GUEST, X86_FEATURE_SC_MSR_PV
-+ DO_SPEC_CTRL_EXIT_TO_GUEST, X86_FEATURE_SC_MSR_PV; \
-+ ALTERNATIVE "", __stringify(verw CPUINFO_verw_sel(%rsp)), \
-+ X86_FEATURE_SC_VERW_PV
-
- /* Use when exiting to HVM guest context. */
- #define SPEC_CTRL_EXIT_TO_HVM \
- ALTERNATIVE "", \
-- DO_SPEC_CTRL_EXIT_TO_GUEST, X86_FEATURE_SC_MSR_HVM
-+ DO_SPEC_CTRL_EXIT_TO_GUEST, X86_FEATURE_SC_MSR_HVM; \
-+ ALTERNATIVE "", __stringify(verw CPUINFO_verw_sel(%rsp)), \
-+ X86_FEATURE_SC_VERW_HVM
-
- /*
- * Use in IST interrupt/exception context. May interrupt Xen or PV context.
diff --git a/main/xen/xsa297-4.11-7.patch b/main/xen/xsa297-4.11-7.patch
deleted file mode 100644
index 940191d8e2..0000000000
--- a/main/xen/xsa297-4.11-7.patch
+++ /dev/null
@@ -1,316 +0,0 @@
-From: Andrew Cooper <andrew.cooper3@citrix.com>
-Subject: x86/spec-ctrl: Introduce options to control VERW flushing
-
-The Microarchitectural Data Sampling vulnerability is split into categories
-with subtly different properties:
-
- MLPDS - Microarchitectural Load Port Data Sampling
- MSBDS - Microarchitectural Store Buffer Data Sampling
- MFBDS - Microarchitectural Fill Buffer Data Sampling
- MDSUM - Microarchitectural Data Sampling Uncacheable Memory
-
-MDSUM is a special case of the other three, and isn't distinguished further.
-
-These issues pertain to three microarchitectural buffers. The Load Ports, the
-Store Buffers and the Fill Buffers. Each of these structures are flushed by
-the new enhanced VERW functionality, but the conditions under which flushing
-is necessary vary.
-
-For this concise overview of the issues and default logic, the abbreviations
-SP (Store Port), FB (Fill Buffer), LP (Load Port) and HT (Hyperthreading) are
-used for brevity:
-
- * Vulnerable hardware is divided into two categories - parts which suffer
- from SP only, and parts with any other combination of vulnerabilities.
-
- * SP only has an HT interaction when the thread goes idle, due to the static
- partitioning of resources. LP and FB have HT interactions at all points,
- due to the competitive sharing of resources. All issues potentially leak
- data across the return-to-guest transition.
-
- * The microcode which implements VERW flushing also extends MSR_FLUSH_CMD, so
- we don't need to do both on the HVM return-to-guest path. However, some
- parts are not vulnerable to L1TF (therefore have no MSR_FLUSH_CMD), but are
- vulnerable to MDS, so do require VERW on the HVM path.
-
-Note that we deliberately support mds=1 even without MD_CLEAR in case the
-microcode has been updated but the feature bit not exposed.
-
-This is part of XSA-297, CVE-2018-12126, CVE-2018-12127, CVE-2018-12130, CVE-2019-11091.
-
-Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
-Reviewed-by: Jan Beulich <jbeulich@suse.com>
-
-diff --git a/docs/misc/xen-command-line.markdown b/docs/misc/xen-command-line.markdown
-index 8260dfb..8108bbf 100644
---- a/docs/misc/xen-command-line.markdown
-+++ b/docs/misc/xen-command-line.markdown
-@@ -1800,7 +1800,7 @@ is being interpreted as a custom timeout in milliseconds. Zero or boolean
- false disable the quirk workaround, which is also the default.
-
- ### spec-ctrl (x86)
--> `= List of [ <bool>, xen=<bool>, {pv,hvm,msr-sc,rsb}=<bool>,
-+> `= List of [ <bool>, xen=<bool>, {pv,hvm,msr-sc,rsb,md-clear}=<bool>,
- > bti-thunk=retpoline|lfence|jmp, {ibrs,ibpb,ssbd,eager-fpu,
- > l1d-flush}=<bool> ]`
-
-@@ -1824,9 +1824,10 @@ in place for guests to use.
-
- Use of a positive boolean value for either of these options is invalid.
-
--The booleans `pv=`, `hvm=`, `msr-sc=` and `rsb=` offer fine grained control
--over the alternative blocks used by Xen. These impact Xen's ability to
--protect itself, and Xen's ability to virtualise support for guests to use.
-+The booleans `pv=`, `hvm=`, `msr-sc=`, `rsb=` and `md-clear=` offer fine
-+grained control over the alternative blocks used by Xen. These impact Xen's
-+ability to protect itself, and Xen's ability to virtualise support for guests
-+to use.
-
- * `pv=` and `hvm=` offer control over all suboptions for PV and HVM guests
- respectively.
-@@ -1835,6 +1836,11 @@ protect itself, and Xen's ability to virtualise support for guests to use.
- guests and if disabled, guests will be unable to use IBRS/STIBP/SSBD/etc.
- * `rsb=` offers control over whether to overwrite the Return Stack Buffer /
- Return Address Stack on entry to Xen.
-+* `md-clear=` offers control over whether to use VERW to flush
-+ microarchitectural buffers on idle and exit from Xen. *Note: For
-+ compatibility with development versions of this fix, `mds=` is also accepted
-+ on Xen 4.12 and earlier as an alias. Consult vendor documentation in
-+ preference to here.*
-
- If Xen was compiled with INDIRECT\_THUNK support, `bti-thunk=` can be used to
- select which of the thunks gets patched into the `__x86_indirect_thunk_%reg`
-diff --git a/xen/arch/x86/spec_ctrl.c b/xen/arch/x86/spec_ctrl.c
-index fdd90a8..10fcd77 100644
---- a/xen/arch/x86/spec_ctrl.c
-+++ b/xen/arch/x86/spec_ctrl.c
-@@ -34,6 +34,8 @@ static bool __initdata opt_msr_sc_pv = true;
- static bool __initdata opt_msr_sc_hvm = true;
- static bool __initdata opt_rsb_pv = true;
- static bool __initdata opt_rsb_hvm = true;
-+static int8_t __initdata opt_md_clear_pv = -1;
-+static int8_t __initdata opt_md_clear_hvm = -1;
-
- /* Cmdline controls for Xen's speculative settings. */
- static enum ind_thunk {
-@@ -58,6 +60,9 @@ paddr_t __read_mostly l1tf_addr_mask, __read_mostly l1tf_safe_maddr;
- static bool __initdata cpu_has_bug_l1tf;
- static unsigned int __initdata l1d_maxphysaddr;
-
-+static bool __initdata cpu_has_bug_msbds_only; /* => minimal HT impact. */
-+static bool __initdata cpu_has_bug_mds; /* Any other M{LP,SB,FB}DS combination. */
-+
- static int __init parse_bti(const char *s)
- {
- const char *ss;
-@@ -150,6 +155,8 @@ static int __init parse_spec_ctrl(const char *s)
- disable_common:
- opt_rsb_pv = false;
- opt_rsb_hvm = false;
-+ opt_md_clear_pv = 0;
-+ opt_md_clear_hvm = 0;
-
- opt_thunk = THUNK_JMP;
- opt_ibrs = 0;
-@@ -172,11 +179,13 @@ static int __init parse_spec_ctrl(const char *s)
- {
- opt_msr_sc_pv = val;
- opt_rsb_pv = val;
-+ opt_md_clear_pv = val;
- }
- else if ( (val = parse_boolean("hvm", s, ss)) >= 0 )
- {
- opt_msr_sc_hvm = val;
- opt_rsb_hvm = val;
-+ opt_md_clear_hvm = val;
- }
- else if ( (val = parse_boolean("msr-sc", s, ss)) >= 0 )
- {
-@@ -188,6 +197,12 @@ static int __init parse_spec_ctrl(const char *s)
- opt_rsb_pv = val;
- opt_rsb_hvm = val;
- }
-+ else if ( (val = parse_boolean("md-clear", s, ss)) >= 0 ||
-+ (val = parse_boolean("mds", s, ss)) >= 0 )
-+ {
-+ opt_md_clear_pv = val;
-+ opt_md_clear_hvm = val;
-+ }
-
- /* Xen's speculative sidechannel mitigation settings. */
- else if ( !strncmp(s, "bti-thunk=", 10) )
-@@ -373,7 +388,7 @@ static void __init print_details(enum ind_thunk thunk, uint64_t caps)
- "\n");
-
- /* Settings for Xen's protection, irrespective of guests. */
-- printk(" Xen settings: BTI-Thunk %s, SPEC_CTRL: %s%s, Other:%s%s\n",
-+ printk(" Xen settings: BTI-Thunk %s, SPEC_CTRL: %s%s, Other:%s%s%s\n",
- thunk == THUNK_NONE ? "N/A" :
- thunk == THUNK_RETPOLINE ? "RETPOLINE" :
- thunk == THUNK_LFENCE ? "LFENCE" :
-@@ -383,7 +398,8 @@ static void __init print_details(enum ind_thunk thunk, uint64_t caps)
- !boot_cpu_has(X86_FEATURE_SSBD) ? "" :
- (default_xen_spec_ctrl & SPEC_CTRL_SSBD) ? " SSBD+" : " SSBD-",
- opt_ibpb ? " IBPB" : "",
-- opt_l1d_flush ? " L1D_FLUSH" : "");
-+ opt_l1d_flush ? " L1D_FLUSH" : "",
-+ opt_md_clear_pv || opt_md_clear_hvm ? " VERW" : "");
-
- /* L1TF diagnostics, printed if vulnerable or PV shadowing is in use. */
- if ( cpu_has_bug_l1tf || opt_pv_l1tf_hwdom || opt_pv_l1tf_domu )
-@@ -786,6 +802,107 @@ static __init void l1tf_calculations(uint64_t caps)
- : (3ul << (paddr_bits - 2))));
- }
-
-+/* Calculate whether this CPU is vulnerable to MDS. */
-+static __init void mds_calculations(uint64_t caps)
-+{
-+ /* MDS is only known to affect Intel Family 6 processors at this time. */
-+ if ( boot_cpu_data.x86_vendor != X86_VENDOR_INTEL ||
-+ boot_cpu_data.x86 != 6 )
-+ return;
-+
-+ /* Any processor advertising MDS_NO should be not vulnerable to MDS. */
-+ if ( caps & ARCH_CAPS_MDS_NO )
-+ return;
-+
-+ switch ( boot_cpu_data.x86_model )
-+ {
-+ /*
-+ * Core processors since at least Nehalem are vulnerable.
-+ */
-+ case 0x1f: /* Auburndale / Havendale */
-+ case 0x1e: /* Nehalem */
-+ case 0x1a: /* Nehalem EP */
-+ case 0x2e: /* Nehalem EX */
-+ case 0x25: /* Westmere */
-+ case 0x2c: /* Westmere EP */
-+ case 0x2f: /* Westmere EX */
-+ case 0x2a: /* SandyBridge */
-+ case 0x2d: /* SandyBridge EP/EX */
-+ case 0x3a: /* IvyBridge */
-+ case 0x3e: /* IvyBridge EP/EX */
-+ case 0x3c: /* Haswell */
-+ case 0x3f: /* Haswell EX/EP */
-+ case 0x45: /* Haswell D */
-+ case 0x46: /* Haswell H */
-+ case 0x3d: /* Broadwell */
-+ case 0x47: /* Broadwell H */
-+ case 0x4f: /* Broadwell EP/EX */
-+ case 0x56: /* Broadwell D */
-+ case 0x4e: /* Skylake M */
-+ case 0x5e: /* Skylake D */
-+ cpu_has_bug_mds = true;
-+ break;
-+
-+ /*
-+ * Some Core processors have per-stepping vulnerability.
-+ */
-+ case 0x55: /* Skylake-X / Cascade Lake */
-+ if ( boot_cpu_data.x86_mask <= 5 )
-+ cpu_has_bug_mds = true;
-+ break;
-+
-+ case 0x8e: /* Kaby / Coffee / Whiskey Lake M */
-+ if ( boot_cpu_data.x86_mask <= 0xb )
-+ cpu_has_bug_mds = true;
-+ break;
-+
-+ case 0x9e: /* Kaby / Coffee / Whiskey Lake D */
-+ if ( boot_cpu_data.x86_mask <= 0xc )
-+ cpu_has_bug_mds = true;
-+ break;
-+
-+ /*
-+ * Very old and very new Atom processors are not vulnerable.
-+ */
-+ case 0x1c: /* Pineview */
-+ case 0x26: /* Lincroft */
-+ case 0x27: /* Penwell */
-+ case 0x35: /* Cloverview */
-+ case 0x36: /* Cedarview */
-+ case 0x7a: /* Goldmont */
-+ break;
-+
-+ /*
-+ * Middling Atom processors are vulnerable to just the Store Buffer
-+ * aspect.
-+ */
-+ case 0x37: /* Baytrail / Valleyview (Silvermont) */
-+ case 0x4a: /* Merrifield */
-+ case 0x4c: /* Cherrytrail / Brasswell */
-+ case 0x4d: /* Avaton / Rangely (Silvermont) */
-+ case 0x5a: /* Moorefield */
-+ case 0x5d:
-+ case 0x65:
-+ case 0x6e:
-+ case 0x75:
-+ /*
-+ * Knights processors (which are based on the Silvermont/Airmont
-+ * microarchitecture) are similarly only affected by the Store Buffer
-+ * aspect.
-+ */
-+ case 0x57: /* Knights Landing */
-+ case 0x85: /* Knights Mill */
-+ cpu_has_bug_msbds_only = true;
-+ break;
-+
-+ default:
-+ printk("Unrecognised CPU model %#x - assuming vulnerable to MDS\n",
-+ boot_cpu_data.x86_model);
-+ cpu_has_bug_mds = true;
-+ break;
-+ }
-+}
-+
- void __init init_speculation_mitigations(void)
- {
- enum ind_thunk thunk = THUNK_DEFAULT;
-@@ -978,6 +1095,47 @@ void __init init_speculation_mitigations(void)
- "enabled. Please assess your configuration and choose an\n"
- "explicit 'smt=<bool>' setting. See XSA-273.\n");
-
-+ mds_calculations(caps);
-+
-+ /*
-+ * By default, enable PV and HVM mitigations on MDS-vulnerable hardware.
-+ * This will only be a token effort for MLPDS/MFBDS when HT is enabled,
-+ * but it is somewhat better than nothing.
-+ */
-+ if ( opt_md_clear_pv == -1 )
-+ opt_md_clear_pv = ((cpu_has_bug_mds || cpu_has_bug_msbds_only) &&
-+ boot_cpu_has(X86_FEATURE_MD_CLEAR));
-+ if ( opt_md_clear_hvm == -1 )
-+ opt_md_clear_hvm = ((cpu_has_bug_mds || cpu_has_bug_msbds_only) &&
-+ boot_cpu_has(X86_FEATURE_MD_CLEAR));
-+
-+ /*
-+ * Enable MDS defences as applicable. The PV blocks need using all the
-+ * time, and the Idle blocks need using if either PV or HVM defences are
-+ * used.
-+ *
-+ * HVM is more complicated. The MD_CLEAR microcode extends L1D_FLUSH with
-+ * equivelent semantics to avoid needing to perform both flushes on the
-+ * HVM path. The HVM blocks don't need activating if our hypervisor told
-+ * us it was handling L1D_FLUSH, or we are using L1D_FLUSH ourselves.
-+ */
-+ if ( opt_md_clear_pv )
-+ setup_force_cpu_cap(X86_FEATURE_SC_VERW_PV);
-+ if ( opt_md_clear_pv || opt_md_clear_hvm )
-+ setup_force_cpu_cap(X86_FEATURE_SC_VERW_IDLE);
-+ if ( opt_md_clear_hvm && !(caps & ARCH_CAPS_SKIP_L1DFL) && !opt_l1d_flush )
-+ setup_force_cpu_cap(X86_FEATURE_SC_VERW_HVM);
-+
-+ /*
-+ * Warn the user if they are on MLPDS/MFBDS-vulnerable hardware with HT
-+ * active and no explicit SMT choice.
-+ */
-+ if ( opt_smt == -1 && cpu_has_bug_mds && hw_smt_enabled )
-+ warning_add(
-+ "Booted on MLPDS/MFBDS-vulnerable hardware with SMT/Hyperthreading\n"
-+ "enabled. Mitigations will not be fully effective. Please\n"
-+ "choose an explicit smt=<bool> setting. See XSA-297.\n");
-+
- print_details(thunk, caps);
-
- /*
diff --git a/main/zeromq/APKBUILD b/main/zeromq/APKBUILD
index 027349aae1..2c63c2d4cd 100644
--- a/main/zeromq/APKBUILD
+++ b/main/zeromq/APKBUILD
@@ -1,7 +1,7 @@
# Contributor: Natanael Copa <ncopa@alpinelinux.org>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=zeromq
-pkgver=4.3.1
+pkgver=4.3.2
pkgrel=0
pkgdesc="The ZeroMQ messaging library and tools"
url="http://www.zeromq.org/"
@@ -14,9 +14,10 @@ subpackages="$pkgname-dev $pkgname-doc libzmq:libs"
source="https://github.com/zeromq/libzmq/releases/download/v$pkgver/$pkgname-$pkgver.tar.gz
test-driver.patch
"
-builddir="$srcdir/$pkgname-$pkgver"
# secfixes:
+# 4.3.2-r0:
+# - CVE-2019-13132
# 4.3.1-r0:
# - CVE-2019-6250
@@ -29,9 +30,8 @@ build() {
--sysconfdir=/etc \
--mandir=/usr/share/man \
--infodir=/usr/share/info \
- --with-libsodium \
- || return 1
- make || return 1
+ --with-libsodium
+ make
}
check() {
@@ -41,8 +41,8 @@ check() {
package() {
cd "$builddir"
- make DESTDIR="$pkgdir" install || return 1
+ make DESTDIR="$pkgdir" install
}
-sha512sums="b80388a3703993425cdd73054139a8e2895aedb9992ea68d6eadb4ea39b9af576ea14f306dfb432e4c24535feb6b293f82fac5679b655d258f0f921f2b71e772 zeromq-4.3.1.tar.gz
+sha512sums="b6251641e884181db9e6b0b705cced7ea4038d404bdae812ff47bdd0eed12510b6af6846b85cb96898e253ccbac71eca7fe588673300ddb9c3109c973250c8e4 zeromq-4.3.2.tar.gz
64e4ae2c89469359480743beeb4f1e08976a4c52dbfd2dd33020463df78e927993319e456299682901001e0832ebed85291eea0decc1d27a58de78a6c891e660 test-driver.patch"