summaryrefslogtreecommitdiffstats
path: root/meta-oe/recipes-support/libssh2/files/CVE-2016-0787.patch
blob: 9468feb6d0d207ed999c9b7788ca4a0376afc655 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
From 8a453a7b0f1e667b7369eb73b00843a8decdecc9 Mon Sep 17 00:00:00 2001
From: Daniel Stenberg <daniel@haxx.se>
Date: Thu, 11 Feb 2016 13:52:20 +0100
Subject: [PATCH] diffie_hellman_sha256: convert bytes to bits

As otherwise we get far too small numbers.

CVE-2016-0787
Patch is from [https://www.libssh2.org/CVE-2016-0787.patch]

Upstream-Status: Backport
Signed-off-by: Sona Sarmadi <sona.sarmadi@enea.com>
---
 src/kex.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/kex.c b/src/kex.c
index 6349457..e89b36c 100644
--- a/src/kex.c
+++ b/src/kex.c
@@ -751,11 +751,11 @@ static int diffie_hellman_sha256(LIBSSH2_SESSION *session,
 
         /* Zero the whole thing out */
         memset(&exchange_state->req_state, 0, sizeof(packet_require_state_t));
 
         /* Generate x and e */
-        _libssh2_bn_rand(exchange_state->x, group_order, 0, -1);
+        _libssh2_bn_rand(exchange_state->x, group_order * 8 - 1, 0, -1);
         _libssh2_bn_mod_exp(exchange_state->e, g, exchange_state->x, p,
                             exchange_state->ctx);
 
         /* Send KEX init */
         /* packet_type(1) + String Length(4) + leading 0(1) */
-- 
2.7.0