From 178f3a4f56019ae17783b038f2fa4894923e3ed1 Mon Sep 17 00:00:00 2001 From: Jakub Jelen Date: Fri, 14 Sep 2018 16:53:22 +0200 Subject: [PATCH] Fix the cavs test and avoid it crashing (#1628962) Patch from Stephan Mueller, adjusted by myselt --- openssh-6.7p1-kdf-cavs.patch | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/openssh-6.7p1-kdf-cavs.patch b/openssh-6.7p1-kdf-cavs.patch index f92cb50..181267c 100644 --- a/openssh-6.7p1-kdf-cavs.patch +++ b/openssh-6.7p1-kdf-cavs.patch @@ -40,7 +40,7 @@ diff -up openssh-6.8p1/Makefile.in.kdf-cavs openssh-6.8p1/Makefile.in diff -up openssh-6.8p1/ssh-cavs.c.kdf-cavs openssh-6.8p1/ssh-cavs.c --- openssh-6.8p1/ssh-cavs.c.kdf-cavs 2015-03-18 11:23:46.348049354 +0100 +++ openssh-6.8p1/ssh-cavs.c 2015-03-18 11:23:46.348049354 +0100 -@@ -0,0 +1,380 @@ +@@ -0,0 +1,377 @@ +/* + * Copyright (C) 2015, Stephan Mueller + * @@ -93,6 +93,7 @@ diff -up openssh-6.8p1/ssh-cavs.c.kdf-cavs openssh-6.8p1/ssh-cavs.c +#include "cipher.h" +#include "kex.h" +#include "packet.h" ++#include "digest.h" + +static int bin_char(unsigned char hex) +{ @@ -234,16 +235,16 @@ diff -up openssh-6.8p1/ssh-cavs.c.kdf-cavs openssh-6.8p1/ssh-cavs.c + /* select the right hash based on struct ssh_digest digests */ + switch (test->ik_len) { + case 20: -+ kex.hash_alg = 2; ++ kex.hash_alg = SSH_DIGEST_SHA1; + break; + case 32: -+ kex.hash_alg = 3; ++ kex.hash_alg = SSH_DIGEST_SHA256; + break; + case 48: -+ kex.hash_alg = 4; ++ kex.hash_alg = SSH_DIGEST_SHA384; + break; + case 64: -+ kex.hash_alg = 5; ++ kex.hash_alg = SSH_DIGEST_SHA512; + break; + default: + printf("Wrong hash type %u\n", test->ik_len); @@ -320,10 +321,6 @@ diff -up openssh-6.8p1/ssh-cavs.c.kdf-cavs openssh-6.8p1/ssh-cavs.c +out: + if (Kbn) + BN_free(Kbn); -+ if (kex.newkeys[0]) -+ free(kex.newkeys[0]); -+ if (kex.newkeys[1]) -+ free(kex.newkeys[1]); + if (ssh) + ssh_packet_close(ssh); + return ret;