Unified · Split
| @@ -1,3 +1,7 @@ | ||
| 1 | +20070817 | |
| 2 | + two old changes that weren't in the distribution... | |
| 3 | + libkeyring/rsaalg.c: previously failed to ensure the output key was the right length (really rsagen should do that) | |
| 4 | + libinterp/alt.c: use a better random number generator | |
| 1 | 5 | 20070814 |
| 2 | 6 | bufio.b didn't update the buffer pointers correctly on write errors |
| 3 | 7 | 20070807 |
| @@ -1 +1 @@ | ||
| 1 | −#define VERSION "Fourth Edition (20070814)" | |
| 1 | +#define VERSION "Fourth Edition (20070817)" | |
| @@ -268,7 +268,7 @@ xecalt(int block) · 267 unmodified lines | ||
| 268 | 268 | Alt *a; |
| 269 | 269 | Prog *p; |
| 270 | 270 | int nrdy; |
| 271 | − static int xrand = -1; | |
| 271 | + static ulong xrand = 0x20342; | |
| 272 | 272 | |
| 273 | 273 | p = currun(); |
| 274 | 274 | |
| @@ -288,10 +288,7 @@ xecalt(int block) · 13 unmodified lines | ||
| 288 | 288 | return; |
| 289 | 289 | } |
| 290 | 290 | |
| 291 | − xrand += xrand; | |
| 292 | − if(xrand < 0) | |
| 293 | − xrand ^= 0x88888EEF; | |
| 294 | − | |
| 295 | − altcomm(a, xrand%nrdy); | |
| 291 | + xrand = xrand*1103515245 + 12345; | |
| 292 | + altcomm(a, (xrand>>8)%nrdy); | |
| 296 | 293 | altdone(a, p, nil, -1); |
| 297 | 294 | } |
| @@ -124,7 +124,14 @@ rsa_sk2pk(void *vs) · 123 unmodified lines | ||
| 124 | 124 | static void* |
| 125 | 125 | rsa_gen(int len) |
| 126 | 126 | { |
| 127 | − return rsagen(len, 8, 0); | |
| 127 | + RSApriv *key; | |
| 128 | + | |
| 129 | + for(;;){ | |
| 130 | + key = rsagen(len, 6, 0); | |
| 131 | + if(mpsignif(key->pub.n) == len) | |
| 132 | + return key; | |
| 133 | + free(key); | |
| 134 | + } | |
| 128 | 135 | } |
| 129 | 136 | |
| 130 | 137 | /* generate an rsa secret key with same params as a public key */ |