aboutsummaryrefslogtreecommitdiffstats
path: root/g10/skclist.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2006-08-21 20:20:23 +0000
committerWerner Koch <[email protected]>2006-08-21 20:20:23 +0000
commit0ebd23fa76e5af72ad3dc33144efa45500101a1b (patch)
treef5b5f10a242e8d597c7fc599663a455350f0c43b /g10/skclist.c
parentdisconnectafter wake-up bug fix by Bob Dunlop. (diff)
downloadgnupg-0ebd23fa76e5af72ad3dc33144efa45500101a1b.tar.gz
gnupg-0ebd23fa76e5af72ad3dc33144efa45500101a1b.zip
Migrated more stuff to doc/
Migrated the gpg regression tests. Some changes tp the gpg code to fix bugs and for the use in testing. make distcheck works now with gpg enabled.
Diffstat (limited to 'g10/skclist.c')
-rw-r--r--g10/skclist.c27
1 files changed, 19 insertions, 8 deletions
diff --git a/g10/skclist.c b/g10/skclist.c
index d8f3b2dc1..d9a9d5e9f 100644
--- a/g10/skclist.c
+++ b/g10/skclist.c
@@ -35,16 +35,26 @@
#include "i18n.h"
#include "cipher.h"
+#ifndef GCRYCTL_FAKED_RANDOM_P
+#define GCRYCTL_FAKED_RANDOM_P 51
+#endif
-/* There is currently no way to get the status of the quick random
- generator flag from libgcrypt and it is not clear whether this
- faked RNG is really a good idea. Thus for now we use this stub
- function but we should consider to entirely remove this fake RNG
- stuff. */
-static int
+/* Return true if Libgcrypt's RNG is in faked mode. */
+int
random_is_faked (void)
{
- return 0;
+ /* We use a runtime check to allow for slow migrattion of libgcrypt.
+ We can't use the constant becuase that one is actually an enum
+ value. */
+ gpg_error_t err = gcry_control ( 51 /*GCRYCTL_FAKED_RANDOM_P*/, 0);
+
+ if (!err)
+ return 0;
+ if (gpg_err_code (err) != GPG_ERR_INV_OP)
+ return 1;
+ log_info ("WARNING: libgcrypt too old.\n");
+ log_info (" can't check whether we are in faked RNG mode\n");
+ return 0; /* Need to return false. */
}
@@ -82,7 +92,8 @@ is_insecure( PKT_secret_key *sk )
continue; /* skip attribute packets */
if ( strstr( id->name, "(insecure!)" )
|| strstr( id->name, "not secure" )
- || strstr( id->name, "do not use" ) ) {
+ || strstr( id->name, "do not use" )
+ || strstr( id->name, "(INSECURE!)" ) ) {
insecure = 1;
break;
}