diff common-kex.c @ 252:29afa62b5450 insecure-nocrypto

- a hack for grahame to run dropbear with "none" cipher. DO NOT USE IF YOU DON'T KNOW THE CONSEQUENCES Here is your noose. Use it wisely.
author Matt Johnston <matt@ucc.asn.au>
date Fri, 23 Sep 2005 16:29:19 +0000
parents 5e4110bb753a
children 64abb124763d
line wrap: on
line diff
--- a/common-kex.c	Wed Sep 21 15:58:19 2005 +0000
+++ b/common-kex.c	Fri Sep 23 16:29:19 2005 +0000
@@ -298,27 +298,35 @@
 	hashkeys(C2S_key, C2S_keysize, &hs, 'C');
 	hashkeys(S2C_key, S2C_keysize, &hs, 'D');
 
-	if (cbc_start(
-		find_cipher(ses.newkeys->recv_algo_crypt->cipherdesc->name),
-			recv_IV, recv_key, 
-			ses.newkeys->recv_algo_crypt->keysize, 0, 
-			&ses.newkeys->recv_symmetric_struct) != CRYPT_OK) {
-		dropbear_exit("crypto error");
+	if (ses.newkeys->recv_algo_crypt->cipherdesc != NULL) {
+		if (cbc_start(
+			find_cipher(ses.newkeys->recv_algo_crypt->cipherdesc->name),
+				recv_IV, recv_key, 
+				ses.newkeys->recv_algo_crypt->keysize, 0, 
+				&ses.newkeys->recv_symmetric_struct) != CRYPT_OK) {
+			dropbear_exit("crypto error");
+		}
 	}
 
-	if (cbc_start(
-		find_cipher(ses.newkeys->trans_algo_crypt->cipherdesc->name),
-			trans_IV, trans_key, 
-			ses.newkeys->trans_algo_crypt->keysize, 0, 
-			&ses.newkeys->trans_symmetric_struct) != CRYPT_OK) {
-		dropbear_exit("crypto error");
+	if (ses.newkeys->trans_algo_crypt->cipherdesc != NULL) {
+		if (cbc_start(
+			find_cipher(ses.newkeys->trans_algo_crypt->cipherdesc->name),
+				trans_IV, trans_key, 
+				ses.newkeys->trans_algo_crypt->keysize, 0, 
+				&ses.newkeys->trans_symmetric_struct) != CRYPT_OK) {
+			dropbear_exit("crypto error");
+		}
 	}
 	
 	/* MAC keys */
-	hashkeys(ses.newkeys->transmackey, 
-			ses.newkeys->trans_algo_mac->keysize, &hs, mactransletter);
-	hashkeys(ses.newkeys->recvmackey, 
-			ses.newkeys->recv_algo_mac->keysize, &hs, macrecvletter);
+	if (ses.newkeys->trans_algo_mac->hashdesc != NULL) {
+		hashkeys(ses.newkeys->transmackey, 
+				ses.newkeys->trans_algo_mac->keysize, &hs, mactransletter);
+	}
+	if (ses.newkeys->recv_algo_mac->hashdesc != NULL) {
+		hashkeys(ses.newkeys->recvmackey, 
+				ses.newkeys->recv_algo_mac->keysize, &hs, macrecvletter);
+	}
 
 #ifndef DISABLE_ZLIB
 	gen_new_zstreams();