summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorRandy MacLeod <randy.macleod@windriver.com>2021-02-23 22:01:55 -0500
committerRichard Purdie <richard.purdie@linuxfoundation.org>2021-02-26 15:21:20 +0000
commitfcf428cdb5f0187d983e611cc2fb52611d496811 (patch)
treee3670d84e4b6e4022f0e1f072f908784c27b665b /meta
parent53615dae3e84ad4687ef3f0bd1845c088630fca2 (diff)
downloadpoky-fcf428cdb5f0187d983e611cc2fb52611d496811.tar.gz
libssh2: pull in additional commits from meta-oe
b24ef04ae libssh2: Fix build with autoconf 2.70+ d7aa71734 libssh2: enhance ptest b3e9b51c9 libssh2: fix ptest f5df715e2 libssh2: enable ptest c1d1697c5 libssh2: add nativesdk support 3a6cbf246 libssh2: Security Advisory - libssh2 - CVE-2019-17498 40ea4c939 libssh2: upgrade 1.8.2 -> 1.9.0 5a7e65cbf libssh2: Clarify BSD license variant (From OE-Core rev: 57df134b1be56a688f41851e5ff014dd859c0bc3) Signed-off-by: Randy MacLeod <Randy.MacLeod@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r--meta/recipes-support/libssh2/files/0001-Don-t-let-host-enviroment-to-decide-if-a-test-is-bui.patch46
-rw-r--r--meta/recipes-support/libssh2/files/0001-configure-Conditionally-undefine-backend-m4-macro.patch30
-rw-r--r--meta/recipes-support/libssh2/files/CVE-2019-17498.patch131
-rw-r--r--meta/recipes-support/libssh2/files/run-ptest8
-rw-r--r--meta/recipes-support/libssh2/libssh2_1.8.2.bb27
-rw-r--r--meta/recipes-support/libssh2/libssh2_1.9.0.bb53
6 files changed, 268 insertions, 27 deletions
diff --git a/meta/recipes-support/libssh2/files/0001-Don-t-let-host-enviroment-to-decide-if-a-test-is-bui.patch b/meta/recipes-support/libssh2/files/0001-Don-t-let-host-enviroment-to-decide-if-a-test-is-bui.patch
new file mode 100644
index 0000000000..5ff9bf8462
--- /dev/null
+++ b/meta/recipes-support/libssh2/files/0001-Don-t-let-host-enviroment-to-decide-if-a-test-is-bui.patch
@@ -0,0 +1,46 @@
1From f9e3e2ee7b18ba5bb8efe083171f3e701eb0a663 Mon Sep 17 00:00:00 2001
2From: Your Name <you@example.com>
3Date: Mon, 28 Dec 2020 02:08:03 +0000
4Subject: [PATCH] Don't let host enviroment to decide if a test is build
5
6test ssh2.sh need sshd, for cross compile, we need it on target, so
7don't use SSHD on host to decide weither to build a test
8
9Upstream-Status: Inappropriate[oe specific]
10
11Signed-off-by: Changqing Li <changqing.li@windriver.com>
12---
13 tests/Makefile.am | 6 +-----
14 1 file changed, 1 insertion(+), 5 deletions(-)
15
16diff --git a/tests/Makefile.am b/tests/Makefile.am
17index dc0922f..6cbc35d 100644
18--- a/tests/Makefile.am
19+++ b/tests/Makefile.am
20@@ -1,16 +1,12 @@
21 AM_CPPFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/include -I$(top_builddir)/src
22 LDADD = ../src/libssh2.la
23
24-if SSHD
25 noinst_PROGRAMS = ssh2
26 ssh2_SOURCES = ssh2.c
27-endif
28
29 ctests = simple$(EXEEXT)
30 TESTS = $(ctests) mansyntax.sh
31-if SSHD
32 TESTS += ssh2.sh
33-endif
34 check_PROGRAMS = $(ctests)
35
36 TESTS_ENVIRONMENT = SSHD=$(SSHD) EXEEXT=$(EXEEXT)
37@@ -38,4 +34,4 @@ if OPENSSL
38 # EXTRA_DIST += test_public_key_auth_succeeds_with_correct_encrypted_ed25519_key.c
39 # EXTRA_DIST += test_public_key_auth_succeeds_with_correct_ed25519_key_from_mem.c
40 EXTRA_DIST += test_public_key_auth_succeeds_with_correct_rsa_openssh_key.c
41-endif
42\ No newline at end of file
43+endif
44--
452.20.1
46
diff --git a/meta/recipes-support/libssh2/files/0001-configure-Conditionally-undefine-backend-m4-macro.patch b/meta/recipes-support/libssh2/files/0001-configure-Conditionally-undefine-backend-m4-macro.patch
new file mode 100644
index 0000000000..1128c7ea0c
--- /dev/null
+++ b/meta/recipes-support/libssh2/files/0001-configure-Conditionally-undefine-backend-m4-macro.patch
@@ -0,0 +1,30 @@
1From efe7101786193eaddb749c0583af6b54aec6f289 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Tue, 2 Feb 2021 18:45:16 -0800
4Subject: [PATCH] configure: Conditionally undefine backend m4 macro
5
6Unlike the M4 builtin, this macro fails if macro is not defined
7therefore recover the behavior of the builtin.
8
9Upstream-Status: Pending
10Signed-off-by: Khem Raj <raj.khem@gmail.com>
11---
12 configure.ac | 2 +-
13 1 file changed, 1 insertion(+), 1 deletion(-)
14
15diff --git a/configure.ac b/configure.ac
16index fe5054a..758f8c2 100644
17--- a/configure.ac
18+++ b/configure.ac
19@@ -127,7 +127,7 @@ fi
20 m4_set_foreach([crypto_backends], [backend],
21 [AM_CONDITIONAL(m4_toupper(backend), test "$found_crypto" = "backend")]
22 )
23-m4_undefine([backend])
24+m4_ifdef([backend], [m4_undefine([backend])])
25
26
27 # libz
28--
292.30.0
30
diff --git a/meta/recipes-support/libssh2/files/CVE-2019-17498.patch b/meta/recipes-support/libssh2/files/CVE-2019-17498.patch
new file mode 100644
index 0000000000..001080072b
--- /dev/null
+++ b/meta/recipes-support/libssh2/files/CVE-2019-17498.patch
@@ -0,0 +1,131 @@
1From dedcbd106f8e52d5586b0205bc7677e4c9868f9c Mon Sep 17 00:00:00 2001
2From: Will Cosgrove <will@panic.com>
3Date: Fri, 30 Aug 2019 09:57:38 -0700
4Subject: [PATCH] packet.c: improve message parsing (#402)
5
6* packet.c: improve parsing of packets
7
8file: packet.c
9
10notes:
11Use _libssh2_get_string API in SSH_MSG_DEBUG/SSH_MSG_DISCONNECT. Additional uint32 bounds check in SSH_MSG_GLOBAL_REQUEST.
12
13Upstream-Status: Backport
14CVE: CVE-2019-17498
15Signed-off-by: Li Zhou <li.zhou@windriver.com>
16---
17 src/packet.c | 68 ++++++++++++++++++++++------------------------------
18 1 file changed, 29 insertions(+), 39 deletions(-)
19
20diff --git a/src/packet.c b/src/packet.c
21index 38ab629..2e01bfc 100644
22--- a/src/packet.c
23+++ b/src/packet.c
24@@ -419,8 +419,8 @@ _libssh2_packet_add(LIBSSH2_SESSION * session, unsigned char *data,
25 size_t datalen, int macstate)
26 {
27 int rc = 0;
28- char *message = NULL;
29- char *language = NULL;
30+ unsigned char *message = NULL;
31+ unsigned char *language = NULL;
32 size_t message_len = 0;
33 size_t language_len = 0;
34 LIBSSH2_CHANNEL *channelp = NULL;
35@@ -472,33 +472,23 @@ _libssh2_packet_add(LIBSSH2_SESSION * session, unsigned char *data,
36
37 case SSH_MSG_DISCONNECT:
38 if(datalen >= 5) {
39- size_t reason = _libssh2_ntohu32(data + 1);
40+ uint32_t reason = 0;
41+ struct string_buf buf;
42+ buf.data = (unsigned char *)data;
43+ buf.dataptr = buf.data;
44+ buf.len = datalen;
45+ buf.dataptr++; /* advance past type */
46
47- if(datalen >= 9) {
48- message_len = _libssh2_ntohu32(data + 5);
49+ _libssh2_get_u32(&buf, &reason);
50+ _libssh2_get_string(&buf, &message, &message_len);
51+ _libssh2_get_string(&buf, &language, &language_len);
52
53- if(message_len < datalen-13) {
54- /* 9 = packet_type(1) + reason(4) + message_len(4) */
55- message = (char *) data + 9;
56-
57- language_len =
58- _libssh2_ntohu32(data + 9 + message_len);
59- language = (char *) data + 9 + message_len + 4;
60-
61- if(language_len > (datalen-13-message_len)) {
62- /* bad input, clear info */
63- language = message = NULL;
64- language_len = message_len = 0;
65- }
66- }
67- else
68- /* bad size, clear it */
69- message_len = 0;
70- }
71 if(session->ssh_msg_disconnect) {
72- LIBSSH2_DISCONNECT(session, reason, message,
73- message_len, language, language_len);
74+ LIBSSH2_DISCONNECT(session, reason, (const char *)message,
75+ message_len, (const char *)language,
76+ language_len);
77 }
78+
79 _libssh2_debug(session, LIBSSH2_TRACE_TRANS,
80 "Disconnect(%d): %s(%s)", reason,
81 message, language);
82@@ -539,24 +529,24 @@ _libssh2_packet_add(LIBSSH2_SESSION * session, unsigned char *data,
83 int always_display = data[1];
84
85 if(datalen >= 6) {
86- message_len = _libssh2_ntohu32(data + 2);
87-
88- if(message_len <= (datalen - 10)) {
89- /* 6 = packet_type(1) + display(1) + message_len(4) */
90- message = (char *) data + 6;
91- language_len = _libssh2_ntohu32(data + 6 +
92- message_len);
93-
94- if(language_len <= (datalen - 10 - message_len))
95- language = (char *) data + 10 + message_len;
96- }
97+ struct string_buf buf;
98+ buf.data = (unsigned char *)data;
99+ buf.dataptr = buf.data;
100+ buf.len = datalen;
101+ buf.dataptr += 2; /* advance past type & always display */
102+
103+ _libssh2_get_string(&buf, &message, &message_len);
104+ _libssh2_get_string(&buf, &language, &language_len);
105 }
106
107 if(session->ssh_msg_debug) {
108- LIBSSH2_DEBUG(session, always_display, message,
109- message_len, language, language_len);
110+ LIBSSH2_DEBUG(session, always_display,
111+ (const char *)message,
112+ message_len, (const char *)language,
113+ language_len);
114 }
115 }
116+
117 /*
118 * _libssh2_debug will actually truncate this for us so
119 * that it's not an inordinate about of data
120@@ -579,7 +569,7 @@ _libssh2_packet_add(LIBSSH2_SESSION * session, unsigned char *data,
121 uint32_t len = 0;
122 unsigned char want_reply = 0;
123 len = _libssh2_ntohu32(data + 1);
124- if(datalen >= (6 + len)) {
125+ if((len <= (UINT_MAX - 6)) && (datalen >= (6 + len))) {
126 want_reply = data[5 + len];
127 _libssh2_debug(session,
128 LIBSSH2_TRACE_CONN,
129--
1302.17.1
131
diff --git a/meta/recipes-support/libssh2/files/run-ptest b/meta/recipes-support/libssh2/files/run-ptest
new file mode 100644
index 0000000000..5fd7ec65f6
--- /dev/null
+++ b/meta/recipes-support/libssh2/files/run-ptest
@@ -0,0 +1,8 @@
1#!/bin/sh
2
3ptestdir=$(dirname "$(readlink -f "$0")")
4cd tests
5for test in simple ssh2.sh mansyntax.sh
6do
7 ./../test-driver --test-name $test --log-file ../$test.log --trs-file ../$test.trs --color-tests no --enable-hard-errors yes --expect-failure no -- ./$test
8done
diff --git a/meta/recipes-support/libssh2/libssh2_1.8.2.bb b/meta/recipes-support/libssh2/libssh2_1.8.2.bb
deleted file mode 100644
index fe853cde4f..0000000000
--- a/meta/recipes-support/libssh2/libssh2_1.8.2.bb
+++ /dev/null
@@ -1,27 +0,0 @@
1SUMMARY = "A client-side C library implementing the SSH2 protocol"
2HOMEPAGE = "http://www.libssh2.org/"
3SECTION = "libs"
4
5DEPENDS = "zlib"
6
7LICENSE = "BSD"
8LIC_FILES_CHKSUM = "file://COPYING;md5=c5cf34fc0acb44b082ef50ef5e4354ca"
9
10SRC_URI = "http://www.libssh2.org/download/${BP}.tar.gz"
11
12SRC_URI[md5sum] = "616efd99af3d9ef731a26bed6cee9593"
13SRC_URI[sha256sum] = "088307d9f6b6c4b8c13f34602e8ff65d21c2dc4d55284dfe15d502c4ee190d67"
14
15inherit autotools pkgconfig
16
17EXTRA_OECONF += "\
18 --with-libz \
19 --with-libz-prefix=${STAGING_LIBDIR} \
20 "
21
22# only one of openssl and gcrypt could be set
23PACKAGECONFIG ??= "openssl"
24PACKAGECONFIG[openssl] = "--with-openssl --with-libssl-prefix=${STAGING_LIBDIR},--without-openssl,openssl"
25PACKAGECONFIG[gcrypt] = "--with-libgcrypt --with-libgcrypt-prefix=${STAGING_EXECPREFIXDIR},--without-libgcrypt,libgcrypt"
26
27BBCLASSEXTEND = "native"
diff --git a/meta/recipes-support/libssh2/libssh2_1.9.0.bb b/meta/recipes-support/libssh2/libssh2_1.9.0.bb
new file mode 100644
index 0000000000..0b8ccbd217
--- /dev/null
+++ b/meta/recipes-support/libssh2/libssh2_1.9.0.bb
@@ -0,0 +1,53 @@
1SUMMARY = "A client-side C library implementing the SSH2 protocol"
2HOMEPAGE = "http://www.libssh2.org/"
3SECTION = "libs"
4
5DEPENDS = "zlib"
6
7LICENSE = "BSD-3-Clause"
8LIC_FILES_CHKSUM = "file://COPYING;md5=c5cf34fc0acb44b082ef50ef5e4354ca"
9
10SRC_URI = "http://www.libssh2.org/download/${BP}.tar.gz \
11 file://CVE-2019-17498.patch \
12 file://0001-configure-Conditionally-undefine-backend-m4-macro.patch \
13 file://run-ptest \
14"
15
16SRC_URI_append_ptest = " file://0001-Don-t-let-host-enviroment-to-decide-if-a-test-is-bui.patch"
17
18SRC_URI[md5sum] = "1beefafe8963982adc84b408b2959927"
19SRC_URI[sha256sum] = "d5fb8bd563305fd1074dda90bd053fb2d29fc4bce048d182f96eaa466dfadafd"
20
21inherit autotools pkgconfig ptest
22
23EXTRA_OECONF += "\
24 --with-libz \
25 --with-libz-prefix=${STAGING_LIBDIR} \
26 "
27
28# only one of openssl and gcrypt could be set
29PACKAGECONFIG ??= "openssl"
30PACKAGECONFIG[openssl] = "--with-crypto=openssl --with-libssl-prefix=${STAGING_LIBDIR}, , openssl"
31PACKAGECONFIG[gcrypt] = "--with-crypto=libgcrypt --with-libgcrypt-prefix=${STAGING_EXECPREFIXDIR}, , libgcrypt"
32
33BBCLASSEXTEND = "native nativesdk"
34
35# required for ptest on documentation
36RDEPENDS_${PN}-ptest = "man-db openssh"
37RDEPENDS_${PN}-ptest_append_libc-glibc = " locale-base-en-us"
38
39do_compile_ptest() {
40 sed -i "/\$(MAKE) \$(AM_MAKEFLAGS) check-TESTS/d" tests/Makefile
41 oe_runmake check
42}
43
44do_install_ptest() {
45 install -d ${D}${PTEST_PATH}/tests
46 install -m 0755 ${S}/test-driver ${D}${PTEST_PATH}/
47 cp -rf ${B}/tests/.libs/* ${D}${PTEST_PATH}/tests/
48 cp -rf ${S}/tests/mansyntax.sh ${D}${PTEST_PATH}/tests/
49 cp -rf ${S}/tests/ssh2.sh ${D}${PTEST_PATH}/tests/
50 cp -rf ${S}/tests/etc ${D}${PTEST_PATH}/tests/
51 mkdir -p ${D}${PTEST_PATH}/docs
52 cp -r ${S}/docs/* ${D}${PTEST_PATH}/docs/
53}