[svn] gcry - r1239 - in trunk: . cipher doc src
svn author wk
cvs at cvs.gnupg.org
Mon Apr 30 17:38:06 CEST 2007
Author: wk
Date: 2007-04-30 17:37:37 +0200 (Mon, 30 Apr 2007)
New Revision: 1239
Modified:
trunk/NEWS
trunk/cipher/ChangeLog
trunk/cipher/random.h
trunk/cipher/rndegd.c
trunk/doc/gcrypt.texi
trunk/src/ChangeLog
trunk/src/gcrypt.h.in
trunk/src/global.c
Log:
Add support for setting the EGD socket.
Modified: trunk/NEWS
===================================================================
--- trunk/NEWS 2007-04-30 14:09:33 UTC (rev 1238)
+++ trunk/NEWS 2007-04-30 15:37:37 UTC (rev 1239)
@@ -50,14 +50,15 @@
gcry_fast_random_poll NEW
gcry_md_debug NEW
gcry_sexp_nth_string NEW
- GCRYCTL_FAKED_RANDOM_P NEW
- GCRYCTL_DUMP_CONFIG NEW
GCRY_MD_SHA224 NEW
GCRY_PK_USAGE_CERT NEW
GCRY_PK_USAGE_AUTH NEW
GCRY_PK_USAGE_UNKN NEW
GCRY_PK_ECDSA NEW
- GCR_CIPHER_SEED NEW
+ GCRY_CIPHER_SEED NEW
+ GCRYCTL_FAKED_RANDOM_P NEW
+ GCRYCTL_DUMP_CONFIG NEW
+ GCRYCTL_SET_RNDEGD_SOCKET NEW.
gcry_mpi_scan CHANGED: Argument BUFFER is now void*.
gcry_pk_algo_name CHANGED: Returns "?" instead of NULL.
gcry_cipher_algo_name CHANGED: Returns "?" instead of "".
Modified: trunk/cipher/ChangeLog
===================================================================
--- trunk/cipher/ChangeLog 2007-04-30 14:09:33 UTC (rev 1238)
+++ trunk/cipher/ChangeLog 2007-04-30 15:37:37 UTC (rev 1239)
@@ -1,3 +1,7 @@
+2007-04-30 Werner Koch <wk at g10code.com>
+
+ * rndegd.c (_gcry_rndegd_set_socket_name): New.
+
2007-04-30 Marcus Brinkmann <marcus at g10code.de>
* ecc.c (ec2os): Fix relocation of short numbers.
Modified: trunk/cipher/random.h
===================================================================
--- trunk/cipher/random.h 2007-04-30 14:09:33 UTC (rev 1238)
+++ trunk/cipher/random.h 2007-04-30 15:37:37 UTC (rev 1239)
@@ -37,6 +37,9 @@
byte *_gcry_get_random_bits( size_t nbits, int level, int secure );
void _gcry_fast_random_poll( void );
+/*-- rndegd.c --*/
+gpg_error_t _gcry_rndegd_set_socket_name (const char *name);
+
/*-- random-daemon.c (only used from random.c) --*/
#ifdef USE_RANDOM_DAEMON
void _gcry_daemon_initialize_basics (void);
Modified: trunk/cipher/rndegd.c
===================================================================
--- trunk/cipher/rndegd.c 2007-04-30 14:09:33 UTC (rev 1238)
+++ trunk/cipher/rndegd.c 2007-04-30 15:37:37 UTC (rev 1239)
@@ -40,6 +40,10 @@
static int egd_socket = -1;
+/* Allocated name of the socket if supplied at runtime. */
+static char *user_socket_name;
+
+
/* Allocate a new filename from FIRST_PART and SECOND_PART and to
tilde expansion for first_part. SECOND_PART might be NULL.
*/
@@ -115,6 +119,25 @@
}
+/* Note that his fucntion is not thread-safe. */
+gpg_error_t
+_gcry_rndegd_set_socket_name (const char *name)
+{
+ char *newname;
+ struct sockaddr_un addr;
+
+ newname = my_make_filename (name, NULL);
+ if (strlen (newname)+1 >= sizeof addr.sun_path)
+ {
+ gcry_free (newname);
+ return gpg_error_from_syserror ();
+ }
+ gcry_free (user_socket_name);
+ user_socket_name = newname;
+ return 0;
+}
+
+
/* Connect to the EGD and return the file descriptor. Return -1 on
error. With NOFAIL set to true, silently fail and return the
error, otherwise print an error message and die. */
@@ -136,7 +159,18 @@
#ifdef EGD_SOCKET_NAME
bname = EGD_SOCKET_NAME;
#endif
- if ( !bname || !*bname )
+ if (user_socket_name)
+ {
+ name = gcry_strdup (user_socket_name);
+ if (!name)
+ {
+ if (!nofail)
+ log_fatal ("error allocating memory in rndegd: %s\n",
+ strerror(errno) );
+ return -1;
+ }
+ }
+ else if ( !bname || !*bname )
name = my_make_filename ("~/.gnupg", "entropy");
else
name = my_make_filename (bname, NULL);
Modified: trunk/doc/gcrypt.texi
===================================================================
--- trunk/doc/gcrypt.texi 2007-04-30 14:09:33 UTC (rev 1238)
+++ trunk/doc/gcrypt.texi 2007-04-30 15:37:37 UTC (rev 1239)
@@ -535,7 +535,7 @@
This command dumps secure memory manamgent related statistics to the
librarys logging stream.
- at item GCRYCTL_DUMP_CONFIG
+ at item GCRYCTL_DUMP_CONFIG; Arguments: none
This command dumps information pertaining to the configuration of
libgcrypt to the logging stream. It may be used before the
intialization has been finished but not before a gcry_version_check.
@@ -586,7 +586,23 @@
This command registers a thread-callback structure. See section ``multi
threading'' for more information on this command.
- at item GCRYCTL_FAST_POOL
+ at item GCRYCTL_FAST_POLL
+
+Run a fast random poll.
+
+
+ at item GCRYCTL_SET_RNDEGD_SOCKET; Arguments: const char *filename
+
+This command may be used to override the default name of the EGD socket
+to connect to. It may be used only during initialization as it is not
+thread safe. Changing the socket name again is not supported. The
+function may return an error if the given filename is too long for a
+local socket name.
+
+EGD is an alternative random gatherer, used only on a few systems.
+
+
+
@end table
@end deftypefun
Modified: trunk/src/ChangeLog
===================================================================
--- trunk/src/ChangeLog 2007-04-30 14:09:33 UTC (rev 1238)
+++ trunk/src/ChangeLog 2007-04-30 15:37:37 UTC (rev 1239)
@@ -1,8 +1,9 @@
2007-04-30 Werner Koch <wk at g10code.com>
- * global.c (gcry_control): New.
-
* gcrypt.h.in (GCRYCTL_DUMP_CONFIG): New.
+ (GCRYCTL_SET_RNDEGD_SOCKET): New.
+ * global.c (gcry_control): Add GCRYCTL_DUMP_CONFIG and
+ GCRYCTL_SET_RNDEGD_SOCKET.
2007-04-18 Werner Koch <wk at g10code.com>
Modified: trunk/src/gcrypt.h.in
===================================================================
--- trunk/src/gcrypt.h.in 2007-04-30 14:09:33 UTC (rev 1238)
+++ trunk/src/gcrypt.h.in 2007-04-30 15:37:37 UTC (rev 1239)
@@ -356,7 +356,8 @@
GCRYCTL_SET_RANDOM_DAEMON_SOCKET = 49,
GCRYCTL_USE_RANDOM_DAEMON = 50,
GCRYCTL_FAKED_RANDOM_P = 51,
- GCRYCTL_DUMP_CONFIG = 52
+ GCRYCTL_DUMP_CONFIG = 52,
+ GCRYCTL_SET_RNDEGD_SOCKET = 53
};
/* Perform various operations defined by CMD. */
Modified: trunk/src/global.c
===================================================================
--- trunk/src/global.c 2007-04-30 14:09:33 UTC (rev 1238)
+++ trunk/src/global.c 2007-04-30 15:37:37 UTC (rev 1239)
@@ -343,6 +343,14 @@
_gcry_fast_random_poll ();
break;
+ case GCRYCTL_SET_RNDEGD_SOCKET:
+#if USE_RNDEGD
+ err = _gcry_rndegd_set_socket_name (va_arg (arg_ptr, const char *));
+#else
+ err = gpg_error (GPG_ERR_NOT_SUPPORTED);
+#endif
+ break;
+
case GCRYCTL_SET_RANDOM_DAEMON_SOCKET:
_gcry_set_random_daemon_socket (va_arg (arg_ptr, const char *));
break;
@@ -359,8 +367,22 @@
used before the intialization has been finished but not
before a gcry_version_check. */
case GCRYCTL_DUMP_CONFIG:
- log_info ("version=%s\n", VERSION);
- log_info ("mpi-asm=%s\n", _gcry_mpi_get_hw_config ());
+ log_info ("version:%s:\n", VERSION);
+ log_info ("mpi-asm:%s:\n", _gcry_mpi_get_hw_config ());
+ log_info ("rnd-mod:"
+#if USE_RNDEGD
+ "egd:"
+#endif
+#if USE_RNDLINUX
+ "linux:"
+#endif
+#if USE_RNDUNIX
+ "unix:"
+#endif
+#if USE_RNDW32
+ "w32:"
+#endif
+ "\n");
break;
default:
More information about the Gnupg-commits
mailing list