summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles.Forsyth <devnull@localhost>2007-08-17 12:37:52 +0000
committerCharles.Forsyth <devnull@localhost>2007-08-17 12:37:52 +0000
commit2a409d9c503f875c5ba694c0c601b287876c3536 (patch)
tree7726a17882573c760187b91de4be4a9906c4a2ca
parent8efcc02512b6ae020b366620032686a80b570587 (diff)
20070817-1337
-rw-r--r--CHANGES4
-rw-r--r--include/version.h2
-rw-r--r--libinterp/alt.c9
-rw-r--r--libkeyring/rsaalg.c9
4 files changed, 16 insertions, 8 deletions
diff --git a/CHANGES b/CHANGES
index 82e8bddc..7a785ead 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,7 @@
+20070817
+ two old changes that weren't in the distribution...
+ libkeyring/rsaalg.c: previously failed to ensure the output key was the right length (really rsagen should do that)
+ libinterp/alt.c: use a better random number generator
20070814
bufio.b didn't update the buffer pointers correctly on write errors
20070807
diff --git a/include/version.h b/include/version.h
index e3870e6c..ba0111e0 100644
--- a/include/version.h
+++ b/include/version.h
@@ -1 +1 @@
-#define VERSION "Fourth Edition (20070814)"
+#define VERSION "Fourth Edition (20070817)"
diff --git a/libinterp/alt.c b/libinterp/alt.c
index 61bda2e3..75749e19 100644
--- a/libinterp/alt.c
+++ b/libinterp/alt.c
@@ -268,7 +268,7 @@ xecalt(int block)
Alt *a;
Prog *p;
int nrdy;
- static int xrand = -1;
+ static ulong xrand = 0x20342;
p = currun();
@@ -288,10 +288,7 @@ xecalt(int block)
return;
}
- xrand += xrand;
- if(xrand < 0)
- xrand ^= 0x88888EEF;
-
- altcomm(a, xrand%nrdy);
+ xrand = xrand*1103515245 + 12345;
+ altcomm(a, (xrand>>8)%nrdy);
altdone(a, p, nil, -1);
}
diff --git a/libkeyring/rsaalg.c b/libkeyring/rsaalg.c
index 627acb95..ea7b5ab3 100644
--- a/libkeyring/rsaalg.c
+++ b/libkeyring/rsaalg.c
@@ -124,7 +124,14 @@ rsa_sk2pk(void *vs)
static void*
rsa_gen(int len)
{
- return rsagen(len, 8, 0);
+ RSApriv *key;
+
+ for(;;){
+ key = rsagen(len, 6, 0);
+ if(mpsignif(key->pub.n) == len)
+ return key;
+ free(key);
+ }
}
/* generate an rsa secret key with same params as a public key */