[Csync2] generating pre-shared keys very slow
Christian Wiese
morfoh at opensde.org
Wed Dec 17 15:30:30 CET 2008
Hi again,
I found the issue, and now I do not really wonder about the very slow
operation of 'csync2 -k foo.key' because '/dev/random' is used as
entropy source even while having '/dev/urandom' available.
If I use following quick and dirty patch, 'csync2 -k foo.key' works
much faster than before, returning a key immediately and not after
minutes.
Cheers,
Chris
-----------------------------snip----------------------------------------
--- csync2.c.orig 2008-12-17 15:57:19.000000000 +0100
+++ csync2.c 2008-12-17 15:57:57.000000000 +0100
@@ -190,7 +190,7 @@
int create_keyfile(const char *filename)
{
int fd = open(filename, O_WRONLY|O_CREAT|O_EXCL, 0600);
- int rand = open("/dev/random", O_RDONLY);
+ int rand = open("/dev/urandom", O_RDONLY);
char matrix[] =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789._";
unsigned char n; int i;
@@ -201,7 +201,7 @@
return 1;
}
if ( rand == -1 ) {
- fprintf(stderr, "Can't open /dev/random: %s\n",
strerror(errno));
+ fprintf(stderr, "Can't open /dev/urandom: %s\n",
strerror(errno)); return 1;
}
for (i=0; i<64; i++) {
-----------------------------snip----------------------------------------
Am Wed, 17 Dec 2008 14:49:53 +0100
schrieb Christian Wiese <morfoh at opensde.org>:
> Hi,
>
> I am really wondering why 'csync2 -k keyfile' is dog slow on every
> system I tested it. I doubt that it is supposed to be normal
> operations, that generating a key takes > 30min.
>
> Cheers,
> Chris
> _______________________________________________
> Csync2 mailing list
> Csync2 at lists.linbit.com
> http://lists.linbit.com/mailman/listinfo/csync2
More information about the Csync2
mailing list