mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-08 12:44:23 +01:00
Replaced deprecated type names.
* certdump.c (gpgsm_print_serial): Cleaned up cast use in strtoul. (gpgsm_dump_serial): Ditto. * decrypt.c (gpgsm_decrypt): Replaced ERR by RC.
This commit is contained in:
parent
c4182e3e24
commit
cbd57643a7
@ -1,3 +1,10 @@
|
|||||||
|
2003-12-17 Werner Koch <wk@gnupg.org>
|
||||||
|
|
||||||
|
* certdump.c (gpgsm_print_serial): Cleaned up cast use in strtoul.
|
||||||
|
(gpgsm_dump_serial): Ditto.
|
||||||
|
|
||||||
|
* decrypt.c (gpgsm_decrypt): Replaced ERR by RC.
|
||||||
|
|
||||||
2003-12-16 Werner Koch <wk@gnupg.org>
|
2003-12-16 Werner Koch <wk@gnupg.org>
|
||||||
|
|
||||||
* gpgsm.c (main): Set the prefixes for assuan logging.
|
* gpgsm.c (main): Set the prefixes for assuan logging.
|
||||||
|
@ -497,10 +497,10 @@ base64_finish_write (struct writer_cb_parm_s *parm)
|
|||||||
ksba_reader_release function on. */
|
ksba_reader_release function on. */
|
||||||
int
|
int
|
||||||
gpgsm_create_reader (Base64Context *ctx,
|
gpgsm_create_reader (Base64Context *ctx,
|
||||||
CTRL ctrl, FILE *fp, KsbaReader *r_reader)
|
CTRL ctrl, FILE *fp, ksba_reader_t *r_reader)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
KsbaReader r;
|
ksba_reader_t r;
|
||||||
|
|
||||||
*r_reader = NULL;
|
*r_reader = NULL;
|
||||||
*ctx = xtrycalloc (1, sizeof **ctx);
|
*ctx = xtrycalloc (1, sizeof **ctx);
|
||||||
@ -562,10 +562,10 @@ gpgsm_destroy_reader (Base64Context ctx)
|
|||||||
function on. */
|
function on. */
|
||||||
int
|
int
|
||||||
gpgsm_create_writer (Base64Context *ctx,
|
gpgsm_create_writer (Base64Context *ctx,
|
||||||
CTRL ctrl, FILE *fp, KsbaWriter *r_writer)
|
CTRL ctrl, FILE *fp, ksba_writer_t *r_writer)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
KsbaWriter w;
|
ksba_writer_t w;
|
||||||
|
|
||||||
*r_writer = NULL;
|
*r_writer = NULL;
|
||||||
*ctx = xtrycalloc (1, sizeof **ctx);
|
*ctx = xtrycalloc (1, sizeof **ctx);
|
||||||
|
@ -377,7 +377,7 @@ inq_ciphertext_cb (void *opaque, const char *keyword)
|
|||||||
the hex string KEYGRIP. */
|
the hex string KEYGRIP. */
|
||||||
int
|
int
|
||||||
gpgsm_agent_pkdecrypt (const char *keygrip,
|
gpgsm_agent_pkdecrypt (const char *keygrip,
|
||||||
KsbaConstSexp ciphertext,
|
ksba_const_sexp_t ciphertext,
|
||||||
char **r_buf, size_t *r_buflen )
|
char **r_buf, size_t *r_buflen )
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
@ -464,7 +464,7 @@ inq_genkey_parms (void *opaque, const char *keyword)
|
|||||||
|
|
||||||
/* Call the agent to generate a newkey */
|
/* Call the agent to generate a newkey */
|
||||||
int
|
int
|
||||||
gpgsm_agent_genkey (KsbaConstSexp keyparms, KsbaSexp *r_pubkey)
|
gpgsm_agent_genkey (ksba_const_sexp_t keyparms, ksba_sexp_t *r_pubkey)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
struct genkey_parm_s gk_parm;
|
struct genkey_parm_s gk_parm;
|
||||||
@ -511,7 +511,7 @@ gpgsm_agent_genkey (KsbaConstSexp keyparms, KsbaSexp *r_pubkey)
|
|||||||
/* Ask the agent whether the certificate is in the list of trusted
|
/* Ask the agent whether the certificate is in the list of trusted
|
||||||
keys */
|
keys */
|
||||||
int
|
int
|
||||||
gpgsm_agent_istrusted (KsbaCert cert)
|
gpgsm_agent_istrusted (ksba_cert_t cert)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
char *fpr;
|
char *fpr;
|
||||||
@ -538,7 +538,7 @@ gpgsm_agent_istrusted (KsbaCert cert)
|
|||||||
|
|
||||||
/* Ask the agent to mark CERT as a trusted Root-CA one */
|
/* Ask the agent to mark CERT as a trusted Root-CA one */
|
||||||
int
|
int
|
||||||
gpgsm_agent_marktrusted (KsbaCert cert)
|
gpgsm_agent_marktrusted (ksba_cert_t cert)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
char *fpr, *dn;
|
char *fpr, *dn;
|
||||||
@ -601,7 +601,7 @@ learn_cb (void *opaque, const void *buffer, size_t length)
|
|||||||
struct learn_parm_s *parm = opaque;
|
struct learn_parm_s *parm = opaque;
|
||||||
size_t len;
|
size_t len;
|
||||||
char *buf;
|
char *buf;
|
||||||
KsbaCert cert;
|
ksba_cert_t cert;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
if (parm->error)
|
if (parm->error)
|
||||||
|
@ -48,13 +48,13 @@ static int force_pipe_server = 0;
|
|||||||
|
|
||||||
struct inq_certificate_parm_s {
|
struct inq_certificate_parm_s {
|
||||||
ASSUAN_CONTEXT ctx;
|
ASSUAN_CONTEXT ctx;
|
||||||
KsbaCert cert;
|
ksba_cert_t cert;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct lookup_parm_s {
|
struct lookup_parm_s {
|
||||||
CTRL ctrl;
|
CTRL ctrl;
|
||||||
ASSUAN_CONTEXT ctx;
|
ASSUAN_CONTEXT ctx;
|
||||||
void (*cb)(void *, KsbaCert);
|
void (*cb)(void *, ksba_cert_t);
|
||||||
void *cb_value;
|
void *cb_value;
|
||||||
struct membuf data;
|
struct membuf data;
|
||||||
int error;
|
int error;
|
||||||
@ -258,7 +258,7 @@ inq_certificate (void *opaque, const char *line)
|
|||||||
else
|
else
|
||||||
{ /* send the given certificate */
|
{ /* send the given certificate */
|
||||||
int err;
|
int err;
|
||||||
KsbaCert cert;
|
ksba_cert_t cert;
|
||||||
|
|
||||||
err = gpgsm_find_cert (line, &cert);
|
err = gpgsm_find_cert (line, &cert);
|
||||||
if (err)
|
if (err)
|
||||||
@ -353,7 +353,7 @@ lookup_cb (void *opaque, const void *buffer, size_t length)
|
|||||||
struct lookup_parm_s *parm = opaque;
|
struct lookup_parm_s *parm = opaque;
|
||||||
size_t len;
|
size_t len;
|
||||||
char *buf;
|
char *buf;
|
||||||
KsbaCert cert;
|
ksba_cert_t cert;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
if (parm->error)
|
if (parm->error)
|
||||||
@ -477,7 +477,7 @@ lookup_status_cb (void *opaque, const char *line)
|
|||||||
is optional. */
|
is optional. */
|
||||||
int
|
int
|
||||||
gpgsm_dirmngr_lookup (CTRL ctrl, STRLIST names,
|
gpgsm_dirmngr_lookup (CTRL ctrl, STRLIST names,
|
||||||
void (*cb)(void*, KsbaCert), void *cb_value)
|
void (*cb)(void*, ksba_cert_t), void *cb_value)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
char *pattern;
|
char *pattern;
|
||||||
@ -537,7 +537,7 @@ run_command_inq_cb (void *opaque, const char *line)
|
|||||||
if ( !strncmp (line, "SENDCERT", 8) && (line[8] == ' ' || !line[8]) )
|
if ( !strncmp (line, "SENDCERT", 8) && (line[8] == ' ' || !line[8]) )
|
||||||
{ /* send the given certificate */
|
{ /* send the given certificate */
|
||||||
int err;
|
int err;
|
||||||
KsbaCert cert;
|
ksba_cert_t cert;
|
||||||
const unsigned char *der;
|
const unsigned char *der;
|
||||||
size_t derlen;
|
size_t derlen;
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
#include "i18n.h"
|
#include "i18n.h"
|
||||||
|
|
||||||
static int
|
static int
|
||||||
unknown_criticals (KsbaCert cert)
|
unknown_criticals (ksba_cert_t cert)
|
||||||
{
|
{
|
||||||
static const char *known[] = {
|
static const char *known[] = {
|
||||||
"2.5.29.15", /* keyUsage */
|
"2.5.29.15", /* keyUsage */
|
||||||
@ -45,7 +45,7 @@ unknown_criticals (KsbaCert cert)
|
|||||||
};
|
};
|
||||||
int rc = 0, i, idx, crit;
|
int rc = 0, i, idx, crit;
|
||||||
const char *oid;
|
const char *oid;
|
||||||
KsbaError err;
|
gpg_error_t err;
|
||||||
|
|
||||||
for (idx=0; !(err=ksba_cert_get_extension (cert, idx,
|
for (idx=0; !(err=ksba_cert_get_extension (cert, idx,
|
||||||
&oid, &crit, NULL, NULL));idx++)
|
&oid, &crit, NULL, NULL));idx++)
|
||||||
@ -68,9 +68,9 @@ unknown_criticals (KsbaCert cert)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
allowed_ca (KsbaCert cert, int *chainlen)
|
allowed_ca (ksba_cert_t cert, int *chainlen)
|
||||||
{
|
{
|
||||||
KsbaError err;
|
gpg_error_t err;
|
||||||
int flag;
|
int flag;
|
||||||
|
|
||||||
err = ksba_cert_is_ca (cert, &flag, chainlen);
|
err = ksba_cert_is_ca (cert, &flag, chainlen);
|
||||||
@ -86,9 +86,9 @@ allowed_ca (KsbaCert cert, int *chainlen)
|
|||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
check_cert_policy (KsbaCert cert)
|
check_cert_policy (ksba_cert_t cert)
|
||||||
{
|
{
|
||||||
KsbaError err;
|
gpg_error_t err;
|
||||||
char *policies;
|
char *policies;
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
int any_critical;
|
int any_critical;
|
||||||
@ -206,7 +206,7 @@ check_cert_policy (KsbaCert cert)
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
find_up_store_certs_cb (void *cb_value, KsbaCert cert)
|
find_up_store_certs_cb (void *cb_value, ksba_cert_t cert)
|
||||||
{
|
{
|
||||||
if (keydb_store_cert (cert, 1, NULL))
|
if (keydb_store_cert (cert, 1, NULL))
|
||||||
log_error ("error storing issuer certificate as ephemeral\n");
|
log_error ("error storing issuer certificate as ephemeral\n");
|
||||||
@ -215,10 +215,10 @@ find_up_store_certs_cb (void *cb_value, KsbaCert cert)
|
|||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
find_up (KEYDB_HANDLE kh, KsbaCert cert, const char *issuer)
|
find_up (KEYDB_HANDLE kh, ksba_cert_t cert, const char *issuer)
|
||||||
{
|
{
|
||||||
KsbaName authid;
|
ksba_name_t authid;
|
||||||
KsbaSexp authidno;
|
ksba_sexp_t authidno;
|
||||||
int rc = -1;
|
int rc = -1;
|
||||||
|
|
||||||
if (!ksba_cert_get_auth_key_id (cert, NULL, &authid, &authidno))
|
if (!ksba_cert_get_auth_key_id (cert, NULL, &authid, &authidno))
|
||||||
@ -325,7 +325,7 @@ find_up (KEYDB_HANDLE kh, KsbaCert cert, const char *issuer)
|
|||||||
/* Return the next certificate up in the chain starting at START.
|
/* Return the next certificate up in the chain starting at START.
|
||||||
Returns -1 when there are no more certificates. */
|
Returns -1 when there are no more certificates. */
|
||||||
int
|
int
|
||||||
gpgsm_walk_cert_chain (KsbaCert start, KsbaCert *r_next)
|
gpgsm_walk_cert_chain (ksba_cert_t start, ksba_cert_t *r_next)
|
||||||
{
|
{
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
char *issuer = NULL;
|
char *issuer = NULL;
|
||||||
@ -390,7 +390,7 @@ gpgsm_walk_cert_chain (KsbaCert start, KsbaCert *r_next)
|
|||||||
/* Check whether the CERT is a root certificate. Returns True if this
|
/* Check whether the CERT is a root certificate. Returns True if this
|
||||||
is the case. */
|
is the case. */
|
||||||
int
|
int
|
||||||
gpgsm_is_root_cert (KsbaCert cert)
|
gpgsm_is_root_cert (ksba_cert_t cert)
|
||||||
{
|
{
|
||||||
char *issuer;
|
char *issuer;
|
||||||
char *subject;
|
char *subject;
|
||||||
@ -408,13 +408,13 @@ gpgsm_is_root_cert (KsbaCert cert)
|
|||||||
/* Validate a chain and optionally return the nearest expiration time
|
/* Validate a chain and optionally return the nearest expiration time
|
||||||
in R_EXPTIME */
|
in R_EXPTIME */
|
||||||
int
|
int
|
||||||
gpgsm_validate_chain (CTRL ctrl, KsbaCert cert, ksba_isotime_t r_exptime)
|
gpgsm_validate_chain (CTRL ctrl, ksba_cert_t cert, ksba_isotime_t r_exptime)
|
||||||
{
|
{
|
||||||
int rc = 0, depth = 0, maxdepth;
|
int rc = 0, depth = 0, maxdepth;
|
||||||
char *issuer = NULL;
|
char *issuer = NULL;
|
||||||
char *subject = NULL;
|
char *subject = NULL;
|
||||||
KEYDB_HANDLE kh = keydb_new (0);
|
KEYDB_HANDLE kh = keydb_new (0);
|
||||||
KsbaCert subject_cert = NULL, issuer_cert = NULL;
|
ksba_cert_t subject_cert = NULL, issuer_cert = NULL;
|
||||||
ksba_isotime_t current_time;
|
ksba_isotime_t current_time;
|
||||||
ksba_isotime_t exptime;
|
ksba_isotime_t exptime;
|
||||||
int any_expired = 0;
|
int any_expired = 0;
|
||||||
@ -714,13 +714,13 @@ gpgsm_validate_chain (CTRL ctrl, KsbaCert cert, ksba_isotime_t r_exptime)
|
|||||||
the DB and that this one is valid; which it should be because it
|
the DB and that this one is valid; which it should be because it
|
||||||
has been checked using this function. */
|
has been checked using this function. */
|
||||||
int
|
int
|
||||||
gpgsm_basic_cert_check (KsbaCert cert)
|
gpgsm_basic_cert_check (ksba_cert_t cert)
|
||||||
{
|
{
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
char *issuer = NULL;
|
char *issuer = NULL;
|
||||||
char *subject = NULL;
|
char *subject = NULL;
|
||||||
KEYDB_HANDLE kh = keydb_new (0);
|
KEYDB_HANDLE kh = keydb_new (0);
|
||||||
KsbaCert issuer_cert = NULL;
|
ksba_cert_t issuer_cert = NULL;
|
||||||
|
|
||||||
if (opt.no_chain_validation)
|
if (opt.no_chain_validation)
|
||||||
{
|
{
|
||||||
|
@ -101,13 +101,13 @@ do_encode_md (gcry_md_hd_t md, int algo, unsigned int nbits,
|
|||||||
does only test the cryptographic signature and nothing else. It is
|
does only test the cryptographic signature and nothing else. It is
|
||||||
assumed that the ISSUER_CERT is valid. */
|
assumed that the ISSUER_CERT is valid. */
|
||||||
int
|
int
|
||||||
gpgsm_check_cert_sig (KsbaCert issuer_cert, KsbaCert cert)
|
gpgsm_check_cert_sig (ksba_cert_t issuer_cert, ksba_cert_t cert)
|
||||||
{
|
{
|
||||||
const char *algoid;
|
const char *algoid;
|
||||||
gcry_md_hd_t md;
|
gcry_md_hd_t md;
|
||||||
int rc, algo;
|
int rc, algo;
|
||||||
gcry_mpi_t frame;
|
gcry_mpi_t frame;
|
||||||
KsbaSexp p;
|
ksba_sexp_t p;
|
||||||
size_t n;
|
size_t n;
|
||||||
gcry_sexp_t s_sig, s_hash, s_pkey;
|
gcry_sexp_t s_sig, s_hash, s_pkey;
|
||||||
|
|
||||||
@ -210,11 +210,11 @@ gpgsm_check_cert_sig (KsbaCert issuer_cert, KsbaCert cert)
|
|||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
gpgsm_check_cms_signature (KsbaCert cert, KsbaConstSexp sigval,
|
gpgsm_check_cms_signature (ksba_cert_t cert, ksba_const_sexp_t sigval,
|
||||||
gcry_md_hd_t md, int algo)
|
gcry_md_hd_t md, int algo)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
KsbaSexp p;
|
ksba_sexp_t p;
|
||||||
gcry_mpi_t frame;
|
gcry_mpi_t frame;
|
||||||
gcry_sexp_t s_sig, s_hash, s_pkey;
|
gcry_sexp_t s_sig, s_hash, s_pkey;
|
||||||
size_t n;
|
size_t n;
|
||||||
@ -278,7 +278,7 @@ gpgsm_check_cms_signature (KsbaCert cert, KsbaConstSexp sigval,
|
|||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
gpgsm_create_cms_signature (KsbaCert cert, gcry_md_hd_t md, int mdalgo,
|
gpgsm_create_cms_signature (ksba_cert_t cert, gcry_md_hd_t md, int mdalgo,
|
||||||
char **r_sigval)
|
char **r_sigval)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
|
@ -42,10 +42,10 @@ struct dn_array_s {
|
|||||||
|
|
||||||
/* print the first element of an S-Expression */
|
/* print the first element of an S-Expression */
|
||||||
void
|
void
|
||||||
gpgsm_print_serial (FILE *fp, KsbaConstSexp p)
|
gpgsm_print_serial (FILE *fp, ksba_const_sexp_t p)
|
||||||
{
|
{
|
||||||
unsigned long n;
|
unsigned long n;
|
||||||
KsbaConstSexp endp;
|
char *endp;
|
||||||
|
|
||||||
if (!p)
|
if (!p)
|
||||||
fputs (_("none"), fp);
|
fputs (_("none"), fp);
|
||||||
@ -54,7 +54,7 @@ gpgsm_print_serial (FILE *fp, KsbaConstSexp p)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
p++;
|
p++;
|
||||||
n = strtoul (p, (char**)&endp, 10);
|
n = strtoul (p, &endp, 10);
|
||||||
p = endp;
|
p = endp;
|
||||||
if (*p!=':')
|
if (*p!=':')
|
||||||
fputs ("[Internal Error - invalid S-expression]", fp);
|
fputs ("[Internal Error - invalid S-expression]", fp);
|
||||||
@ -68,10 +68,10 @@ gpgsm_print_serial (FILE *fp, KsbaConstSexp p)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
gpgsm_dump_serial (KsbaConstSexp p)
|
gpgsm_dump_serial (ksba_const_sexp_t p)
|
||||||
{
|
{
|
||||||
unsigned long n;
|
unsigned long n;
|
||||||
KsbaConstSexp endp;
|
char *endp;
|
||||||
|
|
||||||
if (!p)
|
if (!p)
|
||||||
log_printf ("none");
|
log_printf ("none");
|
||||||
@ -80,7 +80,7 @@ gpgsm_dump_serial (KsbaConstSexp p)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
p++;
|
p++;
|
||||||
n = strtoul (p, (char**)&endp, 10);
|
n = strtoul (p, &endp, 10);
|
||||||
p = endp;
|
p = endp;
|
||||||
if (*p!=':')
|
if (*p!=':')
|
||||||
log_printf ("ERROR - invalid S-expression");
|
log_printf ("ERROR - invalid S-expression");
|
||||||
@ -142,9 +142,9 @@ gpgsm_dump_string (const char *string)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
gpgsm_dump_cert (const char *text, KsbaCert cert)
|
gpgsm_dump_cert (const char *text, ksba_cert_t cert)
|
||||||
{
|
{
|
||||||
KsbaSexp sexp;
|
ksba_sexp_t sexp;
|
||||||
unsigned char *p;
|
unsigned char *p;
|
||||||
char *dn;
|
char *dn;
|
||||||
ksba_isotime_t t;
|
ksba_isotime_t t;
|
||||||
|
@ -39,9 +39,9 @@
|
|||||||
for verification and a MODE of 3 for decryption (just for
|
for verification and a MODE of 3 for decryption (just for
|
||||||
debugging) */
|
debugging) */
|
||||||
static int
|
static int
|
||||||
cert_usage_p (KsbaCert cert, int mode)
|
cert_usage_p (ksba_cert_t cert, int mode)
|
||||||
{
|
{
|
||||||
KsbaError err;
|
gpg_error_t err;
|
||||||
unsigned int use;
|
unsigned int use;
|
||||||
|
|
||||||
err = ksba_cert_get_key_usage (cert, &use);
|
err = ksba_cert_get_key_usage (cert, &use);
|
||||||
@ -83,7 +83,7 @@ cert_usage_p (KsbaCert cert, int mode)
|
|||||||
|
|
||||||
/* Return 0 if the cert is usable for signing */
|
/* Return 0 if the cert is usable for signing */
|
||||||
int
|
int
|
||||||
gpgsm_cert_use_sign_p (KsbaCert cert)
|
gpgsm_cert_use_sign_p (ksba_cert_t cert)
|
||||||
{
|
{
|
||||||
return cert_usage_p (cert, 0);
|
return cert_usage_p (cert, 0);
|
||||||
}
|
}
|
||||||
@ -91,32 +91,32 @@ gpgsm_cert_use_sign_p (KsbaCert cert)
|
|||||||
|
|
||||||
/* Return 0 if the cert is usable for encryption */
|
/* Return 0 if the cert is usable for encryption */
|
||||||
int
|
int
|
||||||
gpgsm_cert_use_encrypt_p (KsbaCert cert)
|
gpgsm_cert_use_encrypt_p (ksba_cert_t cert)
|
||||||
{
|
{
|
||||||
return cert_usage_p (cert, 1);
|
return cert_usage_p (cert, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
gpgsm_cert_use_verify_p (KsbaCert cert)
|
gpgsm_cert_use_verify_p (ksba_cert_t cert)
|
||||||
{
|
{
|
||||||
return cert_usage_p (cert, 2);
|
return cert_usage_p (cert, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
gpgsm_cert_use_decrypt_p (KsbaCert cert)
|
gpgsm_cert_use_decrypt_p (ksba_cert_t cert)
|
||||||
{
|
{
|
||||||
return cert_usage_p (cert, 3);
|
return cert_usage_p (cert, 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
gpgsm_cert_use_cert_p (KsbaCert cert)
|
gpgsm_cert_use_cert_p (ksba_cert_t cert)
|
||||||
{
|
{
|
||||||
return cert_usage_p (cert, 4);
|
return cert_usage_p (cert, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
same_subject_issuer (const char *subject, const char *issuer, KsbaCert cert)
|
same_subject_issuer (const char *subject, const char *issuer, ksba_cert_t cert)
|
||||||
{
|
{
|
||||||
char *subject2 = ksba_cert_get_subject (cert, 0);
|
char *subject2 = ksba_cert_get_subject (cert, 0);
|
||||||
char *issuer2 = ksba_cert_get_subject (cert, 0);
|
char *issuer2 = ksba_cert_get_subject (cert, 0);
|
||||||
@ -143,7 +143,7 @@ gpgsm_add_to_certlist (CTRL ctrl, const char *name, int secret,
|
|||||||
int rc;
|
int rc;
|
||||||
KEYDB_SEARCH_DESC desc;
|
KEYDB_SEARCH_DESC desc;
|
||||||
KEYDB_HANDLE kh = NULL;
|
KEYDB_HANDLE kh = NULL;
|
||||||
KsbaCert cert = NULL;
|
ksba_cert_t cert = NULL;
|
||||||
|
|
||||||
rc = keydb_classify_name (name, &desc);
|
rc = keydb_classify_name (name, &desc);
|
||||||
if (!rc)
|
if (!rc)
|
||||||
@ -202,7 +202,7 @@ gpgsm_add_to_certlist (CTRL ctrl, const char *name, int secret,
|
|||||||
rc = 0;
|
rc = 0;
|
||||||
else if (!rc)
|
else if (!rc)
|
||||||
{
|
{
|
||||||
KsbaCert cert2 = NULL;
|
ksba_cert_t cert2 = NULL;
|
||||||
|
|
||||||
/* We have to ignore ambigious names as long as
|
/* We have to ignore ambigious names as long as
|
||||||
there only fault is a bad key usage */
|
there only fault is a bad key usage */
|
||||||
@ -275,7 +275,7 @@ gpgsm_release_certlist (CERTLIST list)
|
|||||||
/* Like gpgsm_add_to_certlist, but look only for one certificate. No
|
/* Like gpgsm_add_to_certlist, but look only for one certificate. No
|
||||||
chain validation is done */
|
chain validation is done */
|
||||||
int
|
int
|
||||||
gpgsm_find_cert (const char *name, KsbaCert *r_cert)
|
gpgsm_find_cert (const char *name, ksba_cert_t *r_cert)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
KEYDB_SEARCH_DESC desc;
|
KEYDB_SEARCH_DESC desc;
|
||||||
|
@ -125,14 +125,14 @@ struct para_data_s {
|
|||||||
struct reqgen_ctrl_s {
|
struct reqgen_ctrl_s {
|
||||||
int lnr;
|
int lnr;
|
||||||
int dryrun;
|
int dryrun;
|
||||||
KsbaWriter writer;
|
ksba_writer_t writer;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static int proc_parameters (struct para_data_s *para,
|
static int proc_parameters (struct para_data_s *para,
|
||||||
struct reqgen_ctrl_s *outctrl);
|
struct reqgen_ctrl_s *outctrl);
|
||||||
static int create_request (struct para_data_s *para,
|
static int create_request (struct para_data_s *para,
|
||||||
KsbaConstSexp public,
|
ksba_const_sexp_t public,
|
||||||
struct reqgen_ctrl_s *outctrl);
|
struct reqgen_ctrl_s *outctrl);
|
||||||
|
|
||||||
|
|
||||||
@ -228,7 +228,7 @@ get_parameter_uint (struct para_data_s *para, enum para_name key)
|
|||||||
/* Read the certificate generation parameters from FP and generate
|
/* Read the certificate generation parameters from FP and generate
|
||||||
(all) certificate requests. */
|
(all) certificate requests. */
|
||||||
static int
|
static int
|
||||||
read_parameters (FILE *fp, KsbaWriter writer)
|
read_parameters (FILE *fp, ksba_writer_t writer)
|
||||||
{
|
{
|
||||||
static struct {
|
static struct {
|
||||||
const char *name;
|
const char *name;
|
||||||
@ -423,7 +423,7 @@ proc_parameters (struct para_data_s *para, struct reqgen_ctrl_s *outctrl)
|
|||||||
char numbuf[20];
|
char numbuf[20];
|
||||||
unsigned char keyparms[100];
|
unsigned char keyparms[100];
|
||||||
int rc;
|
int rc;
|
||||||
KsbaSexp public;
|
ksba_sexp_t public;
|
||||||
|
|
||||||
/* check that we have all required parameters */
|
/* check that we have all required parameters */
|
||||||
assert (get_parameter (para, pKEYTYPE));
|
assert (get_parameter (para, pKEYTYPE));
|
||||||
@ -503,13 +503,13 @@ proc_parameters (struct para_data_s *para, struct reqgen_ctrl_s *outctrl)
|
|||||||
/* Parameters are checked, the key pair has been created. Now
|
/* Parameters are checked, the key pair has been created. Now
|
||||||
generate the request and write it out */
|
generate the request and write it out */
|
||||||
static int
|
static int
|
||||||
create_request (struct para_data_s *para, KsbaConstSexp public,
|
create_request (struct para_data_s *para, ksba_const_sexp_t public,
|
||||||
struct reqgen_ctrl_s *outctrl)
|
struct reqgen_ctrl_s *outctrl)
|
||||||
{
|
{
|
||||||
KsbaCertreq cr;
|
ksba_certreq_t cr;
|
||||||
KsbaError err;
|
gpg_error_t err;
|
||||||
gcry_md_hd_t md;
|
gcry_md_hd_t md;
|
||||||
KsbaStopReason stopreason;
|
ksba_stop_reason_t stopreason;
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
const char *s;
|
const char *s;
|
||||||
|
|
||||||
@ -655,7 +655,7 @@ gpgsm_genkey (CTRL ctrl, int in_fd, FILE *out_fp)
|
|||||||
int rc;
|
int rc;
|
||||||
FILE *in_fp;
|
FILE *in_fp;
|
||||||
Base64Context b64writer = NULL;
|
Base64Context b64writer = NULL;
|
||||||
KsbaWriter writer;
|
ksba_writer_t writer;
|
||||||
|
|
||||||
in_fp = fdopen (dup (in_fd), "rb");
|
in_fp = fdopen (dup (in_fd), "rb");
|
||||||
if (!in_fp)
|
if (!in_fp)
|
||||||
|
51
sm/decrypt.c
51
sm/decrypt.c
@ -54,7 +54,7 @@ struct decrypt_filter_parm_s {
|
|||||||
/* Decrypt the session key and fill in the parm structure. The
|
/* Decrypt the session key and fill in the parm structure. The
|
||||||
algo and the IV is expected to be already in PARM. */
|
algo and the IV is expected to be already in PARM. */
|
||||||
static int
|
static int
|
||||||
prepare_decryption (const char *hexkeygrip, KsbaConstSexp enc_val,
|
prepare_decryption (const char *hexkeygrip, ksba_const_sexp_t enc_val,
|
||||||
struct decrypt_filter_parm_s *parm)
|
struct decrypt_filter_parm_s *parm)
|
||||||
{
|
{
|
||||||
char *seskey = NULL;
|
char *seskey = NULL;
|
||||||
@ -148,7 +148,7 @@ prepare_decryption (const char *hexkeygrip, KsbaConstSexp enc_val,
|
|||||||
Due to different buffer sizes or different length of input and
|
Due to different buffer sizes or different length of input and
|
||||||
output, it may happen that fewer bytes are process or fewer bytes
|
output, it may happen that fewer bytes are process or fewer bytes
|
||||||
are written. */
|
are written. */
|
||||||
static KsbaError
|
static gpg_error_t
|
||||||
decrypt_filter (void *arg,
|
decrypt_filter (void *arg,
|
||||||
const void *inbuf, size_t inlen, size_t *inused,
|
const void *inbuf, size_t inlen, size_t *inused,
|
||||||
void *outbuf, size_t maxoutlen, size_t *outlen)
|
void *outbuf, size_t maxoutlen, size_t *outlen)
|
||||||
@ -240,13 +240,12 @@ int
|
|||||||
gpgsm_decrypt (CTRL ctrl, int in_fd, FILE *out_fp)
|
gpgsm_decrypt (CTRL ctrl, int in_fd, FILE *out_fp)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
KsbaError err;
|
|
||||||
Base64Context b64reader = NULL;
|
Base64Context b64reader = NULL;
|
||||||
Base64Context b64writer = NULL;
|
Base64Context b64writer = NULL;
|
||||||
KsbaReader reader;
|
ksba_reader_t reader;
|
||||||
KsbaWriter writer;
|
ksba_writer_t writer;
|
||||||
KsbaCMS cms = NULL;
|
ksba_cms_t cms = NULL;
|
||||||
KsbaStopReason stopreason;
|
ksba_stop_reason_t stopreason;
|
||||||
KEYDB_HANDLE kh;
|
KEYDB_HANDLE kh;
|
||||||
int recp;
|
int recp;
|
||||||
FILE *in_fp = NULL;
|
FILE *in_fp = NULL;
|
||||||
@ -285,30 +284,25 @@ gpgsm_decrypt (CTRL ctrl, int in_fd, FILE *out_fp)
|
|||||||
goto leave;
|
goto leave;
|
||||||
}
|
}
|
||||||
|
|
||||||
err = ksba_cms_new (&cms);
|
rc = ksba_cms_new (&cms);
|
||||||
if (err)
|
if (rc)
|
||||||
{
|
|
||||||
rc = err;
|
|
||||||
goto leave;
|
goto leave;
|
||||||
}
|
|
||||||
|
|
||||||
err = ksba_cms_set_reader_writer (cms, reader, writer);
|
rc = ksba_cms_set_reader_writer (cms, reader, writer);
|
||||||
if (err)
|
if (rc)
|
||||||
{
|
{
|
||||||
log_debug ("ksba_cms_set_reader_writer failed: %s\n",
|
log_debug ("ksba_cms_set_reader_writer failed: %s\n",
|
||||||
gpg_strerror (err));
|
gpg_strerror (rc));
|
||||||
rc = err;
|
|
||||||
goto leave;
|
goto leave;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* parser loop */
|
/* parser loop */
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
err = ksba_cms_parse (cms, &stopreason);
|
rc = ksba_cms_parse (cms, &stopreason);
|
||||||
if (err)
|
if (rc)
|
||||||
{
|
{
|
||||||
log_debug ("ksba_cms_parse failed: %s\n", gpg_strerror (err));
|
log_debug ("ksba_cms_parse failed: %s\n", gpg_strerror (rc));
|
||||||
rc = err;
|
|
||||||
goto leave;
|
goto leave;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -352,27 +346,26 @@ gpgsm_decrypt (CTRL ctrl, int in_fd, FILE *out_fp)
|
|||||||
&dfparm.ivlen);
|
&dfparm.ivlen);
|
||||||
if (rc)
|
if (rc)
|
||||||
{
|
{
|
||||||
log_error ("error getting IV: %s\n", gpg_strerror (err));
|
log_error ("error getting IV: %s\n", gpg_strerror (rc));
|
||||||
rc = err;
|
|
||||||
goto leave;
|
goto leave;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (recp=0; !any_key; recp++)
|
for (recp=0; !any_key; recp++)
|
||||||
{
|
{
|
||||||
char *issuer;
|
char *issuer;
|
||||||
KsbaSexp serial;
|
ksba_sexp_t serial;
|
||||||
KsbaSexp enc_val;
|
ksba_sexp_t enc_val;
|
||||||
char *hexkeygrip = NULL;
|
char *hexkeygrip = NULL;
|
||||||
|
|
||||||
err = ksba_cms_get_issuer_serial (cms, recp, &issuer, &serial);
|
rc = ksba_cms_get_issuer_serial (cms, recp, &issuer, &serial);
|
||||||
if (err == -1 && recp)
|
if (rc == -1 && recp)
|
||||||
break; /* no more recipients */
|
break; /* no more recipients */
|
||||||
if (err)
|
if (rc)
|
||||||
log_error ("recp %d - error getting info: %s\n",
|
log_error ("recp %d - error getting info: %s\n",
|
||||||
recp, gpg_strerror (err));
|
recp, gpg_strerror (rc));
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
KsbaCert cert = NULL;
|
ksba_cert_t cert = NULL;
|
||||||
|
|
||||||
log_debug ("recp %d - issuer: `%s'\n",
|
log_debug ("recp %d - issuer: `%s'\n",
|
||||||
recp, issuer? issuer:"[NONE]");
|
recp, issuer? issuer:"[NONE]");
|
||||||
|
@ -42,7 +42,7 @@ delete_one (CTRL ctrl, const char *username)
|
|||||||
int rc = 0;
|
int rc = 0;
|
||||||
KEYDB_SEARCH_DESC desc;
|
KEYDB_SEARCH_DESC desc;
|
||||||
KEYDB_HANDLE kh = NULL;
|
KEYDB_HANDLE kh = NULL;
|
||||||
KsbaCert cert = NULL;
|
ksba_cert_t cert = NULL;
|
||||||
int duplicates = 0;
|
int duplicates = 0;
|
||||||
|
|
||||||
rc = keydb_classify_name (username, &desc);
|
rc = keydb_classify_name (username, &desc);
|
||||||
@ -77,7 +77,7 @@ delete_one (CTRL ctrl, const char *username)
|
|||||||
rc = 0;
|
rc = 0;
|
||||||
else if (!rc)
|
else if (!rc)
|
||||||
{
|
{
|
||||||
KsbaCert cert2 = NULL;
|
ksba_cert_t cert2 = NULL;
|
||||||
char fpr2[20];
|
char fpr2[20];
|
||||||
|
|
||||||
/* We ignore all duplicated certificates which might have
|
/* We ignore all duplicated certificates which might have
|
||||||
|
14
sm/encrypt.c
14
sm/encrypt.c
@ -152,11 +152,11 @@ encode_session_key (DEK dek, gcry_sexp_t * r_data)
|
|||||||
/* encrypt the DEK under the key contained in CERT and return it as a
|
/* encrypt the DEK under the key contained in CERT and return it as a
|
||||||
canonical S-Exp in encval */
|
canonical S-Exp in encval */
|
||||||
static int
|
static int
|
||||||
encrypt_dek (const DEK dek, KsbaCert cert, char **encval)
|
encrypt_dek (const DEK dek, ksba_cert_t cert, char **encval)
|
||||||
{
|
{
|
||||||
gcry_sexp_t s_ciph, s_data, s_pkey;
|
gcry_sexp_t s_ciph, s_data, s_pkey;
|
||||||
int rc;
|
int rc;
|
||||||
KsbaSexp buf;
|
ksba_sexp_t buf;
|
||||||
size_t len;
|
size_t len;
|
||||||
|
|
||||||
*encval = NULL;
|
*encval = NULL;
|
||||||
@ -292,11 +292,11 @@ gpgsm_encrypt (CTRL ctrl, CERTLIST recplist, int data_fd, FILE *out_fp)
|
|||||||
{
|
{
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
Base64Context b64writer = NULL;
|
Base64Context b64writer = NULL;
|
||||||
KsbaError err;
|
gpg_error_t err;
|
||||||
KsbaWriter writer;
|
ksba_writer_t writer;
|
||||||
KsbaReader reader = NULL;
|
ksba_reader_t reader = NULL;
|
||||||
KsbaCMS cms = NULL;
|
ksba_cms_t cms = NULL;
|
||||||
KsbaStopReason stopreason;
|
ksba_stop_reason_t stopreason;
|
||||||
KEYDB_HANDLE kh = NULL;
|
KEYDB_HANDLE kh = NULL;
|
||||||
struct encrypt_cb_parm_s encparm;
|
struct encrypt_cb_parm_s encparm;
|
||||||
DEK dek = NULL;
|
DEK dek = NULL;
|
||||||
|
10
sm/export.c
10
sm/export.c
@ -33,7 +33,7 @@
|
|||||||
|
|
||||||
#include "keydb.h"
|
#include "keydb.h"
|
||||||
|
|
||||||
static void print_short_info (KsbaCert cert, FILE *fp);
|
static void print_short_info (ksba_cert_t cert, FILE *fp);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -45,9 +45,9 @@ gpgsm_export (CTRL ctrl, STRLIST names, FILE *fp)
|
|||||||
KEYDB_SEARCH_DESC *desc = NULL;
|
KEYDB_SEARCH_DESC *desc = NULL;
|
||||||
int ndesc;
|
int ndesc;
|
||||||
Base64Context b64writer = NULL;
|
Base64Context b64writer = NULL;
|
||||||
KsbaWriter writer;
|
ksba_writer_t writer;
|
||||||
STRLIST sl;
|
STRLIST sl;
|
||||||
KsbaCert cert = NULL;
|
ksba_cert_t cert = NULL;
|
||||||
int rc=0;
|
int rc=0;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
int i;
|
int i;
|
||||||
@ -197,10 +197,10 @@ gpgsm_export (CTRL ctrl, STRLIST names, FILE *fp)
|
|||||||
|
|
||||||
/* Print some info about the certifciate CERT to FP */
|
/* Print some info about the certifciate CERT to FP */
|
||||||
static void
|
static void
|
||||||
print_short_info (KsbaCert cert, FILE *fp)
|
print_short_info (ksba_cert_t cert, FILE *fp)
|
||||||
{
|
{
|
||||||
char *p;
|
char *p;
|
||||||
KsbaSexp sexp;
|
ksba_sexp_t sexp;
|
||||||
int idx;
|
int idx;
|
||||||
|
|
||||||
for (idx=0; (p = ksba_cert_get_issuer (cert, idx)); idx++)
|
for (idx=0; (p = ksba_cert_get_issuer (cert, idx)); idx++)
|
||||||
|
@ -43,7 +43,7 @@
|
|||||||
digest of all 0xff.
|
digest of all 0xff.
|
||||||
*/
|
*/
|
||||||
char *
|
char *
|
||||||
gpgsm_get_fingerprint (KsbaCert cert, int algo, char *array, int *r_len)
|
gpgsm_get_fingerprint (ksba_cert_t cert, int algo, char *array, int *r_len)
|
||||||
{
|
{
|
||||||
gcry_md_hd_t md;
|
gcry_md_hd_t md;
|
||||||
int rc, len;
|
int rc, len;
|
||||||
@ -83,7 +83,7 @@ gpgsm_get_fingerprint (KsbaCert cert, int algo, char *array, int *r_len)
|
|||||||
|
|
||||||
/* Return an allocated buffer with the formatted fingerprint */
|
/* Return an allocated buffer with the formatted fingerprint */
|
||||||
char *
|
char *
|
||||||
gpgsm_get_fingerprint_string (KsbaCert cert, int algo)
|
gpgsm_get_fingerprint_string (ksba_cert_t cert, int algo)
|
||||||
{
|
{
|
||||||
unsigned char digest[MAX_DIGEST_LEN];
|
unsigned char digest[MAX_DIGEST_LEN];
|
||||||
char *buf;
|
char *buf;
|
||||||
@ -105,7 +105,7 @@ gpgsm_get_fingerprint_string (KsbaCert cert, int algo)
|
|||||||
/* Return an allocated buffer with the formatted fingerprint as one
|
/* Return an allocated buffer with the formatted fingerprint as one
|
||||||
large hexnumber */
|
large hexnumber */
|
||||||
char *
|
char *
|
||||||
gpgsm_get_fingerprint_hexstring (KsbaCert cert, int algo)
|
gpgsm_get_fingerprint_hexstring (ksba_cert_t cert, int algo)
|
||||||
{
|
{
|
||||||
unsigned char digest[MAX_DIGEST_LEN];
|
unsigned char digest[MAX_DIGEST_LEN];
|
||||||
char *buf;
|
char *buf;
|
||||||
@ -127,7 +127,7 @@ gpgsm_get_fingerprint_hexstring (KsbaCert cert, int algo)
|
|||||||
/* Return a certificate ID. These are the last 4 bytes of the SHA-1
|
/* Return a certificate ID. These are the last 4 bytes of the SHA-1
|
||||||
fingerprint. */
|
fingerprint. */
|
||||||
unsigned long
|
unsigned long
|
||||||
gpgsm_get_short_fingerprint (KsbaCert cert)
|
gpgsm_get_short_fingerprint (ksba_cert_t cert)
|
||||||
{
|
{
|
||||||
unsigned char digest[20];
|
unsigned char digest[20];
|
||||||
|
|
||||||
@ -141,11 +141,11 @@ gpgsm_get_short_fingerprint (KsbaCert cert)
|
|||||||
be 20 bytes long. returns the array or a newly allocated one if the
|
be 20 bytes long. returns the array or a newly allocated one if the
|
||||||
passed one was NULL */
|
passed one was NULL */
|
||||||
char *
|
char *
|
||||||
gpgsm_get_keygrip (KsbaCert cert, char *array)
|
gpgsm_get_keygrip (ksba_cert_t cert, char *array)
|
||||||
{
|
{
|
||||||
gcry_sexp_t s_pkey;
|
gcry_sexp_t s_pkey;
|
||||||
int rc;
|
int rc;
|
||||||
KsbaSexp p;
|
ksba_sexp_t p;
|
||||||
size_t n;
|
size_t n;
|
||||||
|
|
||||||
p = ksba_cert_get_public_key (cert);
|
p = ksba_cert_get_public_key (cert);
|
||||||
@ -184,7 +184,7 @@ gpgsm_get_keygrip (KsbaCert cert, char *array)
|
|||||||
/* Return an allocated buffer with the keygrip of CERT in from of an
|
/* Return an allocated buffer with the keygrip of CERT in from of an
|
||||||
hexstring. NULL is returned in case of error */
|
hexstring. NULL is returned in case of error */
|
||||||
char *
|
char *
|
||||||
gpgsm_get_keygrip_hexstring (KsbaCert cert)
|
gpgsm_get_keygrip_hexstring (ksba_cert_t cert)
|
||||||
{
|
{
|
||||||
unsigned char grip[20];
|
unsigned char grip[20];
|
||||||
char *buf, *p;
|
char *buf, *p;
|
||||||
@ -209,9 +209,9 @@ gpgsm_get_keygrip_hexstring (KsbaCert cert)
|
|||||||
The caller must free the string.
|
The caller must free the string.
|
||||||
*/
|
*/
|
||||||
char *
|
char *
|
||||||
gpgsm_get_certid (KsbaCert cert)
|
gpgsm_get_certid (ksba_cert_t cert)
|
||||||
{
|
{
|
||||||
KsbaSexp serial;
|
ksba_sexp_t serial;
|
||||||
unsigned char *p;
|
unsigned char *p;
|
||||||
char *endp;
|
char *endp;
|
||||||
unsigned char hash[20];
|
unsigned char hash[20];
|
||||||
|
@ -1316,7 +1316,7 @@ main ( int argc, char **argv)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
KsbaCert cert = NULL;
|
ksba_cert_t cert = NULL;
|
||||||
char *grip = NULL;
|
char *grip = NULL;
|
||||||
|
|
||||||
rc = gpgsm_find_cert (*argv, &cert);
|
rc = gpgsm_find_cert (*argv, &cert);
|
||||||
|
64
sm/gpgsm.h
64
sm/gpgsm.h
@ -142,7 +142,7 @@ typedef struct base64_context_s *Base64Context;
|
|||||||
|
|
||||||
struct certlist_s {
|
struct certlist_s {
|
||||||
struct certlist_s *next;
|
struct certlist_s *next;
|
||||||
KsbaCert cert;
|
ksba_cert_t cert;
|
||||||
};
|
};
|
||||||
typedef struct certlist_s *CERTLIST;
|
typedef struct certlist_s *CERTLIST;
|
||||||
|
|
||||||
@ -158,62 +158,62 @@ void gpgsm_status_with_err_code (CTRL ctrl, int no, const char *text,
|
|||||||
gpg_err_code_t ec);
|
gpg_err_code_t ec);
|
||||||
|
|
||||||
/*-- fingerprint --*/
|
/*-- fingerprint --*/
|
||||||
char *gpgsm_get_fingerprint (KsbaCert cert, int algo, char *array, int *r_len);
|
char *gpgsm_get_fingerprint (ksba_cert_t cert, int algo, char *array, int *r_len);
|
||||||
char *gpgsm_get_fingerprint_string (KsbaCert cert, int algo);
|
char *gpgsm_get_fingerprint_string (ksba_cert_t cert, int algo);
|
||||||
char *gpgsm_get_fingerprint_hexstring (KsbaCert cert, int algo);
|
char *gpgsm_get_fingerprint_hexstring (ksba_cert_t cert, int algo);
|
||||||
unsigned long gpgsm_get_short_fingerprint (KsbaCert cert);
|
unsigned long gpgsm_get_short_fingerprint (ksba_cert_t cert);
|
||||||
char *gpgsm_get_keygrip (KsbaCert cert, char *array);
|
char *gpgsm_get_keygrip (ksba_cert_t cert, char *array);
|
||||||
char *gpgsm_get_keygrip_hexstring (KsbaCert cert);
|
char *gpgsm_get_keygrip_hexstring (ksba_cert_t cert);
|
||||||
char *gpgsm_get_certid (KsbaCert cert);
|
char *gpgsm_get_certid (ksba_cert_t cert);
|
||||||
|
|
||||||
|
|
||||||
/*-- base64.c --*/
|
/*-- base64.c --*/
|
||||||
int gpgsm_create_reader (Base64Context *ctx,
|
int gpgsm_create_reader (Base64Context *ctx,
|
||||||
CTRL ctrl, FILE *fp, KsbaReader *r_reader);
|
CTRL ctrl, FILE *fp, ksba_reader_t *r_reader);
|
||||||
void gpgsm_destroy_reader (Base64Context ctx);
|
void gpgsm_destroy_reader (Base64Context ctx);
|
||||||
int gpgsm_create_writer (Base64Context *ctx,
|
int gpgsm_create_writer (Base64Context *ctx,
|
||||||
CTRL ctrl, FILE *fp, KsbaWriter *r_writer);
|
CTRL ctrl, FILE *fp, ksba_writer_t *r_writer);
|
||||||
int gpgsm_finish_writer (Base64Context ctx);
|
int gpgsm_finish_writer (Base64Context ctx);
|
||||||
void gpgsm_destroy_writer (Base64Context ctx);
|
void gpgsm_destroy_writer (Base64Context ctx);
|
||||||
|
|
||||||
|
|
||||||
/*-- certdump.c --*/
|
/*-- certdump.c --*/
|
||||||
void gpgsm_print_serial (FILE *fp, KsbaConstSexp p);
|
void gpgsm_print_serial (FILE *fp, ksba_const_sexp_t p);
|
||||||
void gpgsm_print_time (FILE *fp, ksba_isotime_t t);
|
void gpgsm_print_time (FILE *fp, ksba_isotime_t t);
|
||||||
void gpgsm_print_name (FILE *fp, const char *string);
|
void gpgsm_print_name (FILE *fp, const char *string);
|
||||||
|
|
||||||
void gpgsm_dump_cert (const char *text, KsbaCert cert);
|
void gpgsm_dump_cert (const char *text, ksba_cert_t cert);
|
||||||
void gpgsm_dump_serial (KsbaConstSexp p);
|
void gpgsm_dump_serial (ksba_const_sexp_t p);
|
||||||
void gpgsm_dump_time (ksba_isotime_t t);
|
void gpgsm_dump_time (ksba_isotime_t t);
|
||||||
void gpgsm_dump_string (const char *string);
|
void gpgsm_dump_string (const char *string);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*-- certcheck.c --*/
|
/*-- certcheck.c --*/
|
||||||
int gpgsm_check_cert_sig (KsbaCert issuer_cert, KsbaCert cert);
|
int gpgsm_check_cert_sig (ksba_cert_t issuer_cert, ksba_cert_t cert);
|
||||||
int gpgsm_check_cms_signature (KsbaCert cert, KsbaConstSexp sigval,
|
int gpgsm_check_cms_signature (ksba_cert_t cert, ksba_const_sexp_t sigval,
|
||||||
gcry_md_hd_t md, int hash_algo);
|
gcry_md_hd_t md, int hash_algo);
|
||||||
/* fixme: move create functions to another file */
|
/* fixme: move create functions to another file */
|
||||||
int gpgsm_create_cms_signature (KsbaCert cert, gcry_md_hd_t md, int mdalgo,
|
int gpgsm_create_cms_signature (ksba_cert_t cert, gcry_md_hd_t md, int mdalgo,
|
||||||
char **r_sigval);
|
char **r_sigval);
|
||||||
|
|
||||||
|
|
||||||
/*-- certchain.c --*/
|
/*-- certchain.c --*/
|
||||||
int gpgsm_walk_cert_chain (KsbaCert start, KsbaCert *r_next);
|
int gpgsm_walk_cert_chain (ksba_cert_t start, ksba_cert_t *r_next);
|
||||||
int gpgsm_is_root_cert (KsbaCert cert);
|
int gpgsm_is_root_cert (ksba_cert_t cert);
|
||||||
int gpgsm_validate_chain (CTRL ctrl, KsbaCert cert, ksba_isotime_t r_exptime);
|
int gpgsm_validate_chain (CTRL ctrl, ksba_cert_t cert, ksba_isotime_t r_exptime);
|
||||||
int gpgsm_basic_cert_check (KsbaCert cert);
|
int gpgsm_basic_cert_check (ksba_cert_t cert);
|
||||||
|
|
||||||
/*-- certlist.c --*/
|
/*-- certlist.c --*/
|
||||||
int gpgsm_cert_use_sign_p (KsbaCert cert);
|
int gpgsm_cert_use_sign_p (ksba_cert_t cert);
|
||||||
int gpgsm_cert_use_encrypt_p (KsbaCert cert);
|
int gpgsm_cert_use_encrypt_p (ksba_cert_t cert);
|
||||||
int gpgsm_cert_use_verify_p (KsbaCert cert);
|
int gpgsm_cert_use_verify_p (ksba_cert_t cert);
|
||||||
int gpgsm_cert_use_decrypt_p (KsbaCert cert);
|
int gpgsm_cert_use_decrypt_p (ksba_cert_t cert);
|
||||||
int gpgsm_cert_use_cert_p (KsbaCert cert);
|
int gpgsm_cert_use_cert_p (ksba_cert_t cert);
|
||||||
int gpgsm_add_to_certlist (CTRL ctrl, const char *name, int secret,
|
int gpgsm_add_to_certlist (CTRL ctrl, const char *name, int secret,
|
||||||
CERTLIST *listaddr);
|
CERTLIST *listaddr);
|
||||||
void gpgsm_release_certlist (CERTLIST list);
|
void gpgsm_release_certlist (CERTLIST list);
|
||||||
int gpgsm_find_cert (const char *name, KsbaCert *r_cert);
|
int gpgsm_find_cert (const char *name, ksba_cert_t *r_cert);
|
||||||
|
|
||||||
/*-- keylist.c --*/
|
/*-- keylist.c --*/
|
||||||
void gpgsm_list_keys (CTRL ctrl, STRLIST names, FILE *fp, unsigned int mode);
|
void gpgsm_list_keys (CTRL ctrl, STRLIST names, FILE *fp, unsigned int mode);
|
||||||
@ -233,7 +233,7 @@ int gpgsm_delete (CTRL ctrl, STRLIST names);
|
|||||||
int gpgsm_verify (CTRL ctrl, int in_fd, int data_fd, FILE *out_fp);
|
int gpgsm_verify (CTRL ctrl, int in_fd, int data_fd, FILE *out_fp);
|
||||||
|
|
||||||
/*-- sign.c --*/
|
/*-- sign.c --*/
|
||||||
int gpgsm_get_default_cert (KsbaCert *r_cert);
|
int gpgsm_get_default_cert (ksba_cert_t *r_cert);
|
||||||
int gpgsm_sign (CTRL ctrl, CERTLIST signerlist,
|
int gpgsm_sign (CTRL ctrl, CERTLIST signerlist,
|
||||||
int data_fd, int detached, FILE *out_fp);
|
int data_fd, int detached, FILE *out_fp);
|
||||||
|
|
||||||
@ -253,19 +253,19 @@ int gpgsm_agent_pksign (const char *keygrip,
|
|||||||
int digestalgo,
|
int digestalgo,
|
||||||
char **r_buf, size_t *r_buflen);
|
char **r_buf, size_t *r_buflen);
|
||||||
int gpgsm_agent_pkdecrypt (const char *keygrip,
|
int gpgsm_agent_pkdecrypt (const char *keygrip,
|
||||||
KsbaConstSexp ciphertext,
|
ksba_const_sexp_t ciphertext,
|
||||||
char **r_buf, size_t *r_buflen);
|
char **r_buf, size_t *r_buflen);
|
||||||
int gpgsm_agent_genkey (KsbaConstSexp keyparms, KsbaSexp *r_pubkey);
|
int gpgsm_agent_genkey (ksba_const_sexp_t keyparms, ksba_sexp_t *r_pubkey);
|
||||||
int gpgsm_agent_istrusted (KsbaCert cert);
|
int gpgsm_agent_istrusted (ksba_cert_t cert);
|
||||||
int gpgsm_agent_havekey (const char *hexkeygrip);
|
int gpgsm_agent_havekey (const char *hexkeygrip);
|
||||||
int gpgsm_agent_marktrusted (KsbaCert cert);
|
int gpgsm_agent_marktrusted (ksba_cert_t cert);
|
||||||
int gpgsm_agent_learn (void);
|
int gpgsm_agent_learn (void);
|
||||||
int gpgsm_agent_passwd (const char *hexkeygrip);
|
int gpgsm_agent_passwd (const char *hexkeygrip);
|
||||||
|
|
||||||
/*-- call-dirmngr.c --*/
|
/*-- call-dirmngr.c --*/
|
||||||
int gpgsm_dirmngr_isvalid (ksba_cert_t cert, int use_ocsp);
|
int gpgsm_dirmngr_isvalid (ksba_cert_t cert, int use_ocsp);
|
||||||
int gpgsm_dirmngr_lookup (CTRL ctrl, STRLIST names,
|
int gpgsm_dirmngr_lookup (CTRL ctrl, STRLIST names,
|
||||||
void (*cb)(void*, KsbaCert), void *cb_value);
|
void (*cb)(void*, ksba_cert_t), void *cb_value);
|
||||||
int gpgsm_dirmngr_run_command (CTRL ctrl, const char *command,
|
int gpgsm_dirmngr_run_command (CTRL ctrl, const char *command,
|
||||||
int argc, char **argv);
|
int argc, char **argv);
|
||||||
|
|
||||||
|
18
sm/import.c
18
sm/import.c
@ -44,7 +44,7 @@ struct stats_s {
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
print_imported_status (CTRL ctrl, KsbaCert cert)
|
print_imported_status (CTRL ctrl, ksba_cert_t cert)
|
||||||
{
|
{
|
||||||
char *fpr;
|
char *fpr;
|
||||||
|
|
||||||
@ -62,7 +62,7 @@ print_imported_status (CTRL ctrl, KsbaCert cert)
|
|||||||
4 := "Error storing certificate".
|
4 := "Error storing certificate".
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
print_import_problem (CTRL ctrl, KsbaCert cert, int reason)
|
print_import_problem (CTRL ctrl, ksba_cert_t cert, int reason)
|
||||||
{
|
{
|
||||||
char *fpr = NULL;
|
char *fpr = NULL;
|
||||||
char buf[25];
|
char buf[25];
|
||||||
@ -117,7 +117,7 @@ print_imported_summary (CTRL ctrl, struct stats_s *stats)
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
check_and_store (CTRL ctrl, struct stats_s *stats, KsbaCert cert, int depth)
|
check_and_store (CTRL ctrl, struct stats_s *stats, ksba_cert_t cert, int depth)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
@ -137,7 +137,7 @@ check_and_store (CTRL ctrl, struct stats_s *stats, KsbaCert cert, int depth)
|
|||||||
|
|
||||||
if (!keydb_store_cert (cert, 0, &existed))
|
if (!keydb_store_cert (cert, 0, &existed))
|
||||||
{
|
{
|
||||||
KsbaCert next = NULL;
|
ksba_cert_t next = NULL;
|
||||||
|
|
||||||
if (!existed)
|
if (!existed)
|
||||||
{
|
{
|
||||||
@ -194,11 +194,11 @@ import_one (CTRL ctrl, struct stats_s *stats, int in_fd)
|
|||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
Base64Context b64reader = NULL;
|
Base64Context b64reader = NULL;
|
||||||
KsbaReader reader;
|
ksba_reader_t reader;
|
||||||
KsbaCert cert = NULL;
|
ksba_cert_t cert = NULL;
|
||||||
KsbaCMS cms = NULL;
|
ksba_cms_t cms = NULL;
|
||||||
FILE *fp = NULL;
|
FILE *fp = NULL;
|
||||||
KsbaContentType ct;
|
ksba_content_type_t ct;
|
||||||
|
|
||||||
fp = fdopen ( dup (in_fd), "rb");
|
fp = fdopen ( dup (in_fd), "rb");
|
||||||
if (!fp)
|
if (!fp)
|
||||||
@ -218,7 +218,7 @@ import_one (CTRL ctrl, struct stats_s *stats, int in_fd)
|
|||||||
ct = ksba_cms_identify (reader);
|
ct = ksba_cms_identify (reader);
|
||||||
if (ct == KSBA_CT_SIGNED_DATA)
|
if (ct == KSBA_CT_SIGNED_DATA)
|
||||||
{ /* This is probably a signed-only message - import the certs */
|
{ /* This is probably a signed-only message - import the certs */
|
||||||
KsbaStopReason stopreason;
|
ksba_stop_reason_t stopreason;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
rc = ksba_cms_new (&cms);
|
rc = ksba_cms_new (&cms);
|
||||||
|
10
sm/keydb.c
10
sm/keydb.c
@ -557,7 +557,7 @@ keydb_insert_keyblock (KEYDB_HANDLE hd, KBNODE kb)
|
|||||||
key used to locate the keyblock or flag bit 1 set for the user ID
|
key used to locate the keyblock or flag bit 1 set for the user ID
|
||||||
node. */
|
node. */
|
||||||
int
|
int
|
||||||
keydb_get_cert (KEYDB_HANDLE hd, KsbaCert *r_cert)
|
keydb_get_cert (KEYDB_HANDLE hd, ksba_cert_t *r_cert)
|
||||||
{
|
{
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
|
|
||||||
@ -584,7 +584,7 @@ keydb_get_cert (KEYDB_HANDLE hd, KsbaCert *r_cert)
|
|||||||
* Insert a new Certificate into one of the resources.
|
* Insert a new Certificate into one of the resources.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
keydb_insert_cert (KEYDB_HANDLE hd, KsbaCert cert)
|
keydb_insert_cert (KEYDB_HANDLE hd, ksba_cert_t cert)
|
||||||
{
|
{
|
||||||
int rc = -1;
|
int rc = -1;
|
||||||
int idx;
|
int idx;
|
||||||
@ -627,7 +627,7 @@ keydb_insert_cert (KEYDB_HANDLE hd, KsbaCert cert)
|
|||||||
|
|
||||||
/* update the current keyblock with KB */
|
/* update the current keyblock with KB */
|
||||||
int
|
int
|
||||||
keydb_update_cert (KEYDB_HANDLE hd, KsbaCert cert)
|
keydb_update_cert (KEYDB_HANDLE hd, ksba_cert_t cert)
|
||||||
{
|
{
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
char digest[20];
|
char digest[20];
|
||||||
@ -881,7 +881,7 @@ keydb_search_issuer (KEYDB_HANDLE hd, const char *issuer)
|
|||||||
|
|
||||||
int
|
int
|
||||||
keydb_search_issuer_sn (KEYDB_HANDLE hd,
|
keydb_search_issuer_sn (KEYDB_HANDLE hd,
|
||||||
const char *issuer, KsbaConstSexp serial)
|
const char *issuer, ksba_const_sexp_t serial)
|
||||||
{
|
{
|
||||||
KEYDB_SEARCH_DESC desc;
|
KEYDB_SEARCH_DESC desc;
|
||||||
int rc;
|
int rc;
|
||||||
@ -1219,7 +1219,7 @@ keydb_classify_name (const char *name, KEYDB_SEARCH_DESC *desc)
|
|||||||
If EXISTED is not NULL it will be set to true if the certificate
|
If EXISTED is not NULL it will be set to true if the certificate
|
||||||
was already in the DB. */
|
was already in the DB. */
|
||||||
int
|
int
|
||||||
keydb_store_cert (KsbaCert cert, int ephemeral, int *existed)
|
keydb_store_cert (ksba_cert_t cert, int ephemeral, int *existed)
|
||||||
{
|
{
|
||||||
KEYDB_HANDLE kh;
|
KEYDB_HANDLE kh;
|
||||||
int rc;
|
int rc;
|
||||||
|
@ -41,9 +41,9 @@ int keydb_update_keyblock (KEYDB_HANDLE hd, KBNODE kb);
|
|||||||
int keydb_insert_keyblock (KEYDB_HANDLE hd, KBNODE kb);
|
int keydb_insert_keyblock (KEYDB_HANDLE hd, KBNODE kb);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int keydb_get_cert (KEYDB_HANDLE hd, KsbaCert *r_cert);
|
int keydb_get_cert (KEYDB_HANDLE hd, ksba_cert_t *r_cert);
|
||||||
int keydb_insert_cert (KEYDB_HANDLE hd, KsbaCert cert);
|
int keydb_insert_cert (KEYDB_HANDLE hd, ksba_cert_t cert);
|
||||||
int keydb_update_cert (KEYDB_HANDLE hd, KsbaCert cert);
|
int keydb_update_cert (KEYDB_HANDLE hd, ksba_cert_t cert);
|
||||||
|
|
||||||
int keydb_delete (KEYDB_HANDLE hd);
|
int keydb_delete (KEYDB_HANDLE hd);
|
||||||
|
|
||||||
@ -63,7 +63,7 @@ int keydb_search_subject (KEYDB_HANDLE hd, const char *issuer);
|
|||||||
|
|
||||||
int keydb_classify_name (const char *name, KEYDB_SEARCH_DESC *desc);
|
int keydb_classify_name (const char *name, KEYDB_SEARCH_DESC *desc);
|
||||||
|
|
||||||
int keydb_store_cert (KsbaCert cert, int ephemeral, int *existed);
|
int keydb_store_cert (ksba_cert_t cert, int ephemeral, int *existed);
|
||||||
|
|
||||||
|
|
||||||
#endif /*GNUPG_KEYDB_H*/
|
#endif /*GNUPG_KEYDB_H*/
|
||||||
|
26
sm/keylist.c
26
sm/keylist.c
@ -45,7 +45,7 @@ struct list_external_parm_s {
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
print_key_data (KsbaCert cert, FILE *fp)
|
print_key_data (ksba_cert_t cert, FILE *fp)
|
||||||
{
|
{
|
||||||
#if 0
|
#if 0
|
||||||
int n = pk ? pubkey_get_npkey( pk->pubkey_algo ) : 0;
|
int n = pk ? pubkey_get_npkey( pk->pubkey_algo ) : 0;
|
||||||
@ -62,9 +62,9 @@ print_key_data (KsbaCert cert, FILE *fp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
print_capabilities (KsbaCert cert, FILE *fp)
|
print_capabilities (ksba_cert_t cert, FILE *fp)
|
||||||
{
|
{
|
||||||
KsbaError err;
|
gpg_error_t err;
|
||||||
unsigned int use;
|
unsigned int use;
|
||||||
|
|
||||||
err = ksba_cert_get_key_usage (cert, &use);
|
err = ksba_cert_get_key_usage (cert, &use);
|
||||||
@ -145,11 +145,11 @@ email_kludge (const char *name)
|
|||||||
|
|
||||||
/* List one certificate in colon mode */
|
/* List one certificate in colon mode */
|
||||||
static void
|
static void
|
||||||
list_cert_colon (KsbaCert cert, FILE *fp, int have_secret)
|
list_cert_colon (ksba_cert_t cert, FILE *fp, int have_secret)
|
||||||
{
|
{
|
||||||
int idx, trustletter = 0;
|
int idx, trustletter = 0;
|
||||||
char *p;
|
char *p;
|
||||||
KsbaSexp sexp;
|
ksba_sexp_t sexp;
|
||||||
char *fpr;
|
char *fpr;
|
||||||
ksba_isotime_t t;
|
ksba_isotime_t t;
|
||||||
|
|
||||||
@ -221,7 +221,7 @@ list_cert_colon (KsbaCert cert, FILE *fp, int have_secret)
|
|||||||
xfree (fpr); fpr = NULL;
|
xfree (fpr); fpr = NULL;
|
||||||
/* print chaining ID (field 13)*/
|
/* print chaining ID (field 13)*/
|
||||||
{
|
{
|
||||||
KsbaCert next;
|
ksba_cert_t next;
|
||||||
|
|
||||||
if (!gpgsm_walk_cert_chain (cert, &next))
|
if (!gpgsm_walk_cert_chain (cert, &next))
|
||||||
{
|
{
|
||||||
@ -276,10 +276,10 @@ list_cert_colon (KsbaCert cert, FILE *fp, int have_secret)
|
|||||||
|
|
||||||
/* List one certificate in standard mode */
|
/* List one certificate in standard mode */
|
||||||
static void
|
static void
|
||||||
list_cert_std (KsbaCert cert, FILE *fp, int have_secret)
|
list_cert_std (ksba_cert_t cert, FILE *fp, int have_secret)
|
||||||
{
|
{
|
||||||
KsbaError kerr;
|
gpg_error_t kerr;
|
||||||
KsbaSexp sexp;
|
ksba_sexp_t sexp;
|
||||||
char *dn;
|
char *dn;
|
||||||
ksba_isotime_t t;
|
ksba_isotime_t t;
|
||||||
int idx;
|
int idx;
|
||||||
@ -397,9 +397,9 @@ list_cert_std (KsbaCert cert, FILE *fp, int have_secret)
|
|||||||
|
|
||||||
/* Same as standard mode mode list all certifying certts too */
|
/* Same as standard mode mode list all certifying certts too */
|
||||||
static void
|
static void
|
||||||
list_cert_chain (KsbaCert cert, FILE *fp)
|
list_cert_chain (ksba_cert_t cert, FILE *fp)
|
||||||
{
|
{
|
||||||
KsbaCert next = NULL;
|
ksba_cert_t next = NULL;
|
||||||
|
|
||||||
list_cert_std (cert, fp, 0);
|
list_cert_std (cert, fp, 0);
|
||||||
ksba_cert_ref (cert);
|
ksba_cert_ref (cert);
|
||||||
@ -425,7 +425,7 @@ list_internal_keys (CTRL ctrl, STRLIST names, FILE *fp, unsigned int mode)
|
|||||||
KEYDB_SEARCH_DESC *desc = NULL;
|
KEYDB_SEARCH_DESC *desc = NULL;
|
||||||
STRLIST sl;
|
STRLIST sl;
|
||||||
int ndesc;
|
int ndesc;
|
||||||
KsbaCert cert = NULL;
|
ksba_cert_t cert = NULL;
|
||||||
int rc=0;
|
int rc=0;
|
||||||
const char *lastresname, *resname;
|
const char *lastresname, *resname;
|
||||||
int have_secret;
|
int have_secret;
|
||||||
@ -548,7 +548,7 @@ list_internal_keys (CTRL ctrl, STRLIST names, FILE *fp, unsigned int mode)
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
list_external_cb (void *cb_value, KsbaCert cert)
|
list_external_cb (void *cb_value, ksba_cert_t cert)
|
||||||
{
|
{
|
||||||
struct list_external_parm_s *parm = cb_value;
|
struct list_external_parm_s *parm = cb_value;
|
||||||
|
|
||||||
|
28
sm/sign.c
28
sm/sign.c
@ -61,9 +61,9 @@ hash_data (int fd, gcry_md_hd_t md)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
hash_and_copy_data (int fd, gcry_md_hd_t md, KsbaWriter writer)
|
hash_and_copy_data (int fd, gcry_md_hd_t md, ksba_writer_t writer)
|
||||||
{
|
{
|
||||||
KsbaError err;
|
gpg_error_t err;
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
char buffer[4096];
|
char buffer[4096];
|
||||||
int nread;
|
int nread;
|
||||||
@ -126,10 +126,10 @@ hash_and_copy_data (int fd, gcry_md_hd_t md, KsbaWriter writer)
|
|||||||
/* Get the default certificate which is defined as the first one our
|
/* Get the default certificate which is defined as the first one our
|
||||||
keyDB returns and has a secret key available. */
|
keyDB returns and has a secret key available. */
|
||||||
int
|
int
|
||||||
gpgsm_get_default_cert (KsbaCert *r_cert)
|
gpgsm_get_default_cert (ksba_cert_t *r_cert)
|
||||||
{
|
{
|
||||||
KEYDB_HANDLE hd;
|
KEYDB_HANDLE hd;
|
||||||
KsbaCert cert = NULL;
|
ksba_cert_t cert = NULL;
|
||||||
int rc;
|
int rc;
|
||||||
char *p;
|
char *p;
|
||||||
|
|
||||||
@ -179,11 +179,11 @@ gpgsm_get_default_cert (KsbaCert *r_cert)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static KsbaCert
|
static ksba_cert_t
|
||||||
get_default_signer (void)
|
get_default_signer (void)
|
||||||
{
|
{
|
||||||
KEYDB_SEARCH_DESC desc;
|
KEYDB_SEARCH_DESC desc;
|
||||||
KsbaCert cert = NULL;
|
ksba_cert_t cert = NULL;
|
||||||
KEYDB_HANDLE kh = NULL;
|
KEYDB_HANDLE kh = NULL;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
@ -233,11 +233,11 @@ get_default_signer (void)
|
|||||||
other certificate up in the chain to the Root-CA to the CMS
|
other certificate up in the chain to the Root-CA to the CMS
|
||||||
object. */
|
object. */
|
||||||
static int
|
static int
|
||||||
add_certificate_list (CTRL ctrl, KsbaCMS cms, KsbaCert cert)
|
add_certificate_list (CTRL ctrl, ksba_cms_t cms, ksba_cert_t cert)
|
||||||
{
|
{
|
||||||
KsbaError err;
|
gpg_error_t err;
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
KsbaCert next = NULL;
|
ksba_cert_t next = NULL;
|
||||||
int n;
|
int n;
|
||||||
int not_root = 0;
|
int not_root = 0;
|
||||||
|
|
||||||
@ -296,11 +296,11 @@ gpgsm_sign (CTRL ctrl, CERTLIST signerlist,
|
|||||||
int data_fd, int detached, FILE *out_fp)
|
int data_fd, int detached, FILE *out_fp)
|
||||||
{
|
{
|
||||||
int i, rc;
|
int i, rc;
|
||||||
KsbaError err;
|
gpg_error_t err;
|
||||||
Base64Context b64writer = NULL;
|
Base64Context b64writer = NULL;
|
||||||
KsbaWriter writer;
|
ksba_writer_t writer;
|
||||||
KsbaCMS cms = NULL;
|
ksba_cms_t cms = NULL;
|
||||||
KsbaStopReason stopreason;
|
ksba_stop_reason_t stopreason;
|
||||||
KEYDB_HANDLE kh = NULL;
|
KEYDB_HANDLE kh = NULL;
|
||||||
gcry_md_hd_t data_md = NULL;
|
gcry_md_hd_t data_md = NULL;
|
||||||
int signer;
|
int signer;
|
||||||
@ -357,7 +357,7 @@ gpgsm_sign (CTRL ctrl, CERTLIST signerlist,
|
|||||||
/* If no list of signers is given, use a default one. */
|
/* If no list of signers is given, use a default one. */
|
||||||
if (!signerlist)
|
if (!signerlist)
|
||||||
{
|
{
|
||||||
KsbaCert cert = get_default_signer ();
|
ksba_cert_t cert = get_default_signer ();
|
||||||
if (!cert)
|
if (!cert)
|
||||||
{
|
{
|
||||||
log_error ("no default signer found\n");
|
log_error ("no default signer found\n");
|
||||||
|
16
sm/verify.c
16
sm/verify.c
@ -86,12 +86,12 @@ gpgsm_verify (CTRL ctrl, int in_fd, int data_fd, FILE *out_fp)
|
|||||||
int i, rc;
|
int i, rc;
|
||||||
Base64Context b64reader = NULL;
|
Base64Context b64reader = NULL;
|
||||||
Base64Context b64writer = NULL;
|
Base64Context b64writer = NULL;
|
||||||
KsbaError err;
|
gpg_error_t err;
|
||||||
KsbaReader reader;
|
ksba_reader_t reader;
|
||||||
KsbaWriter writer = NULL;
|
ksba_writer_t writer = NULL;
|
||||||
KsbaCMS cms = NULL;
|
ksba_cms_t cms = NULL;
|
||||||
KsbaStopReason stopreason;
|
ksba_stop_reason_t stopreason;
|
||||||
KsbaCert cert;
|
ksba_cert_t cert;
|
||||||
KEYDB_HANDLE kh;
|
KEYDB_HANDLE kh;
|
||||||
gcry_md_hd_t data_md = NULL;
|
gcry_md_hd_t data_md = NULL;
|
||||||
int signer;
|
int signer;
|
||||||
@ -242,9 +242,9 @@ gpgsm_verify (CTRL ctrl, int in_fd, int data_fd, FILE *out_fp)
|
|||||||
for (signer=0; ; signer++)
|
for (signer=0; ; signer++)
|
||||||
{
|
{
|
||||||
char *issuer = NULL;
|
char *issuer = NULL;
|
||||||
KsbaSexp sigval = NULL;
|
ksba_sexp_t sigval = NULL;
|
||||||
ksba_isotime_t sigtime, keyexptime;
|
ksba_isotime_t sigtime, keyexptime;
|
||||||
KsbaSexp serial;
|
ksba_sexp_t serial;
|
||||||
char *msgdigest = NULL;
|
char *msgdigest = NULL;
|
||||||
size_t msgdigestlen;
|
size_t msgdigestlen;
|
||||||
char *ctattr;
|
char *ctattr;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user