pkgsrc/net/speakfreely/patches/patch-ag
jlam 47369ef416 Merge net/speakfreely and net/speakfreely-crypto. Allow building without
using patented IDEA algorithm.  Uses two new make variables which may be
defined in mk.conf:

	USE_CRYPTO:	YES, NO
	USE_IDEA:	YES, NO

Defaults to building with crypto but without IDEA.
2000-01-17 16:02:33 +00:00

131 lines
3.4 KiB
Text

$NetBSD: patch-ag,v 1.1 2000/01/17 16:02:34 jlam Exp $
--- speaker.c.orig Tue Sep 14 05:53:42 1999
+++ speaker.c Sat Jan 15 12:46:06 2000
@@ -10,6 +10,10 @@
#include "speakfree.h"
#include "version.h"
+#ifndef SOUNDDIR
+#define SOUNDDIR
+#endif
+
static int audiok = FALSE; /* Audio initialised flag */
static int audiotime = 0; /* Audio timeout counter */
static int debugging = FALSE; /* Debugging enabled */
@@ -22,7 +26,9 @@
static char deskey[9] = ""; /* DES key, if any */
static char rtpdeskey[9] = ""; /* RTP DES key, if any */
static char vatdeskey[9] = ""; /* VAT DES key, if any */
+#ifdef USE_IDEA
static char ideakey[17] = ""; /* IDEA key, if any */
+#endif
static char blowfish_spec = FALSE; /* Nonzero if Blowfish key specified */
#ifdef CRYPTO
static BF_KEY blowfishkey; /* Blowfish key */
@@ -53,7 +59,7 @@
static char *replyfile = NULL; /* Reply file pathname */
static char *replycmdexe = NULL;
static char *replycmd = "sfmike -t"; /* Default reply command */
-static char *busysignal = "sleep 10; sfmike %s busy.au"; /* Default busy signal command */
+static char *busysignal = "sleep 10; sfmike %s " SOUNDDIR "busy.au"; /* Default busy signal command */
static int busytimeout = 60 * 1000000L; /* Busy signal timeout interval */
static int dobusy = FALSE; /* Reject calls when busy ? */
#ifdef HALF_DUPLEX
@@ -261,17 +267,17 @@
MD5Init(&md5c);
MD5Update(&md5c, s, strlen(s));
MD5Final(md5key1, &md5c);
-#ifdef CRYPTO
+#if defined(CRYPTO) && defined(USE_IDEA)
init_idearand(md5key, md5key1, time(NULL));
#endif
for (j = 0; j < 16; j++) {
-#ifdef CRYPTO
+#if defined(CRYPTO) && defined(USE_IDEA)
key[j] = idearand();
#else
key[j] = md5key[j] ^ md5key1[j];
#endif
}
-#ifdef CRYPTO
+#if defined(CRYPTO) && defined(USE_IDEA)
close_idearand();
#endif
}
@@ -533,6 +539,7 @@
an idle message, though, and tweak the timeout so we do this
only once. */
+#ifdef USE_IDEA
if (c->pgpkey[0] == 0) {
if (l == NULL) {
conn = n;
@@ -541,6 +548,7 @@
}
free(c);
}
+#endif
} else {
int makereq = FALSE;
@@ -796,6 +804,7 @@
}
}
+#ifdef USE_IDEA
if ((msg->compression & fEncPGP) && c->pgpkey[0]) {
unsigned short iv[4];
LONG slen = (len + 7) & (~7);
@@ -809,6 +818,7 @@
ideacfb(val, slen);
close_idea();
}
+#endif
if ((msg->compression & fEncBF) && blowfish_spec) {
unsigned char iv[8];
@@ -822,6 +832,7 @@
slen, &blowfishkey, iv, BF_DECRYPT);
}
+#ifdef USE_IDEA
if ((msg->compression & fEncIDEA) && ideakey[0]) {
unsigned short iv[4];
LONG slen = (len + 7) & (~7);
@@ -835,6 +846,7 @@
ideacfb(val, slen);
close_idea();
}
+#endif
if ((msg->compression & fEncDES) && deskey[0]) {
int i;
@@ -1211,7 +1223,7 @@
}
break;
-#ifdef CRYPTO
+#if defined(CRYPTO) && defined(USE_IDEA)
case 'I': /* -Ikey -- Set IDEA key */
if (strlen(op + 1) == 0) {
ideakey[0] = FALSE;
@@ -1660,7 +1672,9 @@
newconn = TRUE;
c->con_next = conn;
+#ifdef USE_IDEA
c->pgpkey[0] = FALSE;
+#endif
bzero(c->keymd5, 16);
c->con_uname[0] = c->con_email[0] = 0;
#ifndef CRYPTO
@@ -2496,7 +2510,7 @@
}
-#ifdef CRYPTO
+#if defined(CRYPTO) && defined(USE_IDEA)
if ((sb.compression & fKeyPGP)) {
char cmd[256], f[40], kmd[16];
FILE *kfile;