diff options
Diffstat (limited to 'common')
-rw-r--r-- | common/ChangeLog | 4 | ||||
-rw-r--r-- | common/sysutils.c | 11 | ||||
-rw-r--r-- | common/sysutils.h | 1 |
3 files changed, 16 insertions, 0 deletions
diff --git a/common/ChangeLog b/common/ChangeLog index 625386739..ba7794e08 100644 --- a/common/ChangeLog +++ b/common/ChangeLog @@ -1,3 +1,7 @@ +2011-04-01 Werner Koch <[email protected]> + + * sysutils.c (get_uint_nonce): New. + 2011-03-03 Werner Koch <[email protected]> * estream.c (struct estream_list): Rename to estream_list_s and diff --git a/common/sysutils.c b/common/sysutils.c index a94d1fca5..648e70fe6 100644 --- a/common/sysutils.c +++ b/common/sysutils.c @@ -150,6 +150,17 @@ get_session_marker (size_t *rlen) return marker; } +/* Return a random number in an unsigned int. */ +unsigned int +get_uint_nonce (void) +{ + unsigned int value; + + gcry_create_nonce (&value, sizeof value); + return value; +} + + #if 0 /* not yet needed - Note that this will require inclusion of cmacros.am in Makefile.am */ diff --git a/common/sysutils.h b/common/sysutils.h index a2f74f936..3559b348e 100644 --- a/common/sysutils.h +++ b/common/sysutils.h @@ -41,6 +41,7 @@ void trap_unaligned (void); int disable_core_dumps (void); int enable_core_dumps (void); const unsigned char *get_session_marker (size_t *rlen); +unsigned int get_uint_nonce (void); /*int check_permissions (const char *path,int extension,int checkonly);*/ void gnupg_sleep (unsigned int seconds); int translate_sys2libc_fd (gnupg_fd_t fd, int for_write); |