$NetBSD: patch-ad,v 1.3 2000/07/29 03:12:20 jlam Exp $

--- mike.c.orig	Tue Jun 13 14:13:04 2000
+++ mike.c	Fri Jul 28 22:57:32 2000
@@ -23,8 +23,10 @@
     char deskey[9];		      /* Destination DES key, if any */
     char rtpdeskey[9];		      /* Destination RTP DES key, if any */
     char vatdeskey[9];		      /* Destination VAT DES key, if any */
+#ifdef USE_IDEA
     char ideakey[17];		      /* Destination IDEA key, if any */
     char pgpkey[17];		      /* Destination PGP key, if any */
+#endif
     char blowfish_spec; 	      /* Nonzero if Blowfish key specified */
 #ifdef CRYPTO
     BF_KEY blowfishkey; 	      /* Destination Blowfish key, if any */
@@ -84,8 +86,10 @@
 static char curkey[9] = "";           /* Current DES key if curkey[0] != 0 */
 static char currtpkey[9] = "";        /* Current RTP DES key if currtpkey[0] != 0 */
 static char curvatkey[9] = "";        /* Current VAT DES key if currtpkey[0] != 0 */
+#ifdef USE_IDEA
 static char curideakey[17] = "";      /* Current IDEA key if curideakey[0] != 0 */
 static char curpgpkey[17] = "";       /* Current PGP key if curpgpkey[0] != 0 */
+#endif
 static char curblowfish_spec = FALSE; /* Nonzero if Blowfish key specified */
 #ifdef CRYPTO
 static BF_KEY curblowfishkey;	      /* Blowfish key */
@@ -429,8 +433,10 @@
     bcopy(curkey, d->deskey, 9);
     bcopy(currtpkey, d->rtpdeskey, 9);
     bcopy(curvatkey, d->vatdeskey, 9);
+#ifdef USE_IDEA
     bcopy(curideakey, d->ideakey, 17);
     bcopy(curpgpkey, d->pgpkey, 17);
+#endif
     d->blowfish_spec = curblowfish_spec;
 #ifdef CRYPTO
     bcopy(&curblowfishkey, &(d->blowfishkey), sizeof(BF_KEY));
@@ -599,8 +605,12 @@
 #endif
 
 #ifdef CRYPTO
+#ifdef USE_IDEA
 	if (d->deskey[0] || d->ideakey[0] || d->blowfish_spec ||
 	    d->pgpkey[0] || d->otp != NULL) {
+#else
+	if (d->deskey[0] || d->blowfish_spec || d->otp != NULL) {
+#endif
 	    soundbuf ebuf;
 	    int i;
 	    LONG slen, plen = 0;
@@ -677,6 +687,7 @@
 		}
 	    }
 
+#ifdef USE_IDEA
 	    /* IDEA encryption. */
 
 	    if (d->ideakey[0]) {
@@ -699,6 +710,7 @@
 		close_idea();
 		ebuf.compression |= fEncIDEA;
 	    }
+#endif
 
 	    /* Blowfish encryption. */
 
@@ -723,6 +735,7 @@
 		ebuf.compression |= fEncBF;
 	    }
 
+#ifdef USE_IDEA
 	    /* PGP encryption. */
 
 	    if (d->pgpkey[0]) {
@@ -745,6 +758,7 @@
 		close_idea();
 		ebuf.compression |= fEncPGP;
 	    }
+#endif
 
 	    /* Key file encryption. */
 
@@ -1593,7 +1607,7 @@
     MD5Init(&md5c);
     MD5Update(&md5c, s, strlen(s));
     MD5Final(md5key1, &md5c);
-#ifdef CRYPTO
+#if defined(CRYPTO) && defined(USE_IDEA)
     init_idearand(md5key, md5key1, time(NULL));
 #define nextrand    idearand()
 #else
@@ -1617,7 +1631,7 @@
 	    key[j] = nextrand;
 	}
     }
-#ifdef CRYPTO
+#if defined(CRYPTO) && defined(USE_IDEA)
     close_idearand();
 #endif
 #undef nextrand
@@ -1657,7 +1671,9 @@
     V fprintf(stderr, "           -F         ADPCM compression\n");
     V fprintf(stderr, "           -G         Automatic gain control\n");
 #ifdef CRYPTO
+#ifdef USE_IDEA
     V fprintf(stderr, "           -Ikey      IDEA encrypt with key\n");
+#endif
     V fprintf(stderr, "           -Kkey      DES encrypt with key\n");
 #endif
     V fprintf(stderr, "           -L         Remote loopback\n");
@@ -1684,7 +1700,7 @@
 #ifdef AUDIO_DEVICE_FILE
     V fprintf(stderr, "           -Yindev[:ctldev] Override default audio device file name or specify open #fd\n");
 #endif
-#ifdef CRYPTO
+#if defined(CRYPTO) && defined(USE_IDEA)
     V fprintf(stderr, "           -Z\"user..\" Send PGP session key for user(s)\n");
 #endif
     V fprintf(stderr, "\n");
@@ -1877,6 +1893,7 @@
 		    break;
 
 #ifdef CRYPTO
+#ifdef USE_IDEA
                 case 'I':             /* -Ikey  --  Set IDEA key */
 		    if (strlen(op + 1) == 0) {
 			curideakey[0] = FALSE;
@@ -1894,6 +1911,7 @@
 			}
 		    }
 		    break;
+#endif
 
                 case 'K':             /* -Kkey  --  Set DES key */
 		    desinit(1);       /* Initialise the DES library */
@@ -2107,6 +2125,7 @@
 #endif
 
 #ifdef CRYPTO
+#ifdef USE_IDEA
                 case 'Z':             /* -Z"user1 user2..."  --  Send PGP
 						 encrypted session key to
 						 named users */
@@ -2196,6 +2215,7 @@
 		    }
 		    break;
 #endif
+#endif
 	    }
 	} else {
 
@@ -2207,10 +2227,15 @@
 	    }
 
 	    if (rtp || vat) {
-#ifdef CRYPTO
+#if defined(CRYPTO) && defined(USE_IDEA)
 		if (curideakey[0] || curpgpkey[0] ||
 		    curblowfish_spec || curotp != NULL) {
                     fprintf(stderr, "Blowfish, IDEA, PGP, and Key File encryption cannot be used\n    with -RTP or -VAT protocols.\n");
+		    return 2;
+		}
+#else
+		if (curblowfish_spec || curotp != NULL) {
+                    fprintf(stderr, "Blowfish and Key File encryption cannot be used\n    with -RTP or -VAT protocols.\n");
 		    return 2;
 		}
 #endif