From 2a409d9c503f875c5ba694c0c601b287876c3536 Mon Sep 17 00:00:00 2001 From: "Charles.Forsyth" Date: Fri, 17 Aug 2007 12:37:52 +0000 Subject: 20070817-1337 --- CHANGES | 4 ++++ include/version.h | 2 +- libinterp/alt.c | 9 +++------ libkeyring/rsaalg.c | 9 ++++++++- 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 */ -- cgit v1.2.3