[PATCH 2/4] Fix --without-openssl without OpenSSL installed

Alex Xu alex_y_xu at yahoo.ca
Mon Jun 11 00:05:39 AEST 2018


---
 auth.h                 | 3 ++-
 cipher.c               | 2 ++
 cipher.h               | 3 +++
 dh.h                   | 3 +++
 kexc25519.c            | 2 ++
 monitor_wrap.h         | 2 ++
 myproposal.h           | 2 +-
 ssh-add.c              | 2 ++
 ssh-keyscan.c          | 2 ++
 ssh_api.c              | 4 ++++
 sshbuf-getput-crypto.c | 3 ++-
 11 files changed, 25 insertions(+), 3 deletions(-)

diff --git a/auth.h b/auth.h
index 29491df9..4fcbcde7 100644
--- a/auth.h
+++ b/auth.h
@@ -30,8 +30,9 @@
 
 #include <signal.h>
 
+#ifdef WITH_OPENSSL
 #include <openssl/rsa.h>
-
+#endif
 #ifdef HAVE_LOGIN_CAP
 #include <login_cap.h>
 #endif
diff --git a/cipher.c b/cipher.c
index a72682a8..c439e66a 100644
--- a/cipher.c
+++ b/cipher.c
@@ -55,7 +55,9 @@
 struct sshcipher_ctx {
 	int	plaintext;
 	int	encrypt;
+#ifdef WITH_OPENSSL
 	EVP_CIPHER_CTX *evp;
+#endif
 	struct chachapoly_ctx cp_ctx; /* XXX union with evp? */
 	struct aesctr_ctx ac_ctx; /* XXX union with evp? */
 	const struct sshcipher *cipher;
diff --git a/cipher.h b/cipher.h
index dc7ecf11..d9d93608 100644
--- a/cipher.h
+++ b/cipher.h
@@ -38,7 +38,10 @@
 #define CIPHER_H
 
 #include <sys/types.h>
+#ifdef WITH_OPENSSL
 #include <openssl/evp.h>
+#endif
+
 #include "cipher-chachapoly.h"
 #include "cipher-aesctr.h"
 
diff --git a/dh.h b/dh.h
index bcd485cf..6e296773 100644
--- a/dh.h
+++ b/dh.h
@@ -26,6 +26,8 @@
 #ifndef DH_H
 #define DH_H
 
+#ifdef WITH_OPENSSL
+
 struct dhgroup {
 	int size;
 	BIGNUM *g;
@@ -76,5 +78,6 @@ u_int	 dh_estimate(int);
 #define MODULI_TESTS_JACOBI		(0x08)
 #define MODULI_TESTS_ELLIPTIC		(0x10)
 
+#endif /* WITH_OPENSSL */
 
 #endif
diff --git a/kexc25519.c b/kexc25519.c
index 0897b8c5..6a54cf9b 100644
--- a/kexc25519.c
+++ b/kexc25519.c
@@ -32,8 +32,10 @@
 #include <signal.h>
 #include <string.h>
 
+#ifdef WITH_OPENSSL
 #include <openssl/bn.h>
 #include <openssl/evp.h>
+#endif
 
 #include "sshbuf.h"
 #include "ssh2.h"
diff --git a/monitor_wrap.h b/monitor_wrap.h
index 76233270..7ab3cc0f 100644
--- a/monitor_wrap.h
+++ b/monitor_wrap.h
@@ -40,7 +40,9 @@ struct sshauthopt;
 
 void mm_log_handler(LogLevel, const char *, void *);
 int mm_is_monitor(void);
+#ifdef WITH_OPENSSL
 DH *mm_choose_dh(int, int, int);
+#endif
 int mm_key_sign(struct sshkey *, u_char **, u_int *, const u_char *, u_int,
     const char *);
 void mm_inform_authserv(char *, char *);
diff --git a/myproposal.h b/myproposal.h
index c255147a..f8d276da 100644
--- a/myproposal.h
+++ b/myproposal.h
@@ -24,6 +24,7 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#ifdef WITH_OPENSSL
 #include <openssl/opensslv.h>
 
 /* conditional algorithm support */
@@ -82,7 +83,6 @@
 # define SHA2_HMAC_MODES
 #endif
 
-#ifdef WITH_OPENSSL
 # ifdef HAVE_EVP_SHA256
 #  define KEX_CURVE25519_METHODS \
 	"curve25519-sha256," \
diff --git a/ssh-add.c b/ssh-add.c
index adcc4599..d9e1118f 100644
--- a/ssh-add.c
+++ b/ssh-add.c
@@ -40,8 +40,10 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 
+#ifdef WITH_OPENSSL
 #include <openssl/evp.h>
 #include "openbsd-compat/openssl-compat.h"
+#endif
 
 #include <errno.h>
 #include <fcntl.h>
diff --git a/ssh-keyscan.c b/ssh-keyscan.c
index 38b1c548..47da5f67 100644
--- a/ssh-keyscan.c
+++ b/ssh-keyscan.c
@@ -19,7 +19,9 @@
 #include <netinet/in.h>
 #include <arpa/inet.h>
 
+#ifdef WITH_OPENSSL
 #include <openssl/bn.h>
+#endif
 
 #include <netdb.h>
 #include <errno.h>
diff --git a/ssh_api.c b/ssh_api.c
index c84b4e71..e60e6740 100644
--- a/ssh_api.c
+++ b/ssh_api.c
@@ -48,7 +48,9 @@ int	_ssh_host_key_sign(struct sshkey *, struct sshkey *,
 int	use_privsep = 0;
 int	mm_sshkey_sign(struct sshkey *, u_char **, u_int *,
     u_char *, u_int, char *, u_int);
+#ifdef WITH_OPENSSL
 DH	*mm_choose_dh(int, int, int);
+#endif
 
 /* Define these two variables here so that they are part of the library */
 u_char *session_id2 = NULL;
@@ -61,11 +63,13 @@ mm_sshkey_sign(struct sshkey *key, u_char **sigp, u_int *lenp,
 	return (-1);
 }
 
+#ifdef WITH_OPENSSL
 DH *
 mm_choose_dh(int min, int nbits, int max)
 {
 	return (NULL);
 }
+#endif
 
 /* API */
 
diff --git a/sshbuf-getput-crypto.c b/sshbuf-getput-crypto.c
index d0d791b5..d7926b6e 100644
--- a/sshbuf-getput-crypto.c
+++ b/sshbuf-getput-crypto.c
@@ -15,6 +15,7 @@
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
+#ifdef WITH_OPENSSL
 #define SSHBUF_INTERNAL
 #include "includes.h"
 
@@ -221,4 +222,4 @@ sshbuf_put_eckey(struct sshbuf *buf, const EC_KEY *v)
 	    EC_KEY_get0_group(v));
 }
 #endif /* OPENSSL_HAS_ECC */
-
+#endif /* WITH_OPENSSL */
-- 
2.17.1



More information about the openssh-unix-dev mailing list