From 6290f74605a06f78eee18fd630ffc9f7d55bcb46 Mon Sep 17 00:00:00 2001 From: Marcus Brinkmann Date: Thu, 22 Nov 2001 15:22:27 +0000 Subject: [PATCH] 2001-11-22 Marcus Brinkmann * engine-gpgsm.c (_gpgme_gpgsm_op_decrypt): New function. (_gpgme_gpgsm_op_import): Likewise. --- gpgme/ChangeLog | 5 ++++ gpgme/engine-gpgsm.c | 58 +++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 62 insertions(+), 1 deletion(-) diff --git a/gpgme/ChangeLog b/gpgme/ChangeLog index 97098b06..419eda8b 100644 --- a/gpgme/ChangeLog +++ b/gpgme/ChangeLog @@ -1,3 +1,8 @@ +2001-11-22 Marcus Brinkmann + + * engine-gpgsm.c (_gpgme_gpgsm_op_decrypt): New function. + (_gpgme_gpgsm_op_import): Likewise. + 2001-11-22 Marcus Brinkmann * engine-gpgsm.c: Shuffle around header inclusion a bit, to still diff --git a/gpgme/engine-gpgsm.c b/gpgme/engine-gpgsm.c index 0b09f18a..fcdb667c 100644 --- a/gpgme/engine-gpgsm.c +++ b/gpgme/engine-gpgsm.c @@ -206,6 +206,50 @@ gpgsm_set_fd (ASSUAN_CONTEXT ctx, const char *which, int fd) return ASSUAN_General_Error; } +GpgmeError +_gpgme_gpgsm_op_decrypt (GpgsmObject gpgsm, GpgmeData ciph, GpgmeData plain) +{ + AssuanError err; + + if (!gpgsm) + return mk_error (Invalid_Value); + + gpgsm->input_data = ciph; + err = gpgsm_set_fd (gpgsm->assuan_ctx, "INPUT", gpgsm->input_fd_server); + if (err) + return mk_error (General_Error); /* FIXME */ + gpgsm->output_data = plain; + err = gpgsm_set_fd (gpgsm->assuan_ctx, "OUTPUT", gpgsm->output_fd_server); + if (err) + return mk_error (General_Error); /* FIXME */ + _gpgme_io_close (gpgsm->message_fd); + gpgsm->message_fd = -1; + + gpgsm->command = "DECRYPT"; + return 0; +} + +GpgmeError +_gpgme_gpgsm_op_import (GpgsmObject gpgsm, GpgmeData keydata) +{ + AssuanError err; + + if (!gpgsm) + return mk_error (Invalid_Value); + + gpgsm->input_data = keydata; + err = gpgsm_set_fd (gpgsm->assuan_ctx, "INPUT", gpgsm->input_fd_server); + if (err) + return mk_error (General_Error); /* FIXME */ + _gpgme_io_close (gpgsm->output_fd); + gpgsm->output_fd = -1; + _gpgme_io_close (gpgsm->message_fd); + gpgsm->message_fd = -1; + + gpgsm->command = "DECRYPT"; + return 0; +} + GpgmeError _gpgme_gpgsm_op_verify (GpgsmObject gpgsm, GpgmeData sig, GpgmeData text) { @@ -347,7 +391,19 @@ _gpgme_gpgsm_set_status_handler (GpgsmObject gpgsm, } GpgmeError - _gpgme_gpgsm_op_verify (GpgsmObject gpgsm, GpgmeData sig, GpgmeData text) +_gpgme_gpgsm_op_decrypt (GpgsmObject gpgsm, GpgmeData ciph, GpgmeData plain) +{ + return mk_error (Invalid_Engine); +} + +GpgmeError +_gpgme_gpgsm_op_import (GpgsmObject gpgsm, GpgmeData keydata) +{ + return mk_error (Invalid_Engine); +} + +GpgmeError +_gpgme_gpgsm_op_verify (GpgsmObject gpgsm, GpgmeData sig, GpgmeData text) { return mk_error (Invalid_Engine); }