summaryrefslogtreecommitdiff
path: root/import-layers/yocto-poky/meta/recipes-support
diff options
context:
space:
mode:
authorBrad Bishop <bradleyb@fuzziesquirrel.com>2017-12-04 09:01:44 +0300
committerBrad Bishop <bradleyb@fuzziesquirrel.com>2017-12-14 20:17:23 +0300
commit37a0e4ddff58c0120cc5cfef104b60d0e180638c (patch)
tree1628857a2eb33ab517ba93d6a3ca25e55bd3e628 /import-layers/yocto-poky/meta/recipes-support
parent3c4c45d1e9a2324191a8640b22df1b71f15f3037 (diff)
downloadopenbmc-37a0e4ddff58c0120cc5cfef104b60d0e180638c.tar.xz
Squashed 'import-layers/yocto-poky/' changes from dc8508f6099..67491b0c104
Yocto 2.2.2 (Morty) Change-Id: Id9a452e28940d9f166957de243d9cb1d8818704e git-subtree-dir: import-layers/yocto-poky git-subtree-split: 67491b0c104101bb9f366d697edd23c895be4302 Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
Diffstat (limited to 'import-layers/yocto-poky/meta/recipes-support')
-rw-r--r--import-layers/yocto-poky/meta/recipes-support/attr/ea-acl.inc48
-rw-r--r--import-layers/yocto-poky/meta/recipes-support/boost/boost.inc2
-rw-r--r--import-layers/yocto-poky/meta/recipes-support/curl/curl_7.50.1.bb1
-rw-r--r--import-layers/yocto-poky/meta/recipes-support/db/db_6.0.35.bb9
-rw-r--r--import-layers/yocto-poky/meta/recipes-support/gmp/gmp_6.1.1.bb1
-rw-r--r--import-layers/yocto-poky/meta/recipes-support/libbsd/libbsd/0001-Replace-__BEGIN_DECLS-and-__END_DECLS.patch363
-rw-r--r--import-layers/yocto-poky/meta/recipes-support/libbsd/libbsd/0002-Remove-funopen.patch55
-rw-r--r--import-layers/yocto-poky/meta/recipes-support/libbsd/libbsd/0003-Fix-build-breaks-due-to-missing-a.out.h.patch130
-rw-r--r--import-layers/yocto-poky/meta/recipes-support/libbsd/libbsd_0.8.3.bb7
-rw-r--r--import-layers/yocto-poky/meta/recipes-support/libgcrypt/files/0001-ecc-Store-EdDSA-session-key-in-secure-memory.patch39
-rw-r--r--import-layers/yocto-poky/meta/recipes-support/libgcrypt/files/CVE-2017-7526.patch455
-rw-r--r--import-layers/yocto-poky/meta/recipes-support/libgcrypt/libgcrypt.inc2
-rw-r--r--import-layers/yocto-poky/meta/recipes-support/libpcre/libpcre_8.39.bb4
-rw-r--r--import-layers/yocto-poky/meta/recipes-support/libxslt/libxslt/0001-Check-for-integer-overflow-in-xsltAddTextString.patch80
-rw-r--r--import-layers/yocto-poky/meta/recipes-support/libxslt/libxslt/0001-Link-libraries-with-libm.patch48
-rw-r--r--import-layers/yocto-poky/meta/recipes-support/libxslt/libxslt_1.1.29.bb2
-rw-r--r--import-layers/yocto-poky/meta/recipes-support/nspr/nspr/nspr.pc.in2
-rw-r--r--import-layers/yocto-poky/meta/recipes-support/nspr/nspr_4.12.bb11
-rw-r--r--import-layers/yocto-poky/meta/recipes-support/rng-tools/rng-tools_5.bb2
19 files changed, 1220 insertions, 41 deletions
diff --git a/import-layers/yocto-poky/meta/recipes-support/attr/ea-acl.inc b/import-layers/yocto-poky/meta/recipes-support/attr/ea-acl.inc
index 370e16f4a..b3ca65e68 100644
--- a/import-layers/yocto-poky/meta/recipes-support/attr/ea-acl.inc
+++ b/import-layers/yocto-poky/meta/recipes-support/attr/ea-acl.inc
@@ -10,6 +10,7 @@ inherit autotools-brokensep gettext
EXTRA_AUTORECONF += "--exclude=autoheader"
EXTRA_OECONF = "INSTALL_USER=root INSTALL_GROUP=root"
EXTRA_OECONF_append_class-native = " --enable-gettext=no"
+EXTRA_OECONF_append_class-target = "${@['', ' --disable-gettext '][(d.getVar('USE_NLS', True) == 'no')]}"
EXTRA_OEMAKE = "PKG_LIB_DIR=${base_libdir} PKG_DEVLIB_DIR=${libdir}"
@@ -17,36 +18,33 @@ do_install () {
oe_runmake install install-lib install-dev DIST_ROOT="${D}"
}
-PACKAGES =+ "lib${BPN}"
-
-FILES_lib${BPN} = "${base_libdir}/lib*${SOLIBS}"
-
-BBCLASSEXTEND = "native"
-# Only append ldflags for target recipe and if USE_NLS is enabled
-LDFLAGS_append_libc-uclibc_class-target = "${@['', ' -lintl '][(d.getVar('USE_NLS', True) == 'yes')]}"
-EXTRA_OECONF_append_libc-uclibc_class-target = "${@['', ' --disable-gettext '][(d.getVar('USE_NLS', True) == 'no')]}"
-
-fix_symlink () {
- if [ "${BB_CURRENTTASK}" != "populate_sysroot" -a "${BB_CURRENTTASK}" != "populate_sysroot_setscene" ]
- then
- return
- fi
-
+do_install_append_class-native () {
if test "${libdir}" = "${base_libdir}" ; then
return
fi
+ librelpath=${@os.path.relpath(d.getVar('libdir',True), d.getVar('base_libdir', True))}
+ baselibrelpath=${@os.path.relpath(d.getVar('base_libdir',True), d.getVar('libdir', True))}
+
# Remove bad symlinks & create the correct symlinks
- if test -L ${libdir}/lib${BPN}.so ; then
- rm -rf ${libdir}/lib${BPN}.so
- ln -sf ${base_libdir}/lib${BPN}.so ${libdir}/lib${BPN}.so
+ if test -L ${D}${libdir}/lib${BPN}.so ; then
+ rm -rf ${D}${libdir}/lib${BPN}.so
+ ln -sf $baselibrelpath/lib${BPN}.so ${D}${libdir}/lib${BPN}.so
fi
- if test -L ${base_libdir}/lib${BPN}.a ; then
- rm -rf ${base_libdir}/lib${BPN}.a
- ln -sf ${libdir}/lib${BPN}.a ${base_libdir}/lib${BPN}.a
+ if test -L ${D}${base_libdir}/lib${BPN}.a ; then
+ rm -rf ${D}${base_libdir}/lib${BPN}.a
+ ln -sf $librelpath/lib${BPN}.a ${D}${base_libdir}/lib${BPN}.a
fi
- if test -L ${base_libdir}/lib${BPN}.la ; then
- rm -rf ${base_libdir}/lib${BPN}.la
- ln -sf ${libdir}/lib${BPN}.la ${base_libdir}/lib${BPN}.la
+ if test -L ${D}${base_libdir}/lib${BPN}.la ; then
+ rm -rf ${D}${base_libdir}/lib${BPN}.la
+ ln -sf $librelpath/lib${BPN}.la ${D}${base_libdir}/lib${BPN}.la
fi
}
-SSTATEPOSTINSTFUNCS_class-native += "fix_symlink"
+
+PACKAGES =+ "lib${BPN}"
+
+FILES_lib${BPN} = "${base_libdir}/lib*${SOLIBS}"
+
+BBCLASSEXTEND = "native"
+# Only append ldflags for target recipe and if USE_NLS is enabled
+LDFLAGS_append_libc-uclibc_class-target = "${@['', ' -lintl '][(d.getVar('USE_NLS', True) == 'yes')]}"
+EXTRA_OECONF_append_libc-uclibc_class-target = "${@['', ' --disable-gettext '][(d.getVar('USE_NLS', True) == 'no')]}"
diff --git a/import-layers/yocto-poky/meta/recipes-support/boost/boost.inc b/import-layers/yocto-poky/meta/recipes-support/boost/boost.inc
index ef16533ba..1966d3d80 100644
--- a/import-layers/yocto-poky/meta/recipes-support/boost/boost.inc
+++ b/import-layers/yocto-poky/meta/recipes-support/boost/boost.inc
@@ -34,6 +34,8 @@ BOOST_LIBS_append_x86-64 = " context coroutine"
BOOST_LIBS_append_powerpc = " context coroutine"
# need consistent settings for native builds (x86 override not applied for native)
BOOST_LIBS_remove_class-native = " context coroutine"
+# does not compile
+BOOST_LIBS_remove_mips16e = "wave"
# optional libraries
PACKAGECONFIG ??= "locale"
diff --git a/import-layers/yocto-poky/meta/recipes-support/curl/curl_7.50.1.bb b/import-layers/yocto-poky/meta/recipes-support/curl/curl_7.50.1.bb
index a21419a4d..653fa2e7a 100644
--- a/import-layers/yocto-poky/meta/recipes-support/curl/curl_7.50.1.bb
+++ b/import-layers/yocto-poky/meta/recipes-support/curl/curl_7.50.1.bb
@@ -17,6 +17,7 @@ SRC_URI += " file://configure_ac.patch"
SRC_URI[md5sum] = "015f6a0217ca6f2c5442ca406476920b"
SRC_URI[sha256sum] = "3c12c5f54ccaa1d40abc65d672107dcc75d3e1fcb38c267484334280096e5156"
+CVE_PRODUCT = "libcurl"
inherit autotools pkgconfig binconfig multilib_header
PACKAGECONFIG ??= "${@bb.utils.contains("DISTRO_FEATURES", "ipv6", "ipv6", "", d)} gnutls proxy zlib"
diff --git a/import-layers/yocto-poky/meta/recipes-support/db/db_6.0.35.bb b/import-layers/yocto-poky/meta/recipes-support/db/db_6.0.35.bb
index 32afbe82d..0f69cab76 100644
--- a/import-layers/yocto-poky/meta/recipes-support/db/db_6.0.35.bb
+++ b/import-layers/yocto-poky/meta/recipes-support/db/db_6.0.35.bb
@@ -77,15 +77,6 @@ do_configure() {
oe_runconf
}
-# Override the MUTEX setting here, the POSIX library is
-# the default - "POSIX/pthreads/library".
-# Don't ignore the nice SWP instruction on the ARM:
-# These enable the ARM assembler mutex code
-ARM_MUTEX = "--with-mutex=ARM/gcc-assembly"
-MUTEX = ""
-MUTEX_arm = "${ARM_MUTEX}"
-MUTEX_armeb = "${ARM_MUTEX}"
-EXTRA_OECONF += "${MUTEX}"
EXTRA_OEMAKE_append_class-target = " LIBTOOL=${STAGING_BINDIR_CROSS}/${HOST_SYS}-libtool"
EXTRA_OEMAKE += "STRIP=true"
diff --git a/import-layers/yocto-poky/meta/recipes-support/gmp/gmp_6.1.1.bb b/import-layers/yocto-poky/meta/recipes-support/gmp/gmp_6.1.1.bb
index 303c3ef9e..614d21ab7 100644
--- a/import-layers/yocto-poky/meta/recipes-support/gmp/gmp_6.1.1.bb
+++ b/import-layers/yocto-poky/meta/recipes-support/gmp/gmp_6.1.1.bb
@@ -21,6 +21,7 @@ SRC_URI[sha256sum] = "a8109865f2893f1373b0a8ed5ff7429de8db696fc451b1036bd7bdf95b
acpaths = ""
EXTRA_OECONF += " --enable-cxx=detect"
+EXTRA_OECONF_mipsarchr6_append = " --disable-assembly"
PACKAGES =+ "libgmpxx"
FILES_libgmpxx = "${libdir}/libgmpxx${SOLIBS}"
diff --git a/import-layers/yocto-poky/meta/recipes-support/libbsd/libbsd/0001-Replace-__BEGIN_DECLS-and-__END_DECLS.patch b/import-layers/yocto-poky/meta/recipes-support/libbsd/libbsd/0001-Replace-__BEGIN_DECLS-and-__END_DECLS.patch
new file mode 100644
index 000000000..e97e30e84
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-support/libbsd/libbsd/0001-Replace-__BEGIN_DECLS-and-__END_DECLS.patch
@@ -0,0 +1,363 @@
+From 88adbe1a855b7aa95bd925c80ed83c86f3fc42e3 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Sun, 6 Nov 2016 09:39:31 -0800
+Subject: [PATCH 1/3] Replace __BEGIN_DECLS and __END_DECLS
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+Upstream-Status: Pending
+
+ include/bsd/err.h | 10 ++++++++--
+ include/bsd/libutil.h | 10 ++++++++--
+ include/bsd/md5.h | 10 ++++++++--
+ include/bsd/nlist.h | 10 ++++++++--
+ include/bsd/readpassphrase.h | 10 ++++++++--
+ include/bsd/stdio.h | 10 ++++++++--
+ include/bsd/stdlib.h | 10 ++++++++--
+ include/bsd/string.h | 10 ++++++++--
+ include/bsd/stringlist.h | 10 ++++++++--
+ include/bsd/unistd.h | 10 ++++++++--
+ include/bsd/vis.h | 10 ++++++++--
+ include/bsd/wchar.h | 10 ++++++++--
+ src/hash/sha512.h | 10 ++++++++--
+ 13 files changed, 104 insertions(+), 26 deletions(-)
+
+diff --git a/include/bsd/err.h b/include/bsd/err.h
+index 12fd051..43dfc32 100644
+--- a/include/bsd/err.h
++++ b/include/bsd/err.h
+@@ -42,7 +42,10 @@
+
+ #include <stdarg.h>
+
+-__BEGIN_DECLS
++/* __BEGIN_DECLS */
++#ifdef __cplusplus
++extern "C" {
++#endif
+ void warnc(int code, const char *format, ...)
+ __printflike(2, 3);
+ void vwarnc(int code, const char *format, va_list ap)
+@@ -51,6 +54,9 @@ void errc(int status, int code, const char *format, ...)
+ __printflike(3, 4);
+ void verrc(int status, int code, const char *format, va_list ap)
+ __printflike(3, 0);
+-__END_DECLS
++#ifdef __cplusplus
++}
++#endif
++/* __END_DECLS */
+
+ #endif
+diff --git a/include/bsd/libutil.h b/include/bsd/libutil.h
+index ebb6160..28b919d 100644
+--- a/include/bsd/libutil.h
++++ b/include/bsd/libutil.h
+@@ -53,7 +53,10 @@ struct pidfh {
+ ino_t pf_ino;
+ };
+
+-__BEGIN_DECLS
++/* __BEGIN_DECLS */
++#ifdef __cplusplus
++extern "C" {
++#endif
+ int humanize_number(char *buf, size_t len, int64_t bytes,
+ const char *suffix, int scale, int flags);
+ int expand_number(const char *_buf, uint64_t *_num);
+@@ -66,7 +69,10 @@ int pidfile_close(struct pidfh *pfh);
+ int pidfile_remove(struct pidfh *pfh);
+
+ char *fparseln(FILE *, size_t *, size_t *, const char[3], int);
+-__END_DECLS
++#ifdef __cplusplus
++}
++#endif
++/* __END_DECLS */
+
+ /* humanize_number(3) */
+ #define HN_DECIMAL 0x01
+diff --git a/include/bsd/md5.h b/include/bsd/md5.h
+index 9a75fad..3531fd6 100644
+--- a/include/bsd/md5.h
++++ b/include/bsd/md5.h
+@@ -30,7 +30,10 @@ typedef struct MD5Context {
+ #include <sys/cdefs.h>
+ #include <sys/types.h>
+
+-__BEGIN_DECLS
++/* __BEGIN_DECLS */
++#ifdef __cplusplus
++extern "C" {
++#endif
+ void MD5Init(MD5_CTX *);
+ void MD5Update(MD5_CTX *, const uint8_t *, size_t)
+ __attribute__((__bounded__(__string__,2,3)));
+@@ -49,6 +52,9 @@ char *MD5FileChunk(const char *, char *, off_t, off_t)
+ char *MD5Data(const uint8_t *, size_t, char *)
+ __attribute__((__bounded__(__string__,1,2)))
+ __attribute__((__bounded__(__minbytes__,3,MD5_DIGEST_STRING_LENGTH)));
+-__END_DECLS
++#ifdef __cplusplus
++}
++#endif
++/* __END_DECLS */
+
+ #endif /* _MD5_H_ */
+diff --git a/include/bsd/nlist.h b/include/bsd/nlist.h
+index 2730237..0389ab7 100644
+--- a/include/bsd/nlist.h
++++ b/include/bsd/nlist.h
+@@ -30,8 +30,14 @@
+ #include <sys/cdefs.h>
+ #include <a.out.h>
+
+-__BEGIN_DECLS
++/* __BEGIN_DECLS */
++#ifdef __cplusplus
++extern "C" {
++#endif
+ extern int nlist(const char *filename, struct nlist *list);
+-__END_DECLS
++#ifdef __cplusplus
++}
++#endif
++/* __END_DECLS */
+
+ #endif
+diff --git a/include/bsd/readpassphrase.h b/include/bsd/readpassphrase.h
+index e1dacc3..76e0d33 100644
+--- a/include/bsd/readpassphrase.h
++++ b/include/bsd/readpassphrase.h
+@@ -34,8 +34,14 @@
+ #include <sys/cdefs.h>
+ #include <sys/types.h>
+
+-__BEGIN_DECLS
++/* __BEGIN_DECLS */
++#ifdef __cplusplus
++extern "C" {
++#endif
+ char * readpassphrase(const char *, char *, size_t, int);
+-__END_DECLS
++#ifdef __cplusplus
++}
++#endif
++/* __END_DECLS */
+
+ #endif /* !_READPASSPHRASE_H_ */
+diff --git a/include/bsd/stdio.h b/include/bsd/stdio.h
+index 7697425..b5b3efd 100644
+--- a/include/bsd/stdio.h
++++ b/include/bsd/stdio.h
+@@ -41,7 +41,10 @@
+ #include <sys/cdefs.h>
+ #include <sys/types.h>
+
+-__BEGIN_DECLS
++/* __BEGIN_DECLS */
++#ifdef __cplusplus
++extern "C" {
++#endif
+ const char *fmtcheck(const char *, const char *);
+
+ /* XXX: The function requires cooperation from the system libc to store the
+@@ -69,7 +72,10 @@ FILE *funopen(const void *cookie,
+ #define fwopen(cookie, fn) funopen(cookie, NULL, fn, NULL, NULL)
+
+ int fpurge(FILE *fp);
+-__END_DECLS
++#ifdef __cplusplus
++}
++#endif
++/* __END_DECLS */
+
+ #endif
+ #endif
+diff --git a/include/bsd/stdlib.h b/include/bsd/stdlib.h
+index 0604cad..b9f0515 100644
+--- a/include/bsd/stdlib.h
++++ b/include/bsd/stdlib.h
+@@ -46,7 +46,10 @@
+ #include <sys/stat.h>
+ #include <stdint.h>
+
+-__BEGIN_DECLS
++/* __BEGIN_DECLS */
++#ifdef __cplusplus
++extern "C" {
++#endif
+ uint32_t arc4random(void);
+ void arc4random_stir(void);
+ void arc4random_addrandom(u_char *dat, int datlen);
+@@ -73,6 +76,9 @@ long long strtonum(const char *nptr, long long minval, long long maxval,
+ const char **errstr);
+
+ char *getbsize(int *headerlenp, long *blocksizep);
+-__END_DECLS
++#ifdef __cplusplus
++}
++#endif
++/* __END_DECLS */
+
+ #endif
+diff --git a/include/bsd/string.h b/include/bsd/string.h
+index ee2f953..fbf8c54 100644
+--- a/include/bsd/string.h
++++ b/include/bsd/string.h
+@@ -36,13 +36,19 @@
+ #include <sys/cdefs.h>
+ #include <sys/types.h>
+
+-__BEGIN_DECLS
++/* __BEGIN_DECLS */
++#ifdef __cplusplus
++extern "C" {
++#endif
+ size_t strlcpy(char *dst, const char *src, size_t siz);
+ size_t strlcat(char *dst, const char *src, size_t siz);
+ char *strnstr(const char *str, const char *find, size_t str_len);
+ void strmode(mode_t mode, char *str);
+
+ void explicit_bzero(void *buf, size_t len);
+-__END_DECLS
++#ifdef __cplusplus
++}
++#endif
++/* __END_DECLS */
+
+ #endif
+diff --git a/include/bsd/stringlist.h b/include/bsd/stringlist.h
+index e3c42e9..40d0a52 100644
+--- a/include/bsd/stringlist.h
++++ b/include/bsd/stringlist.h
+@@ -43,12 +43,18 @@ typedef struct _stringlist {
+ size_t sl_cur;
+ } StringList;
+
+-__BEGIN_DECLS
++/* __BEGIN_DECLS */
++#ifdef __cplusplus
++extern "C" {
++#endif
+ StringList *sl_init(void);
+ int sl_add(StringList *, char *);
+ void sl_free(StringList *, int);
+ char *sl_find(StringList *, const char *);
+ int sl_delete(StringList *, const char *, int);
+-__END_DECLS
++#ifdef __cplusplus
++}
++#endif
++/* __END_DECLS */
+
+ #endif /* _STRINGLIST_H */
+diff --git a/include/bsd/unistd.h b/include/bsd/unistd.h
+index 1f9c5f8..5b2f4c7 100644
+--- a/include/bsd/unistd.h
++++ b/include/bsd/unistd.h
+@@ -45,7 +45,10 @@
+ #define S_ISTXT S_ISVTX
+ #endif
+
+-__BEGIN_DECLS
++/* __BEGIN_DECLS */
++#ifdef __cplusplus
++extern "C" {
++#endif
+ extern int optreset;
+
+ #ifdef LIBBSD_OVERLAY
+@@ -68,6 +71,9 @@ void setproctitle(const char *fmt, ...)
+ __printflike(1, 2);
+
+ int getpeereid(int s, uid_t *euid, gid_t *egid);
+-__END_DECLS
++#ifdef __cplusplus
++}
++#endif
++/* __END_DECLS */
+
+ #endif
+diff --git a/include/bsd/vis.h b/include/bsd/vis.h
+index 835d2d6..63c951e 100644
+--- a/include/bsd/vis.h
++++ b/include/bsd/vis.h
+@@ -74,7 +74,10 @@
+
+ #include <sys/cdefs.h>
+
+-__BEGIN_DECLS
++/* __BEGIN_DECLS */
++#ifdef __cplusplus
++extern "C" {
++#endif
+ char *vis(char *, int, int, int);
+ int strvis(char *, const char *, int);
+ int strvisx(char *, const char *, size_t, int);
+@@ -83,6 +86,9 @@ int strunvis(char *, const char *);
+ int strunvisx(char *, const char *, int);
+ ssize_t strnunvis(char *, const char *, size_t);
+ int unvis(char *, int, int *, int);
+-__END_DECLS
++#ifdef __cplusplus
++}
++#endif
++/* __END_DECLS */
+
+ #endif /* !_VIS_H_ */
+diff --git a/include/bsd/wchar.h b/include/bsd/wchar.h
+index 33a500e..aa70742 100644
+--- a/include/bsd/wchar.h
++++ b/include/bsd/wchar.h
+@@ -43,12 +43,18 @@
+ #include <sys/cdefs.h>
+ #include <sys/types.h>
+
+-__BEGIN_DECLS
++/* __BEGIN_DECLS */
++#ifdef __cplusplus
++extern "C" {
++#endif
+ wchar_t *fgetwln(FILE *stream, size_t *len);
+
+ size_t wcslcat(wchar_t *dst, const wchar_t *src, size_t size);
+ size_t wcslcpy(wchar_t *dst, const wchar_t *src, size_t size);
+-__END_DECLS
++#ifdef __cplusplus
++}
++#endif
++/* __END_DECLS */
+
+ #endif
+ #endif
+diff --git a/src/hash/sha512.h b/src/hash/sha512.h
+index 4f368a1..27ddc24 100644
+--- a/src/hash/sha512.h
++++ b/src/hash/sha512.h
+@@ -39,7 +39,10 @@ typedef struct SHA512Context {
+ unsigned char buf[128];
+ } SHA512_CTX;
+
+-__BEGIN_DECLS
++/* __BEGIN_DECLS */
++#ifdef __cplusplus
++extern "C" {
++#endif
+
+ void SHA512_Init(SHA512_CTX *);
+ void SHA512_Update(SHA512_CTX *, const void *, size_t);
+@@ -48,6 +51,9 @@ char *SHA512_End(SHA512_CTX *, char *);
+ char *SHA512_File(const char *, char *);
+ char *SHA512_FileChunk(const char *, char *, off_t, off_t);
+ char *SHA512_Data(const void *, unsigned int, char *);
+-__END_DECLS
++#ifdef __cplusplus
++}
++#endif
++/* __END_DECLS */
+
+ #endif /* !_SHA512_H_ */
+--
+2.10.2
+
diff --git a/import-layers/yocto-poky/meta/recipes-support/libbsd/libbsd/0002-Remove-funopen.patch b/import-layers/yocto-poky/meta/recipes-support/libbsd/libbsd/0002-Remove-funopen.patch
new file mode 100644
index 000000000..83ce7c8dd
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-support/libbsd/libbsd/0002-Remove-funopen.patch
@@ -0,0 +1,55 @@
+From 28fc66e8b848709a2e69dba7f07694248e0154e8 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Sun, 6 Nov 2016 09:40:43 -0800
+Subject: [PATCH 2/3] Remove funopen()
+
+Musl doesnt have prerequisites for it.
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+Upstream-Status: Inappropriate [musl specific]
+
+ man/Makefile.am | 1 -
+ src/Makefile.am | 1 -
+ test/Makefile.am | 1 -
+ 3 files changed, 3 deletions(-)
+
+diff --git a/man/Makefile.am b/man/Makefile.am
+index e4d6e4a..c701d94 100644
+--- a/man/Makefile.am
++++ b/man/Makefile.am
+@@ -29,7 +29,6 @@ dist_man_MANS = \
+ flopen.3 \
+ fmtcheck.3 \
+ fparseln.3 \
+- funopen.3bsd \
+ getbsize.3 \
+ getmode.3 \
+ getpeereid.3 \
+diff --git a/src/Makefile.am b/src/Makefile.am
+index ad83dbf..13225a3 100644
+--- a/src/Makefile.am
++++ b/src/Makefile.am
+@@ -76,7 +76,6 @@ libbsd_la_SOURCES = \
+ fmtcheck.c \
+ fparseln.c \
+ fpurge.c \
+- funopen.c \
+ getbsize.c \
+ getpeereid.c \
+ hash/md5.c \
+diff --git a/test/Makefile.am b/test/Makefile.am
+index a75c8ff..e3a1d41 100644
+--- a/test/Makefile.am
++++ b/test/Makefile.am
+@@ -36,7 +36,6 @@ check_PROGRAMS = \
+ endian \
+ humanize \
+ fgetln \
+- funopen \
+ fparseln \
+ fpurge \
+ md5 \
+--
+2.10.2
+
diff --git a/import-layers/yocto-poky/meta/recipes-support/libbsd/libbsd/0003-Fix-build-breaks-due-to-missing-a.out.h.patch b/import-layers/yocto-poky/meta/recipes-support/libbsd/libbsd/0003-Fix-build-breaks-due-to-missing-a.out.h.patch
new file mode 100644
index 000000000..176d940fc
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-support/libbsd/libbsd/0003-Fix-build-breaks-due-to-missing-a.out.h.patch
@@ -0,0 +1,130 @@
+From a1b93c25311834f2f411e9bfe2e616899ba2122d Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Sun, 6 Nov 2016 10:23:55 -0800
+Subject: [PATCH 3/3] Fix build breaks due to missing a.out.h
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+Upstream-Status: Pending
+
+ include/bsd/nlist.h | 1 -
+ include/bsd/nlist.h => src/local-aout.h | 47 ++++++++++++++++++++++-----------
+ src/nlist.c | 9 +++++++
+ 3 files changed, 41 insertions(+), 16 deletions(-)
+ copy include/bsd/nlist.h => src/local-aout.h (63%)
+
+diff --git a/include/bsd/nlist.h b/include/bsd/nlist.h
+index 0389ab7..9c7e3d8 100644
+--- a/include/bsd/nlist.h
++++ b/include/bsd/nlist.h
+@@ -28,7 +28,6 @@
+ #define LIBBSD_NLIST_H
+
+ #include <sys/cdefs.h>
+-#include <a.out.h>
+
+ /* __BEGIN_DECLS */
+ #ifdef __cplusplus
+diff --git a/include/bsd/nlist.h b/src/local-aout.h
+similarity index 63%
+copy from include/bsd/nlist.h
+copy to src/local-aout.h
+index 0389ab7..2adb93e 100644
+--- a/include/bsd/nlist.h
++++ b/src/local-aout.h
+@@ -1,5 +1,5 @@
+ /*
+- * Copyright © 2009 Guillem Jover <guillem@hadrons.org>
++ * Copyright © 2016 Khem Raj <raj.khem@gmail.com>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+@@ -24,20 +24,37 @@
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+-#ifndef LIBBSD_NLIST_H
+-#define LIBBSD_NLIST_H
++#ifndef LIBBSD_LOCAL_AOUT_H
++#define LIBBSD_LOCAL_AOUT_H
+
+-#include <sys/cdefs.h>
+-#include <a.out.h>
++#define N_UNDF 0
++#define N_ABS 2
++#define N_TEXT 4
++#define N_DATA 6
++#define N_BSS 8
++#define N_FN 15
++#define N_EXT 1
++#define N_TYPE 036
++#define N_STAB 0340
++#define N_INDR 0xa
++#define N_SETA 0x14 /* Absolute set element symbol. */
++#define N_SETT 0x16 /* Text set element symbol. */
++#define N_SETD 0x18 /* Data set element symbol. */
++#define N_SETB 0x1A /* Bss set element symbol. */
++#define N_SETV 0x1C /* Pointer to set vector in data area. */
+
+-/* __BEGIN_DECLS */
+-#ifdef __cplusplus
+-extern "C" {
+-#endif
+-extern int nlist(const char *filename, struct nlist *list);
+-#ifdef __cplusplus
+-}
+-#endif
+-/* __END_DECLS */
++struct nlist
++{
++ union
++ {
++ char *n_name;
++ struct nlist *n_next;
++ long n_strx;
++ } n_un;
++ unsigned char n_type;
++ char n_other;
++ short n_desc;
++ unsigned long n_value;
++};
+
+-#endif
++#endif /* LIBBSD_LOCAL_AOUT_H */
+diff --git a/src/nlist.c b/src/nlist.c
+index 0cffe55..625d310 100644
+--- a/src/nlist.c
++++ b/src/nlist.c
+@@ -40,7 +40,11 @@ static char sccsid[] = "@(#)nlist.c 8.1 (Berkeley) 6/4/93";
+
+ #include <errno.h>
+ #include <fcntl.h>
++#ifdef __GLIBC__
+ #include <a.out.h>
++#else
++#define __NO_A_OUT_SUPPORT
++#endif
+ #include <stdio.h>
+ #include <string.h>
+ #include <unistd.h>
+@@ -48,12 +52,17 @@ static char sccsid[] = "@(#)nlist.c 8.1 (Berkeley) 6/4/93";
+ #if !defined(__NO_A_OUT_SUPPORT)
+ #define _NLIST_DO_AOUT
+ #endif
++
+ #define _NLIST_DO_ELF
+
+ #ifdef _NLIST_DO_ELF
+ #include "local-elf.h"
+ #endif
+
++#ifdef _NLIST_DO_ELF
++#include "local-aout.h"
++#endif
++
+ #define SIZE_T_MAX 0xffffffffU
+
+ #ifdef _NLIST_DO_AOUT
+--
+2.10.2
+
diff --git a/import-layers/yocto-poky/meta/recipes-support/libbsd/libbsd_0.8.3.bb b/import-layers/yocto-poky/meta/recipes-support/libbsd/libbsd_0.8.3.bb
index 92121efa8..fadd7886a 100644
--- a/import-layers/yocto-poky/meta/recipes-support/libbsd/libbsd_0.8.3.bb
+++ b/import-layers/yocto-poky/meta/recipes-support/libbsd/libbsd_0.8.3.bb
@@ -36,8 +36,15 @@ SECTION = "libs"
SRC_URI = " \
http://libbsd.freedesktop.org/releases/${BPN}-${PV}.tar.xz \
"
+SRC_URI_append_libc-musl = " \
+ file://0001-Replace-__BEGIN_DECLS-and-__END_DECLS.patch \
+ file://0002-Remove-funopen.patch \
+ file://0003-Fix-build-breaks-due-to-missing-a.out.h.patch \
+"
SRC_URI[md5sum] = "e935c1bb6cc98a4a43cb1da22795493a"
SRC_URI[sha256sum] = "934b634f4dfd865b6482650b8f522c70ae65c463529de8be907b53c89c3a34a8"
inherit autotools pkgconfig
+
+BBCLASSEXTEND = "native nativesdk"
diff --git a/import-layers/yocto-poky/meta/recipes-support/libgcrypt/files/0001-ecc-Store-EdDSA-session-key-in-secure-memory.patch b/import-layers/yocto-poky/meta/recipes-support/libgcrypt/files/0001-ecc-Store-EdDSA-session-key-in-secure-memory.patch
new file mode 100644
index 000000000..f6c4ca76f
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-support/libgcrypt/files/0001-ecc-Store-EdDSA-session-key-in-secure-memory.patch
@@ -0,0 +1,39 @@
+CVE: CVE-2017-9526
+Upstream-Status: Backport
+Signed-off-by: Ross Burton <ross.burton@intel.com>
+
+From b3cab278eb9c2ceda79f980bc26460d97f260041 Mon Sep 17 00:00:00 2001
+From: Jo Van Bulck <jo.vanbulck@cs.kuleuven.be>
+Date: Thu, 19 Jan 2017 17:00:15 +0100
+Subject: [PATCH] ecc: Store EdDSA session key in secure memory.
+
+* cipher/ecc-eddsa.c (_gcry_ecc_eddsa_sign): use mpi_snew to allocate
+session key.
+--
+
+An attacker who learns the EdDSA session key from side-channel
+observation during the signing process, can easily revover the long-
+term secret key. Storing the session key in secure memory ensures that
+constant time point operations are used in the MPI library.
+
+Signed-off-by: Jo Van Bulck <jo.vanbulck@cs.kuleuven.be>
+---
+ cipher/ecc-eddsa.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/cipher/ecc-eddsa.c b/cipher/ecc-eddsa.c
+index f91f8489..813e030d 100644
+--- a/cipher/ecc-eddsa.c
++++ b/cipher/ecc-eddsa.c
+@@ -603,7 +603,7 @@ _gcry_ecc_eddsa_sign (gcry_mpi_t input, ECC_secret_key *skey,
+ a = mpi_snew (0);
+ x = mpi_new (0);
+ y = mpi_new (0);
+- r = mpi_new (0);
++ r = mpi_snew (0);
+ ctx = _gcry_mpi_ec_p_internal_new (skey->E.model, skey->E.dialect, 0,
+ skey->E.p, skey->E.a, skey->E.b);
+ b = (ctx->nbits+7)/8;
+--
+2.11.0
+
diff --git a/import-layers/yocto-poky/meta/recipes-support/libgcrypt/files/CVE-2017-7526.patch b/import-layers/yocto-poky/meta/recipes-support/libgcrypt/files/CVE-2017-7526.patch
new file mode 100644
index 000000000..7180e7af2
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-support/libgcrypt/files/CVE-2017-7526.patch
@@ -0,0 +1,455 @@
+Flush+reload side-channel attack on RSA secret keys dubbed "Sliding right
+into disaster".
+
+CVE: CVE-2017-7526
+Upstream-Status: Backport
+Signed-off-by: Ross Burton <ross.burton@intel.com>
+
+From 56bd068335500207dea2cece9cc662bcd9658951 Mon Sep 17 00:00:00 2001
+From: NIIBE Yutaka <gniibe@fsij.org>
+Date: Tue, 4 Apr 2017 17:38:05 +0900
+Subject: [PATCH 1/5] mpi: Simplify mpi_powm.
+
+* mpi/mpi-pow.c (_gcry_mpi_powm): Simplify the loop.
+
+--
+
+This fix is not a solution for the problem reported (yet). The
+problem is that the current algorithm of _gcry_mpi_powm depends on
+exponent and some information leaks is possible.
+
+Reported-by: Andreas Zankl <andreas.zankl@aisec.fraunhofer.de>
+Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
+
+(backport from master commit:
+719468e53133d3bdf12156c5bfdea2bf15f9f6f1)
+
+Signed-off-by: Ross Burton <ross.burton@intel.com>
+---
+ mpi/mpi-pow.c | 105 +++++++++++++++++-----------------------------------------
+ 1 file changed, 30 insertions(+), 75 deletions(-)
+
+diff --git a/mpi/mpi-pow.c b/mpi/mpi-pow.c
+index a780ebd1..7b3dc318 100644
+--- a/mpi/mpi-pow.c
++++ b/mpi/mpi-pow.c
+@@ -609,12 +609,8 @@ _gcry_mpi_powm (gcry_mpi_t res,
+ if (e == 0)
+ {
+ j += c;
+- i--;
+- if ( i < 0 )
+- {
+- c = 0;
+- break;
+- }
++ if ( --i < 0 )
++ break;
+
+ e = ep[i];
+ c = BITS_PER_MPI_LIMB;
+@@ -629,38 +625,33 @@ _gcry_mpi_powm (gcry_mpi_t res,
+ c -= c0;
+ j += c0;
+
++ e0 = (e >> (BITS_PER_MPI_LIMB - W));
+ if (c >= W)
+- {
+- e0 = (e >> (BITS_PER_MPI_LIMB - W));
+- e = (e << W);
+- c -= W;
+- }
++ c0 = 0;
+ else
+ {
+- i--;
+- if ( i < 0 )
++ if ( --i < 0 )
+ {
+- e = (e >> (BITS_PER_MPI_LIMB - c));
+- break;
++ e0 = (e >> (BITS_PER_MPI_LIMB - c));
++ j += c - W;
++ goto last_step;
++ }
++ else
++ {
++ c0 = c;
++ e = ep[i];
++ c = BITS_PER_MPI_LIMB;
++ e0 |= (e >> (BITS_PER_MPI_LIMB - (W - c0)));
+ }
+-
+- c0 = c;
+- e0 = (e >> (BITS_PER_MPI_LIMB - W))
+- | (ep[i] >> (BITS_PER_MPI_LIMB - W + c0));
+- e = (ep[i] << (W - c0));
+- c = BITS_PER_MPI_LIMB - W + c0;
+ }
+
++ e = e << (W - c0);
++ c -= (W - c0);
++
++ last_step:
+ count_trailing_zeros (c0, e0);
+ e0 = (e0 >> c0) >> 1;
+
+- for (j += W - c0; j; j--)
+- {
+- mul_mod (xp, &xsize, rp, rsize, rp, rsize, mp, msize, &karactx);
+- tp = rp; rp = xp; xp = tp;
+- rsize = xsize;
+- }
+-
+ /*
+ * base_u <= precomp[e0]
+ * base_u_size <= precomp_size[e0]
+@@ -677,25 +668,23 @@ _gcry_mpi_powm (gcry_mpi_t res,
+ u.d = precomp[k];
+
+ mpi_set_cond (&w, &u, k == e0);
+- base_u_size |= (precomp_size[k] & ((mpi_size_t)0 - (k == e0)) );
++ base_u_size |= ( precomp_size[k] & ((mpi_size_t)0 - (k == e0)) );
+ }
+
+- mul_mod (xp, &xsize, rp, rsize, base_u, base_u_size,
+- mp, msize, &karactx);
+- tp = rp; rp = xp; xp = tp;
+- rsize = xsize;
++ for (j += W - c0; j >= 0; j--)
++ {
++ mul_mod (xp, &xsize, rp, rsize,
++ j == 0 ? base_u : rp, j == 0 ? base_u_size : rsize,
++ mp, msize, &karactx);
++ tp = rp; rp = xp; xp = tp;
++ rsize = xsize;
++ }
+
+ j = c0;
++ if ( i < 0 )
++ break;
+ }
+
+- if (c != 0)
+- {
+- j += c;
+- count_trailing_zeros (c, e);
+- e = (e >> c);
+- j -= c;
+- }
+-
+ while (j--)
+ {
+ mul_mod (xp, &xsize, rp, rsize, rp, rsize, mp, msize, &karactx);
+@@ -703,40 +692,6 @@ _gcry_mpi_powm (gcry_mpi_t res,
+ rsize = xsize;
+ }
+
+- if (e != 0)
+- {
+- /*
+- * base_u <= precomp[(e>>1)]
+- * base_u_size <= precomp_size[(e>>1)]
+- */
+- base_u_size = 0;
+- for (k = 0; k < (1<< (W - 1)); k++)
+- {
+- struct gcry_mpi w, u;
+- w.alloced = w.nlimbs = precomp_size[k];
+- u.alloced = u.nlimbs = precomp_size[k];
+- w.sign = u.sign = 0;
+- w.flags = u.flags = 0;
+- w.d = base_u;
+- u.d = precomp[k];
+-
+- mpi_set_cond (&w, &u, k == (e>>1));
+- base_u_size |= (precomp_size[k] & ((mpi_size_t)0 - (k == (e>>1))) );
+- }
+-
+- mul_mod (xp, &xsize, rp, rsize, base_u, base_u_size,
+- mp, msize, &karactx);
+- tp = rp; rp = xp; xp = tp;
+- rsize = xsize;
+-
+- for (; c; c--)
+- {
+- mul_mod (xp, &xsize, rp, rsize, rp, rsize, mp, msize, &karactx);
+- tp = rp; rp = xp; xp = tp;
+- rsize = xsize;
+- }
+- }
+-
+ /* We shifted MOD, the modulo reduction argument, left
+ MOD_SHIFT_CNT steps. Adjust the result by reducing it with the
+ original MOD.
+--
+2.11.0
+
+
+From 6e237c8c48d257dc315e364791d284c6bf3fa703 Mon Sep 17 00:00:00 2001
+From: NIIBE Yutaka <gniibe@fsij.org>
+Date: Sat, 24 Jun 2017 20:46:20 +0900
+Subject: [PATCH 2/5] Same computation for square and multiply.
+
+* mpi/mpi-pow.c (_gcry_mpi_powm): Compare msize for max_u_size. Move
+the assignment to base_u into the loop. Copy content refered by RP to
+BASE_U except the last of the loop.
+
+--
+
+Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
+(backport from master commit:
+78130828e9a140a9de4dafadbc844dbb64cb709a)
+
+Signed-off-by: Ross Burton <ross.burton@intel.com>
+---
+ mpi/mpi-pow.c | 50 +++++++++++++++++++++++++++++---------------------
+ 1 file changed, 29 insertions(+), 21 deletions(-)
+
+diff --git a/mpi/mpi-pow.c b/mpi/mpi-pow.c
+index 7b3dc318..3cba6903 100644
+--- a/mpi/mpi-pow.c
++++ b/mpi/mpi-pow.c
+@@ -573,6 +573,8 @@ _gcry_mpi_powm (gcry_mpi_t res,
+ MPN_COPY (precomp[i], rp, rsize);
+ }
+
++ if (msize > max_u_size)
++ max_u_size = msize;
+ base_u = mpi_alloc_limb_space (max_u_size, esec);
+ MPN_ZERO (base_u, max_u_size);
+
+@@ -619,6 +621,10 @@ _gcry_mpi_powm (gcry_mpi_t res,
+ {
+ int c0;
+ mpi_limb_t e0;
++ struct gcry_mpi w, u;
++ w.sign = u.sign = 0;
++ w.flags = u.flags = 0;
++ w.d = base_u;
+
+ count_leading_zeros (c0, e);
+ e = (e << c0);
+@@ -652,29 +658,31 @@ _gcry_mpi_powm (gcry_mpi_t res,
+ count_trailing_zeros (c0, e0);
+ e0 = (e0 >> c0) >> 1;
+
+- /*
+- * base_u <= precomp[e0]
+- * base_u_size <= precomp_size[e0]
+- */
+- base_u_size = 0;
+- for (k = 0; k < (1<< (W - 1)); k++)
+- {
+- struct gcry_mpi w, u;
+- w.alloced = w.nlimbs = precomp_size[k];
+- u.alloced = u.nlimbs = precomp_size[k];
+- w.sign = u.sign = 0;
+- w.flags = u.flags = 0;
+- w.d = base_u;
+- u.d = precomp[k];
+-
+- mpi_set_cond (&w, &u, k == e0);
+- base_u_size |= ( precomp_size[k] & ((mpi_size_t)0 - (k == e0)) );
+- }
+-
+ for (j += W - c0; j >= 0; j--)
+ {
+- mul_mod (xp, &xsize, rp, rsize,
+- j == 0 ? base_u : rp, j == 0 ? base_u_size : rsize,
++
++ /*
++ * base_u <= precomp[e0]
++ * base_u_size <= precomp_size[e0]
++ */
++ base_u_size = 0;
++ for (k = 0; k < (1<< (W - 1)); k++)
++ {
++ w.alloced = w.nlimbs = precomp_size[k];
++ u.alloced = u.nlimbs = precomp_size[k];
++ u.d = precomp[k];
++
++ mpi_set_cond (&w, &u, k == e0);
++ base_u_size |= ( precomp_size[k] & (0UL - (k == e0)) );
++ }
++
++ w.alloced = w.nlimbs = rsize;
++ u.alloced = u.nlimbs = rsize;
++ u.d = rp;
++ mpi_set_cond (&w, &u, j != 0);
++ base_u_size ^= ((base_u_size ^ rsize) & (0UL - (j != 0)));
++
++ mul_mod (xp, &xsize, rp, rsize, base_u, base_u_size,
+ mp, msize, &karactx);
+ tp = rp; rp = xp; xp = tp;
+ rsize = xsize;
+--
+2.11.0
+
+
+From bf059348dafc1b8d29e07b9426d870ead853db84 Mon Sep 17 00:00:00 2001
+From: NIIBE Yutaka <gniibe@fsij.org>
+Date: Thu, 29 Jun 2017 11:48:44 +0900
+Subject: [PATCH 3/5] rsa: Add exponent blinding.
+
+* cipher/rsa.c (secret): Blind secret D with randomized nonce R for
+mpi_powm computation.
+
+--
+
+Co-authored-by: Werner Koch <wk@gnupg.org>
+Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
+
+The paper describing attack: https://eprint.iacr.org/2017/627
+
+Sliding right into disaster: Left-to-right sliding windows leak
+by Daniel J. Bernstein and Joachim Breitner and Daniel Genkin and
+Leon Groot Bruinderink and Nadia Heninger and Tanja Lange and
+Christine van Vredendaal and Yuval Yarom
+
+ It is well known that constant-time implementations of modular
+ exponentiation cannot use sliding windows. However, software
+ libraries such as Libgcrypt, used by GnuPG, continue to use sliding
+ windows. It is widely believed that, even if the complete pattern of
+ squarings and multiplications is observed through a side-channel
+ attack, the number of exponent bits leaked is not sufficient to
+ carry out a full key-recovery attack against RSA. Specifically,
+ 4-bit sliding windows leak only 40% of the bits, and 5-bit sliding
+ windows leak only 33% of the bits.
+
+ In this paper we demonstrate a complete break of RSA-1024 as
+ implemented in Libgcrypt. Our attack makes essential use of the fact
+ that Libgcrypt uses the left-to-right method for computing the
+ sliding-window expansion. We show for the first time that the
+ direction of the encoding matters: the pattern of squarings and
+ multiplications in left-to-right sliding windows leaks significantly
+ more information about exponent bits than for right-to-left. We show
+ how to incorporate this additional information into the
+ Heninger-Shacham algorithm for partial key reconstruction, and use
+ it to obtain very efficient full key recovery for RSA-1024. We also
+ provide strong evidence that the same attack works for RSA-2048 with
+ only moderately more computation.
+
+Exponent blinding is a kind of workaround to add noise. Signal (leak)
+is still there for non-constant-time implementation.
+
+(backported from master commit:
+8725c99ffa41778f382ca97233183bcd687bb0ce)
+
+Signed-off-by: Ross Burton <ross.burton@intel.com>
+---
+ cipher/rsa.c | 32 +++++++++++++++++++++++++-------
+ 1 file changed, 25 insertions(+), 7 deletions(-)
+
+diff --git a/cipher/rsa.c b/cipher/rsa.c
+index b6c73741..25e29b5c 100644
+--- a/cipher/rsa.c
++++ b/cipher/rsa.c
+@@ -1021,15 +1021,33 @@ secret (gcry_mpi_t output, gcry_mpi_t input, RSA_secret_key *skey )
+ gcry_mpi_t m1 = mpi_alloc_secure( mpi_get_nlimbs(skey->n)+1 );
+ gcry_mpi_t m2 = mpi_alloc_secure( mpi_get_nlimbs(skey->n)+1 );
+ gcry_mpi_t h = mpi_alloc_secure( mpi_get_nlimbs(skey->n)+1 );
+-
+- /* m1 = c ^ (d mod (p-1)) mod p */
++ gcry_mpi_t D_blind = mpi_alloc_secure ( mpi_get_nlimbs(skey->n) + 1 );
++ gcry_mpi_t r;
++ unsigned int r_nbits;
++
++ r_nbits = mpi_get_nbits (skey->p) / 4;
++ if (r_nbits < 96)
++ r_nbits = 96;
++ r = mpi_alloc_secure ((r_nbits + BITS_PER_MPI_LIMB-1)/BITS_PER_MPI_LIMB);
++
++ /* d_blind = (d mod (p-1)) + (p-1) * r */
++ /* m1 = c ^ d_blind mod p */
++ _gcry_mpi_randomize (r, r_nbits, GCRY_WEAK_RANDOM);
++ mpi_set_highbit (r, r_nbits - 1);
+ mpi_sub_ui( h, skey->p, 1 );
+- mpi_fdiv_r( h, skey->d, h );
+- mpi_powm( m1, input, h, skey->p );
+- /* m2 = c ^ (d mod (q-1)) mod q */
++ mpi_mul ( D_blind, h, r );
++ mpi_fdiv_r ( h, skey->d, h );
++ mpi_add ( D_blind, D_blind, h );
++ mpi_powm( m1, input, D_blind, skey->p );
++ /* d_blind = (d mod (q-1)) + (q-1) * r */
++ /* m2 = c ^ d_blind mod q */
++ _gcry_mpi_randomize (r, r_nbits, GCRY_WEAK_RANDOM);
++ mpi_set_highbit (r, r_nbits - 1);
+ mpi_sub_ui( h, skey->q, 1 );
+- mpi_fdiv_r( h, skey->d, h );
+- mpi_powm( m2, input, h, skey->q );
++ mpi_mul ( D_blind, h, r );
++ mpi_fdiv_r ( h, skey->d, h );
++ mpi_add ( D_blind, D_blind, h );
++ mpi_powm( m2, input, D_blind, skey->q );
+ /* h = u * ( m2 - m1 ) mod q */
+ mpi_sub( h, m2, m1 );
+ if ( mpi_has_sign ( h ) )
+--
+2.11.0
+
+
+From 09b9df2675a24e679b7944352ad6385e9e68474f Mon Sep 17 00:00:00 2001
+From: NIIBE Yutaka <gniibe@fsij.org>
+Date: Thu, 29 Jun 2017 12:36:27 +0900
+Subject: [PATCH 4/5] rsa: Fix exponent blinding.
+
+* cipher/rsa.c (secret): Free D_BLIND.
+
+--
+
+Fixes-commit: a9f612def801c8145d551d995475e5d51a4c988c
+Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
+Signed-off-by: Ross Burton <ross.burton@intel.com>
+---
+ cipher/rsa.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/cipher/rsa.c b/cipher/rsa.c
+index 25e29b5c..33f92ebd 100644
+--- a/cipher/rsa.c
++++ b/cipher/rsa.c
+@@ -1057,6 +1057,7 @@ secret (gcry_mpi_t output, gcry_mpi_t input, RSA_secret_key *skey )
+ mpi_mul ( h, h, skey->p );
+ mpi_add ( output, m1, h );
+
++ mpi_free ( D_blind );
+ mpi_free ( h );
+ mpi_free ( m1 );
+ mpi_free ( m2 );
+--
+2.11.0
+
+
+From 1323fdcf6f2f9fd1da8c5adf396650f15a2a1260 Mon Sep 17 00:00:00 2001
+From: NIIBE Yutaka <gniibe@fsij.org>
+Date: Thu, 29 Jun 2017 12:40:19 +0900
+Subject: [PATCH 5/5] rsa: More fix.
+
+* cipher/rsa.c (secret): Free R.
+
+--
+
+Fixes-commit: a9f612def801c8145d551d995475e5d51a4c988c
+Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
+Signed-off-by: Ross Burton <ross.burton@intel.com>
+---
+ cipher/rsa.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/cipher/rsa.c b/cipher/rsa.c
+index 33f92ebd..8d8d157b 100644
+--- a/cipher/rsa.c
++++ b/cipher/rsa.c
+@@ -1057,6 +1057,7 @@ secret (gcry_mpi_t output, gcry_mpi_t input, RSA_secret_key *skey )
+ mpi_mul ( h, h, skey->p );
+ mpi_add ( output, m1, h );
+
++ mpi_free ( r );
+ mpi_free ( D_blind );
+ mpi_free ( h );
+ mpi_free ( m1 );
+--
+2.11.0
+
diff --git a/import-layers/yocto-poky/meta/recipes-support/libgcrypt/libgcrypt.inc b/import-layers/yocto-poky/meta/recipes-support/libgcrypt/libgcrypt.inc
index 15805cd43..00870e3d2 100644
--- a/import-layers/yocto-poky/meta/recipes-support/libgcrypt/libgcrypt.inc
+++ b/import-layers/yocto-poky/meta/recipes-support/libgcrypt/libgcrypt.inc
@@ -20,6 +20,8 @@ SRC_URI = "${GNUPG_MIRROR}/libgcrypt/libgcrypt-${PV}.tar.gz \
file://libgcrypt-fix-building-error-with-O2-in-sysroot-path.patch \
file://fix-ICE-failure-on-mips-with-option-O-and-g.patch \
file://fix-undefined-reference-to-pthread.patch \
+ file://0001-ecc-Store-EdDSA-session-key-in-secure-memory.patch \
+ file://CVE-2017-7526.patch \
"
BINCONFIG = "${bindir}/libgcrypt-config"
diff --git a/import-layers/yocto-poky/meta/recipes-support/libpcre/libpcre_8.39.bb b/import-layers/yocto-poky/meta/recipes-support/libpcre/libpcre_8.39.bb
index 2d4668b52..90dfb3355 100644
--- a/import-layers/yocto-poky/meta/recipes-support/libpcre/libpcre_8.39.bb
+++ b/import-layers/yocto-poky/meta/recipes-support/libpcre/libpcre_8.39.bb
@@ -7,7 +7,9 @@ HOMEPAGE = "http://www.pcre.org"
SECTION = "devel"
LICENSE = "BSD"
LIC_FILES_CHKSUM = "file://LICENCE;md5=b8221cbf43c5587f90ccf228f1185cc2"
-SRC_URI = "ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-${PV}.tar.bz2 \
+
+
+SRC_URI = "${SOURCEFORGE_MIRROR}/projects/pcre/files/prce/8.39/pcre-${PV}.tar.bz2 \
file://pcre-cross.patch \
file://fix-pcre-name-collision.patch \
file://run-ptest \
diff --git a/import-layers/yocto-poky/meta/recipes-support/libxslt/libxslt/0001-Check-for-integer-overflow-in-xsltAddTextString.patch b/import-layers/yocto-poky/meta/recipes-support/libxslt/libxslt/0001-Check-for-integer-overflow-in-xsltAddTextString.patch
new file mode 100644
index 000000000..57aaacc58
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-support/libxslt/libxslt/0001-Check-for-integer-overflow-in-xsltAddTextString.patch
@@ -0,0 +1,80 @@
+From 08ab2774b870de1c7b5a48693df75e8154addae5 Mon Sep 17 00:00:00 2001
+From: Nick Wellnhofer <wellnhofer@aevum.de>
+Date: Thu, 12 Jan 2017 15:39:52 +0100
+Subject: [PATCH] Check for integer overflow in xsltAddTextString
+
+Limit buffer size in xsltAddTextString to INT_MAX. The issue can be
+exploited to trigger an out of bounds write on 64-bit systems.
+
+Originally reported to Chromium:
+
+https://crbug.com/676623
+
+CVE: CVE-2017-5029
+Upstream-Status: Backport
+
+Signed-off-by: Fan Xin <fan.xin@jp.fujitus.com>
+
+---
+ libxslt/transform.c | 25 ++++++++++++++++++++++---
+ libxslt/xsltInternals.h | 4 ++--
+ 2 files changed, 24 insertions(+), 5 deletions(-)
+
+diff --git a/libxslt/transform.c b/libxslt/transform.c
+index 519133f..02bff34 100644
+--- a/libxslt/transform.c
++++ b/libxslt/transform.c
+@@ -813,13 +813,32 @@ xsltAddTextString(xsltTransformContextPtr ctxt, xmlNodePtr target,
+ return(target);
+
+ if (ctxt->lasttext == target->content) {
++ int minSize;
+
+- if (ctxt->lasttuse + len >= ctxt->lasttsize) {
++ /* Check for integer overflow accounting for NUL terminator. */
++ if (len >= INT_MAX - ctxt->lasttuse) {
++ xsltTransformError(ctxt, NULL, target,
++ "xsltCopyText: text allocation failed\n");
++ return(NULL);
++ }
++ minSize = ctxt->lasttuse + len + 1;
++
++ if (ctxt->lasttsize < minSize) {
+ xmlChar *newbuf;
+ int size;
++ int extra;
++
++ /* Double buffer size but increase by at least 100 bytes. */
++ extra = minSize < 100 ? 100 : minSize;
++
++ /* Check for integer overflow. */
++ if (extra > INT_MAX - ctxt->lasttsize) {
++ size = INT_MAX;
++ }
++ else {
++ size = ctxt->lasttsize + extra;
++ }
+
+- size = ctxt->lasttsize + len + 100;
+- size *= 2;
+ newbuf = (xmlChar *) xmlRealloc(target->content,size);
+ if (newbuf == NULL) {
+ xsltTransformError(ctxt, NULL, target,
+diff --git a/libxslt/xsltInternals.h b/libxslt/xsltInternals.h
+index 060b178..5ad1771 100644
+--- a/libxslt/xsltInternals.h
++++ b/libxslt/xsltInternals.h
+@@ -1754,8 +1754,8 @@ struct _xsltTransformContext {
+ * Speed optimization when coalescing text nodes
+ */
+ const xmlChar *lasttext; /* last text node content */
+- unsigned int lasttsize; /* last text node size */
+- unsigned int lasttuse; /* last text node use */
++ int lasttsize; /* last text node size */
++ int lasttuse; /* last text node use */
+ /*
+ * Per Context Debugging
+ */
+--
+1.9.1
+
diff --git a/import-layers/yocto-poky/meta/recipes-support/libxslt/libxslt/0001-Link-libraries-with-libm.patch b/import-layers/yocto-poky/meta/recipes-support/libxslt/libxslt/0001-Link-libraries-with-libm.patch
new file mode 100644
index 000000000..16ffeba10
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-support/libxslt/libxslt/0001-Link-libraries-with-libm.patch
@@ -0,0 +1,48 @@
+From 487e2f7e35dad3deec7978ce4478a3d4ea5070e7 Mon Sep 17 00:00:00 2001
+From: Jussi Kukkonen <jussi.kukkonen@intel.com>
+Date: Fri, 10 Feb 2017 14:26:59 +0200
+Subject: [PATCH] Link libraries with libm
+
+Otherwise linking the resulting libraries to a binary (e.g. xsltproc)
+fails when using gold linker:
+| ../libxslt/.libs/libxslt.so: error: undefined reference to 'fmod'
+| ../libxslt/.libs/libxslt.so: error: undefined reference to 'pow'
+| ../libexslt/.libs/libexslt.so: error: undefined reference to 'floor'
+| collect2: error: ld returned 1 exit status
+
+Upstream-Status: Submitted [mailing list, Feb 10 2017]
+Signed-off-by: Jussi Kukkonen <jussi.kukkonen@intel.com>
+---
+ libexslt/Makefile.am | 2 +-
+ libxslt/Makefile.am | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/libexslt/Makefile.am b/libexslt/Makefile.am
+index 1cf5138..5449524 100644
+--- a/libexslt/Makefile.am
++++ b/libexslt/Makefile.am
+@@ -27,7 +27,7 @@ libexslt_la_SOURCES = \
+ libexslt.h \
+ dynamic.c
+
+-libexslt_la_LIBADD = $(top_builddir)/libxslt/libxslt.la $(EXTRA_LIBS) $(LIBGCRYPT_LIBS)
++libexslt_la_LIBADD = $(top_builddir)/libxslt/libxslt.la $(EXTRA_LIBS) $(LIBGCRYPT_LIBS) $(M_LIBS)
+ libexslt_la_LDFLAGS = $(WIN32_EXTRA_LDFLAGS) -version-info $(LIBEXSLT_VERSION_INFO)
+
+ man_MANS = libexslt.3
+diff --git a/libxslt/Makefile.am b/libxslt/Makefile.am
+index d9fed68..9d44c3d 100644
+--- a/libxslt/Makefile.am
++++ b/libxslt/Makefile.am
+@@ -62,7 +62,7 @@ else
+ LIBXSLT_VERSION_SCRIPT =
+ endif
+
+-libxslt_la_LIBADD = $(LIBXML_LIBS) $(EXTRA_LIBS)
++libxslt_la_LIBADD = $(LIBXML_LIBS) $(M_LIBS) $(EXTRA_LIBS)
+ libxslt_la_LDFLAGS = \
+ $(WIN32_EXTRA_LDFLAGS) \
+ $(LIBXSLT_VERSION_SCRIPT) \
+--
+2.1.4
+
diff --git a/import-layers/yocto-poky/meta/recipes-support/libxslt/libxslt_1.1.29.bb b/import-layers/yocto-poky/meta/recipes-support/libxslt/libxslt_1.1.29.bb
index be747e608..d27c70660 100644
--- a/import-layers/yocto-poky/meta/recipes-support/libxslt/libxslt_1.1.29.bb
+++ b/import-layers/yocto-poky/meta/recipes-support/libxslt/libxslt_1.1.29.bb
@@ -11,6 +11,8 @@ DEPENDS = "libxml2"
SRC_URI = "ftp://xmlsoft.org/libxslt/libxslt-${PV}.tar.gz \
file://pkgconfig_fix.patch \
file://0001-Use-pkg-config-to-find-gcrypt-and-libxml2.patch \
+ file://0001-Link-libraries-with-libm.patch \
+ file://0001-Check-for-integer-overflow-in-xsltAddTextString.patch \
"
SRC_URI[md5sum] = "a129d3c44c022de3b9dcf6d6f288d72e"
diff --git a/import-layers/yocto-poky/meta/recipes-support/nspr/nspr/nspr.pc.in b/import-layers/yocto-poky/meta/recipes-support/nspr/nspr/nspr.pc.in
index c37d0bcbd..d74caabe4 100644
--- a/import-layers/yocto-poky/meta/recipes-support/nspr/nspr/nspr.pc.in
+++ b/import-layers/yocto-poky/meta/recipes-support/nspr/nspr/nspr.pc.in
@@ -6,6 +6,6 @@ includedir=OEINCDIR
Name: NSPR
Description: The Netscape Portable Runtime
-Version: 4.9.5
+Version: NSPRVERSION
Libs: -L${libdir} -lplds4 -lplc4 -lnspr4 -lpthread -ldl
Cflags:
diff --git a/import-layers/yocto-poky/meta/recipes-support/nspr/nspr_4.12.bb b/import-layers/yocto-poky/meta/recipes-support/nspr/nspr_4.12.bb
index fa6d52357..9345a51f3 100644
--- a/import-layers/yocto-poky/meta/recipes-support/nspr/nspr_4.12.bb
+++ b/import-layers/yocto-poky/meta/recipes-support/nspr/nspr_4.12.bb
@@ -160,10 +160,13 @@ do_compile_append() {
do_install_append() {
install -D ${WORKDIR}/nspr.pc.in ${D}${libdir}/pkgconfig/nspr.pc
- sed -i s:OEPREFIX:${prefix}:g ${D}${libdir}/pkgconfig/nspr.pc
- sed -i s:OELIBDIR:${libdir}:g ${D}${libdir}/pkgconfig/nspr.pc
- sed -i s:OEINCDIR:${includedir}:g ${D}${libdir}/pkgconfig/nspr.pc
- sed -i s:OEEXECPREFIX:${exec_prefix}:g ${D}${libdir}/pkgconfig/nspr.pc
+ sed -i \
+ -e 's:NSPRVERSION:${PV}:g' \
+ -e 's:OEPREFIX:${prefix}:g' \
+ -e 's:OELIBDIR:${libdir}:g' \
+ -e 's:OEINCDIR:${includedir}:g' \
+ -e 's:OEEXECPREFIX:${exec_prefix}:g' \
+ ${D}${libdir}/pkgconfig/nspr.pc
mkdir -p ${D}${libdir}/nspr/tests
install -m 0755 ${S}/pr/tests/runtests.pl ${D}${libdir}/nspr/tests
diff --git a/import-layers/yocto-poky/meta/recipes-support/rng-tools/rng-tools_5.bb b/import-layers/yocto-poky/meta/recipes-support/rng-tools/rng-tools_5.bb
index 913a092fd..9329e8ad3 100644
--- a/import-layers/yocto-poky/meta/recipes-support/rng-tools/rng-tools_5.bb
+++ b/import-layers/yocto-poky/meta/recipes-support/rng-tools/rng-tools_5.bb
@@ -2,7 +2,7 @@ SUMMARY = "Random number generator daemon"
LICENSE = "GPLv2"
LIC_FILES_CHKSUM = "file://COPYING;md5=0b6f033afe6db235e559456585dc8cdc"
-SRC_URI = "http://heanet.dl.sourceforge.net/sourceforge/gkernel/${BP}.tar.gz \
+SRC_URI = "${SOURCEFORGE_MIRROR}/gkernel/${BP}.tar.gz \
file://0001-If-the-libc-is-lacking-argp-use-libargp.patch \
file://0002-Add-argument-to-control-the-libargp-dependency.patch \
file://underquote.patch \