diff common-kex.c @ 292:64abb124763d insecure-nocrypto

propagate from branch 'au.asn.ucc.matt.dropbear' (head 7ad1775ed65e75dbece27fe6b65bf1a234db386a) to branch 'au.asn.ucc.matt.dropbear.insecure-nocrypto' (head 88ed2b94d9bfec9a4f661caf592ed01da5eb3b6a)
author Matt Johnston <matt@ucc.asn.au>
date Fri, 10 Mar 2006 06:30:52 +0000
parents 63601217f5ab 29afa62b5450
children 582cb38e4eb5
line wrap: on
line diff
--- a/common-kex.c	Thu Mar 09 15:03:22 2006 +0000
+++ b/common-kex.c	Fri Mar 10 06:30:52 2006 +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();