2003-08-05 17:11:04 +00:00
|
|
|
|
/* verify.c - Verify a messages signature
|
2011-02-04 12:57:53 +01:00
|
|
|
|
* Copyright (C) 2001, 2002, 2003, 2007,
|
2010-03-08 12:22:18 +00:00
|
|
|
|
* 2010 Free Software Foundation, Inc.
|
2003-08-05 17:11:04 +00:00
|
|
|
|
*
|
|
|
|
|
* This file is part of GnuPG.
|
|
|
|
|
*
|
|
|
|
|
* GnuPG is free software; you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
2007-07-04 19:49:40 +00:00
|
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
2003-08-05 17:11:04 +00:00
|
|
|
|
* (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* GnuPG 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 General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2016-11-05 12:02:19 +01:00
|
|
|
|
* along with this program; if not, see <https://www.gnu.org/licenses/>.
|
2003-08-05 17:11:04 +00:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
#include <string.h>
|
|
|
|
|
#include <errno.h>
|
2011-02-04 12:57:53 +01:00
|
|
|
|
#include <unistd.h>
|
2003-08-05 17:11:04 +00:00
|
|
|
|
#include <time.h>
|
|
|
|
|
#include <assert.h>
|
|
|
|
|
|
|
|
|
|
#include "gpgsm.h"
|
|
|
|
|
#include <gcrypt.h>
|
|
|
|
|
#include <ksba.h>
|
|
|
|
|
|
|
|
|
|
#include "keydb.h"
|
2017-03-07 20:21:23 +09:00
|
|
|
|
#include "../common/i18n.h"
|
2017-05-30 14:30:24 +02:00
|
|
|
|
#include "../common/compliance.h"
|
2003-08-05 17:11:04 +00:00
|
|
|
|
|
|
|
|
|
static char *
|
2003-10-31 12:12:47 +00:00
|
|
|
|
strtimestamp_r (ksba_isotime_t atime)
|
2003-08-05 17:11:04 +00:00
|
|
|
|
{
|
|
|
|
|
char *buffer = xmalloc (15);
|
2011-02-04 12:57:53 +01:00
|
|
|
|
|
2003-10-31 12:12:47 +00:00
|
|
|
|
if (!atime || !*atime)
|
2003-08-05 17:11:04 +00:00
|
|
|
|
strcpy (buffer, "none");
|
|
|
|
|
else
|
2003-10-31 12:12:47 +00:00
|
|
|
|
sprintf (buffer, "%.4s-%.2s-%.2s", atime, atime+4, atime+6);
|
2003-08-05 17:11:04 +00:00
|
|
|
|
return buffer;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2007-11-19 16:03:50 +00:00
|
|
|
|
/* Hash the data for a detached signature. Returns 0 on success. */
|
|
|
|
|
static gpg_error_t
|
2003-08-05 17:11:04 +00:00
|
|
|
|
hash_data (int fd, gcry_md_hd_t md)
|
|
|
|
|
{
|
2007-11-19 16:03:50 +00:00
|
|
|
|
gpg_error_t err = 0;
|
2010-03-08 12:22:18 +00:00
|
|
|
|
estream_t fp;
|
2003-08-05 17:11:04 +00:00
|
|
|
|
char buffer[4096];
|
|
|
|
|
int nread;
|
|
|
|
|
|
2010-03-08 12:22:18 +00:00
|
|
|
|
fp = es_fdopen_nc (fd, "rb");
|
2003-08-05 17:11:04 +00:00
|
|
|
|
if (!fp)
|
|
|
|
|
{
|
2007-11-19 16:03:50 +00:00
|
|
|
|
err = gpg_error_from_syserror ();
|
|
|
|
|
log_error ("fdopen(%d) failed: %s\n", fd, gpg_strerror (err));
|
|
|
|
|
return err;
|
2003-08-05 17:11:04 +00:00
|
|
|
|
}
|
|
|
|
|
|
2011-02-04 12:57:53 +01:00
|
|
|
|
do
|
2003-08-05 17:11:04 +00:00
|
|
|
|
{
|
2010-03-08 12:22:18 +00:00
|
|
|
|
nread = es_fread (buffer, 1, DIM(buffer), fp);
|
2003-08-05 17:11:04 +00:00
|
|
|
|
gcry_md_write (md, buffer, nread);
|
|
|
|
|
}
|
|
|
|
|
while (nread);
|
2010-03-08 12:22:18 +00:00
|
|
|
|
if (es_ferror (fp))
|
2007-11-19 16:03:50 +00:00
|
|
|
|
{
|
|
|
|
|
err = gpg_error_from_syserror ();
|
|
|
|
|
log_error ("read error on fd %d: %s\n", fd, gpg_strerror (err));
|
|
|
|
|
}
|
2010-03-08 12:22:18 +00:00
|
|
|
|
es_fclose (fp);
|
2007-11-19 16:03:50 +00:00
|
|
|
|
return err;
|
2003-08-05 17:11:04 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-03-08 12:22:18 +00:00
|
|
|
|
/* Perform a verify operation. To verify detached signatures, DATA_FD
|
2003-08-05 17:11:04 +00:00
|
|
|
|
must be different than -1. With OUT_FP given and a non-detached
|
2010-03-08 12:22:18 +00:00
|
|
|
|
signature, the signed material is written to that stream. */
|
2003-08-05 17:11:04 +00:00
|
|
|
|
int
|
2010-03-08 12:22:18 +00:00
|
|
|
|
gpgsm_verify (ctrl_t ctrl, int in_fd, int data_fd, estream_t out_fp)
|
2003-08-05 17:11:04 +00:00
|
|
|
|
{
|
|
|
|
|
int i, rc;
|
2017-02-16 17:11:38 +01:00
|
|
|
|
gnupg_ksba_io_t b64reader = NULL;
|
|
|
|
|
gnupg_ksba_io_t b64writer = NULL;
|
2003-12-17 12:28:24 +00:00
|
|
|
|
ksba_reader_t reader;
|
|
|
|
|
ksba_writer_t writer = NULL;
|
|
|
|
|
ksba_cms_t cms = NULL;
|
|
|
|
|
ksba_stop_reason_t stopreason;
|
|
|
|
|
ksba_cert_t cert;
|
2003-08-05 17:11:04 +00:00
|
|
|
|
KEYDB_HANDLE kh;
|
|
|
|
|
gcry_md_hd_t data_md = NULL;
|
|
|
|
|
int signer;
|
|
|
|
|
const char *algoid;
|
|
|
|
|
int algo;
|
|
|
|
|
int is_detached;
|
2010-03-08 12:22:18 +00:00
|
|
|
|
estream_t in_fp = NULL;
|
2003-08-05 17:11:04 +00:00
|
|
|
|
char *p;
|
|
|
|
|
|
2007-11-19 16:03:50 +00:00
|
|
|
|
audit_set_type (ctrl->audit, AUDIT_TYPE_VERIFY);
|
|
|
|
|
|
2016-11-10 15:38:14 +01:00
|
|
|
|
kh = keydb_new ();
|
2003-08-05 17:11:04 +00:00
|
|
|
|
if (!kh)
|
|
|
|
|
{
|
2012-08-22 12:54:38 -04:00
|
|
|
|
log_error (_("failed to allocate keyDB handle\n"));
|
2003-08-05 17:11:04 +00:00
|
|
|
|
rc = gpg_error (GPG_ERR_GENERAL);
|
|
|
|
|
goto leave;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2010-03-08 12:22:18 +00:00
|
|
|
|
in_fp = es_fdopen_nc (in_fd, "rb");
|
|
|
|
|
if (!in_fp)
|
2003-08-05 17:11:04 +00:00
|
|
|
|
{
|
2010-03-08 12:22:18 +00:00
|
|
|
|
rc = gpg_error_from_syserror ();
|
2003-08-05 17:11:04 +00:00
|
|
|
|
log_error ("fdopen() failed: %s\n", strerror (errno));
|
|
|
|
|
goto leave;
|
|
|
|
|
}
|
|
|
|
|
|
2017-02-16 15:16:48 +01:00
|
|
|
|
rc = gnupg_ksba_create_reader
|
|
|
|
|
(&b64reader, ((ctrl->is_pem? GNUPG_KSBA_IO_PEM : 0)
|
|
|
|
|
| (ctrl->is_base64? GNUPG_KSBA_IO_BASE64 : 0)
|
|
|
|
|
| (ctrl->autodetect_encoding? GNUPG_KSBA_IO_AUTODETECT : 0)),
|
|
|
|
|
in_fp, &reader);
|
2003-08-05 17:11:04 +00:00
|
|
|
|
if (rc)
|
|
|
|
|
{
|
|
|
|
|
log_error ("can't create reader: %s\n", gpg_strerror (rc));
|
|
|
|
|
goto leave;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (out_fp)
|
|
|
|
|
{
|
2017-02-16 15:16:48 +01:00
|
|
|
|
rc = gnupg_ksba_create_writer
|
|
|
|
|
(&b64writer, ((ctrl->create_pem? GNUPG_KSBA_IO_PEM : 0)
|
|
|
|
|
| (ctrl->create_base64? GNUPG_KSBA_IO_BASE64 : 0)),
|
|
|
|
|
ctrl->pem_name, out_fp, &writer);
|
2003-08-05 17:11:04 +00:00
|
|
|
|
if (rc)
|
|
|
|
|
{
|
|
|
|
|
log_error ("can't create writer: %s\n", gpg_strerror (rc));
|
|
|
|
|
goto leave;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2004-06-06 13:00:59 +00:00
|
|
|
|
rc = ksba_cms_new (&cms);
|
|
|
|
|
if (rc)
|
|
|
|
|
goto leave;
|
2003-08-05 17:11:04 +00:00
|
|
|
|
|
2004-06-06 13:00:59 +00:00
|
|
|
|
rc = ksba_cms_set_reader_writer (cms, reader, writer);
|
|
|
|
|
if (rc)
|
2003-08-05 17:11:04 +00:00
|
|
|
|
{
|
|
|
|
|
log_error ("ksba_cms_set_reader_writer failed: %s\n",
|
2004-06-06 13:00:59 +00:00
|
|
|
|
gpg_strerror (rc));
|
2003-08-05 17:11:04 +00:00
|
|
|
|
goto leave;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
rc = gcry_md_open (&data_md, 0, 0);
|
|
|
|
|
if (rc)
|
|
|
|
|
{
|
|
|
|
|
log_error ("md_open failed: %s\n", gpg_strerror (rc));
|
|
|
|
|
goto leave;
|
|
|
|
|
}
|
|
|
|
|
if (DBG_HASHING)
|
2011-09-20 09:54:27 +02:00
|
|
|
|
gcry_md_debug (data_md, "vrfy.data");
|
2003-08-05 17:11:04 +00:00
|
|
|
|
|
2007-11-19 16:03:50 +00:00
|
|
|
|
audit_log (ctrl->audit, AUDIT_SETUP_READY);
|
|
|
|
|
|
2003-08-05 17:11:04 +00:00
|
|
|
|
is_detached = 0;
|
2011-02-04 12:57:53 +01:00
|
|
|
|
do
|
2003-08-05 17:11:04 +00:00
|
|
|
|
{
|
2004-06-06 13:00:59 +00:00
|
|
|
|
rc = ksba_cms_parse (cms, &stopreason);
|
|
|
|
|
if (rc)
|
2003-08-05 17:11:04 +00:00
|
|
|
|
{
|
2004-06-06 13:00:59 +00:00
|
|
|
|
log_error ("ksba_cms_parse failed: %s\n", gpg_strerror (rc));
|
2003-08-05 17:11:04 +00:00
|
|
|
|
goto leave;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (stopreason == KSBA_SR_NEED_HASH)
|
|
|
|
|
{
|
|
|
|
|
is_detached = 1;
|
2007-11-19 16:03:50 +00:00
|
|
|
|
audit_log (ctrl->audit, AUDIT_DETACHED_SIGNATURE);
|
2003-08-05 17:11:04 +00:00
|
|
|
|
if (opt.verbose)
|
|
|
|
|
log_info ("detached signature\n");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (stopreason == KSBA_SR_NEED_HASH
|
|
|
|
|
|| stopreason == KSBA_SR_BEGIN_DATA)
|
2011-02-04 12:57:53 +01:00
|
|
|
|
{
|
2007-12-06 15:55:03 +00:00
|
|
|
|
audit_log (ctrl->audit, AUDIT_GOT_DATA);
|
|
|
|
|
|
|
|
|
|
/* We are now able to enable the hash algorithms */
|
2003-08-05 17:11:04 +00:00
|
|
|
|
for (i=0; (algoid=ksba_cms_get_digest_algo_list (cms, i)); i++)
|
|
|
|
|
{
|
|
|
|
|
algo = gcry_md_map_name (algoid);
|
|
|
|
|
if (!algo)
|
2005-11-13 19:07:06 +00:00
|
|
|
|
{
|
2012-06-05 19:29:22 +02:00
|
|
|
|
log_error ("unknown hash algorithm '%s'\n",
|
2005-11-13 19:07:06 +00:00
|
|
|
|
algoid? algoid:"?");
|
|
|
|
|
if (algoid
|
|
|
|
|
&& ( !strcmp (algoid, "1.2.840.113549.1.1.2")
|
|
|
|
|
||!strcmp (algoid, "1.2.840.113549.2.2")))
|
|
|
|
|
log_info (_("(this is the MD2 algorithm)\n"));
|
2007-11-19 16:03:50 +00:00
|
|
|
|
audit_log_s (ctrl->audit, AUDIT_BAD_DATA_HASH_ALGO, algoid);
|
2005-11-13 19:07:06 +00:00
|
|
|
|
}
|
2003-08-05 17:11:04 +00:00
|
|
|
|
else
|
2007-11-19 16:03:50 +00:00
|
|
|
|
{
|
2007-12-13 15:45:40 +00:00
|
|
|
|
if (DBG_X509)
|
|
|
|
|
log_debug ("enabling hash algorithm %d (%s)\n",
|
|
|
|
|
algo, algoid? algoid:"");
|
2007-11-19 16:03:50 +00:00
|
|
|
|
gcry_md_enable (data_md, algo);
|
|
|
|
|
audit_log_i (ctrl->audit, AUDIT_DATA_HASH_ALGO, algo);
|
|
|
|
|
}
|
2003-08-05 17:11:04 +00:00
|
|
|
|
}
|
2007-12-13 15:45:40 +00:00
|
|
|
|
if (opt.extra_digest_algo)
|
|
|
|
|
{
|
|
|
|
|
if (DBG_X509)
|
2011-02-04 12:57:53 +01:00
|
|
|
|
log_debug ("enabling extra hash algorithm %d\n",
|
2007-12-13 15:45:40 +00:00
|
|
|
|
opt.extra_digest_algo);
|
|
|
|
|
gcry_md_enable (data_md, opt.extra_digest_algo);
|
2009-12-02 18:33:59 +00:00
|
|
|
|
audit_log_i (ctrl->audit, AUDIT_DATA_HASH_ALGO,
|
|
|
|
|
opt.extra_digest_algo);
|
2007-12-13 15:45:40 +00:00
|
|
|
|
}
|
2003-08-05 17:11:04 +00:00
|
|
|
|
if (is_detached)
|
|
|
|
|
{
|
|
|
|
|
if (data_fd == -1)
|
2007-11-19 16:03:50 +00:00
|
|
|
|
{
|
|
|
|
|
log_info ("detached signature w/o data "
|
|
|
|
|
"- assuming certs-only\n");
|
|
|
|
|
audit_log (ctrl->audit, AUDIT_CERT_ONLY_SIG);
|
|
|
|
|
}
|
2003-08-05 17:11:04 +00:00
|
|
|
|
else
|
2007-11-19 16:03:50 +00:00
|
|
|
|
audit_log_ok (ctrl->audit, AUDIT_DATA_HASHING,
|
|
|
|
|
hash_data (data_fd, data_md));
|
2003-08-05 17:11:04 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
ksba_cms_set_hash_function (cms, HASH_FNC, data_md);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (stopreason == KSBA_SR_END_DATA)
|
|
|
|
|
{ /* The data bas been hashed */
|
2009-12-02 18:33:59 +00:00
|
|
|
|
audit_log_ok (ctrl->audit, AUDIT_DATA_HASHING, 0);
|
2003-08-05 17:11:04 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2011-02-04 12:57:53 +01:00
|
|
|
|
while (stopreason != KSBA_SR_READY);
|
2003-08-05 17:11:04 +00:00
|
|
|
|
|
|
|
|
|
if (b64writer)
|
|
|
|
|
{
|
2017-02-16 17:11:38 +01:00
|
|
|
|
rc = gnupg_ksba_finish_writer (b64writer);
|
2011-02-04 12:57:53 +01:00
|
|
|
|
if (rc)
|
2003-08-05 17:11:04 +00:00
|
|
|
|
{
|
|
|
|
|
log_error ("write failed: %s\n", gpg_strerror (rc));
|
2007-11-19 16:03:50 +00:00
|
|
|
|
audit_log_ok (ctrl->audit, AUDIT_WRITE_ERROR, rc);
|
2003-08-05 17:11:04 +00:00
|
|
|
|
goto leave;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (data_fd != -1 && !is_detached)
|
|
|
|
|
{
|
|
|
|
|
log_error ("data given for a non-detached signature\n");
|
|
|
|
|
rc = gpg_error (GPG_ERR_CONFLICT);
|
2007-11-19 16:03:50 +00:00
|
|
|
|
audit_log (ctrl->audit, AUDIT_USAGE_ERROR);
|
2003-08-05 17:11:04 +00:00
|
|
|
|
goto leave;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (i=0; (cert=ksba_cms_get_cert (cms, i)); i++)
|
|
|
|
|
{
|
|
|
|
|
/* Fixme: it might be better to check the validity of the
|
|
|
|
|
certificate first before entering it into the DB. This way
|
|
|
|
|
we would avoid cluttering the DB with invalid
|
|
|
|
|
certificates. */
|
2011-02-04 12:57:53 +01:00
|
|
|
|
audit_log_cert (ctrl->audit, AUDIT_SAVE_CERT, cert,
|
2016-11-10 17:01:19 +01:00
|
|
|
|
keydb_store_cert (ctrl, cert, 0, NULL));
|
2003-08-05 17:11:04 +00:00
|
|
|
|
ksba_cert_release (cert);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
cert = NULL;
|
|
|
|
|
for (signer=0; ; signer++)
|
|
|
|
|
{
|
|
|
|
|
char *issuer = NULL;
|
2003-12-17 12:28:24 +00:00
|
|
|
|
ksba_sexp_t sigval = NULL;
|
2003-10-31 12:12:47 +00:00
|
|
|
|
ksba_isotime_t sigtime, keyexptime;
|
2003-12-17 12:28:24 +00:00
|
|
|
|
ksba_sexp_t serial;
|
2003-08-05 17:11:04 +00:00
|
|
|
|
char *msgdigest = NULL;
|
|
|
|
|
size_t msgdigestlen;
|
|
|
|
|
char *ctattr;
|
2007-12-13 15:45:40 +00:00
|
|
|
|
int sigval_hash_algo;
|
2007-08-10 16:52:05 +00:00
|
|
|
|
int info_pkalgo;
|
|
|
|
|
unsigned int verifyflags;
|
2003-08-05 17:11:04 +00:00
|
|
|
|
|
2004-06-06 13:00:59 +00:00
|
|
|
|
rc = ksba_cms_get_issuer_serial (cms, signer, &issuer, &serial);
|
|
|
|
|
if (!signer && gpg_err_code (rc) == GPG_ERR_NO_DATA
|
2003-11-12 15:17:44 +00:00
|
|
|
|
&& data_fd == -1 && is_detached)
|
2003-08-05 17:11:04 +00:00
|
|
|
|
{
|
|
|
|
|
log_info ("certs-only message accepted\n");
|
2004-06-06 13:00:59 +00:00
|
|
|
|
rc = 0;
|
2003-08-05 17:11:04 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
2004-06-06 13:00:59 +00:00
|
|
|
|
if (rc)
|
2003-08-05 17:11:04 +00:00
|
|
|
|
{
|
2004-06-06 13:00:59 +00:00
|
|
|
|
if (signer && rc == -1)
|
|
|
|
|
rc = 0;
|
2003-08-05 17:11:04 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
2004-04-05 17:25:21 +00:00
|
|
|
|
|
|
|
|
|
gpgsm_status (ctrl, STATUS_NEWSIG, NULL);
|
2007-11-19 16:03:50 +00:00
|
|
|
|
audit_log_i (ctrl->audit, AUDIT_NEW_SIG, signer);
|
2004-04-05 17:25:21 +00:00
|
|
|
|
|
2003-08-05 17:11:04 +00:00
|
|
|
|
if (DBG_X509)
|
|
|
|
|
{
|
2012-06-05 19:29:22 +02:00
|
|
|
|
log_debug ("signer %d - issuer: '%s'\n",
|
2003-08-05 17:11:04 +00:00
|
|
|
|
signer, issuer? issuer:"[NONE]");
|
|
|
|
|
log_debug ("signer %d - serial: ", signer);
|
|
|
|
|
gpgsm_dump_serial (serial);
|
|
|
|
|
log_printf ("\n");
|
|
|
|
|
}
|
2007-11-19 16:03:50 +00:00
|
|
|
|
if (ctrl->audit)
|
|
|
|
|
{
|
|
|
|
|
char *tmpstr = gpgsm_format_sn_issuer (serial, issuer);
|
|
|
|
|
audit_log_s (ctrl->audit, AUDIT_SIG_NAME, tmpstr);
|
|
|
|
|
xfree (tmpstr);
|
|
|
|
|
}
|
2003-08-05 17:11:04 +00:00
|
|
|
|
|
2004-06-06 13:00:59 +00:00
|
|
|
|
rc = ksba_cms_get_signing_time (cms, signer, sigtime);
|
|
|
|
|
if (gpg_err_code (rc) == GPG_ERR_NO_DATA)
|
2003-10-31 12:12:47 +00:00
|
|
|
|
*sigtime = 0;
|
2004-06-06 13:00:59 +00:00
|
|
|
|
else if (rc)
|
2003-08-05 17:11:04 +00:00
|
|
|
|
{
|
2004-06-06 13:00:59 +00:00
|
|
|
|
log_error ("error getting signing time: %s\n", gpg_strerror (rc));
|
|
|
|
|
*sigtime = 0; /* (we can't encode an error in the time string.) */
|
2003-08-05 17:11:04 +00:00
|
|
|
|
}
|
|
|
|
|
|
2004-06-06 13:00:59 +00:00
|
|
|
|
rc = ksba_cms_get_message_digest (cms, signer,
|
|
|
|
|
&msgdigest, &msgdigestlen);
|
|
|
|
|
if (!rc)
|
2003-08-05 17:11:04 +00:00
|
|
|
|
{
|
|
|
|
|
algoid = ksba_cms_get_digest_algo (cms, signer);
|
|
|
|
|
algo = gcry_md_map_name (algoid);
|
|
|
|
|
if (DBG_X509)
|
|
|
|
|
log_debug ("signer %d - digest algo: %d\n", signer, algo);
|
2017-05-31 12:51:56 +02:00
|
|
|
|
if (! gcry_md_is_enabled (data_md, algo))
|
2003-08-05 17:11:04 +00:00
|
|
|
|
{
|
2011-02-04 12:57:53 +01:00
|
|
|
|
log_error ("digest algo %d (%s) has not been enabled\n",
|
2007-12-13 15:45:40 +00:00
|
|
|
|
algo, algoid?algoid:"");
|
2007-11-19 16:03:50 +00:00
|
|
|
|
audit_log_s (ctrl->audit, AUDIT_SIG_STATUS, "unsupported");
|
2003-08-05 17:11:04 +00:00
|
|
|
|
goto next_signer;
|
|
|
|
|
}
|
|
|
|
|
}
|
2004-06-06 13:00:59 +00:00
|
|
|
|
else if (gpg_err_code (rc) == GPG_ERR_NO_DATA)
|
2003-08-05 17:11:04 +00:00
|
|
|
|
{
|
|
|
|
|
assert (!msgdigest);
|
2004-06-06 13:00:59 +00:00
|
|
|
|
rc = 0;
|
2003-08-05 17:11:04 +00:00
|
|
|
|
algoid = NULL;
|
2011-02-04 12:57:53 +01:00
|
|
|
|
algo = 0;
|
2003-08-05 17:11:04 +00:00
|
|
|
|
}
|
|
|
|
|
else /* real error */
|
2007-11-19 16:03:50 +00:00
|
|
|
|
{
|
|
|
|
|
audit_log_s (ctrl->audit, AUDIT_SIG_STATUS, "error");
|
|
|
|
|
break;
|
|
|
|
|
}
|
2003-08-05 17:11:04 +00:00
|
|
|
|
|
2004-06-06 13:00:59 +00:00
|
|
|
|
rc = ksba_cms_get_sigattr_oids (cms, signer,
|
|
|
|
|
"1.2.840.113549.1.9.3", &ctattr);
|
2011-02-04 12:57:53 +01:00
|
|
|
|
if (!rc)
|
2003-08-05 17:11:04 +00:00
|
|
|
|
{
|
|
|
|
|
const char *s;
|
|
|
|
|
|
|
|
|
|
if (DBG_X509)
|
2004-06-06 13:00:59 +00:00
|
|
|
|
log_debug ("signer %d - content-type attribute: %s",
|
|
|
|
|
signer, ctattr);
|
|
|
|
|
|
2003-08-05 17:11:04 +00:00
|
|
|
|
s = ksba_cms_get_content_oid (cms, 1);
|
|
|
|
|
if (!s || strcmp (ctattr, s))
|
|
|
|
|
{
|
|
|
|
|
log_error ("content-type attribute does not match "
|
|
|
|
|
"actual content-type\n");
|
|
|
|
|
ksba_free (ctattr);
|
|
|
|
|
ctattr = NULL;
|
2007-11-19 16:03:50 +00:00
|
|
|
|
audit_log_s (ctrl->audit, AUDIT_SIG_STATUS, "bad");
|
2003-08-05 17:11:04 +00:00
|
|
|
|
goto next_signer;
|
|
|
|
|
}
|
|
|
|
|
ksba_free (ctattr);
|
|
|
|
|
ctattr = NULL;
|
|
|
|
|
}
|
2004-06-06 13:00:59 +00:00
|
|
|
|
else if (rc != -1)
|
2003-08-05 17:11:04 +00:00
|
|
|
|
{
|
|
|
|
|
log_error ("error getting content-type attribute: %s\n",
|
2004-06-06 13:00:59 +00:00
|
|
|
|
gpg_strerror (rc));
|
2007-11-19 16:03:50 +00:00
|
|
|
|
audit_log_s (ctrl->audit, AUDIT_SIG_STATUS, "bad");
|
2003-08-05 17:11:04 +00:00
|
|
|
|
goto next_signer;
|
|
|
|
|
}
|
2004-06-06 13:00:59 +00:00
|
|
|
|
rc = 0;
|
2003-08-05 17:11:04 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sigval = ksba_cms_get_sig_val (cms, signer);
|
|
|
|
|
if (!sigval)
|
|
|
|
|
{
|
|
|
|
|
log_error ("no signature value available\n");
|
2007-11-19 16:03:50 +00:00
|
|
|
|
audit_log_s (ctrl->audit, AUDIT_SIG_STATUS, "bad");
|
2003-08-05 17:11:04 +00:00
|
|
|
|
goto next_signer;
|
|
|
|
|
}
|
2007-12-13 15:45:40 +00:00
|
|
|
|
sigval_hash_algo = hash_algo_from_sigval (sigval);
|
2003-08-05 17:11:04 +00:00
|
|
|
|
if (DBG_X509)
|
2007-12-13 15:45:40 +00:00
|
|
|
|
{
|
|
|
|
|
log_debug ("signer %d - signature available (sigval hash=%d)",
|
|
|
|
|
signer, sigval_hash_algo);
|
|
|
|
|
/* log_printhex ("sigval ", sigval, */
|
|
|
|
|
/* gcry_sexp_canon_len (sigval, 0, NULL, NULL)); */
|
|
|
|
|
}
|
|
|
|
|
if (!sigval_hash_algo)
|
|
|
|
|
sigval_hash_algo = algo; /* Fallback used e.g. with old libksba. */
|
2003-08-05 17:11:04 +00:00
|
|
|
|
|
|
|
|
|
/* Find the certificate of the signer */
|
|
|
|
|
keydb_search_reset (kh);
|
2016-11-10 17:01:19 +01:00
|
|
|
|
rc = keydb_search_issuer_sn (ctrl, kh, issuer, serial);
|
2003-08-05 17:11:04 +00:00
|
|
|
|
if (rc)
|
|
|
|
|
{
|
|
|
|
|
if (rc == -1)
|
|
|
|
|
{
|
|
|
|
|
log_error ("certificate not found\n");
|
|
|
|
|
rc = gpg_error (GPG_ERR_NO_PUBKEY);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
log_error ("failed to find the certificate: %s\n",
|
|
|
|
|
gpg_strerror(rc));
|
|
|
|
|
{
|
|
|
|
|
char numbuf[50];
|
|
|
|
|
sprintf (numbuf, "%d", rc);
|
|
|
|
|
|
|
|
|
|
gpgsm_status2 (ctrl, STATUS_ERROR, "verify.findkey",
|
|
|
|
|
numbuf, NULL);
|
|
|
|
|
}
|
2007-11-19 16:03:50 +00:00
|
|
|
|
audit_log_s (ctrl->audit, AUDIT_SIG_STATUS, "no-cert");
|
2003-08-05 17:11:04 +00:00
|
|
|
|
goto next_signer;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
rc = keydb_get_cert (kh, &cert);
|
|
|
|
|
if (rc)
|
|
|
|
|
{
|
|
|
|
|
log_error ("failed to get cert: %s\n", gpg_strerror (rc));
|
2007-11-19 16:03:50 +00:00
|
|
|
|
audit_log_s (ctrl->audit, AUDIT_SIG_STATUS, "error");
|
2003-08-05 17:11:04 +00:00
|
|
|
|
goto next_signer;
|
|
|
|
|
}
|
|
|
|
|
|
2017-06-06 16:01:40 +02:00
|
|
|
|
/* Check compliance. */
|
|
|
|
|
{
|
|
|
|
|
unsigned int nbits;
|
|
|
|
|
int pk_algo = gpgsm_get_key_algo_info (cert, &nbits);
|
|
|
|
|
|
|
|
|
|
if (! gnupg_pk_is_allowed (opt.compliance, PK_USE_VERIFICATION,
|
|
|
|
|
pk_algo, NULL, nbits, NULL))
|
|
|
|
|
{
|
2017-07-28 17:46:43 +02:00
|
|
|
|
char kidstr[10+1];
|
|
|
|
|
|
|
|
|
|
snprintf (kidstr, sizeof kidstr, "0x%08lX",
|
|
|
|
|
gpgsm_get_short_fingerprint (cert, NULL));
|
|
|
|
|
log_error (_("key %s may not be used for signing in %s mode\n"),
|
|
|
|
|
kidstr,
|
2017-06-06 16:01:40 +02:00
|
|
|
|
gnupg_compliance_option_string (opt.compliance));
|
|
|
|
|
goto next_signer;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (! gnupg_digest_is_allowed (opt.compliance, 0, sigval_hash_algo))
|
|
|
|
|
{
|
2017-07-28 17:46:43 +02:00
|
|
|
|
log_error (_("digest algorithm '%s' may not be used in %s mode\n"),
|
2017-06-06 16:01:40 +02:00
|
|
|
|
gcry_md_algo_name (sigval_hash_algo),
|
|
|
|
|
gnupg_compliance_option_string (opt.compliance));
|
|
|
|
|
goto next_signer;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Check compliance with CO_DE_VS. */
|
|
|
|
|
if (gnupg_pk_is_compliant (CO_DE_VS, pk_algo, NULL, nbits, NULL)
|
|
|
|
|
&& gnupg_digest_is_compliant (CO_DE_VS, sigval_hash_algo))
|
|
|
|
|
gpgsm_status (ctrl, STATUS_VERIFICATION_COMPLIANCE_MODE,
|
|
|
|
|
gnupg_status_compliance_flag (CO_DE_VS));
|
|
|
|
|
}
|
|
|
|
|
|
2003-08-05 17:11:04 +00:00
|
|
|
|
log_info (_("Signature made "));
|
2003-10-31 12:12:47 +00:00
|
|
|
|
if (*sigtime)
|
2009-03-16 09:44:44 +00:00
|
|
|
|
dump_isotime (sigtime);
|
2003-08-05 17:11:04 +00:00
|
|
|
|
else
|
|
|
|
|
log_printf (_("[date not given]"));
|
2007-08-10 16:52:05 +00:00
|
|
|
|
log_printf (_(" using certificate ID 0x%08lX\n"),
|
2009-03-25 16:05:16 +00:00
|
|
|
|
gpgsm_get_short_fingerprint (cert, NULL));
|
2003-08-05 17:11:04 +00:00
|
|
|
|
|
2009-12-02 18:33:59 +00:00
|
|
|
|
audit_log_i (ctrl->audit, AUDIT_DATA_HASH_ALGO, algo);
|
2003-08-05 17:11:04 +00:00
|
|
|
|
|
|
|
|
|
if (msgdigest)
|
|
|
|
|
{ /* Signed attributes are available. */
|
|
|
|
|
gcry_md_hd_t md;
|
|
|
|
|
unsigned char *s;
|
|
|
|
|
|
2007-12-13 15:45:40 +00:00
|
|
|
|
/* Check that the message digest in the signed attributes
|
|
|
|
|
matches the one we calculated on the data. */
|
2003-08-05 17:11:04 +00:00
|
|
|
|
s = gcry_md_read (data_md, algo);
|
|
|
|
|
if ( !s || !msgdigestlen
|
|
|
|
|
|| gcry_md_get_algo_dlen (algo) != msgdigestlen
|
2015-01-23 15:30:03 +01:00
|
|
|
|
|| memcmp (s, msgdigest, msgdigestlen) )
|
2003-08-05 17:11:04 +00:00
|
|
|
|
{
|
|
|
|
|
char *fpr;
|
|
|
|
|
|
2008-04-18 09:20:25 +00:00
|
|
|
|
log_error (_("invalid signature: message digest attribute "
|
|
|
|
|
"does not match computed one\n"));
|
|
|
|
|
if (DBG_X509)
|
|
|
|
|
{
|
|
|
|
|
if (msgdigest)
|
2017-11-27 15:00:25 +01:00
|
|
|
|
log_printhex (msgdigest, msgdigestlen, "message: ");
|
2008-04-18 09:20:25 +00:00
|
|
|
|
if (s)
|
2017-11-27 15:00:25 +01:00
|
|
|
|
log_printhex (s, gcry_md_get_algo_dlen (algo),
|
|
|
|
|
"computed: ");
|
2008-04-18 09:20:25 +00:00
|
|
|
|
}
|
2006-11-14 10:23:21 +00:00
|
|
|
|
fpr = gpgsm_fpr_and_name_for_status (cert);
|
2003-08-05 17:11:04 +00:00
|
|
|
|
gpgsm_status (ctrl, STATUS_BADSIG, fpr);
|
|
|
|
|
xfree (fpr);
|
2007-11-19 16:03:50 +00:00
|
|
|
|
audit_log_s (ctrl->audit, AUDIT_SIG_STATUS, "bad");
|
2011-02-04 12:57:53 +01:00
|
|
|
|
goto next_signer;
|
2003-08-05 17:11:04 +00:00
|
|
|
|
}
|
2011-02-04 12:57:53 +01:00
|
|
|
|
|
2009-12-02 18:33:59 +00:00
|
|
|
|
audit_log_i (ctrl->audit, AUDIT_ATTR_HASH_ALGO, sigval_hash_algo);
|
2007-12-13 15:45:40 +00:00
|
|
|
|
rc = gcry_md_open (&md, sigval_hash_algo, 0);
|
2003-08-05 17:11:04 +00:00
|
|
|
|
if (rc)
|
|
|
|
|
{
|
|
|
|
|
log_error ("md_open failed: %s\n", gpg_strerror (rc));
|
2007-11-19 16:03:50 +00:00
|
|
|
|
audit_log_s (ctrl->audit, AUDIT_SIG_STATUS, "error");
|
2003-08-05 17:11:04 +00:00
|
|
|
|
goto next_signer;
|
|
|
|
|
}
|
|
|
|
|
if (DBG_HASHING)
|
2011-09-20 09:54:27 +02:00
|
|
|
|
gcry_md_debug (md, "vrfy.attr");
|
2003-08-05 17:11:04 +00:00
|
|
|
|
|
|
|
|
|
ksba_cms_set_hash_function (cms, HASH_FNC, md);
|
|
|
|
|
rc = ksba_cms_hash_signed_attrs (cms, signer);
|
|
|
|
|
if (rc)
|
|
|
|
|
{
|
|
|
|
|
log_error ("hashing signed attrs failed: %s\n",
|
2003-11-12 15:17:44 +00:00
|
|
|
|
gpg_strerror (rc));
|
2003-08-05 17:11:04 +00:00
|
|
|
|
gcry_md_close (md);
|
2007-11-19 16:03:50 +00:00
|
|
|
|
audit_log_s (ctrl->audit, AUDIT_SIG_STATUS, "error");
|
2003-08-05 17:11:04 +00:00
|
|
|
|
goto next_signer;
|
|
|
|
|
}
|
2011-02-04 12:57:53 +01:00
|
|
|
|
rc = gpgsm_check_cms_signature (cert, sigval, md,
|
2007-12-13 15:45:40 +00:00
|
|
|
|
sigval_hash_algo, &info_pkalgo);
|
2003-08-05 17:11:04 +00:00
|
|
|
|
gcry_md_close (md);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2011-02-04 12:57:53 +01:00
|
|
|
|
rc = gpgsm_check_cms_signature (cert, sigval, data_md,
|
2007-12-13 15:45:40 +00:00
|
|
|
|
algo, &info_pkalgo);
|
2003-08-05 17:11:04 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (rc)
|
|
|
|
|
{
|
|
|
|
|
char *fpr;
|
|
|
|
|
|
|
|
|
|
log_error ("invalid signature: %s\n", gpg_strerror (rc));
|
2006-11-14 10:23:21 +00:00
|
|
|
|
fpr = gpgsm_fpr_and_name_for_status (cert);
|
2003-08-05 17:11:04 +00:00
|
|
|
|
gpgsm_status (ctrl, STATUS_BADSIG, fpr);
|
|
|
|
|
xfree (fpr);
|
2007-11-19 16:03:50 +00:00
|
|
|
|
audit_log_s (ctrl->audit, AUDIT_SIG_STATUS, "bad");
|
2003-08-05 17:11:04 +00:00
|
|
|
|
goto next_signer;
|
|
|
|
|
}
|
|
|
|
|
rc = gpgsm_cert_use_verify_p (cert); /*(this displays an info message)*/
|
|
|
|
|
if (rc)
|
|
|
|
|
{
|
|
|
|
|
gpgsm_status_with_err_code (ctrl, STATUS_ERROR, "verify.keyusage",
|
|
|
|
|
gpg_err_code (rc));
|
|
|
|
|
rc = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (DBG_X509)
|
|
|
|
|
log_debug ("signature okay - checking certs\n");
|
2007-11-19 16:03:50 +00:00
|
|
|
|
audit_log (ctrl->audit, AUDIT_VALIDATE_CHAIN);
|
2007-08-10 16:52:05 +00:00
|
|
|
|
rc = gpgsm_validate_chain (ctrl, cert,
|
|
|
|
|
*sigtime? sigtime : "19700101T000000",
|
2011-02-04 12:57:53 +01:00
|
|
|
|
keyexptime, 0,
|
2007-08-10 16:52:05 +00:00
|
|
|
|
NULL, 0, &verifyflags);
|
2003-08-05 17:11:04 +00:00
|
|
|
|
{
|
2006-11-14 10:23:21 +00:00
|
|
|
|
char *fpr, *buf, *tstr;
|
|
|
|
|
|
|
|
|
|
fpr = gpgsm_fpr_and_name_for_status (cert);
|
|
|
|
|
if (gpg_err_code (rc) == GPG_ERR_CERT_EXPIRED)
|
|
|
|
|
{
|
|
|
|
|
gpgsm_status (ctrl, STATUS_EXPKEYSIG, fpr);
|
|
|
|
|
rc = 0;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
gpgsm_status (ctrl, STATUS_GOODSIG, fpr);
|
2011-02-04 12:57:53 +01:00
|
|
|
|
|
2006-11-14 10:23:21 +00:00
|
|
|
|
xfree (fpr);
|
2003-08-05 17:11:04 +00:00
|
|
|
|
|
|
|
|
|
fpr = gpgsm_get_fingerprint_hexstring (cert, GCRY_MD_SHA1);
|
|
|
|
|
tstr = strtimestamp_r (sigtime);
|
2007-08-10 16:52:05 +00:00
|
|
|
|
buf = xasprintf ("%s %s %s %s 0 0 %d %d 00", fpr, tstr,
|
|
|
|
|
*sigtime? sigtime : "0",
|
|
|
|
|
*keyexptime? keyexptime : "0",
|
|
|
|
|
info_pkalgo, algo);
|
2003-08-05 17:11:04 +00:00
|
|
|
|
xfree (tstr);
|
|
|
|
|
xfree (fpr);
|
|
|
|
|
gpgsm_status (ctrl, STATUS_VALIDSIG, buf);
|
|
|
|
|
xfree (buf);
|
|
|
|
|
}
|
|
|
|
|
|
2007-12-06 15:55:03 +00:00
|
|
|
|
audit_log_ok (ctrl->audit, AUDIT_CHAIN_STATUS, rc);
|
2003-08-05 17:11:04 +00:00
|
|
|
|
if (rc) /* of validate_chain */
|
|
|
|
|
{
|
|
|
|
|
log_error ("invalid certification chain: %s\n", gpg_strerror (rc));
|
|
|
|
|
if (gpg_err_code (rc) == GPG_ERR_BAD_CERT_CHAIN
|
|
|
|
|
|| gpg_err_code (rc) == GPG_ERR_BAD_CERT
|
|
|
|
|
|| gpg_err_code (rc) == GPG_ERR_BAD_CA_CERT
|
|
|
|
|
|| gpg_err_code (rc) == GPG_ERR_CERT_REVOKED)
|
|
|
|
|
gpgsm_status_with_err_code (ctrl, STATUS_TRUST_NEVER, NULL,
|
|
|
|
|
gpg_err_code (rc));
|
|
|
|
|
else
|
2011-02-04 12:57:53 +01:00
|
|
|
|
gpgsm_status_with_err_code (ctrl, STATUS_TRUST_UNDEFINED, NULL,
|
2003-08-05 17:11:04 +00:00
|
|
|
|
gpg_err_code (rc));
|
2007-11-19 16:03:50 +00:00
|
|
|
|
audit_log_s (ctrl->audit, AUDIT_SIG_STATUS, "bad");
|
2003-08-05 17:11:04 +00:00
|
|
|
|
goto next_signer;
|
|
|
|
|
}
|
|
|
|
|
|
2007-11-19 16:03:50 +00:00
|
|
|
|
audit_log_s (ctrl->audit, AUDIT_SIG_STATUS, "good");
|
|
|
|
|
|
2003-08-05 17:11:04 +00:00
|
|
|
|
for (i=0; (p = ksba_cert_get_subject (cert, i)); i++)
|
|
|
|
|
{
|
|
|
|
|
log_info (!i? _("Good signature from")
|
|
|
|
|
: _(" aka"));
|
|
|
|
|
log_printf (" \"");
|
2010-03-15 11:15:45 +00:00
|
|
|
|
gpgsm_es_print_name (log_get_stream (), p);
|
2003-08-05 17:11:04 +00:00
|
|
|
|
log_printf ("\"\n");
|
|
|
|
|
ksba_free (p);
|
|
|
|
|
}
|
|
|
|
|
|
2007-08-10 16:52:05 +00:00
|
|
|
|
/* Print a note if this is a qualified signature. */
|
|
|
|
|
{
|
|
|
|
|
size_t qualbuflen;
|
|
|
|
|
char qualbuffer[1];
|
2011-02-04 12:57:53 +01:00
|
|
|
|
|
2007-08-10 16:52:05 +00:00
|
|
|
|
rc = ksba_cert_get_user_data (cert, "is_qualified", &qualbuffer,
|
|
|
|
|
sizeof (qualbuffer), &qualbuflen);
|
|
|
|
|
if (!rc && qualbuflen)
|
|
|
|
|
{
|
|
|
|
|
if (*qualbuffer)
|
|
|
|
|
{
|
|
|
|
|
log_info (_("This is a qualified signature\n"));
|
|
|
|
|
if (!opt.qualsig_approval)
|
2011-02-04 12:57:53 +01:00
|
|
|
|
log_info
|
2007-08-10 16:52:05 +00:00
|
|
|
|
(_("Note, that this software is not officially approved "
|
|
|
|
|
"to create or verify such signatures.\n"));
|
|
|
|
|
}
|
2011-02-04 12:57:53 +01:00
|
|
|
|
}
|
2007-08-10 16:52:05 +00:00
|
|
|
|
else if (gpg_err_code (rc) != GPG_ERR_NOT_FOUND)
|
|
|
|
|
log_error ("get_user_data(is_qualified) failed: %s\n",
|
2011-02-04 12:57:53 +01:00
|
|
|
|
gpg_strerror (rc));
|
2007-08-10 16:52:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
2011-02-04 12:57:53 +01:00
|
|
|
|
gpgsm_status (ctrl, STATUS_TRUST_FULLY,
|
2011-12-07 16:15:15 +01:00
|
|
|
|
(verifyflags & VALIDATE_FLAG_STEED)?
|
|
|
|
|
"0 steed":
|
2007-08-10 16:52:05 +00:00
|
|
|
|
(verifyflags & VALIDATE_FLAG_CHAIN_MODEL)?
|
|
|
|
|
"0 chain": "0 shell");
|
2011-02-04 12:57:53 +01:00
|
|
|
|
|
2003-08-05 17:11:04 +00:00
|
|
|
|
next_signer:
|
|
|
|
|
rc = 0;
|
|
|
|
|
xfree (issuer);
|
|
|
|
|
xfree (serial);
|
|
|
|
|
xfree (sigval);
|
|
|
|
|
xfree (msgdigest);
|
|
|
|
|
ksba_cert_release (cert);
|
|
|
|
|
cert = NULL;
|
|
|
|
|
}
|
|
|
|
|
rc = 0;
|
|
|
|
|
|
|
|
|
|
leave:
|
|
|
|
|
ksba_cms_release (cms);
|
2017-02-16 17:11:38 +01:00
|
|
|
|
gnupg_ksba_destroy_reader (b64reader);
|
|
|
|
|
gnupg_ksba_destroy_writer (b64writer);
|
2011-02-04 12:57:53 +01:00
|
|
|
|
keydb_release (kh);
|
2003-08-05 17:11:04 +00:00
|
|
|
|
gcry_md_close (data_md);
|
2010-03-08 12:22:18 +00:00
|
|
|
|
es_fclose (in_fp);
|
2003-08-05 17:11:04 +00:00
|
|
|
|
|
|
|
|
|
if (rc)
|
|
|
|
|
{
|
|
|
|
|
char numbuf[50];
|
|
|
|
|
sprintf (numbuf, "%d", rc );
|
|
|
|
|
gpgsm_status2 (ctrl, STATUS_ERROR, "verify.leave",
|
|
|
|
|
numbuf, NULL);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return rc;
|
|
|
|
|
}
|