aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/enigma
diff options
context:
space:
mode:
authorJung-uk Kim <jkim@FreeBSD.org>2006-07-25 22:20:05 +0000
committerJung-uk Kim <jkim@FreeBSD.org>2006-07-25 22:20:05 +0000
commit93e3b716ba80e91bd5118be43d5d5402c8cd3061 (patch)
tree191957cbccf26256736f69538da240c4fbef6ea1 /usr.bin/enigma
parentce92ededd9e25b3fafca5ef868abb2ae15c3d1df (diff)
downloadsrc-93e3b716ba80e91bd5118be43d5d5402c8cd3061.tar.gz
src-93e3b716ba80e91bd5118be43d5d5402c8cd3061.zip
Notes
Diffstat (limited to 'usr.bin/enigma')
-rw-r--r--usr.bin/enigma/enigma.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/usr.bin/enigma/enigma.c b/usr.bin/enigma/enigma.c
index 25bb4568a20b..68fd29ddfbc0 100644
--- a/usr.bin/enigma/enigma.c
+++ b/usr.bin/enigma/enigma.c
@@ -1,4 +1,4 @@
-/*
+/*-
* "enigma.c" is in file cbw.tar from
* anonymous FTP host watmsg.waterloo.edu: pub/crypt/cbw.tar.Z
*
@@ -40,7 +40,7 @@ setup(char *pw)
int ic, i, k, temp;
char salt[3];
unsigned rnd;
- long seed;
+ int32_t seed;
strlcpy(salt, pw, sizeof(salt));
memcpy(buf, crypt(pw, salt), sizeof(buf));
@@ -53,13 +53,6 @@ setup(char *pw)
}
for(i=0;i<ROTORSZ;i++) {
seed = 5*seed + buf[i%13];
- if( sizeof(long) > 4 ) {
- /* Force seed to stay in 32-bit signed math */
- if( seed & 0x80000000 )
- seed = seed | (-1L & ~0xFFFFFFFFL);
- else
- seed &= 0x7FFFFFFF;
- }
rnd = seed % 65521;
k = ROTORSZ-1 - i;
ic = (rnd&MASK)%(k+1);
@@ -140,7 +133,7 @@ shuffle(char deckary[])
{
int i, ic, k, temp;
unsigned rnd;
- static long seed = 123;
+ static int32_t seed = 123;
for(i=0;i<ROTORSZ;i++) {
seed = 5*seed + buf[i%13];