mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-22 10:19:57 +01:00
Mainly changes to adjust for the changed KSBA API.
This commit is contained in:
parent
f794da4ad4
commit
dba40e5e45
@ -329,7 +329,7 @@ cmd_pkdecrypt (ASSUAN_CONTEXT ctx, char *line)
|
||||
{
|
||||
int rc;
|
||||
CTRL ctrl = assuan_get_pointer (ctx);
|
||||
char *value;
|
||||
unsigned char *value;
|
||||
size_t valuelen;
|
||||
|
||||
/* First inquire the data to decrypt */
|
||||
@ -365,7 +365,7 @@ cmd_genkey (ASSUAN_CONTEXT ctx, char *line)
|
||||
{
|
||||
CTRL ctrl = assuan_get_pointer (ctx);
|
||||
int rc;
|
||||
char *value;
|
||||
unsigned char *value;
|
||||
size_t valuelen;
|
||||
|
||||
/* First inquire the parameters */
|
||||
|
@ -137,7 +137,7 @@ agent_genkey (CTRL ctrl, const char *keyparam, size_t keyparamlen,
|
||||
{
|
||||
log_error ("key generation failed: %s\n", gpg_strerror (rc));
|
||||
xfree (pi);
|
||||
return map_gcry_err (rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
/* break out the parts */
|
||||
|
@ -105,7 +105,6 @@ agent_pkdecrypt (CTRL ctrl, const char *ciphertext, size_t ciphertextlen,
|
||||
if (rc)
|
||||
{
|
||||
log_error ("decryption failed: %s\n", gpg_strerror (rc));
|
||||
rc = map_gcry_err (rc);
|
||||
goto leave;
|
||||
}
|
||||
|
||||
|
@ -39,7 +39,9 @@ do_encode_md (const byte * md, size_t mdlen, int algo, gcry_sexp_t * r_hash)
|
||||
char * p, tmp[16];
|
||||
int i, rc;
|
||||
|
||||
#warning I do do like that stuff - libgcrypt provides easier interfaces. -wk
|
||||
#ifdef __GNUC__
|
||||
#warning I do not like that stuff - libgcrypt provides easier interfaces. -wk
|
||||
#endif
|
||||
/* FIXME: Either use the build function or create canonical encoded
|
||||
S-expressions. */
|
||||
|
||||
@ -128,7 +130,6 @@ agent_pksign (CTRL ctrl, FILE *outfp, int ignore_cache)
|
||||
if (rc)
|
||||
{
|
||||
log_error ("signing failed: %s\n", gpg_strerror (rc));
|
||||
rc = map_gcry_err (rc);
|
||||
goto leave;
|
||||
}
|
||||
|
||||
|
@ -1,3 +1,7 @@
|
||||
2003-11-12 Werner Koch <wk@gnupg.org>
|
||||
|
||||
* maperror.c (map_ksba_err, map_gcry_err, map_kbx_err): Removed.
|
||||
|
||||
2003-10-31 Werner Koch <wk@gnupg.org>
|
||||
|
||||
* util.h (gnupg_isotime_t): New.
|
||||
|
@ -32,49 +32,6 @@
|
||||
#include "util.h"
|
||||
#include "errors.h"
|
||||
|
||||
/* Note: we might want to wrap this in a macro to get our hands on
|
||||
the line and file where the error occured */
|
||||
int
|
||||
map_ksba_err (int err)
|
||||
{
|
||||
switch (err)
|
||||
{
|
||||
case 0:
|
||||
break;
|
||||
|
||||
case -1: err = GPG_ERR_EOF; break;
|
||||
case KSBA_Out_Of_Core: err = GPG_ERR_ENOMEM; break;
|
||||
case KSBA_Invalid_Value: err = GPG_ERR_INV_VALUE; break;
|
||||
case KSBA_Not_Implemented: err = GPG_ERR_NOT_IMPLEMENTED; break;
|
||||
case KSBA_Conflict: err = GPG_ERR_CONFLICT; break;
|
||||
case KSBA_Read_Error: err = GPG_ERR_EIO; break;
|
||||
case KSBA_Write_Error: err = GPG_ERR_EIO; break;
|
||||
case KSBA_No_Data: err = GPG_ERR_NO_DATA; break;
|
||||
case KSBA_Bug: err = GPG_ERR_BUG; break;
|
||||
case KSBA_Unsupported_Algorithm: err = GPG_ERR_UNSUPPORTED_ALGORITHM; break;
|
||||
case KSBA_Invalid_Index: err = GPG_ERR_INV_INDEX; break;
|
||||
case KSBA_Invalid_Sexp: err = GPG_ERR_INV_SEXP; break;
|
||||
case KSBA_Unknown_Sexp: err = GPG_ERR_UNKNOWN_SEXP; break;
|
||||
|
||||
default:
|
||||
err = GPG_ERR_GENERAL;
|
||||
break;
|
||||
}
|
||||
return gpg_err_make (GPG_ERR_SOURCE_GPGSM, err);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
map_gcry_err (int err)
|
||||
{
|
||||
return err;
|
||||
}
|
||||
|
||||
int
|
||||
map_kbx_err (int err)
|
||||
{
|
||||
return err;
|
||||
}
|
||||
|
||||
/* Map Assuan error code ERR to an GPG_ERR_ code. We need to
|
||||
distinguish between genuine (and legacy) Assuan error codes and
|
||||
|
@ -58,8 +58,6 @@ typedef char gnupg_isotime_t[16];
|
||||
|
||||
|
||||
/*-- maperror.c --*/
|
||||
int map_ksba_err (int err);
|
||||
int map_gcry_err (int err);
|
||||
int map_kbx_err (int err);
|
||||
gpg_error_t map_assuan_err (int err);
|
||||
int map_to_assuan_status (int rc);
|
||||
|
@ -246,7 +246,9 @@ openpgp_pk_test_algo( int algo, unsigned int usage_flags )
|
||||
|
||||
if (algo == GCRY_PK_ELG_E)
|
||||
algo = GCRY_PK_ELG;
|
||||
#ifdef __GNUC__
|
||||
#warning need to handle the usage here?
|
||||
#endif
|
||||
if (algo < 0 || algo > 110)
|
||||
return GPG_ERR_PUBKEY_ALGO;
|
||||
return gcry_pk_algo_info (algo, GCRYCTL_TEST_ALGO, NULL, &value);
|
||||
|
@ -1,3 +1,7 @@
|
||||
2003-11-06 Werner Koch <wk@gnupg.org>
|
||||
|
||||
* strlist.h (strlist_t): New. STRLIST is now deprecated.
|
||||
|
||||
2003-06-18 Werner Koch <wk@gnupg.org>
|
||||
|
||||
* strlist.c (strlist_pop): New.
|
||||
|
@ -26,17 +26,22 @@ struct string_list {
|
||||
unsigned int flags;
|
||||
char d[1];
|
||||
};
|
||||
typedef struct string_list *STRLIST;
|
||||
typedef struct string_list *STRLIST; /* Deprecated. */
|
||||
typedef struct string_list *strlist_t;
|
||||
|
||||
void free_strlist (strlist_t sl);
|
||||
strlist_t add_to_strlist (strlist_t *list, const char *string);
|
||||
|
||||
void free_strlist( STRLIST sl );
|
||||
STRLIST add_to_strlist( STRLIST *list, const char *string );
|
||||
/*STRLIST add_to_strlist2( STRLIST *list, const char *string, int is_utf8 );*/
|
||||
STRLIST append_to_strlist( STRLIST *list, const char *string );
|
||||
/*STRLIST append_to_strlist2( STRLIST *list, const char *string, int is_utf8 );*/
|
||||
STRLIST strlist_prev( STRLIST head, STRLIST node );
|
||||
STRLIST strlist_last( STRLIST node );
|
||||
char * strlist_pop (STRLIST *list);
|
||||
/*strlist_t add_to_strlist2( strlist_t *list,
|
||||
const char *string, int is_utf8);*/
|
||||
|
||||
strlist_t append_to_strlist (strlist_t *list, const char *string);
|
||||
|
||||
/*strlist_t append_to_strlist2( strlist_t *list, const char *string,
|
||||
int is_utf8);*/
|
||||
strlist_t strlist_prev (strlist_t head, strlist_t node);
|
||||
strlist_t strlist_last (strlist_t node);
|
||||
char * strlist_pop (strlist_t *list);
|
||||
|
||||
#define FREE_STRLIST(a) do { free_strlist((a)); (a) = NULL ; } while(0)
|
||||
|
||||
|
@ -1,3 +1,9 @@
|
||||
2003-11-12 Werner Koch <wk@gnupg.org>
|
||||
|
||||
Adjusted for API changes in Libksba.
|
||||
|
||||
* keybox-blob.c: Include time.h
|
||||
|
||||
2003-06-03 Werner Koch <wk@gnupg.org>
|
||||
|
||||
Changed all error codes in all files to the new libgpg-error scheme.
|
||||
|
@ -110,6 +110,7 @@ X.509 specific are noted like [X.509: xxx]
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <assert.h>
|
||||
#include <time.h>
|
||||
|
||||
#include "keybox-defs.h"
|
||||
#include <gcrypt.h>
|
||||
|
@ -21,14 +21,15 @@
|
||||
#ifndef KEYBOX_DEFS_H
|
||||
#define KEYBOX_DEFS_H 1
|
||||
|
||||
#include <sys/types.h> /* off_t */
|
||||
#include "keybox.h"
|
||||
|
||||
#ifdef GPG_ERR_SOURCE_DEFAULT
|
||||
#error GPG_ERR_SOURCE_DEFAULT already defined
|
||||
#endif
|
||||
#define GPG_ERR_SOURCE_DEFAULT GPG_ERR_SOURCE_KEYBOX
|
||||
|
||||
#include <gpg-error.h>
|
||||
#include <sys/types.h> /* off_t */
|
||||
#include "keybox.h"
|
||||
|
||||
|
||||
|
||||
#ifndef HAVE_BYTE_TYPEDEF
|
||||
|
@ -778,9 +778,9 @@ keybox_get_cert (KEYBOX_HANDLE hd, KsbaCert *r_cert)
|
||||
if (cert_off+cert_len > length)
|
||||
return gpg_error (GPG_ERR_TOO_SHORT);
|
||||
|
||||
reader = ksba_reader_new ();
|
||||
if (!reader)
|
||||
return gpg_error (GPG_ERR_ENOMEM);
|
||||
rc = ksba_reader_new (&reader);
|
||||
if (rc)
|
||||
return rc;
|
||||
rc = ksba_reader_set_mem (reader, buffer+cert_off, cert_len);
|
||||
if (rc)
|
||||
{
|
||||
@ -789,11 +789,11 @@ keybox_get_cert (KEYBOX_HANDLE hd, KsbaCert *r_cert)
|
||||
return gpg_error (GPG_ERR_GENERAL);
|
||||
}
|
||||
|
||||
cert = ksba_cert_new ();
|
||||
if (!cert)
|
||||
rc = ksba_cert_new (&cert);
|
||||
if (rc)
|
||||
{
|
||||
ksba_reader_release (reader);
|
||||
return gpg_error (GPG_ERR_ENOMEM);
|
||||
return rc;
|
||||
}
|
||||
|
||||
rc = ksba_cert_read_der (cert, reader);
|
||||
|
@ -1,3 +1,7 @@
|
||||
2003-11-12 Werner Koch <wk@gnupg.org>
|
||||
|
||||
Adjusted for API changes in Libksba.
|
||||
|
||||
2003-10-30 Werner Koch <wk@gnupg.org>
|
||||
|
||||
* apdu.c (close_ct_reader, close_pcsc_reader): Implemented.
|
||||
|
@ -79,9 +79,9 @@
|
||||
|
||||
#ifdef HAVE_OPENSC
|
||||
#include <opensc/pkcs15.h>
|
||||
#include "scdaemon.h"
|
||||
#include <ksba.h>
|
||||
|
||||
#include "scdaemon.h"
|
||||
#include "card-common.h"
|
||||
|
||||
static int dinsig_read_cert (CARD card, const char *certidstr,
|
||||
@ -113,12 +113,11 @@ dinsig_enum_keypairs (CARD card, int idx,
|
||||
if (rc)
|
||||
return rc;
|
||||
|
||||
cert = ksba_cert_new ();
|
||||
if (!cert)
|
||||
rc = ksba_cert_new (&cert);
|
||||
if (rc)
|
||||
{
|
||||
gpg_error_t tmperr = out_of_core ();
|
||||
xfree (buf);
|
||||
return tmperr;
|
||||
return rc;
|
||||
}
|
||||
|
||||
krc = ksba_cert_init_from_mem (cert, buf, buflen);
|
||||
@ -126,9 +125,9 @@ dinsig_enum_keypairs (CARD card, int idx,
|
||||
if (krc)
|
||||
{
|
||||
log_error ("failed to parse the certificate at idx %d: %s\n",
|
||||
idx, ksba_strerror (krc));
|
||||
idx, gpg_strerror (krc));
|
||||
ksba_cert_release (cert);
|
||||
return gpg_error (GPG_ERR_CARD);
|
||||
return krc;
|
||||
}
|
||||
if (card_help_get_keygrip (cert, keygrip))
|
||||
{
|
||||
|
@ -27,9 +27,9 @@
|
||||
|
||||
#ifdef HAVE_OPENSC
|
||||
#include <opensc/pkcs15.h>
|
||||
#include <ksba.h>
|
||||
|
||||
#include "scdaemon.h"
|
||||
#include <ksba.h>
|
||||
#include "card-common.h"
|
||||
|
||||
|
||||
@ -148,21 +148,20 @@ p15_enum_keypairs (CARD card, int idx,
|
||||
return gpg_error (GPG_ERR_CARD);
|
||||
}
|
||||
|
||||
cert = ksba_cert_new ();
|
||||
if (!cert)
|
||||
rc = ksba_cert_new (&cert);
|
||||
if (rc)
|
||||
{
|
||||
gpg_error_t tmperr = out_of_core ();
|
||||
sc_pkcs15_free_certificate (certder);
|
||||
return tmperr;
|
||||
return rc;
|
||||
}
|
||||
krc = ksba_cert_init_from_mem (cert, certder->data, certder->data_len);
|
||||
sc_pkcs15_free_certificate (certder);
|
||||
if (krc)
|
||||
{
|
||||
log_error ("failed to parse the certificate for private key %d: %s\n",
|
||||
idx, ksba_strerror (krc));
|
||||
idx, gpg_strerror (krc));
|
||||
ksba_cert_release (cert);
|
||||
return gpg_error (GPG_ERR_CARD);
|
||||
return krc;
|
||||
}
|
||||
if (card_help_get_keygrip (cert, keygrip))
|
||||
{
|
||||
|
@ -28,9 +28,10 @@
|
||||
#ifdef HAVE_OPENSC
|
||||
#include <opensc/pkcs15.h>
|
||||
#endif
|
||||
#include <ksba.h>
|
||||
|
||||
#include "scdaemon.h"
|
||||
#include <ksba.h>
|
||||
|
||||
#include "card-common.h"
|
||||
|
||||
/* Map the SC error codes to the GNUPG ones */
|
||||
|
@ -25,11 +25,11 @@
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <unistd.h>
|
||||
#include <ksba.h>
|
||||
|
||||
#include <assuan.h>
|
||||
|
||||
#include "scdaemon.h"
|
||||
#include <ksba.h>
|
||||
#include "app-common.h"
|
||||
|
||||
/* maximum length aloowed as a PIN; used for INQUIRE NEEDPIN */
|
||||
@ -453,18 +453,16 @@ cmd_readkey (ASSUAN_CONTEXT ctx, char *line)
|
||||
goto leave;
|
||||
}
|
||||
|
||||
kc = ksba_cert_new ();
|
||||
if (!kc)
|
||||
rc = ksba_cert_new (&kc);
|
||||
if (rc)
|
||||
{
|
||||
rc = out_of_core ();
|
||||
xfree (cert);
|
||||
goto leave;
|
||||
}
|
||||
rc = ksba_cert_init_from_mem (kc, cert, ncert);
|
||||
if (rc)
|
||||
{
|
||||
log_error ("failed to parse the certificate: %s\n", ksba_strerror (rc));
|
||||
rc = map_ksba_err (rc);
|
||||
log_error ("failed to parse the certificate: %s\n", gpg_strerror (rc));
|
||||
goto leave;
|
||||
}
|
||||
|
||||
@ -531,7 +529,7 @@ pin_cb (void *opaque, const char *info, char **retstr)
|
||||
ASSUAN_CONTEXT ctx = opaque;
|
||||
char *command;
|
||||
int rc;
|
||||
char *value;
|
||||
unsigned char *value;
|
||||
size_t valuelen;
|
||||
|
||||
*retstr = NULL;
|
||||
|
@ -1,3 +1,7 @@
|
||||
2003-11-12 Werner Koch <wk@gnupg.org>
|
||||
|
||||
Adjusted for API changes in Libksba.
|
||||
|
||||
2003-10-31 Werner Koch <wk@gnupg.org>
|
||||
|
||||
* certchain.c (gpgsm_validate_chain): Changed to use ksba_isotime_t.
|
||||
|
21
sm/base64.c
21
sm/base64.c
@ -27,9 +27,10 @@
|
||||
#include <time.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "gpgsm.h"
|
||||
|
||||
#include <ksba.h>
|
||||
|
||||
#include "gpgsm.h"
|
||||
#include "i18n.h"
|
||||
|
||||
#ifdef HAVE_DOSISH_SYSTEM
|
||||
@ -427,7 +428,7 @@ base64_writer_cb (void *cb_value, const void *buffer, size_t count)
|
||||
parm->base64.idx = idx;
|
||||
parm->base64.quad_count = quad_count;
|
||||
|
||||
return ferror (fp) ? KSBA_Write_Error:0;
|
||||
return ferror (fp) ? gpg_error_from_errno (errno) : 0;
|
||||
}
|
||||
|
||||
static int
|
||||
@ -506,11 +507,11 @@ gpgsm_create_reader (Base64Context *ctx,
|
||||
if (!*ctx)
|
||||
return OUT_OF_CORE (errno);
|
||||
|
||||
r = ksba_reader_new ();
|
||||
if (!r)
|
||||
rc = ksba_reader_new (&r);
|
||||
if (rc)
|
||||
{
|
||||
xfree (*ctx); *ctx = NULL;
|
||||
return gpg_error (GPG_ERR_ENOMEM);
|
||||
return rc;
|
||||
}
|
||||
|
||||
(*ctx)->u.rparm.fp = fp;
|
||||
@ -537,7 +538,7 @@ gpgsm_create_reader (Base64Context *ctx,
|
||||
{
|
||||
ksba_reader_release (r);
|
||||
xfree (*ctx); *ctx = NULL;
|
||||
return map_ksba_err (rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
*r_reader = r;
|
||||
@ -571,11 +572,11 @@ gpgsm_create_writer (Base64Context *ctx,
|
||||
if (!*ctx)
|
||||
return OUT_OF_CORE (errno);
|
||||
|
||||
w = ksba_writer_new ();
|
||||
if (!w)
|
||||
rc = ksba_writer_new (&w);
|
||||
if (rc)
|
||||
{
|
||||
xfree (*ctx); *ctx = NULL;
|
||||
return gpg_error (GPG_ERR_ENOMEM);
|
||||
return rc;
|
||||
}
|
||||
|
||||
if (ctrl->create_pem || ctrl->create_base64)
|
||||
@ -593,7 +594,7 @@ gpgsm_create_writer (Base64Context *ctx,
|
||||
{
|
||||
ksba_writer_release (w);
|
||||
xfree (*ctx); *ctx = NULL;
|
||||
return map_ksba_err (rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
*r_writer = w;
|
||||
|
@ -622,18 +622,18 @@ learn_cb (void *opaque, const void *buffer, size_t length)
|
||||
|
||||
|
||||
/* FIXME: this should go into import.c */
|
||||
cert = ksba_cert_new ();
|
||||
if (!cert)
|
||||
rc = ksba_cert_new (&cert);
|
||||
if (rc)
|
||||
{
|
||||
parm->error = gpg_error (GPG_ERR_ENOMEM);
|
||||
parm->error = rc;
|
||||
return 0;
|
||||
}
|
||||
rc = ksba_cert_init_from_mem (cert, buf, len);
|
||||
if (rc)
|
||||
{
|
||||
log_error ("failed to parse a certificate: %s\n", ksba_strerror (rc));
|
||||
log_error ("failed to parse a certificate: %s\n", gpg_strerror (rc));
|
||||
ksba_cert_release (cert);
|
||||
parm->error = map_ksba_err (rc);
|
||||
parm->error = rc;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -357,16 +357,16 @@ lookup_cb (void *opaque, const void *buffer, size_t length)
|
||||
return 0;
|
||||
}
|
||||
|
||||
cert = ksba_cert_new ();
|
||||
if (!cert)
|
||||
rc = ksba_cert_new (&cert);
|
||||
if (rc)
|
||||
{
|
||||
parm->error = gpg_error (GPG_ERR_ENOMEM);
|
||||
parm->error = rc;
|
||||
return 0;
|
||||
}
|
||||
rc = ksba_cert_init_from_mem (cert, buf, len);
|
||||
if (rc)
|
||||
{
|
||||
log_error ("failed to parse a certificate: %s\n", ksba_strerror (rc));
|
||||
log_error ("failed to parse a certificate: %s\n", gpg_strerror (rc));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -62,7 +62,7 @@ unknown_criticals (KsbaCert cert)
|
||||
}
|
||||
}
|
||||
if (err && err != -1)
|
||||
rc = map_ksba_err (err);
|
||||
rc = err;
|
||||
|
||||
return rc;
|
||||
}
|
||||
@ -75,7 +75,7 @@ allowed_ca (KsbaCert cert, int *chainlen)
|
||||
|
||||
err = ksba_cert_is_ca (cert, &flag, chainlen);
|
||||
if (err)
|
||||
return map_ksba_err (err);
|
||||
return err;
|
||||
if (!flag)
|
||||
{
|
||||
log_error (_("issuer certificate is not marked as a CA\n"));
|
||||
@ -94,10 +94,10 @@ check_cert_policy (KsbaCert cert)
|
||||
int any_critical;
|
||||
|
||||
err = ksba_cert_get_cert_policies (cert, &policies);
|
||||
if (err == KSBA_No_Data)
|
||||
if (gpg_err_code (err) == GPG_ERR_NO_DATA)
|
||||
return 0; /* no policy given */
|
||||
if (err)
|
||||
return map_ksba_err (err);
|
||||
return err;
|
||||
|
||||
/* STRING is a line delimited list of certifiate policies as stored
|
||||
in the certificate. The line itself is colon delimited where the
|
||||
@ -471,7 +471,7 @@ gpgsm_validate_chain (CTRL ctrl, KsbaCert cert, ksba_isotime_t r_exptime)
|
||||
if (rc)
|
||||
{
|
||||
log_error (_("certificate with invalid validity: %s\n"),
|
||||
ksba_strerror (rc));
|
||||
gpg_strerror (rc));
|
||||
rc = gpg_error (GPG_ERR_BAD_CERT);
|
||||
goto leave;
|
||||
}
|
||||
@ -522,7 +522,7 @@ gpgsm_validate_chain (CTRL ctrl, KsbaCert cert, ksba_isotime_t r_exptime)
|
||||
rc = gpgsm_dirmngr_isvalid (subject_cert);
|
||||
if (rc)
|
||||
{
|
||||
switch (rc)
|
||||
switch (gpg_err_code (rc))
|
||||
{
|
||||
case GPG_ERR_CERT_REVOKED:
|
||||
log_error (_("the certificate has been revoked\n"));
|
||||
|
@ -129,9 +129,9 @@ gpgsm_check_cert_sig (KsbaCert issuer_cert, KsbaCert cert)
|
||||
rc = ksba_cert_hash (cert, 1, HASH_FNC, md);
|
||||
if (rc)
|
||||
{
|
||||
log_error ("ksba_cert_hash failed: %s\n", ksba_strerror (rc));
|
||||
log_error ("ksba_cert_hash failed: %s\n", gpg_strerror (rc));
|
||||
gcry_md_close (md);
|
||||
return map_ksba_err (rc);
|
||||
return rc;
|
||||
}
|
||||
gcry_md_final (md);
|
||||
|
||||
|
@ -45,7 +45,7 @@ cert_usage_p (KsbaCert cert, int mode)
|
||||
unsigned int use;
|
||||
|
||||
err = ksba_cert_get_key_usage (cert, &use);
|
||||
if (err == KSBA_No_Data)
|
||||
if (gpg_err_code (err) == GPG_ERR_NO_DATA)
|
||||
{
|
||||
if (opt.verbose && mode < 2)
|
||||
log_info (mode?
|
||||
@ -56,8 +56,8 @@ cert_usage_p (KsbaCert cert, int mode)
|
||||
if (err)
|
||||
{
|
||||
log_error (_("error getting key usage information: %s\n"),
|
||||
ksba_strerror (err));
|
||||
return map_ksba_err (err);
|
||||
gpg_strerror (err));
|
||||
return err;
|
||||
}
|
||||
|
||||
if (mode == 4)
|
||||
|
@ -513,9 +513,9 @@ create_request (struct para_data_s *para, KsbaConstSexp public,
|
||||
int rc = 0;
|
||||
const char *s;
|
||||
|
||||
cr = ksba_certreq_new ();
|
||||
if (!cr)
|
||||
return gpg_error (GPG_ERR_ENOMEM);
|
||||
err = ksba_certreq_new (&cr);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
rc = gcry_md_open (&md, GCRY_MD_SHA1, 0);
|
||||
if (rc)
|
||||
@ -533,8 +533,8 @@ create_request (struct para_data_s *para, KsbaConstSexp public,
|
||||
if (err)
|
||||
{
|
||||
log_error ("error setting the subject's name: %s\n",
|
||||
ksba_strerror (err));
|
||||
rc = map_ksba_err (err);
|
||||
gpg_strerror (err));
|
||||
rc = err;
|
||||
goto leave;
|
||||
}
|
||||
|
||||
@ -557,8 +557,8 @@ create_request (struct para_data_s *para, KsbaConstSexp public,
|
||||
if (err)
|
||||
{
|
||||
log_error ("error setting the subject's alternate name: %s\n",
|
||||
ksba_strerror (err));
|
||||
rc = map_ksba_err (err);
|
||||
gpg_strerror (err));
|
||||
rc = err;
|
||||
goto leave;
|
||||
}
|
||||
}
|
||||
@ -568,8 +568,8 @@ create_request (struct para_data_s *para, KsbaConstSexp public,
|
||||
if (err)
|
||||
{
|
||||
log_error ("error setting the public key: %s\n",
|
||||
ksba_strerror (err));
|
||||
rc = map_ksba_err (err);
|
||||
gpg_strerror (err));
|
||||
rc = err;
|
||||
goto leave;
|
||||
}
|
||||
|
||||
@ -578,8 +578,8 @@ create_request (struct para_data_s *para, KsbaConstSexp public,
|
||||
err = ksba_certreq_build (cr, &stopreason);
|
||||
if (err)
|
||||
{
|
||||
log_error ("ksba_certreq_build failed: %s\n", ksba_strerror (err));
|
||||
rc = map_ksba_err (err);
|
||||
log_error ("ksba_certreq_build failed: %s\n", gpg_strerror (err));
|
||||
rc = err;
|
||||
goto leave;
|
||||
}
|
||||
if (stopreason == KSBA_SR_NEED_SIG)
|
||||
@ -630,8 +630,8 @@ create_request (struct para_data_s *para, KsbaConstSexp public,
|
||||
if (err)
|
||||
{
|
||||
log_error ("failed to store the sig_val: %s\n",
|
||||
ksba_strerror (err));
|
||||
rc = map_ksba_err (err);
|
||||
gpg_strerror (err));
|
||||
rc = err;
|
||||
goto leave;
|
||||
}
|
||||
}
|
||||
|
30
sm/decrypt.c
30
sm/decrypt.c
@ -159,10 +159,10 @@ decrypt_filter (void *arg,
|
||||
|
||||
/* fixme: Should we issue an error when we have not seen one full block? */
|
||||
if (!inlen)
|
||||
return KSBA_Bug;
|
||||
return gpg_error (GPG_ERR_BUG);
|
||||
|
||||
if (maxoutlen < 2*parm->blklen)
|
||||
return KSBA_Bug;
|
||||
return gpg_error (GPG_ERR_BUG);
|
||||
/* make some space becuase we will later need an extra block at the end */
|
||||
maxoutlen -= blklen;
|
||||
|
||||
@ -174,7 +174,7 @@ decrypt_filter (void *arg,
|
||||
parm->helpblock[i] = ((const char*)inbuf)[j];
|
||||
inlen -= j;
|
||||
if (blklen > maxoutlen)
|
||||
return KSBA_Bug;
|
||||
return gpg_error (GPG_ERR_BUG);
|
||||
if (i < blklen)
|
||||
{
|
||||
parm->helpblocklen = i;
|
||||
@ -285,10 +285,10 @@ gpgsm_decrypt (CTRL ctrl, int in_fd, FILE *out_fp)
|
||||
goto leave;
|
||||
}
|
||||
|
||||
cms = ksba_cms_new ();
|
||||
if (!cms)
|
||||
err = ksba_cms_new (&cms);
|
||||
if (err)
|
||||
{
|
||||
rc = gpg_error (GPG_ERR_ENOMEM);
|
||||
rc = err;
|
||||
goto leave;
|
||||
}
|
||||
|
||||
@ -296,8 +296,8 @@ gpgsm_decrypt (CTRL ctrl, int in_fd, FILE *out_fp)
|
||||
if (err)
|
||||
{
|
||||
log_debug ("ksba_cms_set_reader_writer failed: %s\n",
|
||||
ksba_strerror (err));
|
||||
rc = map_ksba_err (err);
|
||||
gpg_strerror (err));
|
||||
rc = err;
|
||||
goto leave;
|
||||
}
|
||||
|
||||
@ -307,8 +307,8 @@ gpgsm_decrypt (CTRL ctrl, int in_fd, FILE *out_fp)
|
||||
err = ksba_cms_parse (cms, &stopreason);
|
||||
if (err)
|
||||
{
|
||||
log_debug ("ksba_cms_parse failed: %s\n", ksba_strerror (err));
|
||||
rc = map_ksba_err (err);
|
||||
log_debug ("ksba_cms_parse failed: %s\n", gpg_strerror (err));
|
||||
rc = err;
|
||||
goto leave;
|
||||
}
|
||||
|
||||
@ -352,8 +352,8 @@ gpgsm_decrypt (CTRL ctrl, int in_fd, FILE *out_fp)
|
||||
&dfparm.ivlen);
|
||||
if (rc)
|
||||
{
|
||||
log_error ("error getting IV: %s\n", ksba_strerror (err));
|
||||
rc = map_ksba_err (err);
|
||||
log_error ("error getting IV: %s\n", gpg_strerror (err));
|
||||
rc = err;
|
||||
goto leave;
|
||||
}
|
||||
|
||||
@ -369,7 +369,7 @@ gpgsm_decrypt (CTRL ctrl, int in_fd, FILE *out_fp)
|
||||
break; /* no more recipients */
|
||||
if (err)
|
||||
log_error ("recp %d - error getting info: %s\n",
|
||||
recp, ksba_strerror (err));
|
||||
recp, gpg_strerror (err));
|
||||
else
|
||||
{
|
||||
KsbaCert cert = NULL;
|
||||
@ -461,10 +461,8 @@ gpgsm_decrypt (CTRL ctrl, int in_fd, FILE *out_fp)
|
||||
dfparm.lastblock,
|
||||
dfparm.blklen - npadding);
|
||||
if (rc)
|
||||
{
|
||||
rc = map_ksba_err (rc);
|
||||
goto leave;
|
||||
}
|
||||
|
||||
for (i=dfparm.blklen - npadding; i < dfparm.blklen; i++)
|
||||
{
|
||||
if (dfparm.lastblock[i] != npadding)
|
||||
|
40
sm/encrypt.c
40
sm/encrypt.c
@ -330,16 +330,14 @@ gpgsm_encrypt (CTRL ctrl, CERTLIST recplist, int data_fd, FILE *out_fp)
|
||||
goto leave;
|
||||
}
|
||||
|
||||
reader = ksba_reader_new ();
|
||||
if (!reader)
|
||||
rc = KSBA_Out_Of_Core;
|
||||
err = ksba_reader_new (&reader);
|
||||
if (err)
|
||||
rc = err;
|
||||
if (!rc)
|
||||
rc = ksba_reader_set_cb (reader, encrypt_cb, &encparm);
|
||||
if (rc)
|
||||
{
|
||||
rc = map_ksba_err (rc);
|
||||
goto leave;
|
||||
}
|
||||
|
||||
encparm.fp = data_fp;
|
||||
|
||||
ctrl->pem_name = "ENCRYPTED MESSAGE";
|
||||
@ -350,10 +348,10 @@ gpgsm_encrypt (CTRL ctrl, CERTLIST recplist, int data_fd, FILE *out_fp)
|
||||
goto leave;
|
||||
}
|
||||
|
||||
cms = ksba_cms_new ();
|
||||
if (!cms)
|
||||
err = ksba_cms_new (&cms);
|
||||
if (err)
|
||||
{
|
||||
rc = gpg_error (GPG_ERR_ENOMEM);
|
||||
rc = err;
|
||||
goto leave;
|
||||
}
|
||||
|
||||
@ -361,8 +359,8 @@ gpgsm_encrypt (CTRL ctrl, CERTLIST recplist, int data_fd, FILE *out_fp)
|
||||
if (err)
|
||||
{
|
||||
log_debug ("ksba_cms_set_reader_writer failed: %s\n",
|
||||
ksba_strerror (err));
|
||||
rc = map_ksba_err (err);
|
||||
gpg_strerror (err));
|
||||
rc = err;
|
||||
goto leave;
|
||||
}
|
||||
|
||||
@ -374,8 +372,8 @@ gpgsm_encrypt (CTRL ctrl, CERTLIST recplist, int data_fd, FILE *out_fp)
|
||||
if (err)
|
||||
{
|
||||
log_debug ("ksba_cms_set_content_type failed: %s\n",
|
||||
ksba_strerror (err));
|
||||
rc = map_ksba_err (err);
|
||||
gpg_strerror (err));
|
||||
rc = err;
|
||||
goto leave;
|
||||
}
|
||||
|
||||
@ -399,8 +397,8 @@ gpgsm_encrypt (CTRL ctrl, CERTLIST recplist, int data_fd, FILE *out_fp)
|
||||
if (err)
|
||||
{
|
||||
log_error ("ksba_cms_set_content_enc_algo failed: %s\n",
|
||||
ksba_strerror (err));
|
||||
rc = map_ksba_err (err);
|
||||
gpg_strerror (err));
|
||||
rc = err;
|
||||
goto leave;
|
||||
}
|
||||
|
||||
@ -432,8 +430,8 @@ gpgsm_encrypt (CTRL ctrl, CERTLIST recplist, int data_fd, FILE *out_fp)
|
||||
if (err)
|
||||
{
|
||||
log_error ("ksba_cms_add_recipient failed: %s\n",
|
||||
ksba_strerror (err));
|
||||
rc = map_ksba_err (err);
|
||||
gpg_strerror (err));
|
||||
rc = err;
|
||||
xfree (encval);
|
||||
goto leave;
|
||||
}
|
||||
@ -443,8 +441,8 @@ gpgsm_encrypt (CTRL ctrl, CERTLIST recplist, int data_fd, FILE *out_fp)
|
||||
if (err)
|
||||
{
|
||||
log_error ("ksba_cms_set_enc_val failed: %s\n",
|
||||
ksba_strerror (err));
|
||||
rc = map_ksba_err (err);
|
||||
gpg_strerror (err));
|
||||
rc = err;
|
||||
goto leave;
|
||||
}
|
||||
}
|
||||
@ -456,8 +454,8 @@ gpgsm_encrypt (CTRL ctrl, CERTLIST recplist, int data_fd, FILE *out_fp)
|
||||
err = ksba_cms_build (cms, &stopreason);
|
||||
if (err)
|
||||
{
|
||||
log_debug ("ksba_cms_build failed: %s\n", ksba_strerror (err));
|
||||
rc = map_ksba_err (err);
|
||||
log_debug ("ksba_cms_build failed: %s\n", gpg_strerror (err));
|
||||
rc = err;
|
||||
goto leave;
|
||||
}
|
||||
}
|
||||
|
@ -155,7 +155,7 @@ gpgsm_export (CTRL ctrl, STRLIST names, FILE *fp)
|
||||
rc = ksba_writer_write (writer, image, imagelen);
|
||||
if (rc)
|
||||
{
|
||||
log_error ("write error: %s\n", ksba_strerror (rc));
|
||||
log_error ("write error: %s\n", gpg_strerror (rc));
|
||||
goto leave;
|
||||
}
|
||||
|
||||
|
@ -70,7 +70,7 @@ gpgsm_get_fingerprint (KsbaCert cert, int algo, char *array, int *r_len)
|
||||
rc = ksba_cert_hash (cert, 0, HASH_FNC, md);
|
||||
if (rc)
|
||||
{
|
||||
log_error ("ksba_cert_hash failed: %s\n", ksba_strerror (rc));
|
||||
log_error ("ksba_cert_hash failed: %s\n", gpg_strerror (rc));
|
||||
gcry_md_close (md);
|
||||
memset (array, 0xff, len); /* better return an invalid fpr than NULL */
|
||||
return array;
|
||||
@ -204,7 +204,7 @@ gpgsm_get_keygrip_hexstring (KsbaCert cert)
|
||||
serial number for this. In most cases the serial number is not
|
||||
that large and the resulting string can be passed on an assuan
|
||||
command line. Everything is hexencoded with the serialnumber
|
||||
delimted from the has by a dot.
|
||||
delimited from the hash by a dot.
|
||||
|
||||
The caller must free the string.
|
||||
*/
|
||||
|
29
sm/import.c
29
sm/import.c
@ -221,19 +221,15 @@ import_one (CTRL ctrl, struct stats_s *stats, int in_fd)
|
||||
KsbaStopReason stopreason;
|
||||
int i;
|
||||
|
||||
cms = ksba_cms_new ();
|
||||
if (!cms)
|
||||
{
|
||||
rc = gpg_error (GPG_ERR_ENOMEM);
|
||||
goto leave;
|
||||
}
|
||||
rc = ksba_cms_new (&cms);
|
||||
if (rc)
|
||||
goto leave;
|
||||
|
||||
rc = ksba_cms_set_reader_writer (cms, reader, NULL);
|
||||
if (rc)
|
||||
{
|
||||
log_error ("ksba_cms_set_reader_writer failed: %s\n",
|
||||
ksba_strerror (rc));
|
||||
rc = map_ksba_err (rc);
|
||||
gpg_strerror (rc));
|
||||
goto leave;
|
||||
}
|
||||
|
||||
@ -243,8 +239,7 @@ import_one (CTRL ctrl, struct stats_s *stats, int in_fd)
|
||||
rc = ksba_cms_parse (cms, &stopreason);
|
||||
if (rc)
|
||||
{
|
||||
log_error ("ksba_cms_parse failed: %s\n", ksba_strerror (rc));
|
||||
rc = map_ksba_err (rc);
|
||||
log_error ("ksba_cms_parse failed: %s\n", gpg_strerror (rc));
|
||||
goto leave;
|
||||
}
|
||||
|
||||
@ -265,19 +260,13 @@ import_one (CTRL ctrl, struct stats_s *stats, int in_fd)
|
||||
else if (ct == KSBA_CT_NONE)
|
||||
{ /* Failed to identify this message - assume a certificate */
|
||||
|
||||
cert = ksba_cert_new ();
|
||||
if (!cert)
|
||||
{
|
||||
rc = gpg_error (GPG_ERR_ENOMEM);
|
||||
goto leave;
|
||||
}
|
||||
rc = ksba_cert_new (&cert);
|
||||
if (rc)
|
||||
goto leave;
|
||||
|
||||
rc = ksba_cert_read_der (cert, reader);
|
||||
if (rc)
|
||||
{
|
||||
rc = map_ksba_err (rc);
|
||||
goto leave;
|
||||
}
|
||||
goto leave;
|
||||
|
||||
check_and_store (ctrl, stats, cert, 0);
|
||||
}
|
||||
|
14
sm/keylist.c
14
sm/keylist.c
@ -68,7 +68,7 @@ print_capabilities (KsbaCert cert, FILE *fp)
|
||||
unsigned int use;
|
||||
|
||||
err = ksba_cert_get_key_usage (cert, &use);
|
||||
if (err == KSBA_No_Data)
|
||||
if (gpg_err_code (err) == GPG_ERR_NO_DATA)
|
||||
{
|
||||
putc ('e', fp);
|
||||
putc ('s', fp);
|
||||
@ -81,7 +81,7 @@ print_capabilities (KsbaCert cert, FILE *fp)
|
||||
if (err)
|
||||
{
|
||||
log_error (_("error getting key usage information: %s\n"),
|
||||
ksba_strerror (err));
|
||||
gpg_strerror (err));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -328,11 +328,11 @@ list_cert_std (KsbaCert cert, FILE *fp, int have_secret)
|
||||
putc ('\n', fp);
|
||||
|
||||
kerr = ksba_cert_get_key_usage (cert, &kusage);
|
||||
if (kerr != KSBA_No_Data)
|
||||
if (gpg_err_code (kerr) != GPG_ERR_NO_DATA)
|
||||
{
|
||||
fputs (" key usage:", fp);
|
||||
if (kerr)
|
||||
fprintf (fp, " [error: %s]", ksba_strerror (kerr));
|
||||
fprintf (fp, " [error: %s]", gpg_strerror (kerr));
|
||||
else
|
||||
{
|
||||
if ( (kusage & KSBA_KEYUSAGE_DIGITAL_SIGNATURE))
|
||||
@ -358,11 +358,11 @@ list_cert_std (KsbaCert cert, FILE *fp, int have_secret)
|
||||
}
|
||||
|
||||
kerr = ksba_cert_get_cert_policies (cert, &string);
|
||||
if (kerr != KSBA_No_Data)
|
||||
if (gpg_err_code (kerr) != GPG_ERR_NO_DATA)
|
||||
{
|
||||
fputs (" policies: ", fp);
|
||||
if (kerr)
|
||||
fprintf (fp, "[error: %s]", ksba_strerror (kerr));
|
||||
fprintf (fp, "[error: %s]", gpg_strerror (kerr));
|
||||
else
|
||||
{
|
||||
for (p=string; *p; p++)
|
||||
@ -381,7 +381,7 @@ list_cert_std (KsbaCert cert, FILE *fp, int have_secret)
|
||||
{
|
||||
fputs (" chain length: ", fp);
|
||||
if (kerr)
|
||||
fprintf (fp, "[error: %s]", ksba_strerror (kerr));
|
||||
fprintf (fp, "[error: %s]", gpg_strerror (kerr));
|
||||
else if (chainlen == -1)
|
||||
fputs ("unlimited", fp);
|
||||
else
|
||||
|
@ -26,7 +26,8 @@
|
||||
#include <ctype.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <ksba.h>
|
||||
|
||||
#include "gpgsm.h"
|
||||
|
||||
#include <ksba.h>
|
||||
|
||||
|
||||
|
56
sm/sign.c
56
sm/sign.c
@ -88,8 +88,8 @@ hash_and_copy_data (int fd, gcry_md_hd_t md, KsbaWriter writer)
|
||||
err = ksba_writer_write_octet_string (writer, buffer, nread, 0);
|
||||
if (err)
|
||||
{
|
||||
log_error ("write failed: %s\n", ksba_strerror (err));
|
||||
rc = map_ksba_err (err);
|
||||
log_error ("write failed: %s\n", gpg_strerror (err));
|
||||
rc = err;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -114,8 +114,8 @@ hash_and_copy_data (int fd, gcry_md_hd_t md, KsbaWriter writer)
|
||||
err = ksba_writer_write_octet_string (writer, NULL, 0, 1);
|
||||
if (err)
|
||||
{
|
||||
log_error ("write failed: %s\n", ksba_strerror (err));
|
||||
rc = map_ksba_err (err);
|
||||
log_error ("write failed: %s\n", gpg_strerror (err));
|
||||
rc = err;
|
||||
}
|
||||
}
|
||||
|
||||
@ -278,8 +278,8 @@ add_certificate_list (CTRL ctrl, KsbaCMS cms, KsbaCert cert)
|
||||
|
||||
ksba_failure:
|
||||
ksba_cert_release (cert);
|
||||
log_error ("ksba_cms_add_cert failed: %s\n", ksba_strerror (err));
|
||||
return map_ksba_err (err);
|
||||
log_error ("ksba_cms_add_cert failed: %s\n", gpg_strerror (err));
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
@ -326,10 +326,10 @@ gpgsm_sign (CTRL ctrl, CERTLIST signerlist,
|
||||
goto leave;
|
||||
}
|
||||
|
||||
cms = ksba_cms_new ();
|
||||
if (!cms)
|
||||
err = ksba_cms_new (&cms);
|
||||
if (err)
|
||||
{
|
||||
rc = gpg_error (GPG_ERR_ENOMEM);
|
||||
rc = err;
|
||||
goto leave;
|
||||
}
|
||||
|
||||
@ -337,8 +337,8 @@ gpgsm_sign (CTRL ctrl, CERTLIST signerlist,
|
||||
if (err)
|
||||
{
|
||||
log_debug ("ksba_cms_set_reader_writer failed: %s\n",
|
||||
ksba_strerror (err));
|
||||
rc = map_ksba_err (err);
|
||||
gpg_strerror (err));
|
||||
rc = err;
|
||||
goto leave;
|
||||
}
|
||||
|
||||
@ -349,8 +349,8 @@ gpgsm_sign (CTRL ctrl, CERTLIST signerlist,
|
||||
if (err)
|
||||
{
|
||||
log_debug ("ksba_cms_set_content_type failed: %s\n",
|
||||
ksba_strerror (err));
|
||||
rc = map_ksba_err (err);
|
||||
gpg_strerror (err));
|
||||
rc = err;
|
||||
goto leave;
|
||||
}
|
||||
|
||||
@ -386,8 +386,8 @@ gpgsm_sign (CTRL ctrl, CERTLIST signerlist,
|
||||
err = ksba_cms_add_signer (cms, cl->cert);
|
||||
if (err)
|
||||
{
|
||||
log_error ("ksba_cms_add_signer failed: %s\n", ksba_strerror (err));
|
||||
rc = map_ksba_err (err);
|
||||
log_error ("ksba_cms_add_signer failed: %s\n", gpg_strerror (err));
|
||||
rc = err;
|
||||
goto leave;
|
||||
}
|
||||
rc = add_certificate_list (ctrl, cms, cl->cert);
|
||||
@ -402,8 +402,8 @@ gpgsm_sign (CTRL ctrl, CERTLIST signerlist,
|
||||
if (err)
|
||||
{
|
||||
log_debug ("ksba_cms_add_digest_algo failed: %s\n",
|
||||
ksba_strerror (err));
|
||||
rc = map_ksba_err (err);
|
||||
gpg_strerror (err));
|
||||
rc = err;
|
||||
goto leave;
|
||||
}
|
||||
}
|
||||
@ -455,8 +455,8 @@ gpgsm_sign (CTRL ctrl, CERTLIST signerlist,
|
||||
if (err)
|
||||
{
|
||||
log_error ("ksba_cms_set_message_digest failed: %s\n",
|
||||
ksba_strerror (err));
|
||||
rc = map_ksba_err (err);
|
||||
gpg_strerror (err));
|
||||
rc = err;
|
||||
goto leave;
|
||||
}
|
||||
}
|
||||
@ -469,8 +469,8 @@ gpgsm_sign (CTRL ctrl, CERTLIST signerlist,
|
||||
if (err)
|
||||
{
|
||||
log_error ("ksba_cms_set_signing_time failed: %s\n",
|
||||
ksba_strerror (err));
|
||||
rc = map_ksba_err (err);
|
||||
gpg_strerror (err));
|
||||
rc = err;
|
||||
goto leave;
|
||||
}
|
||||
}
|
||||
@ -480,8 +480,8 @@ gpgsm_sign (CTRL ctrl, CERTLIST signerlist,
|
||||
err = ksba_cms_build (cms, &stopreason);
|
||||
if (err)
|
||||
{
|
||||
log_debug ("ksba_cms_build failed: %s\n", ksba_strerror (err));
|
||||
rc = map_ksba_err (err);
|
||||
log_debug ("ksba_cms_build failed: %s\n", gpg_strerror (err));
|
||||
rc = err;
|
||||
goto leave;
|
||||
}
|
||||
|
||||
@ -515,8 +515,8 @@ gpgsm_sign (CTRL ctrl, CERTLIST signerlist,
|
||||
if (err)
|
||||
{
|
||||
log_error ("ksba_cms_set_message_digest failed: %s\n",
|
||||
ksba_strerror (err));
|
||||
rc = map_ksba_err (err);
|
||||
gpg_strerror (err));
|
||||
rc = err;
|
||||
goto leave;
|
||||
}
|
||||
}
|
||||
@ -546,7 +546,7 @@ gpgsm_sign (CTRL ctrl, CERTLIST signerlist,
|
||||
if (rc)
|
||||
{
|
||||
log_debug ("hashing signed attrs failed: %s\n",
|
||||
ksba_strerror (rc));
|
||||
gpg_strerror (rc));
|
||||
gcry_md_close (md);
|
||||
goto leave;
|
||||
}
|
||||
@ -563,8 +563,8 @@ gpgsm_sign (CTRL ctrl, CERTLIST signerlist,
|
||||
if (err)
|
||||
{
|
||||
log_error ("failed to store the signature: %s\n",
|
||||
ksba_strerror (err));
|
||||
rc = map_ksba_err (err);
|
||||
gpg_strerror (err));
|
||||
rc = err;
|
||||
gcry_md_close (md);
|
||||
goto leave;
|
||||
}
|
||||
|
31
sm/verify.c
31
sm/verify.c
@ -135,8 +135,8 @@ gpgsm_verify (CTRL ctrl, int in_fd, int data_fd, FILE *out_fp)
|
||||
}
|
||||
}
|
||||
|
||||
cms = ksba_cms_new ();
|
||||
if (!cms)
|
||||
err = ksba_cms_new (&cms);
|
||||
if (err)
|
||||
{
|
||||
rc = gpg_error (GPG_ERR_ENOMEM);
|
||||
goto leave;
|
||||
@ -146,8 +146,8 @@ gpgsm_verify (CTRL ctrl, int in_fd, int data_fd, FILE *out_fp)
|
||||
if (err)
|
||||
{
|
||||
log_error ("ksba_cms_set_reader_writer failed: %s\n",
|
||||
ksba_strerror (err));
|
||||
rc = map_ksba_err (err);
|
||||
gpg_strerror (err));
|
||||
rc = err;
|
||||
goto leave;
|
||||
}
|
||||
|
||||
@ -166,8 +166,8 @@ gpgsm_verify (CTRL ctrl, int in_fd, int data_fd, FILE *out_fp)
|
||||
err = ksba_cms_parse (cms, &stopreason);
|
||||
if (err)
|
||||
{
|
||||
log_error ("ksba_cms_parse failed: %s\n", ksba_strerror (err));
|
||||
rc = map_ksba_err (err);
|
||||
log_error ("ksba_cms_parse failed: %s\n", gpg_strerror (err));
|
||||
rc = err;
|
||||
goto leave;
|
||||
}
|
||||
|
||||
@ -250,7 +250,8 @@ gpgsm_verify (CTRL ctrl, int in_fd, int data_fd, FILE *out_fp)
|
||||
char *ctattr;
|
||||
|
||||
err = ksba_cms_get_issuer_serial (cms, signer, &issuer, &serial);
|
||||
if (!signer && err == KSBA_No_Data && data_fd == -1 && is_detached)
|
||||
if (!signer && gpg_err_code (err) == GPG_ERR_NO_DATA
|
||||
&& data_fd == -1 && is_detached)
|
||||
{
|
||||
log_info ("certs-only message accepted\n");
|
||||
err = 0;
|
||||
@ -272,11 +273,11 @@ gpgsm_verify (CTRL ctrl, int in_fd, int data_fd, FILE *out_fp)
|
||||
}
|
||||
|
||||
err = ksba_cms_get_signing_time (cms, signer, sigtime);
|
||||
if (err == KSBA_No_Data)
|
||||
if (gpg_err_code (err) == GPG_ERR_NO_DATA)
|
||||
*sigtime = 0;
|
||||
else if (err)
|
||||
{
|
||||
log_error ("error getting signing time: %s\n", ksba_strerror (err));
|
||||
log_error ("error getting signing time: %s\n", gpg_strerror (err));
|
||||
*sigtime = 0; /* FIXME: we can't encode an error in the time
|
||||
string. */
|
||||
}
|
||||
@ -295,7 +296,7 @@ gpgsm_verify (CTRL ctrl, int in_fd, int data_fd, FILE *out_fp)
|
||||
goto next_signer;
|
||||
}
|
||||
}
|
||||
else if (err == KSBA_No_Data)
|
||||
else if (gpg_err_code (err) == GPG_ERR_NO_DATA)
|
||||
{
|
||||
assert (!msgdigest);
|
||||
err = 0;
|
||||
@ -328,7 +329,7 @@ gpgsm_verify (CTRL ctrl, int in_fd, int data_fd, FILE *out_fp)
|
||||
else if (err != -1)
|
||||
{
|
||||
log_error ("error getting content-type attribute: %s\n",
|
||||
ksba_strerror (err));
|
||||
gpg_strerror (err));
|
||||
goto next_signer;
|
||||
}
|
||||
err = 0;
|
||||
@ -420,7 +421,7 @@ gpgsm_verify (CTRL ctrl, int in_fd, int data_fd, FILE *out_fp)
|
||||
if (rc)
|
||||
{
|
||||
log_error ("hashing signed attrs failed: %s\n",
|
||||
ksba_strerror (rc));
|
||||
gpg_strerror (rc));
|
||||
gcry_md_close (md);
|
||||
goto next_signer;
|
||||
}
|
||||
@ -514,9 +515,9 @@ gpgsm_verify (CTRL ctrl, int in_fd, int data_fd, FILE *out_fp)
|
||||
}
|
||||
rc = 0;
|
||||
if (err)
|
||||
{
|
||||
log_error ("ksba error: %s\n", ksba_strerror (err));
|
||||
rc = map_ksba_err (rc);
|
||||
{ /* FIXME: still needed? */
|
||||
log_error ("ksba error: %s\n", gpg_strerror (err));
|
||||
rc = err;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user