summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Ghinea <stefan.ghinea@windriver.com>2021-04-23 20:18:26 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2021-05-04 22:57:50 +0100
commit5cde220103874fa92949e3211bf50620d319458f (patch)
treeb53917bd31a8a91974f1a250a9f15b2c1ef7b0bd
parent80c76a82ec29d585fff9da914a4c5ff9279bd8cc (diff)
downloadpoky-5cde220103874fa92949e3211bf50620d319458f.tar.gz
libssh2: fix build failure with option no-ecdsa
libssh2 fails at do_compile if DEPRECATED_CRYPTO_FLAGS = "no-ecdsa" is set in recipe: ../src/.libs/libssh2.so: undefined reference to `LIBSSH2_KEX_METHOD_EC_SHA_HASH_CREATE_VERIFY' References: https://github.com/libssh2/libssh2/issues/549 Upstream patches: https://github.com/libssh2/libssh2/commit/1f76151c92e1b52e9c24ebf06adc77fbd6c062bc (From OE-Core rev: d70cf4cd57d61f7db7179673b211e631c944e0e6) Signed-off-by: Stefan Ghinea <stefan.ghinea@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit 2bb146e7315f8080cb49a95212231ccb76a4a822) Signed-off-by: Anuj Mittal <anuj.mittal@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/recipes-support/libssh2/files/0001-kex.c-move-EC-macro-outside-of-if-check-549-550.patch112
-rw-r--r--meta/recipes-support/libssh2/libssh2_1.9.0.bb1
2 files changed, 113 insertions, 0 deletions
diff --git a/meta/recipes-support/libssh2/files/0001-kex.c-move-EC-macro-outside-of-if-check-549-550.patch b/meta/recipes-support/libssh2/files/0001-kex.c-move-EC-macro-outside-of-if-check-549-550.patch
new file mode 100644
index 0000000000..b331c1bf81
--- /dev/null
+++ b/meta/recipes-support/libssh2/files/0001-kex.c-move-EC-macro-outside-of-if-check-549-550.patch
@@ -0,0 +1,112 @@
1From 1f76151c92e1b52e9c24ebf06adc77fbd6c062bc Mon Sep 17 00:00:00 2001
2From: Will Cosgrove <will@panic.com>
3Date: Tue, 26 Jan 2021 11:41:21 -0800
4Subject: [PATCH] kex.c: move EC macro outside of if check #549 (#550)
5
6File: kex.c
7
8Notes:
9Moved the macro LIBSSH2_KEX_METHOD_EC_SHA_HASH_CREATE_VERIFY outside of the LIBSSH2_ECDSA since it's also now used by the ED25519 code.
10
11Sha 256, 384 and 512 need to be defined for all backends now even if they aren't used directly. I believe this is already the case, but just a heads up.
12
13Credit:
14Stefan-Ghinea
15
16Upstream-Status: Backport
17
18Reference to upstream patch:
19https://github.com/libssh2/libssh2/commit/1f76151c92e1b52e9c24ebf06adc77fbd6c062bc
20
21Signed-off-by: Stefan Ghinea <stefan.ghinea@windriver.com>
22---
23 src/kex.c | 66 +++++++++++++++++++++++++++----------------------------
24 1 file changed, 33 insertions(+), 33 deletions(-)
25
26diff --git a/src/kex.c b/src/kex.c
27index cb16639..19ab6ec 100644
28--- a/src/kex.c
29+++ b/src/kex.c
30@@ -1885,39 +1885,6 @@ kex_method_diffie_hellman_group_exchange_sha256_key_exchange
31 }
32
33
34-#if LIBSSH2_ECDSA
35-
36-/* kex_session_ecdh_curve_type
37- * returns the EC curve type by name used in key exchange
38- */
39-
40-static int
41-kex_session_ecdh_curve_type(const char *name, libssh2_curve_type *out_type)
42-{
43- int ret = 0;
44- libssh2_curve_type type;
45-
46- if(name == NULL)
47- return -1;
48-
49- if(strcmp(name, "ecdh-sha2-nistp256") == 0)
50- type = LIBSSH2_EC_CURVE_NISTP256;
51- else if(strcmp(name, "ecdh-sha2-nistp384") == 0)
52- type = LIBSSH2_EC_CURVE_NISTP384;
53- else if(strcmp(name, "ecdh-sha2-nistp521") == 0)
54- type = LIBSSH2_EC_CURVE_NISTP521;
55- else {
56- ret = -1;
57- }
58-
59- if(ret == 0 && out_type) {
60- *out_type = type;
61- }
62-
63- return ret;
64-}
65-
66-
67 /* LIBSSH2_KEX_METHOD_EC_SHA_HASH_CREATE_VERIFY
68 *
69 * Macro that create and verifies EC SHA hash with a given digest bytes
70@@ -2027,6 +1994,39 @@ kex_session_ecdh_curve_type(const char *name, libssh2_curve_type *out_type)
71 } \
72
73
74+#if LIBSSH2_ECDSA
75+
76+/* kex_session_ecdh_curve_type
77+ * returns the EC curve type by name used in key exchange
78+ */
79+
80+static int
81+kex_session_ecdh_curve_type(const char *name, libssh2_curve_type *out_type)
82+{
83+ int ret = 0;
84+ libssh2_curve_type type;
85+
86+ if(name == NULL)
87+ return -1;
88+
89+ if(strcmp(name, "ecdh-sha2-nistp256") == 0)
90+ type = LIBSSH2_EC_CURVE_NISTP256;
91+ else if(strcmp(name, "ecdh-sha2-nistp384") == 0)
92+ type = LIBSSH2_EC_CURVE_NISTP384;
93+ else if(strcmp(name, "ecdh-sha2-nistp521") == 0)
94+ type = LIBSSH2_EC_CURVE_NISTP521;
95+ else {
96+ ret = -1;
97+ }
98+
99+ if(ret == 0 && out_type) {
100+ *out_type = type;
101+ }
102+
103+ return ret;
104+}
105+
106+
107 /* ecdh_sha2_nistp
108 * Elliptic Curve Diffie Hellman Key Exchange
109 */
110--
1112.17.1
112
diff --git a/meta/recipes-support/libssh2/libssh2_1.9.0.bb b/meta/recipes-support/libssh2/libssh2_1.9.0.bb
index 0b8ccbd217..a5451628e7 100644
--- a/meta/recipes-support/libssh2/libssh2_1.9.0.bb
+++ b/meta/recipes-support/libssh2/libssh2_1.9.0.bb
@@ -11,6 +11,7 @@ SRC_URI = "http://www.libssh2.org/download/${BP}.tar.gz \
11 file://CVE-2019-17498.patch \ 11 file://CVE-2019-17498.patch \
12 file://0001-configure-Conditionally-undefine-backend-m4-macro.patch \ 12 file://0001-configure-Conditionally-undefine-backend-m4-macro.patch \
13 file://run-ptest \ 13 file://run-ptest \
14 file://0001-kex.c-move-EC-macro-outside-of-if-check-549-550.patch \
14" 15"
15 16
16SRC_URI_append_ptest = " file://0001-Don-t-let-host-enviroment-to-decide-if-a-test-is-bui.patch" 17SRC_URI_append_ptest = " file://0001-Don-t-let-host-enviroment-to-decide-if-a-test-is-bui.patch"