From ab67e42d6a0529f5fb81ee86049bf10abe99f839 Mon Sep 17 00:00:00 2001
From: Jakub Jelen <jjelen@redhat.com>
Date: Tue, 7 Nov 2017 09:38:40 +0100
Subject: [PATCH] pki_crypto: Avoid segfault with OpenSSL 1.1.0

Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
---
 src/pki_crypto.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/pki_crypto.c b/src/pki_crypto.c
index 34d6e81c..30f49a81 100644
--- a/src/pki_crypto.c
+++ b/src/pki_crypto.c
@@ -452,6 +452,10 @@ int pki_key_generate_rsa(ssh_key key, int parameter){
 int pki_key_generate_dss(ssh_key key, int parameter){
     int rc;
 #if OPENSSL_VERSION_NUMBER > 0x10100000L
+    key->dsa = DSA_new();
+    if (!key->dsa) {
+        return SSH_ERROR;
+    }
     rc = DSA_generate_parameters_ex(key->dsa,
                                     parameter,
                                     NULL,  /* seed */
-- 
2.19.1

