[Pkg-gnupg-commit] [gnupg2] 99/185: agent: New GETINFO sub-command jent_active.

Daniel Kahn Gillmor dkg at fifthhorseman.net
Mon Aug 7 11:55:25 UTC 2017


This is an automated email from the git hooks/post-receive script.

dkg pushed a commit to branch experimental
in repository gnupg2.

commit bbbd0db34b4e387f8dc089fb7d69fdcf2ed91a01
Author: Werner Koch <wk at gnupg.org>
Date:   Mon Jul 17 14:08:00 2017 +0200

    agent: New GETINFO sub-command jent_active.
    
    * agent/command.c (cmd_getinfo): Implement it for gcrypt >= 1.8.
    --
    
    For the de-vs compliance of gpg we need to check whether the Jitter
    RNG is used on Windows.  This change allows to test this for
    gpg-agent.
    
    Signed-off-by: Werner Koch <wk at gnupg.org>
---
 agent/command.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/agent/command.c b/agent/command.c
index d370821..e387db5 100644
--- a/agent/command.c
+++ b/agent/command.c
@@ -2852,6 +2852,7 @@ static const char hlp_getinfo[] =
   "  cmd_has_option\n"
   "              - Returns OK if the command CMD implements the option OPT.\n"
   "  connections - Return number of active connections.\n"
+  "  jent_active - Returns OK if Libgcrypt's JENT is active.\n"
   "  restricted  - Returns OK if the connection is in restricted mode.\n";
 static gpg_error_t
 cmd_getinfo (assuan_context_t ctx, char *line)
@@ -2992,6 +2993,24 @@ cmd_getinfo (assuan_context_t ctx, char *line)
                 get_agent_active_connection_count ());
       rc = assuan_send_data (ctx, numbuf, strlen (numbuf));
     }
+  else if (!strcmp (line, "jent_active"))
+    {
+#if GCRYPT_VERSION_NUMBER >= 0x010800
+      char *buf;
+      char *fields[5];
+
+      buf = gcry_get_config (0, "rng-type");
+      if (buf
+          && split_fields_colon (buf, fields, DIM (fields)) >= 5
+          && atoi (fields[4]) > 0)
+        rc = 0;
+      else
+        rc = gpg_error (GPG_ERR_FALSE);
+      gcry_free (buf);
+#else
+      rc = gpg_error (GPG_ERR_FALSE);
+#endif
+    }
   else
     rc = set_error (GPG_ERR_ASS_PARAMETER, "unknown value for WHAT");
   return rc;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-gnupg/gnupg2.git



More information about the Pkg-gnupg-commit mailing list