aboutsummaryrefslogtreecommitdiffstats
path: root/cipher
diff options
context:
space:
mode:
Diffstat (limited to 'cipher')
-rw-r--r--cipher/ChangeLog7
-rw-r--r--cipher/rndegd.c19
-rw-r--r--cipher/rndlinux.c7
3 files changed, 28 insertions, 5 deletions
diff --git a/cipher/ChangeLog b/cipher/ChangeLog
index 06466ca5e..b4195dd3c 100644
--- a/cipher/ChangeLog
+++ b/cipher/ChangeLog
@@ -1,3 +1,10 @@
+Fri Aug 25 16:05:38 CEST 2000 Werner Koch <[email protected]>
+
+ * rndlinux.c (open_device): Loose random device checking.
+ By Nils Ellmenreich.
+
+ * rndegd.c (gather_random): Name of socket is nom configurable.
+
Wed Jun 28 11:54:44 CEST 2000 Werner Koch <wk@>
* rsa.c, rsa.h: New based on the old module version (only in CVS for now).
diff --git a/cipher/rndegd.c b/cipher/rndegd.c
index 97395b959..0e4b414b8 100644
--- a/cipher/rndegd.c
+++ b/cipher/rndegd.c
@@ -114,13 +114,28 @@ gather_random( void (*add)(const void*, size_t, int), int requester,
}
}
if( fd == -1 ) {
- char *name = make_filename( g10_opt_homedir, "entropy", NULL );
+ const char *bname = NULL;
+ char *name;
struct sockaddr_un addr;
int addr_len;
+
+ #ifdef EGD_SOCKET_NAME
+ bname = EGD_SOCKET_NAME;
+ #endif
+ if ( !bname || !*bname )
+ bname = "entropy";
+
+ if ( *bname == '=' && bname[1] )
+ name = make_filename( g10_opt_homedir, bname+1 , NULL );
+ else
+ name = make_filename( bname , NULL );
+
+ if ( strlen(name)+1 >= sizeof addr.sun_path )
+ g10_log_fatal ("EGD socketname is too long\n");
memset( &addr, 0, sizeof addr );
addr.sun_family = AF_UNIX;
- strcpy( addr.sun_path, name ); /* fixme: check that it is long enough */
+ strcpy( addr.sun_path, name );
addr_len = offsetof( struct sockaddr_un, sun_path )
+ strlen( addr.sun_path );
diff --git a/cipher/rndlinux.c b/cipher/rndlinux.c
index 6f80a8def..4ac8bb310 100644
--- a/cipher/rndlinux.c
+++ b/cipher/rndlinux.c
@@ -70,7 +70,7 @@ get_entropy_count( int fd )
#endif
/****************
- * Used to open the Linux and xBSD /dev/random devices
+ * Used to open the /dev/random devices (Linux, xBSD, Solaris (if it exists), ...)
*/
static int
open_device( const char *name, int minor )
@@ -83,8 +83,9 @@ open_device( const char *name, int minor )
g10_log_fatal("can't open %s: %s\n", name, strerror(errno) );
if( fstat( fd, &sb ) )
g10_log_fatal("stat() off %s failed: %s\n", name, strerror(errno) );
- if( !S_ISCHR(sb.st_mode) )
- g10_log_fatal("invalid random device!\n" );
+ /* Don't check device type for better portability */
+ /* if( (!S_ISCHR(sb.st_mode)) && (!S_ISFIFO(sb.st_mode)) )
+ g10_log_fatal("invalid random device!\n" ); */
return fd;
}