aboutsummaryrefslogtreecommitdiffstats
path: root/g13/server.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2016-08-13 15:39:28 +0000
committerWerner Koch <[email protected]>2016-08-13 15:39:28 +0000
commit37e932658cbd873ac96ff7e2067a97dffc2e0507 (patch)
treea7fa463b26bea36fabb64563a6495f61ca985c66 /g13/server.c
parentg13: New command --find-device. (diff)
downloadgnupg-37e932658cbd873ac96ff7e2067a97dffc2e0507.tar.gz
gnupg-37e932658cbd873ac96ff7e2067a97dffc2e0507.zip
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 <[email protected]>
Diffstat (limited to 'g13/server.c')
-rw-r--r--g13/server.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/g13/server.c b/g13/server.c
index a96ec6e17..5a273c229 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;
+}