mirror of https://github.com/BOINC/boinc.git
*** empty log message ***
svn path=/trunk/boinc/; revision=4300
This commit is contained in:
parent
febe38240a
commit
fc0057979b
|
@ -18126,3 +18126,10 @@ David 6 Oct 2004
|
|||
client/
|
||||
ssl_http.C,h
|
||||
ssl_net_xfer.C,h
|
||||
|
||||
David 6 Oct 2004
|
||||
- the key generation function of crypt_prog now uses /dev/random
|
||||
instead of getting random seed based on time
|
||||
|
||||
lib/
|
||||
crypt_prog.C
|
||||
|
|
|
@ -43,6 +43,19 @@ void die(char* p) {
|
|||
exit(1);
|
||||
}
|
||||
|
||||
void better_random_create(R_RANDOM_STRUCT* r) {
|
||||
FILE* f = fopen("/dev/random", "r");
|
||||
if (!f) {
|
||||
fprintf(stderr, "can't open /dev/random\n");
|
||||
exit(1);
|
||||
}
|
||||
fread(r->state, 16, 1, f);
|
||||
fread(r->output, 16, 1, f);
|
||||
fclose(f);
|
||||
r->bytesNeeded = 0;
|
||||
r->outputAvailable = 16;
|
||||
}
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
R_RANDOM_STRUCT randomStruct;
|
||||
R_RSA_PUBLIC_KEY public_key;
|
||||
|
@ -62,7 +75,9 @@ int main(int argc, char** argv) {
|
|||
printf("creating keys in %s and %s\n", argv[3], argv[4]);
|
||||
n = atoi(argv[2]);
|
||||
|
||||
R_RandomCreate(&randomStruct);
|
||||
//R_RandomCreate(&randomStruct);
|
||||
|
||||
better_random_create(&randomStruct);
|
||||
|
||||
protoKey.bits = n;
|
||||
protoKey.useFermat4 = 1;
|
||||
|
|
Loading…
Reference in New Issue