[Pkg-gnupg-commit] [gnupg2] 78/112: g13: Move some function around.

Daniel Kahn Gillmor dkg at fifthhorseman.net
Tue Aug 30 17:48:23 UTC 2016


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

dkg pushed a commit to branch master
in repository gnupg2.

commit 37e932658cbd873ac96ff7e2067a97dffc2e0507
Author: Werner Koch <wk at gnupg.org>
Date:   Sat Aug 13 17:39:28 2016 +0200

    g13: Move some function around.
    
    * g13/keyblob.c (g13_keyblob_decrypt): Move to ...
    * g13/server.c: to here.
    * g13/suspend.c, g13/mount.c: Include server.h.
    * g13/Makefile.am (g13_syshelp_SOURCES): Add keyblob.c
    --
    
    This is done to be able to use keyblob read code in syshelp w/o
    requiring linking to call-gpg.c
    
    Signed-off-by: Werner Koch <wk at gnupg.org>
---
 g13/Makefile.am |  2 +-
 g13/keyblob.c   | 22 ----------------------
 g13/keyblob.h   |  3 ---
 g13/mount.c     |  1 +
 g13/server.c    | 27 +++++++++++++++++++++++++++
 g13/server.h    |  4 ++++
 g13/suspend.c   |  1 +
 7 files changed, 34 insertions(+), 26 deletions(-)

diff --git a/g13/Makefile.am b/g13/Makefile.am
index 05963c8..90dd471 100644
--- a/g13/Makefile.am
+++ b/g13/Makefile.am
@@ -57,7 +57,7 @@ g13_LDADD = $(libcommonpth) \
 g13_syshelp_SOURCES = \
 	g13-syshelp.c g13-syshelp.h \
 	g13-common.c g13-common.h \
-	keyblob.h \
+	keyblob.c keyblob.h \
 	g13tuple.c g13tuple.h \
 	sh-cmd.c \
 	sh-blockdev.c \
diff --git a/g13/keyblob.c b/g13/keyblob.c
index cad0c4f..8a5b622 100644
--- a/g13/keyblob.c
+++ b/g13/keyblob.c
@@ -28,12 +28,10 @@
 #include <assert.h>
 
 #include "g13.h"
-#include "i18n.h"
 #include "mount.h"
 
 #include "keyblob.h"
 #include "../common/sysutils.h"
-#include "../common/call-gpg.h"
 #include "host2net.h"
 
 
@@ -207,23 +205,3 @@ g13_keyblob_read (const char *filename,
 
   return err;
 }
-
-
-/*
- * Decrypt the keyblob (ENCKEYBLOB,ENCKEYBLOBLEN) and store the result
- * at (R_KEYBLOB, R_KEYBLOBLEN).  Returns 0 on success or an error
- * code.  On error R_KEYBLOB is set to NULL.
- */
-gpg_error_t
-g13_keyblob_decrypt (ctrl_t ctrl, const void *enckeyblob, size_t enckeybloblen,
-                     void **r_keyblob, size_t *r_keybloblen)
-{
-  gpg_error_t err;
-
-  /* FIXME:  For now we only implement OpenPGP.  */
-  err = gpg_decrypt_blob (ctrl, opt.gpg_program, opt.gpg_arguments,
-                          enckeyblob, enckeybloblen,
-                          r_keyblob, r_keybloblen);
-
-  return err;
-}
diff --git a/g13/keyblob.h b/g13/keyblob.h
index 3415e9a..48f0b9c 100644
--- a/g13/keyblob.h
+++ b/g13/keyblob.h
@@ -157,9 +157,6 @@
 gpg_error_t g13_is_container (ctrl_t ctrl, const char *filename);
 gpg_error_t g13_keyblob_read (const char *filename,
                               void **r_enckeyblob, size_t *r_enckeybloblen);
-gpg_error_t g13_keyblob_decrypt (ctrl_t ctrl,
-                                 const void *enckeyblob, size_t enckeybloblen,
-                                 void **r_keyblob, size_t *r_keybloblen);
 
 
 #endif /*G13_KEYBLOB_H*/
diff --git a/g13/mount.c b/g13/mount.c
index 272cd77..951a859 100644
--- a/g13/mount.c
+++ b/g13/mount.c
@@ -36,6 +36,7 @@
 #include "mountinfo.h"
 #include "runner.h"
 #include "host2net.h"
+#include "server.h"  /*(g13_keyblob_decrypt)*/
 #include "../common/sysutils.h"
 
 
diff --git a/g13/server.c b/g13/server.c
index a96ec6e..5a273c2 100644
--- a/g13/server.c
+++ b/g13/server.c
@@ -34,6 +34,8 @@
 #include "mount.h"
 #include "suspend.h"
 #include "../common/server-help.h"
+#include "../common/call-gpg.h"
+
 
 /* The filepointer for status message used in non-server mode */
 static FILE *statusfp;
@@ -769,3 +771,28 @@ g13_proxy_pinentry_notify (ctrl_t ctrl, const unsigned char *line)
     return 0;
   return assuan_inquire (ctrl->server_local->assuan_ctx, line, NULL, NULL, 0);
 }
+
+
+/*
+ * Decrypt the keyblob (ENCKEYBLOB,ENCKEYBLOBLEN) and store the result
+ * at (R_KEYBLOB, R_KEYBLOBLEN).  Returns 0 on success or an error
+ * code.  On error R_KEYBLOB is set to NULL.
+ *
+ * This actually does not belong here but for that simple wrapper it
+ * does not make sense to add another source file.  Note that we do
+ * not want to have this in keyblob.c, because that code is also used
+ * by the syshelp.
+ */
+gpg_error_t
+g13_keyblob_decrypt (ctrl_t ctrl, const void *enckeyblob, size_t enckeybloblen,
+                     void **r_keyblob, size_t *r_keybloblen)
+{
+  gpg_error_t err;
+
+  /* FIXME:  For now we only implement OpenPGP.  */
+  err = gpg_decrypt_blob (ctrl, opt.gpg_program, opt.gpg_arguments,
+                          enckeyblob, enckeybloblen,
+                          r_keyblob, r_keybloblen);
+
+  return err;
+}
diff --git a/g13/server.h b/g13/server.h
index af8494a..41636c8 100644
--- a/g13/server.h
+++ b/g13/server.h
@@ -25,4 +25,8 @@ gpg_error_t g13_server (ctrl_t ctrl);
 
 gpg_error_t g13_proxy_pinentry_notify (ctrl_t ctrl, const unsigned char *line);
 
+gpg_error_t g13_keyblob_decrypt (ctrl_t ctrl,
+                                 const void *enckeyblob, size_t enckeybloblen,
+                                 void **r_keyblob, size_t *r_keybloblen);
+
 #endif /*G13_SERVER_H*/
diff --git a/g13/suspend.c b/g13/suspend.c
index 0532c8b..39aeaeb 100644
--- a/g13/suspend.c
+++ b/g13/suspend.c
@@ -33,6 +33,7 @@
 #include "keyblob.h"
 #include "backend.h"
 #include "g13tuple.h"
+#include "server.h"  /*(g13_keyblob_decrypt)*/
 
 
 

-- 
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