Copyright (C) 2001, 2002, 2003, 2004 g10 Code GmbH
This file is part of GPGME.
-
+
GPGME is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of
the License, or (at your option) any later version.
-
+
GPGME is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
-
+
You should have received a copy of the GNU Lesser General Public
License along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
#include "context.h"
#include "ops.h"
+
\f
typedef struct
{
int okay;
int failed;
-
+
/* A pointer to the next pointer of the last recipient in the list.
This makes appending new invalid signers painless while
preserving the order. */
rec = malloc (sizeof (*rec));
if (!rec)
- return gpg_error_from_errno (errno);
+ return gpg_error_from_syserror ();
rec->next = NULL;
rec->keyid = rec->_keyid;
if (*args)
{
- errno = 0;
+ gpg_err_set_errno (0);
rec->pubkey_algo = strtol (args, &tail, 0);
if (errno || args == tail || *tail != ' ')
{
return gpg_error (GPG_ERR_NO_DATA);
break;
+ case GPGME_STATUS_DECRYPTION_INFO:
+ /* Fixme: Provide a way to return the used symmetric algorithm. */
+ break;
+
case GPGME_STATUS_DECRYPTION_OKAY:
opd->okay = 1;
break;
{
opd->result.unsupported_algorithm = strdup (args);
if (!opd->result.unsupported_algorithm)
- return gpg_error_from_errno (errno);
+ return gpg_error_from_syserror ();
}
}
}
err = _gpgme_parse_plaintext (args, &opd->result.file_name);
if (err)
return err;
-
+
default:
break;
}
gpgme_op_decrypt_start (gpgme_ctx_t ctx, gpgme_data_t cipher,
gpgme_data_t plain)
{
+ gpgme_error_t err;
+
TRACE_BEG2 (DEBUG_CTX, "gpgme_op_decrypt_start", ctx,
"cipher=%p, plain=%p", cipher, plain);
- return TRACE_ERR (decrypt_start (ctx, 0, cipher, plain));
+
+ if (!ctx)
+ return TRACE_ERR (gpg_error (GPG_ERR_INV_VALUE));
+
+ err = decrypt_start (ctx, 0, cipher, plain);
+ return TRACE_ERR (err);
}
TRACE_BEG2 (DEBUG_CTX, "gpgme_op_decrypt", ctx,
"cipher=%p, plain=%p", cipher, plain);
+
+ if (!ctx)
+ return TRACE_ERR (gpg_error (GPG_ERR_INV_VALUE));
+
err = decrypt_start (ctx, 1, cipher, plain);
if (!err)
err = _gpgme_wait_one (ctx);