summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2006-08-28 09:40:39 +0000
committerWerner Koch <wk@gnupg.org>2006-08-28 09:40:39 +0000
commit9dba89cde740d7c518a73b869d07d6247e0e7488 (patch)
treef3f15bc215c20a02b6fb9f5c5691825aa3e48ec9 /src
parent5681a844ea16e74ededb45db7e9665b4ffd29045 (diff)
downloadlibgcrypt-9dba89cde740d7c518a73b869d07d6247e0e7488.tar.gz
Fixed a problem with shifting MPIs by 0.
Add a way to check whether the RNG is in fake mode.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog4
-rw-r--r--src/gcrypt.h3
-rw-r--r--src/global.c9
3 files changed, 14 insertions, 2 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index ae9e9ea8..b2e8b7b8 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,7 @@
+2006-08-21 Werner Koch <wk@g10code.com>
+
+ * gcrypt.h (GCRYCTL_FAKED_RANDOM_P): New.
+
2006-07-29 Marcus Brinkmann <marcus@g10code.de>
* secmem.c (init_pool): Close FD after establishing the mapping.
diff --git a/src/gcrypt.h b/src/gcrypt.h
index 3d823f77..b46e97a2 100644
--- a/src/gcrypt.h
+++ b/src/gcrypt.h
@@ -348,7 +348,8 @@ enum gcry_ctl_cmds
GCRYCTL_SET_THREAD_CBS = 47,
GCRYCTL_FAST_POLL = 48,
GCRYCTL_SET_RANDOM_DAEMON_SOCKET = 49,
- GCRYCTL_USE_RANDOM_DAEMON = 50
+ GCRYCTL_USE_RANDOM_DAEMON = 50,
+ GCRYCTL_FAKED_RANDOM_P = 51
};
/* Perform various operations defined by CMD. */
diff --git a/src/global.c b/src/global.c
index f2faeb86..46a12be7 100644
--- a/src/global.c
+++ b/src/global.c
@@ -219,6 +219,13 @@ gcry_control (enum gcry_ctl_cmds cmd, ...)
_gcry_quick_random_gen (1);
break;
+ case GCRYCTL_FAKED_RANDOM_P:
+ /* Return an error if the RNG is faked one (i.e. enabled by
+ ENABLE_QUICK_RANDOM. */
+ if (_gcry_random_is_faked ())
+ err = GPG_ERR_GENERAL;
+ break;
+
case GCRYCTL_DUMP_RANDOM_STATS:
_gcry_random_dump_stats ();
break;
@@ -329,7 +336,7 @@ gcry_control (enum gcry_ctl_cmds cmd, ...)
case GCRYCTL_FAST_POLL:
/* We need to do make sure that the random pool is really
- initialized so that the poll fucntion is not a NOP. */
+ initialized so that the poll function is not a NOP. */
_gcry_random_initialize (1);
_gcry_fast_random_poll ();
break;