1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-12-22 10:19:57 +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:
Werner Koch 2003-12-17 12:28:24 +00:00
parent c4182e3e24
commit cbd57643a7
22 changed files with 203 additions and 203 deletions

View File

@ -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>
* gpgsm.c (main): Set the prefixes for assuan logging.

View File

@ -497,10 +497,10 @@ base64_finish_write (struct writer_cb_parm_s *parm)
ksba_reader_release function on. */
int
gpgsm_create_reader (Base64Context *ctx,
CTRL ctrl, FILE *fp, KsbaReader *r_reader)
CTRL ctrl, FILE *fp, ksba_reader_t *r_reader)
{
int rc;
KsbaReader r;
ksba_reader_t r;
*r_reader = NULL;
*ctx = xtrycalloc (1, sizeof **ctx);
@ -562,10 +562,10 @@ gpgsm_destroy_reader (Base64Context ctx)
function on. */
int
gpgsm_create_writer (Base64Context *ctx,
CTRL ctrl, FILE *fp, KsbaWriter *r_writer)
CTRL ctrl, FILE *fp, ksba_writer_t *r_writer)
{
int rc;
KsbaWriter w;
ksba_writer_t w;
*r_writer = NULL;
*ctx = xtrycalloc (1, sizeof **ctx);

View File

@ -377,7 +377,7 @@ inq_ciphertext_cb (void *opaque, const char *keyword)
the hex string KEYGRIP. */
int
gpgsm_agent_pkdecrypt (const char *keygrip,
KsbaConstSexp ciphertext,
ksba_const_sexp_t ciphertext,
char **r_buf, size_t *r_buflen )
{
int rc;
@ -464,7 +464,7 @@ inq_genkey_parms (void *opaque, const char *keyword)
/* Call the agent to generate a newkey */
int
gpgsm_agent_genkey (KsbaConstSexp keyparms, KsbaSexp *r_pubkey)
gpgsm_agent_genkey (ksba_const_sexp_t keyparms, ksba_sexp_t *r_pubkey)
{
int rc;
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
keys */
int
gpgsm_agent_istrusted (KsbaCert cert)
gpgsm_agent_istrusted (ksba_cert_t cert)
{
int rc;
char *fpr;
@ -538,7 +538,7 @@ gpgsm_agent_istrusted (KsbaCert cert)
/* Ask the agent to mark CERT as a trusted Root-CA one */
int
gpgsm_agent_marktrusted (KsbaCert cert)
gpgsm_agent_marktrusted (ksba_cert_t cert)
{
int rc;
char *fpr, *dn;
@ -601,7 +601,7 @@ learn_cb (void *opaque, const void *buffer, size_t length)
struct learn_parm_s *parm = opaque;
size_t len;
char *buf;
KsbaCert cert;
ksba_cert_t cert;
int rc;
if (parm->error)

View File

@ -48,13 +48,13 @@ static int force_pipe_server = 0;
struct inq_certificate_parm_s {
ASSUAN_CONTEXT ctx;
KsbaCert cert;
ksba_cert_t cert;
};
struct lookup_parm_s {
CTRL ctrl;
ASSUAN_CONTEXT ctx;
void (*cb)(void *, KsbaCert);
void (*cb)(void *, ksba_cert_t);
void *cb_value;
struct membuf data;
int error;
@ -258,7 +258,7 @@ inq_certificate (void *opaque, const char *line)
else
{ /* send the given certificate */
int err;
KsbaCert cert;
ksba_cert_t cert;
err = gpgsm_find_cert (line, &cert);
if (err)
@ -353,7 +353,7 @@ lookup_cb (void *opaque, const void *buffer, size_t length)
struct lookup_parm_s *parm = opaque;
size_t len;
char *buf;
KsbaCert cert;
ksba_cert_t cert;
int rc;
if (parm->error)
@ -477,7 +477,7 @@ lookup_status_cb (void *opaque, const char *line)
is optional. */
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 rc;
char *pattern;
@ -537,7 +537,7 @@ run_command_inq_cb (void *opaque, const char *line)
if ( !strncmp (line, "SENDCERT", 8) && (line[8] == ' ' || !line[8]) )
{ /* send the given certificate */
int err;
KsbaCert cert;
ksba_cert_t cert;
const unsigned char *der;
size_t derlen;

View File

@ -35,7 +35,7 @@
#include "i18n.h"
static int
unknown_criticals (KsbaCert cert)
unknown_criticals (ksba_cert_t cert)
{
static const char *known[] = {
"2.5.29.15", /* keyUsage */
@ -45,7 +45,7 @@ unknown_criticals (KsbaCert cert)
};
int rc = 0, i, idx, crit;
const char *oid;
KsbaError err;
gpg_error_t err;
for (idx=0; !(err=ksba_cert_get_extension (cert, idx,
&oid, &crit, NULL, NULL));idx++)
@ -68,9 +68,9 @@ unknown_criticals (KsbaCert cert)
}
static int
allowed_ca (KsbaCert cert, int *chainlen)
allowed_ca (ksba_cert_t cert, int *chainlen)
{
KsbaError err;
gpg_error_t err;
int flag;
err = ksba_cert_is_ca (cert, &flag, chainlen);
@ -86,9 +86,9 @@ allowed_ca (KsbaCert cert, int *chainlen)
static int
check_cert_policy (KsbaCert cert)
check_cert_policy (ksba_cert_t cert)
{
KsbaError err;
gpg_error_t err;
char *policies;
FILE *fp;
int any_critical;
@ -206,7 +206,7 @@ check_cert_policy (KsbaCert cert)
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))
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
find_up (KEYDB_HANDLE kh, KsbaCert cert, const char *issuer)
find_up (KEYDB_HANDLE kh, ksba_cert_t cert, const char *issuer)
{
KsbaName authid;
KsbaSexp authidno;
ksba_name_t authid;
ksba_sexp_t authidno;
int rc = -1;
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.
Returns -1 when there are no more certificates. */
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;
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
is the case. */
int
gpgsm_is_root_cert (KsbaCert cert)
gpgsm_is_root_cert (ksba_cert_t cert)
{
char *issuer;
char *subject;
@ -408,13 +408,13 @@ gpgsm_is_root_cert (KsbaCert cert)
/* Validate a chain and optionally return the nearest expiration time
in R_EXPTIME */
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;
char *issuer = NULL;
char *subject = NULL;
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 exptime;
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
has been checked using this function. */
int
gpgsm_basic_cert_check (KsbaCert cert)
gpgsm_basic_cert_check (ksba_cert_t cert)
{
int rc = 0;
char *issuer = NULL;
char *subject = NULL;
KEYDB_HANDLE kh = keydb_new (0);
KsbaCert issuer_cert = NULL;
ksba_cert_t issuer_cert = NULL;
if (opt.no_chain_validation)
{

View File

@ -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
assumed that the ISSUER_CERT is valid. */
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;
gcry_md_hd_t md;
int rc, algo;
gcry_mpi_t frame;
KsbaSexp p;
ksba_sexp_t p;
size_t n;
gcry_sexp_t s_sig, s_hash, s_pkey;
@ -210,11 +210,11 @@ gpgsm_check_cert_sig (KsbaCert issuer_cert, KsbaCert cert)
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)
{
int rc;
KsbaSexp p;
ksba_sexp_t p;
gcry_mpi_t frame;
gcry_sexp_t s_sig, s_hash, s_pkey;
size_t n;
@ -278,7 +278,7 @@ gpgsm_check_cms_signature (KsbaCert cert, KsbaConstSexp sigval,
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)
{
int rc;

View File

@ -42,10 +42,10 @@ struct dn_array_s {
/* print the first element of an S-Expression */
void
gpgsm_print_serial (FILE *fp, KsbaConstSexp p)
gpgsm_print_serial (FILE *fp, ksba_const_sexp_t p)
{
unsigned long n;
KsbaConstSexp endp;
char *endp;
if (!p)
fputs (_("none"), fp);
@ -54,7 +54,7 @@ gpgsm_print_serial (FILE *fp, KsbaConstSexp p)
else
{
p++;
n = strtoul (p, (char**)&endp, 10);
n = strtoul (p, &endp, 10);
p = endp;
if (*p!=':')
fputs ("[Internal Error - invalid S-expression]", fp);
@ -68,10 +68,10 @@ gpgsm_print_serial (FILE *fp, KsbaConstSexp p)
void
gpgsm_dump_serial (KsbaConstSexp p)
gpgsm_dump_serial (ksba_const_sexp_t p)
{
unsigned long n;
KsbaConstSexp endp;
char *endp;
if (!p)
log_printf ("none");
@ -80,7 +80,7 @@ gpgsm_dump_serial (KsbaConstSexp p)
else
{
p++;
n = strtoul (p, (char**)&endp, 10);
n = strtoul (p, &endp, 10);
p = endp;
if (*p!=':')
log_printf ("ERROR - invalid S-expression");
@ -142,9 +142,9 @@ gpgsm_dump_string (const char *string)
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;
char *dn;
ksba_isotime_t t;

View File

@ -39,9 +39,9 @@
for verification and a MODE of 3 for decryption (just for
debugging) */
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;
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 */
int
gpgsm_cert_use_sign_p (KsbaCert cert)
gpgsm_cert_use_sign_p (ksba_cert_t cert)
{
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 */
int
gpgsm_cert_use_encrypt_p (KsbaCert cert)
gpgsm_cert_use_encrypt_p (ksba_cert_t cert)
{
return cert_usage_p (cert, 1);
}
int
gpgsm_cert_use_verify_p (KsbaCert cert)
gpgsm_cert_use_verify_p (ksba_cert_t cert)
{
return cert_usage_p (cert, 2);
}
int
gpgsm_cert_use_decrypt_p (KsbaCert cert)
gpgsm_cert_use_decrypt_p (ksba_cert_t cert)
{
return cert_usage_p (cert, 3);
}
int
gpgsm_cert_use_cert_p (KsbaCert cert)
gpgsm_cert_use_cert_p (ksba_cert_t cert)
{
return cert_usage_p (cert, 4);
}
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 *issuer2 = ksba_cert_get_subject (cert, 0);
@ -143,7 +143,7 @@ gpgsm_add_to_certlist (CTRL ctrl, const char *name, int secret,
int rc;
KEYDB_SEARCH_DESC desc;
KEYDB_HANDLE kh = NULL;
KsbaCert cert = NULL;
ksba_cert_t cert = NULL;
rc = keydb_classify_name (name, &desc);
if (!rc)
@ -202,7 +202,7 @@ gpgsm_add_to_certlist (CTRL ctrl, const char *name, int secret,
rc = 0;
else if (!rc)
{
KsbaCert cert2 = NULL;
ksba_cert_t cert2 = NULL;
/* We have to ignore ambigious names as long as
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
chain validation is done */
int
gpgsm_find_cert (const char *name, KsbaCert *r_cert)
gpgsm_find_cert (const char *name, ksba_cert_t *r_cert)
{
int rc;
KEYDB_SEARCH_DESC desc;

View File

@ -125,14 +125,14 @@ struct para_data_s {
struct reqgen_ctrl_s {
int lnr;
int dryrun;
KsbaWriter writer;
ksba_writer_t writer;
};
static int proc_parameters (struct para_data_s *para,
struct reqgen_ctrl_s *outctrl);
static int create_request (struct para_data_s *para,
KsbaConstSexp public,
ksba_const_sexp_t public,
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
(all) certificate requests. */
static int
read_parameters (FILE *fp, KsbaWriter writer)
read_parameters (FILE *fp, ksba_writer_t writer)
{
static struct {
const char *name;
@ -423,7 +423,7 @@ proc_parameters (struct para_data_s *para, struct reqgen_ctrl_s *outctrl)
char numbuf[20];
unsigned char keyparms[100];
int rc;
KsbaSexp public;
ksba_sexp_t public;
/* check that we have all required parameters */
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
generate the request and write it out */
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)
{
KsbaCertreq cr;
KsbaError err;
ksba_certreq_t cr;
gpg_error_t err;
gcry_md_hd_t md;
KsbaStopReason stopreason;
ksba_stop_reason_t stopreason;
int rc = 0;
const char *s;
@ -655,7 +655,7 @@ gpgsm_genkey (CTRL ctrl, int in_fd, FILE *out_fp)
int rc;
FILE *in_fp;
Base64Context b64writer = NULL;
KsbaWriter writer;
ksba_writer_t writer;
in_fp = fdopen (dup (in_fd), "rb");
if (!in_fp)

View File

@ -54,7 +54,7 @@ struct decrypt_filter_parm_s {
/* Decrypt the session key and fill in the parm structure. The
algo and the IV is expected to be already in PARM. */
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)
{
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
output, it may happen that fewer bytes are process or fewer bytes
are written. */
static KsbaError
static gpg_error_t
decrypt_filter (void *arg,
const void *inbuf, size_t inlen, size_t *inused,
void *outbuf, size_t maxoutlen, size_t *outlen)
@ -240,13 +240,12 @@ int
gpgsm_decrypt (CTRL ctrl, int in_fd, FILE *out_fp)
{
int rc;
KsbaError err;
Base64Context b64reader = NULL;
Base64Context b64writer = NULL;
KsbaReader reader;
KsbaWriter writer;
KsbaCMS cms = NULL;
KsbaStopReason stopreason;
ksba_reader_t reader;
ksba_writer_t writer;
ksba_cms_t cms = NULL;
ksba_stop_reason_t stopreason;
KEYDB_HANDLE kh;
int recp;
FILE *in_fp = NULL;
@ -285,30 +284,25 @@ gpgsm_decrypt (CTRL ctrl, int in_fd, FILE *out_fp)
goto leave;
}
err = ksba_cms_new (&cms);
if (err)
{
rc = err;
goto leave;
}
rc = ksba_cms_new (&cms);
if (rc)
goto leave;
err = ksba_cms_set_reader_writer (cms, reader, writer);
if (err)
rc = ksba_cms_set_reader_writer (cms, reader, writer);
if (rc)
{
log_debug ("ksba_cms_set_reader_writer failed: %s\n",
gpg_strerror (err));
rc = err;
gpg_strerror (rc));
goto leave;
}
/* parser loop */
do
{
err = ksba_cms_parse (cms, &stopreason);
if (err)
rc = ksba_cms_parse (cms, &stopreason);
if (rc)
{
log_debug ("ksba_cms_parse failed: %s\n", gpg_strerror (err));
rc = err;
log_debug ("ksba_cms_parse failed: %s\n", gpg_strerror (rc));
goto leave;
}
@ -352,27 +346,26 @@ gpgsm_decrypt (CTRL ctrl, int in_fd, FILE *out_fp)
&dfparm.ivlen);
if (rc)
{
log_error ("error getting IV: %s\n", gpg_strerror (err));
rc = err;
log_error ("error getting IV: %s\n", gpg_strerror (rc));
goto leave;
}
for (recp=0; !any_key; recp++)
{
char *issuer;
KsbaSexp serial;
KsbaSexp enc_val;
ksba_sexp_t serial;
ksba_sexp_t enc_val;
char *hexkeygrip = NULL;
err = ksba_cms_get_issuer_serial (cms, recp, &issuer, &serial);
if (err == -1 && recp)
rc = ksba_cms_get_issuer_serial (cms, recp, &issuer, &serial);
if (rc == -1 && recp)
break; /* no more recipients */
if (err)
if (rc)
log_error ("recp %d - error getting info: %s\n",
recp, gpg_strerror (err));
recp, gpg_strerror (rc));
else
{
KsbaCert cert = NULL;
ksba_cert_t cert = NULL;
log_debug ("recp %d - issuer: `%s'\n",
recp, issuer? issuer:"[NONE]");

View File

@ -42,7 +42,7 @@ delete_one (CTRL ctrl, const char *username)
int rc = 0;
KEYDB_SEARCH_DESC desc;
KEYDB_HANDLE kh = NULL;
KsbaCert cert = NULL;
ksba_cert_t cert = NULL;
int duplicates = 0;
rc = keydb_classify_name (username, &desc);
@ -77,7 +77,7 @@ delete_one (CTRL ctrl, const char *username)
rc = 0;
else if (!rc)
{
KsbaCert cert2 = NULL;
ksba_cert_t cert2 = NULL;
char fpr2[20];
/* We ignore all duplicated certificates which might have

View File

@ -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
canonical S-Exp in encval */
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;
int rc;
KsbaSexp buf;
ksba_sexp_t buf;
size_t len;
*encval = NULL;
@ -292,11 +292,11 @@ gpgsm_encrypt (CTRL ctrl, CERTLIST recplist, int data_fd, FILE *out_fp)
{
int rc = 0;
Base64Context b64writer = NULL;
KsbaError err;
KsbaWriter writer;
KsbaReader reader = NULL;
KsbaCMS cms = NULL;
KsbaStopReason stopreason;
gpg_error_t err;
ksba_writer_t writer;
ksba_reader_t reader = NULL;
ksba_cms_t cms = NULL;
ksba_stop_reason_t stopreason;
KEYDB_HANDLE kh = NULL;
struct encrypt_cb_parm_s encparm;
DEK dek = NULL;

View File

@ -33,7 +33,7 @@
#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;
int ndesc;
Base64Context b64writer = NULL;
KsbaWriter writer;
ksba_writer_t writer;
STRLIST sl;
KsbaCert cert = NULL;
ksba_cert_t cert = NULL;
int rc=0;
int count = 0;
int i;
@ -197,10 +197,10 @@ gpgsm_export (CTRL ctrl, STRLIST names, FILE *fp)
/* Print some info about the certifciate CERT to FP */
static void
print_short_info (KsbaCert cert, FILE *fp)
print_short_info (ksba_cert_t cert, FILE *fp)
{
char *p;
KsbaSexp sexp;
ksba_sexp_t sexp;
int idx;
for (idx=0; (p = ksba_cert_get_issuer (cert, idx)); idx++)

View File

@ -43,7 +43,7 @@
digest of all 0xff.
*/
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;
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 */
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];
char *buf;
@ -105,7 +105,7 @@ gpgsm_get_fingerprint_string (KsbaCert cert, int algo)
/* Return an allocated buffer with the formatted fingerprint as one
large hexnumber */
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];
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
fingerprint. */
unsigned long
gpgsm_get_short_fingerprint (KsbaCert cert)
gpgsm_get_short_fingerprint (ksba_cert_t cert)
{
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
passed one was NULL */
char *
gpgsm_get_keygrip (KsbaCert cert, char *array)
gpgsm_get_keygrip (ksba_cert_t cert, char *array)
{
gcry_sexp_t s_pkey;
int rc;
KsbaSexp p;
ksba_sexp_t p;
size_t n;
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
hexstring. NULL is returned in case of error */
char *
gpgsm_get_keygrip_hexstring (KsbaCert cert)
gpgsm_get_keygrip_hexstring (ksba_cert_t cert)
{
unsigned char grip[20];
char *buf, *p;
@ -209,9 +209,9 @@ gpgsm_get_keygrip_hexstring (KsbaCert cert)
The caller must free the string.
*/
char *
gpgsm_get_certid (KsbaCert cert)
gpgsm_get_certid (ksba_cert_t cert)
{
KsbaSexp serial;
ksba_sexp_t serial;
unsigned char *p;
char *endp;
unsigned char hash[20];

View File

@ -1316,7 +1316,7 @@ main ( int argc, char **argv)
else
{
int rc;
KsbaCert cert = NULL;
ksba_cert_t cert = NULL;
char *grip = NULL;
rc = gpgsm_find_cert (*argv, &cert);

View File

@ -142,7 +142,7 @@ typedef struct base64_context_s *Base64Context;
struct certlist_s {
struct certlist_s *next;
KsbaCert cert;
ksba_cert_t cert;
};
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);
/*-- fingerprint --*/
char *gpgsm_get_fingerprint (KsbaCert cert, int algo, char *array, int *r_len);
char *gpgsm_get_fingerprint_string (KsbaCert cert, int algo);
char *gpgsm_get_fingerprint_hexstring (KsbaCert cert, int algo);
unsigned long gpgsm_get_short_fingerprint (KsbaCert cert);
char *gpgsm_get_keygrip (KsbaCert cert, char *array);
char *gpgsm_get_keygrip_hexstring (KsbaCert cert);
char *gpgsm_get_certid (KsbaCert cert);
char *gpgsm_get_fingerprint (ksba_cert_t cert, int algo, char *array, int *r_len);
char *gpgsm_get_fingerprint_string (ksba_cert_t cert, int algo);
char *gpgsm_get_fingerprint_hexstring (ksba_cert_t cert, int algo);
unsigned long gpgsm_get_short_fingerprint (ksba_cert_t cert);
char *gpgsm_get_keygrip (ksba_cert_t cert, char *array);
char *gpgsm_get_keygrip_hexstring (ksba_cert_t cert);
char *gpgsm_get_certid (ksba_cert_t cert);
/*-- base64.c --*/
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);
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);
void gpgsm_destroy_writer (Base64Context ctx);
/*-- 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_name (FILE *fp, const char *string);
void gpgsm_dump_cert (const char *text, KsbaCert cert);
void gpgsm_dump_serial (KsbaConstSexp p);
void gpgsm_dump_cert (const char *text, ksba_cert_t cert);
void gpgsm_dump_serial (ksba_const_sexp_t p);
void gpgsm_dump_time (ksba_isotime_t t);
void gpgsm_dump_string (const char *string);
/*-- certcheck.c --*/
int gpgsm_check_cert_sig (KsbaCert issuer_cert, KsbaCert cert);
int gpgsm_check_cms_signature (KsbaCert cert, KsbaConstSexp sigval,
int gpgsm_check_cert_sig (ksba_cert_t issuer_cert, ksba_cert_t cert);
int gpgsm_check_cms_signature (ksba_cert_t cert, ksba_const_sexp_t sigval,
gcry_md_hd_t md, int hash_algo);
/* 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);
/*-- certchain.c --*/
int gpgsm_walk_cert_chain (KsbaCert start, KsbaCert *r_next);
int gpgsm_is_root_cert (KsbaCert cert);
int gpgsm_validate_chain (CTRL ctrl, KsbaCert cert, ksba_isotime_t r_exptime);
int gpgsm_basic_cert_check (KsbaCert cert);
int gpgsm_walk_cert_chain (ksba_cert_t start, ksba_cert_t *r_next);
int gpgsm_is_root_cert (ksba_cert_t cert);
int gpgsm_validate_chain (CTRL ctrl, ksba_cert_t cert, ksba_isotime_t r_exptime);
int gpgsm_basic_cert_check (ksba_cert_t cert);
/*-- certlist.c --*/
int gpgsm_cert_use_sign_p (KsbaCert cert);
int gpgsm_cert_use_encrypt_p (KsbaCert cert);
int gpgsm_cert_use_verify_p (KsbaCert cert);
int gpgsm_cert_use_decrypt_p (KsbaCert cert);
int gpgsm_cert_use_cert_p (KsbaCert cert);
int gpgsm_cert_use_sign_p (ksba_cert_t cert);
int gpgsm_cert_use_encrypt_p (ksba_cert_t cert);
int gpgsm_cert_use_verify_p (ksba_cert_t cert);
int gpgsm_cert_use_decrypt_p (ksba_cert_t cert);
int gpgsm_cert_use_cert_p (ksba_cert_t cert);
int gpgsm_add_to_certlist (CTRL ctrl, const char *name, int secret,
CERTLIST *listaddr);
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 --*/
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);
/*-- 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 data_fd, int detached, FILE *out_fp);
@ -253,19 +253,19 @@ int gpgsm_agent_pksign (const char *keygrip,
int digestalgo,
char **r_buf, size_t *r_buflen);
int gpgsm_agent_pkdecrypt (const char *keygrip,
KsbaConstSexp ciphertext,
ksba_const_sexp_t ciphertext,
char **r_buf, size_t *r_buflen);
int gpgsm_agent_genkey (KsbaConstSexp keyparms, KsbaSexp *r_pubkey);
int gpgsm_agent_istrusted (KsbaCert cert);
int gpgsm_agent_genkey (ksba_const_sexp_t keyparms, ksba_sexp_t *r_pubkey);
int gpgsm_agent_istrusted (ksba_cert_t cert);
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_passwd (const char *hexkeygrip);
/*-- call-dirmngr.c --*/
int gpgsm_dirmngr_isvalid (ksba_cert_t cert, int use_ocsp);
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 argc, char **argv);

View File

@ -44,7 +44,7 @@ struct stats_s {
static void
print_imported_status (CTRL ctrl, KsbaCert cert)
print_imported_status (CTRL ctrl, ksba_cert_t cert)
{
char *fpr;
@ -62,7 +62,7 @@ print_imported_status (CTRL ctrl, KsbaCert cert)
4 := "Error storing certificate".
*/
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 buf[25];
@ -117,7 +117,7 @@ print_imported_summary (CTRL ctrl, struct stats_s *stats)
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;
@ -137,7 +137,7 @@ check_and_store (CTRL ctrl, struct stats_s *stats, KsbaCert cert, int depth)
if (!keydb_store_cert (cert, 0, &existed))
{
KsbaCert next = NULL;
ksba_cert_t next = NULL;
if (!existed)
{
@ -194,11 +194,11 @@ import_one (CTRL ctrl, struct stats_s *stats, int in_fd)
{
int rc;
Base64Context b64reader = NULL;
KsbaReader reader;
KsbaCert cert = NULL;
KsbaCMS cms = NULL;
ksba_reader_t reader;
ksba_cert_t cert = NULL;
ksba_cms_t cms = NULL;
FILE *fp = NULL;
KsbaContentType ct;
ksba_content_type_t ct;
fp = fdopen ( dup (in_fd), "rb");
if (!fp)
@ -218,7 +218,7 @@ import_one (CTRL ctrl, struct stats_s *stats, int in_fd)
ct = ksba_cms_identify (reader);
if (ct == KSBA_CT_SIGNED_DATA)
{ /* This is probably a signed-only message - import the certs */
KsbaStopReason stopreason;
ksba_stop_reason_t stopreason;
int i;
rc = ksba_cms_new (&cms);

View File

@ -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
node. */
int
keydb_get_cert (KEYDB_HANDLE hd, KsbaCert *r_cert)
keydb_get_cert (KEYDB_HANDLE hd, ksba_cert_t *r_cert)
{
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.
*/
int
keydb_insert_cert (KEYDB_HANDLE hd, KsbaCert cert)
keydb_insert_cert (KEYDB_HANDLE hd, ksba_cert_t cert)
{
int rc = -1;
int idx;
@ -627,7 +627,7 @@ keydb_insert_cert (KEYDB_HANDLE hd, KsbaCert cert)
/* update the current keyblock with KB */
int
keydb_update_cert (KEYDB_HANDLE hd, KsbaCert cert)
keydb_update_cert (KEYDB_HANDLE hd, ksba_cert_t cert)
{
int rc = 0;
char digest[20];
@ -881,7 +881,7 @@ keydb_search_issuer (KEYDB_HANDLE hd, const char *issuer)
int
keydb_search_issuer_sn (KEYDB_HANDLE hd,
const char *issuer, KsbaConstSexp serial)
const char *issuer, ksba_const_sexp_t serial)
{
KEYDB_SEARCH_DESC desc;
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
was already in the DB. */
int
keydb_store_cert (KsbaCert cert, int ephemeral, int *existed)
keydb_store_cert (ksba_cert_t cert, int ephemeral, int *existed)
{
KEYDB_HANDLE kh;
int rc;

View File

@ -41,9 +41,9 @@ int keydb_update_keyblock (KEYDB_HANDLE hd, KBNODE kb);
int keydb_insert_keyblock (KEYDB_HANDLE hd, KBNODE kb);
#endif
int keydb_get_cert (KEYDB_HANDLE hd, KsbaCert *r_cert);
int keydb_insert_cert (KEYDB_HANDLE hd, KsbaCert cert);
int keydb_update_cert (KEYDB_HANDLE hd, KsbaCert cert);
int keydb_get_cert (KEYDB_HANDLE hd, ksba_cert_t *r_cert);
int keydb_insert_cert (KEYDB_HANDLE hd, ksba_cert_t cert);
int keydb_update_cert (KEYDB_HANDLE hd, ksba_cert_t cert);
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_store_cert (KsbaCert cert, int ephemeral, int *existed);
int keydb_store_cert (ksba_cert_t cert, int ephemeral, int *existed);
#endif /*GNUPG_KEYDB_H*/

View File

@ -45,7 +45,7 @@ struct list_external_parm_s {
static void
print_key_data (KsbaCert cert, FILE *fp)
print_key_data (ksba_cert_t cert, FILE *fp)
{
#if 0
int n = pk ? pubkey_get_npkey( pk->pubkey_algo ) : 0;
@ -62,9 +62,9 @@ print_key_data (KsbaCert cert, FILE *fp)
}
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;
err = ksba_cert_get_key_usage (cert, &use);
@ -145,11 +145,11 @@ email_kludge (const char *name)
/* List one certificate in colon mode */
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;
char *p;
KsbaSexp sexp;
ksba_sexp_t sexp;
char *fpr;
ksba_isotime_t t;
@ -221,7 +221,7 @@ list_cert_colon (KsbaCert cert, FILE *fp, int have_secret)
xfree (fpr); fpr = NULL;
/* print chaining ID (field 13)*/
{
KsbaCert next;
ksba_cert_t 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 */
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;
KsbaSexp sexp;
gpg_error_t kerr;
ksba_sexp_t sexp;
char *dn;
ksba_isotime_t t;
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 */
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);
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;
STRLIST sl;
int ndesc;
KsbaCert cert = NULL;
ksba_cert_t cert = NULL;
int rc=0;
const char *lastresname, *resname;
int have_secret;
@ -548,7 +548,7 @@ list_internal_keys (CTRL ctrl, STRLIST names, FILE *fp, unsigned int mode)
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;

View File

@ -61,9 +61,9 @@ hash_data (int fd, gcry_md_hd_t md)
}
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;
char buffer[4096];
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
keyDB returns and has a secret key available. */
int
gpgsm_get_default_cert (KsbaCert *r_cert)
gpgsm_get_default_cert (ksba_cert_t *r_cert)
{
KEYDB_HANDLE hd;
KsbaCert cert = NULL;
ksba_cert_t cert = NULL;
int rc;
char *p;
@ -179,11 +179,11 @@ gpgsm_get_default_cert (KsbaCert *r_cert)
}
static KsbaCert
static ksba_cert_t
get_default_signer (void)
{
KEYDB_SEARCH_DESC desc;
KsbaCert cert = NULL;
ksba_cert_t cert = NULL;
KEYDB_HANDLE kh = NULL;
int rc;
@ -233,11 +233,11 @@ get_default_signer (void)
other certificate up in the chain to the Root-CA to the CMS
object. */
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;
KsbaCert next = NULL;
ksba_cert_t next = NULL;
int n;
int not_root = 0;
@ -296,11 +296,11 @@ gpgsm_sign (CTRL ctrl, CERTLIST signerlist,
int data_fd, int detached, FILE *out_fp)
{
int i, rc;
KsbaError err;
gpg_error_t err;
Base64Context b64writer = NULL;
KsbaWriter writer;
KsbaCMS cms = NULL;
KsbaStopReason stopreason;
ksba_writer_t writer;
ksba_cms_t cms = NULL;
ksba_stop_reason_t stopreason;
KEYDB_HANDLE kh = NULL;
gcry_md_hd_t data_md = NULL;
int signer;
@ -357,7 +357,7 @@ gpgsm_sign (CTRL ctrl, CERTLIST signerlist,
/* If no list of signers is given, use a default one. */
if (!signerlist)
{
KsbaCert cert = get_default_signer ();
ksba_cert_t cert = get_default_signer ();
if (!cert)
{
log_error ("no default signer found\n");

View File

@ -86,12 +86,12 @@ gpgsm_verify (CTRL ctrl, int in_fd, int data_fd, FILE *out_fp)
int i, rc;
Base64Context b64reader = NULL;
Base64Context b64writer = NULL;
KsbaError err;
KsbaReader reader;
KsbaWriter writer = NULL;
KsbaCMS cms = NULL;
KsbaStopReason stopreason;
KsbaCert cert;
gpg_error_t err;
ksba_reader_t reader;
ksba_writer_t writer = NULL;
ksba_cms_t cms = NULL;
ksba_stop_reason_t stopreason;
ksba_cert_t cert;
KEYDB_HANDLE kh;
gcry_md_hd_t data_md = NULL;
int signer;
@ -242,9 +242,9 @@ gpgsm_verify (CTRL ctrl, int in_fd, int data_fd, FILE *out_fp)
for (signer=0; ; signer++)
{
char *issuer = NULL;
KsbaSexp sigval = NULL;
ksba_sexp_t sigval = NULL;
ksba_isotime_t sigtime, keyexptime;
KsbaSexp serial;
ksba_sexp_t serial;
char *msgdigest = NULL;
size_t msgdigestlen;
char *ctattr;