summaryrefslogtreecommitdiffstats
path: root/g10
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2015-01-22 12:06:11 +0100
committerWerner Koch <wk@gnupg.org>2015-01-22 12:06:11 +0100
commit11142e0ad7bc9a9e3c3dccf958d8dbd3312cb993 (patch)
tree0dd1a333374407a96a3258b4cb46a5e634e683ae /g10
parentgpg: Remove an unused variable. (diff)
downloadgnupg2-11142e0ad7bc9a9e3c3dccf958d8dbd3312cb993.tar.xz
gnupg2-11142e0ad7bc9a9e3c3dccf958d8dbd3312cb993.zip
gpg: Replace remaining old error code macros by GPG_ERR_.
* g10/gpg.h (g10_errstr): Remove macro and change all occurrences by gpg_strerror. (G10ERR_): Remove all macros and change all occurrences by their GPG_ERR_ counterparts. Signed-off-by: Werner Koch <wk@gnupg.org>
Diffstat (limited to 'g10')
-rw-r--r--g10/armor.c6
-rw-r--r--g10/compress.c2
-rw-r--r--g10/decrypt-data.c2
-rw-r--r--g10/decrypt.c2
-rw-r--r--g10/encrypt.c14
-rw-r--r--g10/exec.c18
-rw-r--r--g10/getkey.c49
-rw-r--r--g10/gpg.c43
-rw-r--r--g10/gpg.h64
-rw-r--r--g10/gpgv.c10
-rw-r--r--g10/import.c59
-rw-r--r--g10/keydb.c4
-rw-r--r--g10/keyedit.c56
-rw-r--r--g10/keygen.c33
-rw-r--r--g10/keylist.c14
-rw-r--r--g10/keyring.c44
-rw-r--r--g10/keyserver.c8
-rw-r--r--g10/mainproc.c52
-rw-r--r--g10/misc.c2
-rw-r--r--g10/parse-packet.c24
-rw-r--r--g10/pkclist.c16
-rw-r--r--g10/plaintext.c4
-rw-r--r--g10/pubkey-enc.c12
-rw-r--r--g10/revoke.c32
-rw-r--r--g10/seckey-cert.c8
-rw-r--r--g10/sig-check.c33
-rw-r--r--g10/sign.c12
-rw-r--r--g10/tdbdump.c6
-rw-r--r--g10/tdbio.c106
-rw-r--r--g10/trust.c2
-rw-r--r--g10/trustdb.c28
-rw-r--r--g10/verify.c5
32 files changed, 362 insertions, 408 deletions
diff --git a/g10/armor.c b/g10/armor.c
index b00f9854f..e36866009 100644
--- a/g10/armor.c
+++ b/g10/armor.c
@@ -534,7 +534,7 @@ check_input( armor_filter_context_t *afx, IOBUF a )
i = parse_header_line( afx, line, len );
if( i <= 0 ) {
if (i && RFC2440)
- rc = G10ERR_INVALID_ARMOR;
+ rc = GPG_ERR_INV_ARMOR;
break;
}
}
@@ -915,11 +915,11 @@ radix64_read( armor_filter_context_t *afx, IOBUF a, size_t *retn,
rc = 0;
else if( rc == 2 ) {
log_error(_("premature eof (in trailer)\n"));
- rc = G10ERR_INVALID_ARMOR;
+ rc = GPG_ERR_INVALID_ARMOR;
}
else {
log_error(_("error in trailer line\n"));
- rc = G10ERR_INVALID_ARMOR;
+ rc = GPG_ERR_INVALID_ARMOR;
}
#endif
}
diff --git a/g10/compress.c b/g10/compress.c
index 0a6e09d46..8047dbbb4 100644
--- a/g10/compress.c
+++ b/g10/compress.c
@@ -310,7 +310,7 @@ handle_compressed (ctrl_t ctrl, void *procctx, PKT_compressed *cd,
int rc;
if(check_compress_algo(cd->algorithm))
- return G10ERR_COMPR_ALGO;
+ return GPG_ERR_COMPR_ALGO;
cfx = xmalloc_clear (sizeof *cfx);
cfx->release = release_context;
cfx->algo = cd->algorithm;
diff --git a/g10/decrypt-data.c b/g10/decrypt-data.c
index 03d38c9c9..570a71d11 100644
--- a/g10/decrypt-data.c
+++ b/g10/decrypt-data.c
@@ -168,7 +168,7 @@ decrypt_data (ctrl_t ctrl, void *procctx, PKT_encrypted *ed, DEK *dek)
}
else if( rc )
{
- log_error("key setup failed: %s\n", g10_errstr(rc) );
+ log_error("key setup failed: %s\n", gpg_strerror (rc) );
goto leave;
}
diff --git a/g10/decrypt.c b/g10/decrypt.c
index b0240f571..fe6fd6389 100644
--- a/g10/decrypt.c
+++ b/g10/decrypt.c
@@ -263,7 +263,7 @@ decrypt_messages (ctrl_t ctrl, int nfiles, char *files[])
iobuf_close(fp);
if (rc)
log_error("%s: decryption failed: %s\n", print_fname_stdin(filename),
- g10_errstr(rc));
+ gpg_strerror (rc));
p = get_last_passphrase();
set_next_passphrase(p);
xfree (p);
diff --git a/g10/encrypt.c b/g10/encrypt.c
index b6925445f..8d2b325f9 100644
--- a/g10/encrypt.c
+++ b/g10/encrypt.c
@@ -287,7 +287,7 @@ encrypt_simple (const char *filename, int mode, int use_seskey)
pkt.pkttype = PKT_SYMKEY_ENC;
pkt.pkt.symkey_enc = enc;
if ((rc = build_packet( out, &pkt )))
- log_error("build symkey packet failed: %s\n", g10_errstr(rc) );
+ log_error("build symkey packet failed: %s\n", gpg_strerror (rc) );
xfree (enc);
}
@@ -358,7 +358,7 @@ encrypt_simple (const char *filename, int mode, int use_seskey)
if (!opt.no_literal)
{
if ( (rc = build_packet( out, &pkt )) )
- log_error("build_packet failed: %s\n", g10_errstr(rc) );
+ log_error("build_packet failed: %s\n", gpg_strerror (rc) );
}
else
{
@@ -441,7 +441,7 @@ write_symkey_enc (STRING2KEY *symkey_s2k, DEK *symkey_dek, DEK *dek,
pkt.pkt.symkey_enc = enc;
if ((rc=build_packet(out,&pkt)))
- log_error("build symkey_enc packet failed: %s\n",g10_errstr(rc));
+ log_error("build symkey_enc packet failed: %s\n",gpg_strerror (rc));
xfree(enc);
return rc;
@@ -708,7 +708,7 @@ encrypt_crypt (ctrl_t ctrl, int filefd, const char *filename,
if (!opt.no_literal)
{
if ((rc = build_packet( out, &pkt )))
- log_error ("build_packet failed: %s\n", g10_errstr(rc));
+ log_error ("build_packet failed: %s\n", gpg_strerror (rc));
}
else
{
@@ -912,7 +912,7 @@ write_pubkey_enc_from_list (PK_LIST pk_list, DEK *dek, iobuf_t out)
rc = build_packet (out, &pkt);
if (rc)
log_error ("build_packet(pubkey_enc) failed: %s\n",
- g10_errstr (rc));
+ gpg_strerror (rc));
}
free_pubkey_enc(enc);
if (rc)
@@ -950,7 +950,7 @@ encrypt_crypt_files (ctrl_t ctrl, int nfiles, char **files, strlist_t remusr)
rc = encrypt_crypt (ctrl, -1, line, remusr, 0, NULL, -1);
if (rc)
log_error ("encryption of '%s' failed: %s\n",
- print_fname_stdin(line), g10_errstr(rc) );
+ print_fname_stdin(line), gpg_strerror (rc) );
write_status( STATUS_FILE_DONE );
}
}
@@ -961,7 +961,7 @@ encrypt_crypt_files (ctrl_t ctrl, int nfiles, char **files, strlist_t remusr)
print_file_status(STATUS_FILE_START, *files, 2);
if ( (rc = encrypt_crypt (ctrl, -1, *files, remusr, 0, NULL, -1)) )
log_error("encryption of '%s' failed: %s\n",
- print_fname_stdin(*files), g10_errstr(rc) );
+ print_fname_stdin(*files), gpg_strerror (rc) );
write_status( STATUS_FILE_DONE );
files++;
}
diff --git a/g10/exec.c b/g10/exec.c
index 0194e9d90..30108eb4e 100644
--- a/g10/exec.c
+++ b/g10/exec.c
@@ -58,15 +58,15 @@ exec_write(struct exec_info **info,const char *program,
const char *args_in,const char *name,int writeonly,int binary)
{
log_error(_("no remote program execution supported\n"));
- return G10ERR_GENERAL;
+ return GPG_ERR_GENERAL;
}
int
-exec_read(struct exec_info *info) { return G10ERR_GENERAL; }
+exec_read(struct exec_info *info) { return GPG_ERR_GENERAL; }
int
-exec_finish(struct exec_info *info) { return G10ERR_GENERAL; }
+exec_finish(struct exec_info *info) { return GPG_ERR_GENERAL; }
int
-set_exec_path(const char *path) { return G10ERR_GENERAL; }
+set_exec_path(const char *path) { return GPG_ERR_GENERAL; }
#else /* ! NO_EXEC */
@@ -130,7 +130,7 @@ set_exec_path(const char *path)
set_exec_path multiple times. */
if(putenv(p)!=0)
- return G10ERR_GENERAL;
+ return GPG_ERR_GENERAL;
else
return 0;
#endif
@@ -214,7 +214,7 @@ make_tempdir(struct exec_info *info)
}
}
- return info->flags.madedir?0:G10ERR_GENERAL;
+ return info->flags.madedir? 0 : GPG_ERR_GENERAL;
}
/* Expands %i and %o in the args to the full temp files within the
@@ -299,7 +299,7 @@ expand_args(struct exec_info *info,const char *args_in)
fail:
xfree (get_membuf (&command, NULL));
- return G10ERR_GENERAL;
+ return GPG_ERR_GENERAL;
}
/* Either handles the tempfile creation, or the fork/exec. If it
@@ -312,7 +312,7 @@ int
exec_write(struct exec_info **info,const char *program,
const char *args_in,const char *name,int writeonly,int binary)
{
- int ret=G10ERR_GENERAL;
+ int ret = GPG_ERR_GENERAL;
if(opt.exec_disable && !opt.no_perm_warn)
{
@@ -500,7 +500,7 @@ exec_write(struct exec_info **info,const char *program,
int
exec_read(struct exec_info *info)
{
- int ret=G10ERR_GENERAL;
+ int ret = GPG_ERR_GENERAL;
fclose(info->tochild);
info->tochild=NULL;
diff --git a/g10/getkey.c b/g10/getkey.c
index 9267dbbdd..d240dd7d1 100644
--- a/g10/getkey.c
+++ b/g10/getkey.c
@@ -403,7 +403,9 @@ get_pubkey (PKT_public_key * pk, u32 * keyid)
if (!rc)
goto leave;
- rc = G10ERR_NO_PUBKEY;
+ log_debug ("looking up key %08X%08X failed: %s\n", keyid[0], keyid[1],
+ gpg_strerror (rc));
+ rc = GPG_ERR_NO_PUBKEY;
leave:
if (!rc)
@@ -449,14 +451,14 @@ get_pubkey_fast (PKT_public_key * pk, u32 * keyid)
if (gpg_err_code (rc) == GPG_ERR_NOT_FOUND)
{
keydb_release (hd);
- return G10ERR_NO_PUBKEY;
+ return GPG_ERR_NO_PUBKEY;
}
rc = keydb_get_keyblock (hd, &keyblock);
keydb_release (hd);
if (rc)
{
- log_error ("keydb_get_keyblock failed: %s\n", g10_errstr (rc));
- return G10ERR_NO_PUBKEY;
+ log_error ("keydb_get_keyblock failed: %s\n", gpg_strerror (rc));
+ return GPG_ERR_NO_PUBKEY;
}
assert (keyblock && keyblock->pkt
@@ -467,7 +469,7 @@ get_pubkey_fast (PKT_public_key * pk, u32 * keyid)
if (keyid[0] == pkid[0] && keyid[1] == pkid[1])
copy_public_key (pk, keyblock->pkt->pkt.public_key);
else
- rc = G10ERR_NO_PUBKEY;
+ rc = GPG_ERR_NO_PUBKEY;
release_kbnode (keyblock);
@@ -744,7 +746,7 @@ get_pubkey_byname (ctrl_t ctrl, GETKEY_CTX * retctx, PKT_public_key * pk,
if (nodefault && is_mbox)
{
/* Nodefault but a mailbox - let the AKL locate the key. */
- rc = G10ERR_NO_PUBKEY;
+ rc = GPG_ERR_NO_PUBKEY;
}
else
{
@@ -755,7 +757,7 @@ get_pubkey_byname (ctrl_t ctrl, GETKEY_CTX * retctx, PKT_public_key * pk,
/* If the requested name resembles a valid mailbox and automatic
retrieval has been enabled, we try to import the key. */
- if (gpg_err_code (rc) == G10ERR_NO_PUBKEY && !no_akl && is_mbox)
+ if (gpg_err_code (rc) == GPG_ERR_NO_PUBKEY && !no_akl && is_mbox)
{
for (akl = opt.auto_key_locate; akl; akl = akl->next)
{
@@ -770,7 +772,7 @@ get_pubkey_byname (ctrl_t ctrl, GETKEY_CTX * retctx, PKT_public_key * pk,
case AKL_NODEFAULT:
/* This is a dummy mechanism. */
mechanism = "None";
- rc = G10ERR_NO_PUBKEY;
+ rc = GPG_ERR_NO_PUBKEY;
break;
case AKL_LOCAL:
@@ -824,7 +826,7 @@ get_pubkey_byname (ctrl_t ctrl, GETKEY_CTX * retctx, PKT_public_key * pk,
else
{
mechanism = "Unconfigured keyserver";
- rc = G10ERR_NO_PUBKEY;
+ rc = GPG_ERR_NO_PUBKEY;
}
break;
@@ -869,7 +871,7 @@ get_pubkey_byname (ctrl_t ctrl, GETKEY_CTX * retctx, PKT_public_key * pk,
else if (!rc && !fpr && !did_key_byname)
{
no_fingerprint = 1;
- rc = G10ERR_NO_PUBKEY;
+ rc = GPG_ERR_NO_PUBKEY;
}
xfree (fpr);
fpr = NULL;
@@ -892,10 +894,11 @@ get_pubkey_byname (ctrl_t ctrl, GETKEY_CTX * retctx, PKT_public_key * pk,
name, mechanism);
break;
}
- if (rc != G10ERR_NO_PUBKEY || opt.verbose || no_fingerprint)
+ if (gpg_err_code (rc) != GPG_ERR_NO_PUBKEY
+ || opt.verbose || no_fingerprint)
log_info (_("error retrieving '%s' via %s: %s\n"),
name, mechanism,
- no_fingerprint ? _("No fingerprint") : g10_errstr (rc));
+ no_fingerprint ? _("No fingerprint") : gpg_strerror (rc));
}
}
@@ -996,7 +999,7 @@ get_pubkey_byfprint (PKT_public_key * pk,
get_pubkey_end (&ctx);
}
else
- rc = G10ERR_GENERAL; /* Oops */
+ rc = GPG_ERR_GENERAL; /* Oops */
return rc;
}
@@ -1026,14 +1029,14 @@ get_pubkey_byfprint_fast (PKT_public_key * pk,
if (gpg_err_code (rc) == GPG_ERR_NOT_FOUND)
{
keydb_release (hd);
- return G10ERR_NO_PUBKEY;
+ return GPG_ERR_NO_PUBKEY;
}
rc = keydb_get_keyblock (hd, &keyblock);
keydb_release (hd);
if (rc)
{
- log_error ("keydb_get_keyblock failed: %s\n", g10_errstr (rc));
- return G10ERR_NO_PUBKEY;
+ log_error ("keydb_get_keyblock failed: %s\n", gpg_strerror (rc));
+ return GPG_ERR_NO_PUBKEY;
}
assert (keyblock->pkt->pkttype == PKT_PUBLIC_KEY
@@ -1073,7 +1076,7 @@ get_keyblock_byfprint (KBNODE * ret_keyblock, const byte * fprint,
get_pubkey_end (&ctx);
}
else
- rc = G10ERR_GENERAL; /* Oops */
+ rc = GPG_ERR_GENERAL; /* Oops */
return rc;
}
@@ -1685,7 +1688,7 @@ merge_selfsigs_main (KBNODE keyblock, int *r_revoked,
more revoked than this. */
break;
}
- else if (rc == G10ERR_NO_PUBKEY)
+ else if (gpg_err_code (rc) == GPG_ERR_NO_PUBKEY)
pk->flags.maybe_revoked = 1;
/* A failure here means the sig did not verify, was
@@ -2543,7 +2546,7 @@ lookup (getkey_ctx_t ctx, kbnode_t *ret_keyblock, int want_secret)
rc = keydb_get_keyblock (ctx->kr_handle, &ctx->keyblock);
if (rc)
{
- log_error ("keydb_get_keyblock failed: %s\n", g10_errstr (rc));
+ log_error ("keydb_get_keyblock failed: %s\n", gpg_strerror (rc));
rc = 0;
goto skip;
}
@@ -2571,7 +2574,7 @@ lookup (getkey_ctx_t ctx, kbnode_t *ret_keyblock, int want_secret)
found:
if (rc && gpg_err_code (rc) != GPG_ERR_NOT_FOUND)
- log_error ("keydb_search failed: %s\n", g10_errstr (rc));
+ log_error ("keydb_search failed: %s\n", gpg_strerror (rc));
if (!rc)
{
@@ -2579,9 +2582,9 @@ found:
ctx->keyblock = NULL;
}
else if (gpg_err_code (rc) == GPG_ERR_NOT_FOUND && no_suitable_key)
- rc = want_secret? G10ERR_UNU_SECKEY : G10ERR_UNU_PUBKEY;
+ rc = want_secret? GPG_ERR_UNUSABLE_SECKEY : GPG_ERR_UNUSABLE_PUBKEY;
else if (gpg_err_code (rc) == GPG_ERR_NOT_FOUND)
- rc = want_secret? G10ERR_NO_SECKEY : G10ERR_NO_PUBKEY;
+ rc = want_secret? GPG_ERR_NO_SECKEY : GPG_ERR_NO_PUBKEY;
release_kbnode (ctx->keyblock);
ctx->keyblock = NULL;
@@ -3013,7 +3016,7 @@ have_secret_key_with_kid (u32 *keyid)
err = keydb_get_keyblock (kdbhd, &keyblock);
if (err)
{
- log_error (_("error reading keyblock: %s\n"), g10_errstr (err));
+ log_error (_("error reading keyblock: %s\n"), gpg_strerror (err));
break;
}
diff --git a/g10/gpg.c b/g10/gpg.c
index 73de511da..2047e306d 100644
--- a/g10/gpg.c
+++ b/g10/gpg.c
@@ -3529,7 +3529,8 @@ main (int argc, char **argv)
break;
}
if (rc)
- log_error (_("failed to initialize the TrustDB: %s\n"), g10_errstr(rc));
+ log_error (_("failed to initialize the TrustDB: %s\n"),
+ gpg_strerror (rc));
#endif /*!NO_TRUST_MODELS*/
switch (cmd)
@@ -3597,14 +3598,14 @@ main (int argc, char **argv)
wrong_args(_("--store [filename]"));
if( (rc = encrypt_store(fname)) )
log_error ("storing '%s' failed: %s\n",
- print_fname_stdin(fname),g10_errstr(rc) );
+ print_fname_stdin(fname),gpg_strerror (rc) );
break;
case aSym: /* encrypt the given file only with the symmetric cipher */
if( argc > 1 )
wrong_args(_("--symmetric [filename]"));
if( (rc = encrypt_symmetric(fname)) )
log_error (_("symmetric encryption of '%s' failed: %s\n"),
- print_fname_stdin(fname),g10_errstr(rc) );
+ print_fname_stdin(fname),gpg_strerror (rc) );
break;
case aEncr: /* encrypt the given file */
@@ -3616,7 +3617,7 @@ main (int argc, char **argv)
wrong_args(_("--encrypt [filename]"));
if( (rc = encrypt_crypt (ctrl, -1, fname, remusr, 0, NULL, -1)) )
log_error("%s: encryption failed: %s\n",
- print_fname_stdin(fname), g10_errstr(rc) );
+ print_fname_stdin(fname), gpg_strerror (rc) );
}
break;
@@ -3637,7 +3638,7 @@ main (int argc, char **argv)
{
if( (rc = encrypt_crypt (ctrl, -1, fname, remusr, 1, NULL, -1)) )
log_error("%s: encryption failed: %s\n",
- print_fname_stdin(fname), g10_errstr(rc) );
+ print_fname_stdin(fname), gpg_strerror (rc) );
}
break;
@@ -3656,7 +3657,7 @@ main (int argc, char **argv)
}
}
if( (rc = sign_file (ctrl, sl, detached_sig, locusr, 0, NULL, NULL)) )
- log_error("signing failed: %s\n", g10_errstr(rc) );
+ log_error("signing failed: %s\n", gpg_strerror (rc) );
free_strlist(sl);
break;
@@ -3671,7 +3672,7 @@ main (int argc, char **argv)
sl = NULL;
if ((rc = sign_file (ctrl, sl, detached_sig, locusr, 1, remusr, NULL)))
log_error("%s: sign+encrypt failed: %s\n",
- print_fname_stdin(fname), g10_errstr(rc) );
+ print_fname_stdin(fname), gpg_strerror (rc) );
free_strlist(sl);
break;
@@ -3696,7 +3697,7 @@ main (int argc, char **argv)
if ((rc = sign_file (ctrl, sl, detached_sig, locusr,
2, remusr, NULL)))
log_error("%s: symmetric+sign+encrypt failed: %s\n",
- print_fname_stdin(fname), g10_errstr(rc) );
+ print_fname_stdin(fname), gpg_strerror (rc) );
free_strlist(sl);
}
break;
@@ -3707,7 +3708,7 @@ main (int argc, char **argv)
rc = sign_symencrypt_file (fname, locusr);
if (rc)
log_error("%s: sign+symmetric failed: %s\n",
- print_fname_stdin(fname), g10_errstr(rc) );
+ print_fname_stdin(fname), gpg_strerror (rc) );
break;
case aClearsign: /* make a clearsig */
@@ -3715,19 +3716,19 @@ main (int argc, char **argv)
wrong_args(_("--clearsign [filename]"));
if( (rc = clearsign_file(fname, locusr, NULL)) )
log_error("%s: clearsign failed: %s\n",
- print_fname_stdin(fname), g10_errstr(rc) );
+ print_fname_stdin(fname), gpg_strerror (rc) );
break;
case aVerify:
if (multifile)
{
if ((rc = verify_files (ctrl, argc, argv)))
- log_error("verify files failed: %s\n", g10_errstr(rc) );
+ log_error("verify files failed: %s\n", gpg_strerror (rc) );
}
else
{
if ((rc = verify_signatures (ctrl, argc, argv)))
- log_error("verify signatures failed: %s\n", g10_errstr(rc) );
+ log_error("verify signatures failed: %s\n", gpg_strerror (rc) );
}
break;
@@ -3739,7 +3740,7 @@ main (int argc, char **argv)
if( argc > 1 )
wrong_args(_("--decrypt [filename]"));
if( (rc = decrypt_message (ctrl, fname) ))
- log_error("decrypt_message failed: %s\n", g10_errstr(rc) );
+ log_error("decrypt_message failed: %s\n", gpg_strerror (rc) );
}
break;
@@ -3912,11 +3913,11 @@ main (int argc, char **argv)
if(rc)
{
if(cmd==aSendKeys)
- log_error(_("keyserver send failed: %s\n"),g10_errstr(rc));
+ log_error(_("keyserver send failed: %s\n"),gpg_strerror (rc));
else if(cmd==aRecvKeys)
- log_error(_("keyserver receive failed: %s\n"),g10_errstr(rc));
+ log_error(_("keyserver receive failed: %s\n"),gpg_strerror (rc));
else
- log_error(_("key export failed: %s\n"),g10_errstr(rc));
+ log_error(_("key export failed: %s\n"),gpg_strerror (rc));
}
free_strlist(sl);
break;
@@ -3937,7 +3938,7 @@ main (int argc, char **argv)
append_to_strlist2( &sl, *argv, utf8_strings );
rc = keyserver_refresh (ctrl, sl);
if(rc)
- log_error(_("keyserver refresh failed: %s\n"),g10_errstr(rc));
+ log_error(_("keyserver refresh failed: %s\n"),gpg_strerror (rc));
free_strlist(sl);
break;
@@ -3947,7 +3948,7 @@ main (int argc, char **argv)
append_to_strlist2( &sl, *argv, utf8_strings );
rc = keyserver_fetch (ctrl, sl);
if(rc)
- log_error("key fetch failed: %s\n",g10_errstr(rc));
+ log_error("key fetch failed: %s\n",gpg_strerror (rc));
free_strlist(sl);
break;
@@ -3988,7 +3989,7 @@ main (int argc, char **argv)
wrong_args("--dearmor [file]");
rc = dearmor_file( argc? *argv: NULL );
if( rc )
- log_error(_("dearmoring failed: %s\n"), g10_errstr(rc));
+ log_error(_("dearmoring failed: %s\n"), gpg_strerror (rc));
break;
case aEnArmor:
@@ -3996,7 +3997,7 @@ main (int argc, char **argv)
wrong_args("--enarmor [file]");
rc = enarmor_file( argc? *argv: NULL );
if( rc )
- log_error(_("enarmoring failed: %s\n"), g10_errstr(rc));
+ log_error(_("enarmoring failed: %s\n"), gpg_strerror (rc));
break;
@@ -4235,7 +4236,7 @@ main (int argc, char **argv)
}
rc = proc_packets (ctrl, NULL, a );
if( rc )
- log_error("processing message failed: %s\n", g10_errstr(rc) );
+ log_error("processing message failed: %s\n", gpg_strerror (rc));
iobuf_close(a);
}
break;
diff --git a/g10/gpg.h b/g10/gpg.h
index ce4d253dc..accec248c 100644
--- a/g10/gpg.h
+++ b/g10/gpg.h
@@ -42,15 +42,6 @@
#define MAX_FINGERPRINT_LEN 20
-
-/*
- Macros formerly in cipher.h
- */
-
-
-
-
-
/*
Forward declarations.
*/
@@ -81,59 +72,4 @@ struct server_control_s
-
-
-/*
- Compatibility stuff to be faded out over time.
- */
-
-/* Simple wrappers. */
-#define g10_errstr(a) gpg_strerror ((a))
-
-
-/* Mapping of the old error codes to the gpg-error ones. Fixme: This
- is just a temporary solution: We need to do all these gpg_error()
- calls in the code. */
-#define G10ERR_BAD_KEY GPG_ERR_BAD_KEY
-#define G10ERR_BAD_PASS GPG_ERR_BAD_PASS
-#define G10ERR_BAD_PUBKEY GPG_ERR_BAD_PUBKEY
-#define G10ERR_BAD_SIGN GPG_ERR_BAD_SIGNATURE
-#define G10ERR_BAD_URI GPG_ERR_BAD_URI
-#define G10ERR_CHECKSUM GPG_ERR_CHECKSUM
-#define G10ERR_CIPHER_ALGO GPG_ERR_CIPHER_ALGO
-#define G10ERR_CLOSE_FILE GPG_ERR_CLOSE_FILE
-#define G10ERR_COMPR_ALGO GPG_ERR_COMPR_ALGO
-#define G10ERR_CREATE_FILE GPG_ERR_CREATE_FILE
-#define G10ERR_DIGEST_ALGO GPG_ERR_DIGEST_ALGO
-#define G10ERR_FILE_EXISTS GPG_ERR_EEXIST
-#define G10ERR_GENERAL GPG_ERR_GENERAL
-#define G10ERR_INV_ARG GPG_ERR_INV_ARG
-#define G10ERR_INV_KEYRING GPG_ERR_INV_KEYRING
-#define G10ERR_INV_USER_ID GPG_ERR_INV_USER_ID
-#define G10ERR_INVALID_ARMOR GPG_ERR_INV_ARMOR
-#define G10ERR_INVALID_PACKET GPG_ERR_INV_PACKET
-#define G10ERR_KEYRING_OPEN GPG_ERR_KEYRING_OPEN
-#define G10ERR_KEYSERVER GPG_ERR_KEYSERVER
-#define G10ERR_NO_DATA GPG_ERR_NO_DATA
-#define G10ERR_NO_PUBKEY GPG_ERR_NO_PUBKEY
-#define G10ERR_NO_SECKEY GPG_ERR_NO_SECKEY
-#define G10ERR_NO_USER_ID GPG_ERR_NO_USER_ID
-#define G10ERR_NOT_PROCESSED GPG_ERR_NOT_PROCESSED
-#define G10ERR_OPEN_FILE GPG_ERR_OPEN_FILE
-#define G10ERR_PASSPHRASE GPG_ERR_PASSPHRASE
-#define G10ERR_PUBKEY_ALGO GPG_ERR_PUBKEY_ALGO
-#define G10ERR_READ_FILE GPG_ERR_READ_FILE
-#define G10ERR_RENAME_FILE GPG_ERR_RENAME_FILE
-#define G10ERR_RESOURCE_LIMIT GPG_ERR_RESOURCE_LIMIT
-#define G10ERR_SIG_CLASS GPG_ERR_SIG_CLASS
-#define G10ERR_TIME_CONFLICT GPG_ERR_TIME_CONFLICT
-#define G10ERR_TRUSTDB GPG_ERR_TRUSTDB
-#define G10ERR_UNEXPECTED GPG_ERR_UNEXPECTED
-#define G10ERR_UNKNOWN_PACKET GPG_ERR_UNKNOWN_PACKET
-#define G10ERR_UNSUPPORTED GPG_ERR_UNSUPPORTED
-#define G10ERR_UNU_PUBKEY GPG_ERR_UNUSABLE_PUBKEY
-#define G10ERR_UNU_SECKEY GPG_ERR_UNUSABLE_SECKEY
-#define G10ERR_WRONG_SECKEY GPG_ERR_WRONG_SECKEY
-
-
#endif /*GNUPG_G10_GPG_H*/
diff --git a/g10/gpgv.c b/g10/gpgv.c
index 7bba53501..f09b5da87 100644
--- a/g10/gpgv.c
+++ b/g10/gpgv.c
@@ -214,7 +214,7 @@ main( int argc, char **argv )
ctrl = xcalloc (1, sizeof *ctrl);
if ((rc = verify_signatures (ctrl, argc, argv)))
- log_error("verify signatures failed: %s\n", g10_errstr(rc) );
+ log_error("verify signatures failed: %s\n", gpg_strerror (rc) );
xfree (ctrl);
@@ -378,7 +378,7 @@ get_session_key (PKT_pubkey_enc *k, DEK *dek)
{
(void)k;
(void)dek;
- return G10ERR_GENERAL;
+ return GPG_ERR_GENERAL;
}
/* Stub: */
@@ -387,7 +387,7 @@ get_override_session_key (DEK *dek, const char *string)
{
(void)dek;
(void)string;
- return G10ERR_GENERAL;
+ return GPG_ERR_GENERAL;
}
/* Stub: */
@@ -398,7 +398,7 @@ decrypt_data (ctrl_t ctrl, void *procctx, PKT_encrypted *ed, DEK *dek)
(void)procctx;
(void)ed;
(void)dek;
- return G10ERR_GENERAL;
+ return GPG_ERR_GENERAL;
}
@@ -419,7 +419,7 @@ check_secret_key (PKT_public_key *pk, int n)
{
(void)pk;
(void)n;
- return G10ERR_GENERAL;
+ return GPG_ERR_GENERAL;
}
/* Stub:
diff --git a/g10/import.c b/g10/import.c
index 4ae913576..56121dbb1 100644
--- a/g10/import.c
+++ b/g10/import.c
@@ -228,7 +228,7 @@ import_keys_internal (ctrl_t ctrl, iobuf_t inp, char **fnames, int nnames,
iobuf_ioctl (NULL, IOBUF_IOCTL_INVALIDATE_CACHE, 0, (char*)fname);
if (rc)
log_error ("import from '%s' failed: %s\n",
- fname, g10_errstr(rc) );
+ fname, gpg_strerror (rc) );
}
if (!fname)
break;
@@ -361,8 +361,8 @@ import (ctrl_t ctrl, IOBUF inp, const char* fname,struct stats_s *stats,
stats->v3keys += v3keys;
if (rc == -1)
rc = 0;
- else if (rc && gpg_err_code (rc) != G10ERR_INV_KEYRING)
- log_error (_("error reading '%s': %s\n"), fname, g10_errstr(rc));
+ else if (rc && gpg_err_code (rc) != GPG_ERR_INV_KEYRING)
+ log_error (_("error reading '%s': %s\n"), fname, gpg_strerror (rc));
return rc;
}
@@ -409,7 +409,7 @@ import_old_secring (ctrl_t ctrl, const char *fname)
import_release_stats_handle (stats);
if (err == -1)
err = 0;
- else if (err && gpg_err_code (err) != G10ERR_INV_KEYRING)
+ else if (err && gpg_err_code (err) != GPG_ERR_INV_KEYRING)
log_error (_("error reading '%s': %s\n"), fname, gpg_strerror (err));
else if (err)
log_error ("import from '%s' failed: %s\n", fname, gpg_strerror (err));
@@ -562,8 +562,8 @@ read_block( IOBUF a, PACKET **pending_pkt, kbnode_t *ret_root, int *r_v3keys)
; /* Do not show a diagnostic. */
else
{
- log_error("read_block: read error: %s\n", g10_errstr(rc) );
- rc = G10ERR_INV_KEYRING;
+ log_error("read_block: read error: %s\n", gpg_strerror (rc) );
+ rc = GPG_ERR_INV_KEYRING;
goto ready;
}
free_packet( pkt );
@@ -596,7 +596,7 @@ read_block( IOBUF a, PACKET **pending_pkt, kbnode_t *ret_root, int *r_v3keys)
case PKT_COMPRESSED:
if (check_compress_algo (pkt->pkt.compressed->algorithm))
{
- rc = G10ERR_COMPR_ALGO;
+ rc = GPG_ERR_COMPR_ALGO;
goto ready;
}
else
@@ -1057,11 +1057,12 @@ import_one (ctrl_t ctrl,
/* Do we have this key already in one of our pubrings ? */
pk_orig = xmalloc_clear( sizeof *pk_orig );
rc = get_pubkey_byfprint_fast (pk_orig, fpr2, fpr2len);
- if (rc && rc != G10ERR_NO_PUBKEY && rc != G10ERR_UNU_PUBKEY )
+ if (rc && gpg_err_code (rc) != GPG_ERR_NO_PUBKEY
+ && gpg_err_code (rc) != GPG_ERR_UNUSABLE_PUBKEY )
{
if (!silent)
log_error (_("key %s: public key not found: %s\n"),
- keystr(keyid), g10_errstr(rc));
+ keystr(keyid), gpg_strerror (rc));
}
else if ( rc && (opt.import_options&IMPORT_MERGE_ONLY) )
{
@@ -1077,9 +1078,9 @@ import_one (ctrl_t ctrl,
rc = keydb_locate_writable (hd, NULL);
if (rc)
{
- log_error (_("no writable keyring found: %s\n"), g10_errstr (rc));
+ log_error (_("no writable keyring found: %s\n"), gpg_strerror (rc));
keydb_release (hd);
- return G10ERR_GENERAL;
+ return GPG_ERR_GENERAL;
}
if (opt.verbose > 1 )
log_info (_("writing to '%s'\n"), keydb_get_resource_name (hd) );
@@ -1087,7 +1088,7 @@ import_one (ctrl_t ctrl,
rc = keydb_insert_keyblock (hd, keyblock );
if (rc)
log_error (_("error writing keyring '%s': %s\n"),
- keydb_get_resource_name (hd), g10_errstr(rc));
+ keydb_get_resource_name (hd), gpg_strerror (rc));
else if (!(opt.import_options & IMPORT_KEEP_OWNERTTRUST))
{
/* This should not be possible since we delete the
@@ -1142,7 +1143,7 @@ import_one (ctrl_t ctrl,
if (rc )
{
log_error (_("key %s: can't locate original keyblock: %s\n"),
- keystr(keyid), g10_errstr(rc));
+ keystr(keyid), gpg_strerror (rc));
keydb_release (hd);
goto leave;
}
@@ -1150,7 +1151,7 @@ import_one (ctrl_t ctrl,
if (rc)
{
log_error (_("key %s: can't read original keyblock: %s\n"),
- keystr(keyid), g10_errstr(rc));
+ keystr(keyid), gpg_strerror (rc));
keydb_release (hd);
goto leave;
}
@@ -1183,7 +1184,7 @@ import_one (ctrl_t ctrl,
rc = keydb_update_keyblock (hd, keyblock_orig);
if (rc)
log_error (_("error writing keyring '%s': %s\n"),
- keydb_get_resource_name (hd), g10_errstr(rc) );
+ keydb_get_resource_name (hd), gpg_strerror (rc) );
else if (non_self)
revalidation_mark ();
@@ -1802,7 +1803,7 @@ import_revoke_cert( const char *fname, kbnode_t node, struct stats_s *stats )
pk = xmalloc_clear( sizeof *pk );
rc = get_pubkey( pk, keyid );
- if (rc == G10ERR_NO_PUBKEY )
+ if (gpg_err_code (rc) == GPG_ERR_NO_PUBKEY )
{
log_error(_("key %s: no public key -"
" can't apply revocation certificate\n"), keystr(keyid));
@@ -1812,7 +1813,7 @@ import_revoke_cert( const char *fname, kbnode_t node, struct stats_s *stats )
else if (rc )
{
log_error(_("key %s: public key not found: %s\n"),
- keystr(keyid), g10_errstr(rc));
+ keystr(keyid), gpg_strerror (rc));
goto leave;
}
@@ -1830,14 +1831,14 @@ import_revoke_cert( const char *fname, kbnode_t node, struct stats_s *stats )
if (rc)
{
log_error (_("key %s: can't locate original keyblock: %s\n"),
- keystr(keyid), g10_errstr(rc));
+ keystr(keyid), gpg_strerror (rc));
goto leave;
}
rc = keydb_get_keyblock (hd, &keyblock );
if (rc)
{
log_error (_("key %s: can't read original keyblock: %s\n"),
- keystr(keyid), g10_errstr(rc));
+ keystr(keyid), gpg_strerror (rc));
goto leave;
}
@@ -1848,7 +1849,7 @@ import_revoke_cert( const char *fname, kbnode_t node, struct stats_s *stats )
if (rc )
{
log_error( _("key %s: invalid revocation certificate"
- ": %s - rejected\n"), keystr(keyid), g10_errstr(rc));
+ ": %s - rejected\n"), keystr(keyid), gpg_strerror (rc));
goto leave;
}
@@ -1872,7 +1873,7 @@ import_revoke_cert( const char *fname, kbnode_t node, struct stats_s *stats )
rc = keydb_update_keyblock (hd, keyblock );
if (rc)
log_error (_("error writing keyring '%s': %s\n"),
- keydb_get_resource_name (hd), g10_errstr(rc) );
+ keydb_get_resource_name (hd), gpg_strerror (rc) );
keydb_release (hd);
hd = NULL;
@@ -1972,7 +1973,7 @@ chk_self_sigs (const char *fname, kbnode_t keyblock,
char *p = utf8_to_native
(unode->pkt->pkt.user_id->name,
strlen (unode->pkt->pkt.user_id->name),0);
- log_info (gpg_err_code(rc) == G10ERR_PUBKEY_ALGO ?
+ log_info (gpg_err_code(rc) == GPG_ERR_PUBKEY_ALGO ?
_("key %s: unsupported public key "
"algorithm on user ID \"%s\"\n"):
_("key %s: invalid self-signature "
@@ -1991,7 +1992,7 @@ chk_self_sigs (const char *fname, kbnode_t keyblock,
if ( rc )
{
if (opt.verbose)
- log_info (gpg_err_code (rc) == G10ERR_PUBKEY_ALGO ?
+ log_info (gpg_err_code (rc) == GPG_ERR_PUBKEY_ALGO ?
_("key %s: unsupported public key algorithm\n"):
_("key %s: invalid direct key signature\n"),
keystr (keyid));
@@ -2017,7 +2018,7 @@ chk_self_sigs (const char *fname, kbnode_t keyblock,
if ( rc )
{
if (opt.verbose)
- log_info (gpg_err_code (rc) == G10ERR_PUBKEY_ALGO ?
+ log_info (gpg_err_code (rc) == GPG_ERR_PUBKEY_ALGO ?
_("key %s: unsupported public key"
" algorithm\n"):
_("key %s: invalid subkey binding\n"),
@@ -2068,7 +2069,7 @@ chk_self_sigs (const char *fname, kbnode_t keyblock,
if ( rc )
{
if(opt.verbose)
- log_info (gpg_err_code (rc) == G10ERR_PUBKEY_ALGO ?
+ log_info (gpg_err_code (rc) == GPG_ERR_PUBKEY_ALGO ?
_("key %s: unsupported public"
" key algorithm\n"):
_("key %s: invalid subkey revocation\n"),
@@ -2214,7 +2215,7 @@ delete_inv_parts( const char *fname, kbnode_t keyblock,
if(opt.verbose)
log_info( _("key %s: invalid revocation"
" certificate: %s - skipped\n"),
- keystr(keyid), g10_errstr(rc));
+ keystr(keyid), gpg_strerror (rc));
delete_kbnode( node );
}
}
@@ -2417,7 +2418,8 @@ revocation_present (ctrl_t ctrl, kbnode_t keyblock)
rc=get_pubkey_byfprint_fast (NULL,sig->revkey[idx]->fpr,
MAX_FINGERPRINT_LEN);
- if(rc==G10ERR_NO_PUBKEY || rc==G10ERR_UNU_PUBKEY)
+ if (gpg_err_code (rc) == GPG_ERR_NO_PUBKEY
+ || gpg_err_code (rc) == GPG_ERR_UNUSABLE_PUBKEY)
{
char *tempkeystr=xstrdup(keystr_from_pk(pk));
@@ -2440,7 +2442,8 @@ revocation_present (ctrl_t ctrl, kbnode_t keyblock)
MAX_FINGERPRINT_LEN);
}
- if(rc==G10ERR_NO_PUBKEY || rc==G10ERR_UNU_PUBKEY)
+ if (gpg_err_code (rc) == GPG_ERR_NO_PUBKEY
+ || gpg_err_code (rc) == GPG_ERR_UNUSABLE_PUBKEY)
log_info(_("WARNING: key %s may be revoked:"
" revocation key %s not present.\n"),
tempkeystr,keystr(keyid));
diff --git a/g10/keydb.c b/g10/keydb.c
index a578c7cb7..263b504e5 100644
--- a/g10/keydb.c
+++ b/g10/keydb.c
@@ -1225,7 +1225,7 @@ keydb_locate_writable (KEYDB_HANDLE hd, const char *reserved)
(void)reserved;
if (!hd)
- return G10ERR_INV_ARG;
+ return GPG_ERR_INV_ARG;
rc = keydb_search_reset (hd); /* this does reset hd->current */
if (rc)
@@ -1293,7 +1293,7 @@ keydb_rebuild_caches (int noisy)
rc = keyring_rebuild_cache (all_resources[i].token,noisy);
if (rc)
log_error (_("failed to rebuild keyring cache: %s\n"),
- g10_errstr (rc));
+ gpg_strerror (rc));
break;
case KEYDB_RESOURCE_TYPE_KEYBOX:
/* N/A. */
diff --git a/g10/keyedit.c b/g10/keyedit.c
index e2da61bdb..f283e5538 100644
--- a/g10/keyedit.c
+++ b/g10/keyedit.c
@@ -128,20 +128,21 @@ print_and_check_one_sig_colon (KBNODE keyblock, KBNODE node,
/* TODO: Make sure a cached sig record here still has the pk that
issued it. See also keylist.c:list_keyblock_print */
- switch ((rc = check_key_signature (keyblock, node, is_selfsig)))
+ rc = check_key_signature (keyblock, node, is_selfsig);
+ switch (gpg_err_code (rc))
{
case 0:
node->flag &= ~(NODFLG_BADSIG | NODFLG_NOKEY | NODFLG_SIGERR);
sigrc = '!';
break;
- case G10ERR_BAD_SIGN:
+ case GPG_ERR_BAD_SIGNATURE:
node->flag = NODFLG_BADSIG;
sigrc = '-';
if (inv_sigs)
++ * inv_sigs;
break;
- case G10ERR_NO_PUBKEY:
- case G10ERR_UNU_PUBKEY:
+ case GPG_ERR_NO_PUBKEY:
+ case GPG_ERR_UNUSABLE_PUBKEY:
node->flag = NODFLG_NOKEY;
sigrc = '?';
if (no_key)
@@ -199,20 +200,21 @@ print_and_check_one_sig (KBNODE keyblock, KBNODE node,
/* TODO: Make sure a cached sig record here still has the pk that
issued it. See also keylist.c:list_keyblock_print */
- switch ((rc = check_key_signature (keyblock, node, is_selfsig)))
+ rc = check_key_signature (keyblock, node, is_selfsig);
+ switch (gpg_err_code (rc))
{
case 0:
node->flag &= ~(NODFLG_BADSIG | NODFLG_NOKEY | NODFLG_SIGERR);
sigrc = '!';
break;
- case G10ERR_BAD_SIGN:
+ case GPG_ERR_BAD_SIGNATURE:
node->flag = NODFLG_BADSIG;
sigrc = '-';
if (inv_sigs)
++ * inv_sigs;
break;
- case G10ERR_NO_PUBKEY:
- case G10ERR_UNU_PUBKEY:
+ case GPG_ERR_NO_PUBKEY:
+ case GPG_ERR_UNUSABLE_PUBKEY:
node->flag = NODFLG_NOKEY;
sigrc = '?';
if (no_key)
@@ -245,7 +247,7 @@ print_and_check_one_sig (KBNODE keyblock, KBNODE node,
tty_printf (" %s", expirestr_from_sig (sig));
tty_printf (" ");
if (sigrc == '%')
- tty_printf ("[%s] ", g10_errstr (rc));
+ tty_printf ("[%s] ", gpg_strerror (rc));
else if (sigrc == '?')
;
else if (*is_selfsig)
@@ -1039,7 +1041,7 @@ sign_uids (estream_t fp,
NULL);
if (rc)
{
- log_error (_("signing failed: %s\n"), g10_errstr (rc));
+ log_error (_("signing failed: %s\n"), gpg_strerror (rc));
goto leave;
}
@@ -1883,11 +1885,11 @@ keyedit_menu (ctrl_t ctrl, const char *username, strlist_t locusr,
iobuf_ioctl (NULL, IOBUF_IOCTL_INVALIDATE_CACHE, 0, (char *) fname);
if (!err && pkt->pkttype != PKT_SECRET_KEY
&& pkt->pkttype != PKT_SECRET_SUBKEY)
- err = G10ERR_NO_SECKEY;
+ err = GPG_ERR_NO_SECKEY;
if (err)
{
tty_printf (_("Error reading backup key from '%s': %s\n"),
- fname, g10_errstr (err));
+ fname, gpg_strerror (err));
free_packet (pkt);
xfree (pkt);
break;
@@ -2198,7 +2200,7 @@ keyedit_menu (ctrl_t ctrl, const char *username, strlist_t locusr,
err = keydb_update_keyblock (kdbhd, keyblock);
if (err)
{
- log_error (_("update failed: %s\n"), g10_errstr (err));
+ log_error (_("update failed: %s\n"), gpg_strerror (err));
break;
}
}
@@ -3278,7 +3280,7 @@ menu_adduid (KBNODE pub_keyblock, int photo, const char *photo_name)
keygen_add_std_prefs, pk, NULL);
if (err)
{
- log_error ("signing failed: %s\n", g10_errstr (err));
+ log_error ("signing failed: %s\n", gpg_strerror (err));
free_user_id (uid);
return 0;
}
@@ -3577,7 +3579,7 @@ menu_addrevoker (ctrl_t ctrl, kbnode_t pub_keyblock, int sensitive)
if (rc)
{
log_error (_("key \"%s\" not found: %s\n"), answer,
- g10_errstr (rc));
+ gpg_strerror (rc));
xfree (answer);
continue;
}
@@ -3662,7 +3664,7 @@ menu_addrevoker (ctrl_t ctrl, kbnode_t pub_keyblock, int sensitive)
keygen_add_revkey, &revkey, NULL);
if (rc)
{
- log_error ("signing failed: %s\n", g10_errstr (rc));
+ log_error ("signing failed: %s\n", gpg_strerror (rc));
goto fail;
}
@@ -3766,7 +3768,7 @@ menu_expire (KBNODE pub_keyblock)
if (rc)
{
log_error ("make_keysig_packet failed: %s\n",
- g10_errstr (rc));
+ gpg_strerror (rc));
return 0;
}
@@ -3882,13 +3884,13 @@ menu_backsign (KBNODE pub_keyblock)
else
{
log_error ("update_keysig_packet failed: %s\n",
- g10_errstr (rc));
+ gpg_strerror (rc));
break;
}
}
else
{
- log_error ("make_backsig failed: %s\n", g10_errstr (rc));
+ log_error ("make_backsig failed: %s\n", gpg_strerror (rc));
break;
}
}
@@ -4024,7 +4026,7 @@ menu_set_primary_uid (KBNODE pub_keyblock)
if (rc)
{
log_error ("update_keysig_packet failed: %s\n",
- g10_errstr (rc));
+ gpg_strerror (rc));
return 0;
}
/* replace the packet */
@@ -4113,7 +4115,7 @@ menu_set_preferences (KBNODE pub_keyblock)
if (rc)
{
log_error ("update_keysig_packet failed: %s\n",
- g10_errstr (rc));
+ gpg_strerror (rc));
return 0;
}
/* replace the packet */
@@ -4248,7 +4250,7 @@ menu_set_keyserver_url (const char *url, KBNODE pub_keyblock)
if (rc)
{
log_error ("update_keysig_packet failed: %s\n",
- g10_errstr (rc));
+ gpg_strerror (rc));
xfree (uri);
return 0;
}
@@ -4447,7 +4449,7 @@ menu_set_notation (const char *string, KBNODE pub_keyblock)
if (rc)
{
log_error ("update_keysig_packet failed: %s\n",
- g10_errstr (rc));
+ gpg_strerror (rc));
free_notation (notation);
xfree (user);
return 0;
@@ -4953,7 +4955,7 @@ reloop: /* (must use this, because we are modifing the list) */
free_public_key (signerkey);
if (rc)
{
- log_error (_("signing failed: %s\n"), g10_errstr (rc));
+ log_error (_("signing failed: %s\n"), gpg_strerror (rc));
release_revocation_reason_info (reason);
return changed;
}
@@ -5044,7 +5046,7 @@ menu_revuid (KBNODE pub_keyblock)
sign_mk_attrib, &attrib, NULL);
if (rc)
{
- log_error (_("signing failed: %s\n"), g10_errstr (rc));
+ log_error (_("signing failed: %s\n"), gpg_strerror (rc));
goto leave;
}
else
@@ -5108,7 +5110,7 @@ menu_revkey (KBNODE pub_keyblock)
revocation_reason_build_cb, reason, NULL);
if (rc)
{
- log_error (_("signing failed: %s\n"), g10_errstr (rc));
+ log_error (_("signing failed: %s\n"), gpg_strerror (rc));
goto scram;
}
@@ -5169,7 +5171,7 @@ menu_revsubkey (KBNODE pub_keyblock)
NULL);
if (rc)
{
- log_error (_("signing failed: %s\n"), g10_errstr (rc));
+ log_error (_("signing failed: %s\n"), gpg_strerror (rc));
release_revocation_reason_info (reason);
return changed;
}
diff --git a/g10/keygen.c b/g10/keygen.c
index de45d2fa9..aaccae4fd 100644
--- a/g10/keygen.c
+++ b/g10/keygen.c
@@ -809,7 +809,8 @@ make_backsig (PKT_signature *sig, PKT_public_key *pk,
err = make_keysig_packet (&backsig, pk, NULL, sub_pk, sub_psk, 0x19,
0, timestamp, 0, NULL, NULL, cache_nonce);
if (err)
- log_error ("make_keysig_packet failed for backsig: %s\n", g10_errstr(err));
+ log_error ("make_keysig_packet failed for backsig: %s\n",
+ gpg_strerror (err));
else
{
/* Get it into a binary packed form. */
@@ -822,7 +823,7 @@ make_backsig (PKT_signature *sig, PKT_public_key *pk,
err = build_packet (backsig_out, &backsig_pkt);
free_packet (&backsig_pkt);
if (err)
- log_error ("build_packet failed for backsig: %s\n", g10_errstr(err));
+ log_error ("build_packet failed for backsig: %s\n", gpg_strerror (err));
else
{
size_t pktlen = 0;
@@ -921,7 +922,7 @@ write_direct_sig (KBNODE root, PKT_public_key *psk,
keygen_add_revkey, revkey, cache_nonce);
if (err)
{
- log_error ("make_keysig_packet failed: %s\n", g10_errstr (err) );
+ log_error ("make_keysig_packet failed: %s\n", gpg_strerror (err) );
return err;
}
@@ -976,7 +977,7 @@ write_selfsigs (KBNODE root, PKT_public_key *psk,
keygen_add_std_prefs, pk, cache_nonce);
if (err)
{
- log_error ("make_keysig_packet failed: %s\n", g10_errstr (err));
+ log_error ("make_keysig_packet failed: %s\n", gpg_strerror (err));
return err;
}
@@ -1036,7 +1037,7 @@ write_keybinding (KBNODE root, PKT_public_key *pri_psk, PKT_public_key *sub_psk,
cache_nonce);
if (err)
{
- log_error ("make_keysig_packeto failed: %s\n", g10_errstr (err));
+ log_error ("make_keysig_packeto failed: %s\n", gpg_strerror (err));
return err;
}
@@ -4095,7 +4096,7 @@ do_generate_keypair (struct para_data_s *para,
{
err = write_keyblock (outctrl->pub.stream, pub_root);
if (err)
- log_error ("can't write public key: %s\n", g10_errstr (err));
+ log_error ("can't write public key: %s\n", gpg_strerror (err));
}
else if (!err) /* Write to the standard keyrings. */
{
@@ -4104,7 +4105,7 @@ do_generate_keypair (struct para_data_s *para,
err = keydb_locate_writable (pub_hd, NULL);
if (err)
log_error (_("no writable public keyring found: %s\n"),
- g10_errstr (err));
+ gpg_strerror (err));
if (!err && opt.verbose)
{
@@ -4117,7 +4118,7 @@ do_generate_keypair (struct para_data_s *para,
err = keydb_insert_keyblock (pub_hd, pub_root);
if (err)
log_error (_("error writing public keyring '%s': %s\n"),
- keydb_get_resource_name (pub_hd), g10_errstr(err));
+ keydb_get_resource_name (pub_hd), gpg_strerror (err));
}
keydb_release (pub_hd);
@@ -4167,9 +4168,9 @@ do_generate_keypair (struct para_data_s *para,
if (err)
{
if (opt.batch)
- log_error ("key generation failed: %s\n", g10_errstr(err) );
+ log_error ("key generation failed: %s\n", gpg_strerror (err) );
else
- tty_printf (_("Key generation failed: %s\n"), g10_errstr(err) );
+ tty_printf (_("Key generation failed: %s\n"), gpg_strerror (err) );
write_status_error (card? "card_key_generate":"key_generate", err);
print_status_key_not_created ( get_parameter_value (para, pHANDLE) );
}
@@ -4297,7 +4298,7 @@ generate_subkeypair (ctrl_t ctrl, kbnode_t keyblock)
xfree (hexgrip);
xfree (serialno);
if (err)
- log_error (_("Key generation failed: %s\n"), g10_errstr (err) );
+ log_error (_("Key generation failed: %s\n"), gpg_strerror (err) );
return err;
}
@@ -4394,7 +4395,7 @@ generate_card_subkeypair (kbnode_t pub_keyblock,
leave:
if (err)
- log_error (_("Key generation failed: %s\n"), g10_errstr(err) );
+ log_error (_("Key generation failed: %s\n"), gpg_strerror (err) );
else
write_status_text (STATUS_KEY_CREATED, "S");
release_parameter_list (para);
@@ -4416,7 +4417,7 @@ write_keyblock( IOBUF out, KBNODE node )
if( rc )
{
log_error("build_packet(%d) failed: %s\n",
- node->pkt->pkttype, g10_errstr(rc) );
+ node->pkt->pkttype, gpg_strerror (rc) );
return rc;
}
}
@@ -4561,7 +4562,7 @@ gen_card_key_with_backup (int algo, int keyno, int is_primary,
rc = save_unprotected_key_to_card (sk_unprotected, keyno);
if (rc)
{
- log_error (_("storing key onto card failed: %s\n"), g10_errstr (rc));
+ log_error (_("storing key onto card failed: %s\n"), gpg_strerror (rc));
free_secret_key (sk_unprotected);
free_secret_key (sk_protected);
write_status_errcode ("save_key_to_card", rc);
@@ -4629,7 +4630,7 @@ gen_card_key_with_backup (int algo, int keyno, int is_primary,
rc = build_packet (fp, pkt);
if (rc)
{
- log_error("build packet failed: %s\n", g10_errstr(rc) );
+ log_error("build packet failed: %s\n", gpg_strerror (rc));
iobuf_cancel (fp);
}
else
@@ -4727,7 +4728,7 @@ save_unprotected_key_to_card (PKT_public_key *sk, int keyno)
gcry_mpi_aprint (GCRYMPI_FMT_USG, &rsa_q, &rsa_q_len, sk->skey[4]);
if (!rsa_n || !rsa_e || !rsa_p || !rsa_q)
{
- rc = G10ERR_INV_ARG;
+ rc = GPG_ERR_INV_ARG;
goto leave;
}
diff --git a/g10/keylist.c b/g10/keylist.c
index 0255f00d8..daabc7dba 100644
--- a/g10/keylist.c
+++ b/g10/keylist.c
@@ -456,7 +456,7 @@ list_all (int secret, int mark_secret)
if (rc)
{
if (gpg_err_code (rc) != GPG_ERR_NOT_FOUND)
- log_error ("keydb_search_first failed: %s\n", g10_errstr (rc));
+ log_error ("keydb_search_first failed: %s\n", gpg_strerror (rc));
goto leave;
}
@@ -466,7 +466,7 @@ list_all (int secret, int mark_secret)
rc = keydb_get_keyblock (hd, &keyblock);
if (rc)
{
- log_error ("keydb_get_keyblock failed: %s\n", g10_errstr (rc));
+ log_error ("keydb_get_keyblock failed: %s\n", gpg_strerror (rc));
goto leave;
}
@@ -503,7 +503,7 @@ list_all (int secret, int mark_secret)
while (!(rc = keydb_search_next (hd)));
es_fflush (es_stdout);
if (rc && gpg_err_code (rc) != GPG_ERR_NOT_FOUND)
- log_error ("keydb_search_next failed: %s\n", g10_errstr (rc));
+ log_error ("keydb_search_next failed: %s\n", gpg_strerror (rc));
if (keydb_get_skipped_counter (hd))
log_info (_("Warning: %lu key(s) skipped due to their large size\n"),
keydb_get_skipped_counter (hd));
@@ -542,7 +542,7 @@ list_one (strlist_t names, int secret, int mark_secret)
rc = getkey_bynames (&ctx, NULL, names, secret, &keyblock);
if (rc)
{
- log_error ("error reading key: %s\n", g10_errstr (rc));
+ log_error ("error reading key: %s\n", gpg_strerror (rc));
get_pubkey_end (ctx);
return;
}
@@ -586,7 +586,7 @@ locate_one (ctrl_t ctrl, strlist_t names)
if (rc)
{
if (gpg_err_code (rc) != GPG_ERR_NO_PUBKEY)
- log_error ("error reading key: %s\n", g10_errstr (rc));
+ log_error ("error reading key: %s\n", gpg_strerror (rc));
}
else
{
@@ -1094,7 +1094,7 @@ list_keyblock_print (KBNODE keyblock, int secret, int fpr, void *opaque)
es_fprintf (es_stdout, " %s", expirestr_from_sig (sig));
es_fprintf (es_stdout, " ");
if (sigrc == '%')
- es_fprintf (es_stdout, "[%s] ", g10_errstr (rc));
+ es_fprintf (es_stdout, "[%s] ", gpg_strerror (rc));
else if (sigrc == '?')
;
else if (!opt.fast_list_mode)
@@ -1477,7 +1477,7 @@ list_keyblock_colon (KBNODE keyblock, int secret, int has_secret, int fpr)
es_fprintf (es_stdout, ":");
if (sigrc == '%')
- es_fprintf (es_stdout, "[%s] ", g10_errstr (rc));
+ es_fprintf (es_stdout, "[%s] ", gpg_strerror (rc));
else if (sigrc == '?')
;
else if (!opt.fast_list_mode)
diff --git a/g10/keyring.c b/g10/keyring.c
index a1936b3e0..7ac3478ad 100644
--- a/g10/keyring.c
+++ b/g10/keyring.c
@@ -309,7 +309,7 @@ keyring_lock (KEYRING_HANDLE hd, int yes)
kr->lockhd = dotlock_create (kr->fname, 0);
if (!kr->lockhd) {
log_info ("can't allocate lock for '%s'\n", kr->fname );
- rc = G10ERR_GENERAL;
+ rc = GPG_ERR_GENERAL;
}
}
}
@@ -324,7 +324,7 @@ keyring_lock (KEYRING_HANDLE hd, int yes)
;
else if (dotlock_take (kr->lockhd, -1) ) {
log_info ("can't lock '%s'\n", kr->fname );
- rc = G10ERR_GENERAL;
+ rc = GPG_ERR_GENERAL;
}
else
kr->is_locked = 1;
@@ -377,13 +377,13 @@ keyring_get_keyblock (KEYRING_HANDLE hd, KBNODE *ret_kb)
if (!a)
{
log_error(_("can't open '%s'\n"), hd->found.kr->fname);
- return G10ERR_KEYRING_OPEN;
+ return GPG_ERR_KEYRING_OPEN;
}
if (iobuf_seek (a, hd->found.offset) ) {
log_error ("can't seek '%s'\n", hd->found.kr->fname);
iobuf_close(a);
- return G10ERR_KEYRING_OPEN;
+ return GPG_ERR_KEYRING_OPEN;
}
pkt = xmalloc (sizeof *pkt);
@@ -393,15 +393,15 @@ keyring_get_keyblock (KEYRING_HANDLE hd, KBNODE *ret_kb)
save_mode = set_packet_list_mode(0);
while ((rc=parse_packet (a, pkt)) != -1) {
hd->found.n_packets++;
- if (rc == G10ERR_UNKNOWN_PACKET) {
+ if (gpg_err_code (rc) == GPG_ERR_UNKNOWN_PACKET) {
free_packet (pkt);
init_packet (pkt);
continue;
}
if (rc) {
log_error ("keyring_get_keyblock: read error: %s\n",
- g10_errstr(rc) );
- rc = G10ERR_INV_KEYRING;
+ gpg_strerror (rc) );
+ rc = GPG_ERR_INV_KEYRING;
break;
}
if (pkt->pkttype == PKT_COMPRESSED) {
@@ -494,7 +494,7 @@ keyring_get_keyblock (KEYRING_HANDLE hd, KBNODE *ret_kb)
/* Make sure that future search operations fail immediately when
* we know that we are working on a invalid keyring
*/
- if (rc == G10ERR_INV_KEYRING)
+ if (gpg_err_code (rc) == GPG_ERR_INV_KEYRING)
hd->current.error = rc;
return rc;
@@ -515,7 +515,7 @@ keyring_update_keyblock (KEYRING_HANDLE hd, KBNODE kb)
/* need to know the number of packets - do a dummy get_keyblock*/
rc = keyring_get_keyblock (hd, NULL);
if (rc) {
- log_error ("re-reading keyblock failed: %s\n", g10_errstr (rc));
+ log_error ("re-reading keyblock failed: %s\n", gpg_strerror (rc));
return rc;
}
if (!hd->found.n_packets)
@@ -567,7 +567,7 @@ keyring_insert_keyblock (KEYRING_HANDLE hd, KBNODE kb)
fname = hd->resource? hd->resource->fname:NULL;
if (!fname)
- return G10ERR_GENERAL;
+ return GPG_ERR_GENERAL;
/* Close this one otherwise we will lose the position for
* a next search. Fixme: it would be better to adjust the position
@@ -602,7 +602,7 @@ keyring_delete_keyblock (KEYRING_HANDLE hd)
/* need to know the number of packets - do a dummy get_keyblock*/
rc = keyring_get_keyblock (hd, NULL);
if (rc) {
- log_error ("re-reading keyblock failed: %s\n", g10_errstr (rc));
+ log_error ("re-reading keyblock failed: %s\n", gpg_strerror (rc));
return rc;
}
if (!hd->found.n_packets)
@@ -659,7 +659,7 @@ prepare_search (KEYRING_HANDLE hd)
if (hd->current.kr && !hd->current.eof) {
if ( !hd->current.iobuf )
- return G10ERR_GENERAL; /* position invalid after a modify */
+ return GPG_ERR_GENERAL; /* Position invalid after a modify. */
return 0; /* okay */
}
@@ -1087,7 +1087,7 @@ keyring_search (KEYRING_HANDLE hd, KEYDB_SEARCH_DESC *desc,
goto found;
break;
default:
- rc = G10ERR_INV_ARG;
+ rc = GPG_ERR_INV_ARG;
goto found;
}
}
@@ -1300,7 +1300,7 @@ write_keyblock (IOBUF fp, KBNODE keyblock)
if ( (rc = build_packet (fp, node->pkt) ))
{
log_error ("build_packet(%d) failed: %s\n",
- node->pkt->pkttype, g10_errstr(rc) );
+ node->pkt->pkttype, gpg_strerror (rc) );
return rc;
}
if (node->pkt->pkttype == PKT_SIGNATURE)
@@ -1391,7 +1391,7 @@ keyring_rebuild_cache (void *token,int noisy)
rc = keyring_get_keyblock (hd, &keyblock);
if (rc)
{
- log_error ("keyring_get_keyblock failed: %s\n", g10_errstr(rc));
+ log_error ("keyring_get_keyblock failed: %s\n", gpg_strerror (rc));
goto leave;
}
if ( keyblock->pkt->pkttype != PKT_PUBLIC_KEY)
@@ -1409,6 +1409,8 @@ keyring_rebuild_cache (void *token,int noisy)
goto leave;
}
+ log_debug ("keblock with version %d\n",
+ keyblock->pkt->pkt.public_key->version);
if (keyblock->pkt->pkt.public_key->version < 4)
{
/* We do not copy/cache v3 keys or any other unknown
@@ -1459,7 +1461,7 @@ keyring_rebuild_cache (void *token,int noisy)
rc = 0;
if (rc)
{
- log_error ("keyring_search failed: %s\n", g10_errstr(rc));
+ log_error ("keyring_search failed: %s\n", gpg_strerror (rc));
goto leave;
}
if(noisy || opt.verbose)
@@ -1541,7 +1543,7 @@ do_copy (int mode, const char *fname, KBNODE root,
while ( (node = walk_kbnode( root, &kbctx, 0 )) ) {
if( (rc = build_packet( newfp, node->pkt )) ) {
log_error("build_packet(%d) failed: %s\n",
- node->pkt->pkttype, g10_errstr(rc) );
+ node->pkt->pkttype, gpg_strerror (rc) );
iobuf_cancel(newfp);
return rc;
}
@@ -1573,7 +1575,7 @@ do_copy (int mode, const char *fname, KBNODE root,
rc = copy_all_packets (fp, newfp);
if( rc != -1 ) {
log_error("%s: copy to '%s' failed: %s\n",
- fname, tmpfname, g10_errstr(rc) );
+ fname, tmpfname, gpg_strerror (rc) );
iobuf_close(fp);
iobuf_cancel(newfp);
goto leave;
@@ -1586,7 +1588,7 @@ do_copy (int mode, const char *fname, KBNODE root,
rc = copy_some_packets( fp, newfp, start_offset );
if( rc ) { /* should never get EOF here */
log_error ("%s: copy to '%s' failed: %s\n",
- fname, tmpfname, g10_errstr(rc) );
+ fname, tmpfname, gpg_strerror (rc) );
iobuf_close(fp);
iobuf_cancel(newfp);
goto leave;
@@ -1596,7 +1598,7 @@ do_copy (int mode, const char *fname, KBNODE root,
rc = skip_some_packets( fp, n_packets );
if( rc ) {
log_error("%s: skipping %u packets failed: %s\n",
- fname, n_packets, g10_errstr(rc));
+ fname, n_packets, gpg_strerror (rc));
iobuf_close(fp);
iobuf_cancel(newfp);
goto leave;
@@ -1617,7 +1619,7 @@ do_copy (int mode, const char *fname, KBNODE root,
rc = copy_all_packets( fp, newfp );
if( rc != -1 ) {
log_error("%s: copy to '%s' failed: %s\n",
- fname, tmpfname, g10_errstr(rc) );
+ fname, tmpfname, gpg_strerror (rc) );
iobuf_close(fp);
iobuf_cancel(newfp);
goto leave;
diff --git a/g10/keyserver.c b/g10/keyserver.c
index 7d8075608..0530907a9 100644
--- a/g10/keyserver.c
+++ b/g10/keyserver.c
@@ -1257,7 +1257,7 @@ keyidlist(strlist_t users,KEYDB_SEARCH_DESC **klist,int *count,int fakev3)
rc = keydb_get_keyblock (kdbhd, &keyblock );
if( rc )
{
- log_error (_("error reading keyblock: %s\n"), g10_errstr(rc) );
+ log_error (_("error reading keyblock: %s\n"), gpg_strerror (rc) );
goto leave;
}
@@ -1414,7 +1414,7 @@ keyserver_refresh (ctrl_t ctrl, strlist_t users)
if(rc)
log_info(_("WARNING: unable to refresh key %s"
" via %s: %s\n"),keystr_from_desc(&desc[i]),
- keyserver->uri,g10_errstr(rc));
+ keyserver->uri,gpg_strerror (rc));
else
{
/* We got it, so mark it as NONE so we don't try and
@@ -1966,7 +1966,7 @@ keyserver_import_pka (ctrl_t ctrl,
const char *name,unsigned char **fpr,size_t *fpr_len)
{
char *uri;
- int rc = G10ERR_NO_PUBKEY;
+ int rc = GPG_ERR_NO_PUBKEY;
*fpr = xmalloc (20);
*fpr_len = 20;
@@ -2019,7 +2019,7 @@ keyserver_import_ldap (ctrl_t ctrl,
/* Parse out the domain */
domain=strrchr(name,'@');
if(!domain)
- return G10ERR_GENERAL;
+ return GPG_ERR_GENERAL;
domain++;
diff --git a/g10/mainproc.c b/g10/mainproc.c
index a66a99d4e..8ff84b738 100644
--- a/g10/mainproc.c
+++ b/g10/mainproc.c
@@ -256,7 +256,7 @@ symkey_decrypt_seskey (DEK *dek, byte *seskey, size_t slen)
{
log_error ( _("weird size for an encrypted session key (%d)\n"),
(int)slen);
- return G10ERR_BAD_KEY;
+ return GPG_ERR_BAD_KEY;
}
if (openpgp_cipher_open (&hd, dek->algo, GCRY_CIPHER_MODE_CFB, 1))
@@ -439,10 +439,10 @@ proc_pubkey_enc (CTX c, PACKET *pkt)
}
}
else
- result = G10ERR_NO_SECKEY;
+ result = GPG_ERR_NO_SECKEY;
}
else
- result = G10ERR_PUBKEY_ALGO;
+ result = GPG_ERR_PUBKEY_ALGO;
if (result == -1)
;
@@ -504,7 +504,7 @@ print_pkenc_list (struct kidlist_item *list, int failed)
free_public_key (pk);
- if (list->reason == G10ERR_NO_SECKEY)
+ if (gpg_err_code (list->reason) == GPG_ERR_NO_SECKEY)
{
if (is_status_enabled())
{
@@ -517,7 +517,7 @@ print_pkenc_list (struct kidlist_item *list, int failed)
else if (list->reason)
{
log_info (_("public key decryption failed: %s\n"),
- g10_errstr(list->reason));
+ gpg_strerror (list->reason));
write_status_error ("pkdecrypt_failed", list->reason);
}
}
@@ -602,7 +602,7 @@ proc_encrypted (CTX c, PACKET *pkt)
}
}
else if (!c->dek)
- result = G10ERR_NO_SECKEY;
+ result = GPG_ERR_NO_SECKEY;
if (!result)
result = decrypt_data (c->ctrl, c, pkt->pkt.encrypted, c->dek );
@@ -620,7 +620,7 @@ proc_encrypted (CTX c, PACKET *pkt)
else if (!opt.no_mdc_warn)
log_info (_("WARNING: message was not integrity protected\n"));
}
- else if (gpg_err_code (result) == G10ERR_BAD_SIGN)
+ else if (gpg_err_code (result) == GPG_ERR_BAD_SIGNATURE)
{
glo_ctrl.lasterr = result;
log_error (_("WARNING: encrypted message has been manipulated!\n"));
@@ -638,7 +638,7 @@ proc_encrypted (CTX c, PACKET *pkt)
}
glo_ctrl.lasterr = result;
write_status (STATUS_DECRYPTION_FAILED);
- log_error (_("decryption failed: %s\n"), g10_errstr(result));
+ log_error (_("decryption failed: %s\n"), gpg_strerror (result));
/* Hmmm: does this work when we have encrypted using multiple
* ways to specify the session key (symmmetric and PK). */
}
@@ -755,7 +755,7 @@ proc_plaintext( CTX c, PACKET *pkt )
}
if (rc)
- log_error ("handle plaintext failed: %s\n", g10_errstr(rc));
+ log_error ("handle plaintext failed: %s\n", gpg_strerror (rc));
free_packet(pkt);
c->last_was_session_key = 0;
@@ -900,16 +900,16 @@ do_check_sig (CTX c, kbnode_t node, int *is_selfsig,
{
log_error (_("standalone revocation - "
"use \"gpg --import\" to apply\n"));
- return G10ERR_NOT_PROCESSED;
+ return GPG_ERR_NOT_PROCESSED;
}
else
{
log_error ("invalid root packet for sigclass %02x\n", sig->sig_class);
- return G10ERR_SIG_CLASS;
+ return GPG_ERR_SIG_CLASS;
}
}
else
- return G10ERR_SIG_CLASS;
+ return GPG_ERR_SIG_CLASS;
rc = signature_check2 (sig, md, NULL, is_expkey, is_revkey, NULL);
if (gpg_err_code (rc) == GPG_ERR_BAD_SIGNATURE && md2)
@@ -1128,7 +1128,7 @@ list_node (CTX c, kbnode_t node)
es_printf ("%c %s %s ",
sigrc, keystr (sig->keyid), datestr_from_sig(sig));
if (sigrc == '%')
- es_printf ("[%s] ", g10_errstr(rc2) );
+ es_printf ("[%s] ", gpg_strerror (rc2) );
else if (sigrc == '?')
;
else if (is_selfsig)
@@ -1197,7 +1197,7 @@ proc_signature_packets (ctrl_t ctrl, void *anchor, iobuf_t a,
{
write_status_text (STATUS_NODATA, "4");
log_error (_("no signature found\n"));
- rc = G10ERR_NO_DATA;
+ rc = GPG_ERR_NO_DATA;
}
/* Propagate the signature seen flag upward. Do this only on success
@@ -1340,7 +1340,7 @@ do_proc_packets (CTX c, iobuf_t a)
case PKT_ENCRYPTED:
case PKT_ENCRYPTED_MDC:
write_status_text( STATUS_UNEXPECTED, "0" );
- rc = G10ERR_UNEXPECTED;
+ rc = GPG_ERR_UNEXPECTED;
goto leave;
case PKT_SIGNATURE: newpkt = add_signature (c, pkt); break;
@@ -1359,7 +1359,7 @@ do_proc_packets (CTX c, iobuf_t a)
case PKT_SECRET_KEY:
case PKT_USER_ID:
write_status_text (STATUS_UNEXPECTED, "0");
- rc = G10ERR_UNEXPECTED;
+ rc = GPG_ERR_UNEXPECTED;
goto leave;
case PKT_SIGNATURE: newpkt = add_signature (c, pkt); break;
@@ -1428,7 +1428,7 @@ do_proc_packets (CTX c, iobuf_t a)
free_packet(pkt);
}
- if (rc == G10ERR_INVALID_PACKET)
+ if (rc == GPG_ERR_INV_PACKET)
write_status_text (STATUS_NODATA, "3");
if (any_data)
@@ -1684,7 +1684,7 @@ check_sig_and_print (CTX c, kbnode_t node)
/* If the key isn't found, check for a preferred keyserver */
- if (gpg_err_code (rc) == G10ERR_NO_PUBKEY && sig->flags.pref_ks)
+ if (gpg_err_code (rc) == GPG_ERR_NO_PUBKEY && sig->flags.pref_ks)
{
const byte *p;
int seq = 0;
@@ -1726,7 +1726,7 @@ check_sig_and_print (CTX c, kbnode_t node)
/* If the preferred keyserver thing above didn't work, our second
try is to use the URI from a DNS PKA record. */
- if (gpg_err_code (rc) == G10ERR_NO_PUBKEY
+ if (gpg_err_code (rc) == GPG_ERR_NO_PUBKEY
&& (opt.keyserver_options.options & KEYSERVER_AUTO_KEY_RETRIEVE)
&& (opt.keyserver_options.options & KEYSERVER_HONOR_PKA_RECORD))
{
@@ -1755,7 +1755,7 @@ check_sig_and_print (CTX c, kbnode_t node)
/* If the preferred keyserver thing above didn't work and we got
no information from the DNS PKA, this is a third try. */
- if (gpg_err_code (rc) == G10ERR_NO_PUBKEY
+ if (gpg_err_code (rc) == GPG_ERR_NO_PUBKEY
&& opt.keyserver
&& (opt.keyserver_options.options&KEYSERVER_AUTO_KEY_RETRIEVE))
{
@@ -2000,7 +2000,7 @@ check_sig_and_print (CTX c, kbnode_t node)
if (sig->flags.expired)
{
log_info (_("Signature expired %s\n"), asctimestamp(sig->expiredate));
- rc = G10ERR_GENERAL; /* need a better error here? */
+ rc = GPG_ERR_GENERAL; /* Need a better error here? */
}
else if (sig->expiredate)
log_info (_("Signature expires %s\n"), asctimestamp(sig->expiredate));
@@ -2065,13 +2065,13 @@ check_sig_and_print (CTX c, kbnode_t node)
sig->pubkey_algo, sig->digest_algo,
sig->sig_class, (ulong)sig->timestamp, rc);
write_status_text (STATUS_ERRSIG, buf);
- if (gpg_err_code (rc) == G10ERR_NO_PUBKEY)
+ if (gpg_err_code (rc) == GPG_ERR_NO_PUBKEY)
{
buf[16] = 0;
write_status_text (STATUS_NO_PUBKEY, buf);
}
- if (gpg_err_code (rc) != G10ERR_NOT_PROCESSED)
- log_error (_("Can't check signature: %s\n"), g10_errstr(rc));
+ if (gpg_err_code (rc) != GPG_ERR_NOT_PROCESSED)
+ log_error (_("Can't check signature: %s\n"), gpg_strerror (rc));
}
return rc;
@@ -2158,7 +2158,7 @@ proc_tree (CTX c, kbnode_t node)
hash_err:
if (rc)
{
- log_error ("can't hash datafile: %s\n", g10_errstr (rc));
+ log_error ("can't hash datafile: %s\n", gpg_strerror (rc));
return;
}
}
@@ -2283,7 +2283,7 @@ proc_tree (CTX c, kbnode_t node)
detached_hash_err:
if (rc)
{
- log_error ("can't hash datafile: %s\n", g10_errstr(rc));
+ log_error ("can't hash datafile: %s\n", gpg_strerror (rc));
return;
}
}
diff --git a/g10/misc.c b/g10/misc.c
index 6a45c6920..a2b5075ed 100644
--- a/g10/misc.c
+++ b/g10/misc.c
@@ -1186,7 +1186,7 @@ check_compress_algo(int algo)
#ifdef HAVE_BZIP2
case 3: return 0;
#endif
- default: return G10ERR_COMPR_ALGO;
+ default: return GPG_ERR_COMPR_ALGO;
}
}
diff --git a/g10/parse-packet.c b/g10/parse-packet.c
index f3b4f49b5..ae215c413 100644
--- a/g10/parse-packet.c
+++ b/g10/parse-packet.c
@@ -591,7 +591,7 @@ parse (IOBUF inp, PACKET * pkt, int onlykeypkts, off_t * retpos,
new_ctb? " new-ctb":"");
pkt->pkttype = pkttype;
- rc = G10ERR_UNKNOWN_PACKET; /* default error */
+ rc = GPG_ERR_UNKNOWN_PACKET; /* default error */
switch (pkttype)
{
case PKT_PUBLIC_KEY:
@@ -657,7 +657,7 @@ parse (IOBUF inp, PACKET * pkt, int onlykeypkts, off_t * retpos,
leave:
/* FIXME: Do we leak in case of an error? */
if (!rc && iobuf_error (inp))
- rc = G10ERR_INV_KEYRING;
+ rc = GPG_ERR_INV_KEYRING;
/* FIXME: We use only the error code for now to avoid problems with
callers which have not been checked to always use gpg_err_code()
@@ -878,7 +878,7 @@ parse_marker (IOBUF inp, int pkttype, unsigned long pktlen)
if (list_mode)
es_fputs (":marker packet: [invalid]\n", listfp);
iobuf_skip_rest (inp, pktlen, 0);
- return G10ERR_INVALID_PACKET;
+ return GPG_ERR_INV_PACKET;
}
@@ -1653,7 +1653,7 @@ parse_signature (IOBUF inp, int pkttype, unsigned long pktlen,
log_error ("signature packet: hashed data too long\n");
if (list_mode)
es_fputs (":signature packet: [hashed data too long]\n", listfp);
- rc = G10ERR_INVALID_PACKET;
+ rc = GPG_ERR_INV_PACKET;
goto leave;
}
if (n)
@@ -1679,7 +1679,7 @@ parse_signature (IOBUF inp, int pkttype, unsigned long pktlen,
log_error ("signature packet: unhashed data too long\n");
if (list_mode)
es_fputs (":signature packet: [unhashed data too long]\n", listfp);
- rc = G10ERR_INVALID_PACKET;
+ rc = GPG_ERR_INV_PACKET;
goto leave;
}
if (n)
@@ -1705,7 +1705,7 @@ parse_signature (IOBUF inp, int pkttype, unsigned long pktlen,
log_error ("packet(%d) too short\n", pkttype);
if (list_mode)
es_fputs (":signature packet: [too short]\n", listfp);
- rc = G10ERR_INVALID_PACKET;
+ rc = GPG_ERR_INV_PACKET;
goto leave;
}
@@ -1825,7 +1825,7 @@ parse_signature (IOBUF inp, int pkttype, unsigned long pktlen,
/* We include a limit to avoid too trivial DoS attacks by
having gpg allocate too much memory. */
log_error ("signature packet: too much data\n");
- rc = G10ERR_INVALID_PACKET;
+ rc = GPG_ERR_INV_PACKET;
}
else
{
@@ -1848,7 +1848,7 @@ parse_signature (IOBUF inp, int pkttype, unsigned long pktlen,
es_putc ('\n', listfp);
}
if (!sig->data[i])
- rc = G10ERR_INVALID_PACKET;
+ rc = GPG_ERR_INV_PACKET;
}
}
@@ -2421,7 +2421,7 @@ parse_user_id (IOBUF inp, int pkttype, unsigned long pktlen, PACKET * packet)
if (list_mode)
es_fprintf (listfp, ":user ID packet: [too large]\n");
iobuf_skip_rest (inp, pktlen, 0);
- return G10ERR_INVALID_PACKET;
+ return GPG_ERR_INV_PACKET;
}
packet->pkt.user_id = xmalloc_clear (sizeof *packet->pkt.user_id + pktlen);
@@ -2502,7 +2502,7 @@ parse_attribute (IOBUF inp, int pkttype, unsigned long pktlen,
if (list_mode)
es_fprintf (listfp, ":attribute packet: [too large]\n");
iobuf_skip_rest (inp, pktlen, 0);
- return G10ERR_INVALID_PACKET;
+ return GPG_ERR_INV_PACKET;
}
#define EXTRA_UID_NAME_SPACE 71
@@ -2547,7 +2547,7 @@ parse_comment (IOBUF inp, int pkttype, unsigned long pktlen, PACKET * packet)
es_fprintf (listfp, ":%scomment packet: [too large]\n",
pkttype == PKT_OLD_COMMENT ? "OpenPGP draft " : "");
iobuf_skip_rest (inp, pktlen, 0);
- return G10ERR_INVALID_PACKET;
+ return GPG_ERR_INV_PACKET;
}
packet->pkt.comment = xmalloc (sizeof *packet->pkt.comment + pktlen - 1);
packet->pkt.comment->len = pktlen;
@@ -2755,7 +2755,7 @@ parse_encrypted (IOBUF inp, int pkttype, unsigned long pktlen,
log_error ("packet(%d) too short\n", pkttype);
if (list_mode)
es_fputs (":encrypted data packet: [too short]\n", listfp);
- rc = G10ERR_INVALID_PACKET;
+ rc = GPG_ERR_INV_PACKET;
iobuf_skip_rest (inp, pktlen, partial);
goto leave;
}
diff --git a/g10/pkclist.c b/g10/pkclist.c
index 1032b0193..41c126e99 100644
--- a/g10/pkclist.c
+++ b/g10/pkclist.c
@@ -520,7 +520,7 @@ check_signatures_trust( PKT_signature *sig )
if (rc)
{ /* this should not happen */
log_error("Ooops; the key vanished - can't check the trust\n");
- rc = G10ERR_NO_PUBKEY;
+ rc = GPG_ERR_NO_PUBKEY;
goto leave;
}
@@ -805,7 +805,7 @@ find_and_check_key (ctrl_t ctrl, const char *name, unsigned int use,
int code;
/* Key not found or other error. */
- log_error (_("%s: skipped: %s\n"), name, g10_errstr(rc) );
+ log_error (_("%s: skipped: %s\n"), name, gpg_strerror (rc) );
switch (gpg_err_code (rc))
{
case GPG_ERR_NO_SECKEY:
@@ -823,7 +823,7 @@ find_and_check_key (ctrl_t ctrl, const char *name, unsigned int use,
{
/* Key found but not usable for us (e.g. sign-only key). */
send_status_inv_recp (3, name); /* Wrong key usage */
- log_error (_("%s: skipped: %s\n"), name, g10_errstr(rc) );
+ log_error (_("%s: skipped: %s\n"), name, gpg_strerror (rc) );
free_public_key (pk);
return rc;
}
@@ -836,7 +836,7 @@ find_and_check_key (ctrl_t ctrl, const char *name, unsigned int use,
send_status_inv_recp (13, name);
log_info (_("%s: skipped: public key is disabled\n"), name);
free_public_key (pk);
- return G10ERR_UNU_PUBKEY;
+ return GPG_ERR_UNUSABLE_PUBKEY;
}
if ( !do_we_trust_pre (pk, trustlevel) )
@@ -844,7 +844,7 @@ find_and_check_key (ctrl_t ctrl, const char *name, unsigned int use,
/* We don't trust this key. */
send_status_inv_recp (10, name);
free_public_key (pk);
- return G10ERR_UNU_PUBKEY;
+ return GPG_ERR_UNUSABLE_PUBKEY;
}
/* Note: do_we_trust may have changed the trustlevel. */
@@ -951,7 +951,7 @@ build_pk_list (ctrl_t ctrl,
NULL, pk, rov->d, NULL, NULL, 1, 1)) )
{
free_public_key ( pk ); pk = NULL;
- log_error (_("%s: skipped: %s\n"), rov->d, g10_errstr(rc) );
+ log_error (_("%s: skipped: %s\n"), rov->d, gpg_strerror (rc) );
send_status_inv_recp (0, rov->d);
goto fail;
}
@@ -992,7 +992,7 @@ build_pk_list (ctrl_t ctrl,
{
/* The public key is not usable for encryption. */
free_public_key( pk ); pk = NULL;
- log_error(_("%s: skipped: %s\n"), rov->d, g10_errstr(rc) );
+ log_error(_("%s: skipped: %s\n"), rov->d, gpg_strerror (rc) );
send_status_inv_recp (3, rov->d); /* Wrong key usage */
goto fail;
}
@@ -1210,7 +1210,7 @@ build_pk_list (ctrl_t ctrl,
{
log_error(_("no valid addressees\n"));
write_status_text (STATUS_NO_RECP, "0");
- rc = G10ERR_NO_USER_ID;
+ rc = GPG_ERR_NO_USER_ID;
}
fail:
diff --git a/g10/plaintext.c b/g10/plaintext.c
index 5d343c6d2..7929f6643 100644
--- a/g10/plaintext.c
+++ b/g10/plaintext.c
@@ -144,7 +144,7 @@ handle_plaintext (PKT_plaintext * pt, md_filter_context_t * mfx,
if (!tmp || !*tmp)
{
xfree (tmp);
- /* FIXME: Below used to be G10ERR_CREATE_FILE */
+ /* FIXME: Below used to be GPG_ERR_CREATE_FILE */
err = gpg_error (GPG_ERR_GENERAL);
goto leave;
}
@@ -196,7 +196,7 @@ handle_plaintext (PKT_plaintext * pt, md_filter_context_t * mfx,
if (!fp)
{
log_error (_("error creating '%s': %s\n"), fname, gpg_strerror (err));
- err = G10ERR_CREATE_FILE;
+ err = GPG_ERR_CREATE_FILE;
if (errno == 106)
log_info ("Do output file and input file have the same name?\n");
goto leave;
diff --git a/g10/pubkey-enc.c b/g10/pubkey-enc.c
index e79199e18..fcd24f86e 100644
--- a/g10/pubkey-enc.c
+++ b/g10/pubkey-enc.c
@@ -104,7 +104,7 @@ get_session_key (PKT_pubkey_enc * k, DEK * dek)
rc = enum_secret_keys (&enum_context, sk);
if (rc)
{
- rc = G10ERR_NO_SECKEY;
+ rc = GPG_ERR_NO_SECKEY;
break;
}
if (sk->pubkey_algo != k->pubkey_algo)
@@ -410,22 +410,22 @@ get_override_session_key (DEK *dek, const char *string)
int i;
if (!string)
- return G10ERR_BAD_KEY;
+ return GPG_ERR_BAD_KEY;
dek->algo = atoi (string);
if (dek->algo < 1)
- return G10ERR_BAD_KEY;
+ return GPG_ERR_BAD_KEY;
if (!(s = strchr (string, ':')))
- return G10ERR_BAD_KEY;
+ return GPG_ERR_BAD_KEY;
s++;
for (i = 0; i < DIM (dek->key) && *s; i++, s += 2)
{
int c = hextobyte (s);
if (c == -1)
- return G10ERR_BAD_KEY;
+ return GPG_ERR_BAD_KEY;
dek->key[i] = c;
}
if (*s)
- return G10ERR_BAD_KEY;
+ return GPG_ERR_BAD_KEY;
dek->keylen = i;
return 0;
}
diff --git a/g10/revoke.c b/g10/revoke.c
index 6b9e709fe..15d28b0bd 100644
--- a/g10/revoke.c
+++ b/g10/revoke.c
@@ -90,7 +90,7 @@ export_minimal_pk(IOBUF out,KBNODE keyblock,
if(!node)
{
log_error("key incomplete\n");
- return G10ERR_GENERAL;
+ return GPG_ERR_GENERAL;
}
keyid_from_pk(node->pkt->pkt.public_key,keyid);
@@ -99,7 +99,7 @@ export_minimal_pk(IOBUF out,KBNODE keyblock,
rc=build_packet(out,&pkt);
if(rc)
{
- log_error(_("build_packet failed: %s\n"), g10_errstr(rc) );
+ log_error(_("build_packet failed: %s\n"), gpg_strerror (rc) );
return rc;
}
@@ -113,7 +113,7 @@ export_minimal_pk(IOBUF out,KBNODE keyblock,
rc=build_packet(out,&pkt);
if(rc)
{
- log_error("build_packet failed: %s\n", g10_errstr(rc) );
+ log_error("build_packet failed: %s\n", gpg_strerror (rc) );
return rc;
}
}
@@ -125,7 +125,7 @@ export_minimal_pk(IOBUF out,KBNODE keyblock,
rc=build_packet(out,&pkt);
if(rc)
{
- log_error(_("build_packet failed: %s\n"), g10_errstr(rc) );
+ log_error(_("build_packet failed: %s\n"), gpg_strerror (rc) );
return rc;
}
}
@@ -143,7 +143,7 @@ export_minimal_pk(IOBUF out,KBNODE keyblock,
else
{
log_error(_("key %s has no user IDs\n"),keystr(keyid));
- return G10ERR_GENERAL;
+ return GPG_ERR_GENERAL;
}
}
@@ -171,7 +171,7 @@ export_minimal_pk(IOBUF out,KBNODE keyblock,
rc=build_packet(out,&pkt);
if(rc)
{
- log_error(_("build_packet failed: %s\n"), g10_errstr(rc) );
+ log_error(_("build_packet failed: %s\n"), gpg_strerror (rc) );
return rc;
}
@@ -183,7 +183,7 @@ export_minimal_pk(IOBUF out,KBNODE keyblock,
rc=build_packet(out,&pkt);
if(rc)
{
- log_error(_("build_packet failed: %s\n"), g10_errstr(rc) );
+ log_error(_("build_packet failed: %s\n"), gpg_strerror (rc) );
return rc;
}
}
@@ -214,7 +214,7 @@ gen_desig_revoke( const char *uname, strlist_t locusr )
if( opt.batch )
{
log_error(_("can't do this in batch mode\n"));
- return G10ERR_GENERAL;
+ return GPG_ERR_GENERAL;
}
afx = new_armor_context ();
@@ -224,13 +224,13 @@ gen_desig_revoke( const char *uname, strlist_t locusr )
if (!rc)
rc = keydb_search (kdbhd, &desc, 1, NULL);
if (rc) {
- log_error (_("key \"%s\" not found: %s\n"),uname, g10_errstr (rc));
+ log_error (_("key \"%s\" not found: %s\n"),uname, gpg_strerror (rc));
goto leave;
}
rc = keydb_get_keyblock (kdbhd, &keyblock );
if( rc ) {
- log_error (_("error reading keyblock: %s\n"), g10_errstr(rc) );
+ log_error (_("error reading keyblock: %s\n"), gpg_strerror (rc) );
goto leave;
}
@@ -342,7 +342,7 @@ gen_desig_revoke( const char *uname, strlist_t locusr )
revocation_reason_build_cb, reason,
NULL);
if( rc ) {
- log_error(_("make_keysig_packet failed: %s\n"), g10_errstr(rc));
+ log_error(_("make_keysig_packet failed: %s\n"), gpg_strerror (rc));
goto leave;
}
@@ -469,7 +469,7 @@ create_revocation (const char *filename,
revocation_reason_build_cb, reason, cache_nonce);
if (rc)
{
- log_error (_("make_keysig_packet failed: %s\n"), g10_errstr (rc));
+ log_error (_("make_keysig_packet failed: %s\n"), gpg_strerror (rc));
goto leave;
}
@@ -490,7 +490,7 @@ create_revocation (const char *filename,
rc = build_packet (out, &pkt);
if (rc)
{
- log_error (_("build_packet failed: %s\n"), g10_errstr (rc));
+ log_error (_("build_packet failed: %s\n"), gpg_strerror (rc));
goto leave;
}
}
@@ -601,7 +601,7 @@ gen_revoke (const char *uname)
if( opt.batch )
{
log_error(_("can't do this in batch mode\n"));
- return G10ERR_GENERAL;
+ return GPG_ERR_GENERAL;
}
/* Search the userid; we don't want the whole getkey stuff here. */
@@ -612,14 +612,14 @@ gen_revoke (const char *uname)
if (rc)
{
log_error (_("secret key \"%s\" not found: %s\n"),
- uname, g10_errstr (rc));
+ uname, gpg_strerror (rc));
goto leave;
}
rc = keydb_get_keyblock (kdbhd, &keyblock );
if (rc)
{
- log_error (_("error reading keyblock: %s\n"), g10_errstr(rc) );
+ log_error (_("error reading keyblock: %s\n"), gpg_strerror (rc) );
goto leave;
}
diff --git a/g10/seckey-cert.c b/g10/seckey-cert.c
index 1dde6f91c..10037567c 100644
--- a/g10/seckey-cert.c
+++ b/g10/seckey-cert.c
@@ -55,20 +55,20 @@ xxxx_do_check( PKT_secret_key *sk, const char *tryagain_text, int mode,
if( sk->protect.s2k.mode == 1001 ) {
log_info(_("secret key parts are not available\n"));
- return G10ERR_UNU_SECKEY;
+ return GPG_ERR_UNUSABLE_SECKEY;
}
if( sk->protect.algo == CIPHER_ALGO_NONE )
BUG();
if( openpgp_cipher_test_algo( sk->protect.algo ) ) {
log_info(_("protection algorithm %d%s is not supported\n"),
sk->protect.algo,sk->protect.algo==1?" (IDEA)":"" );
- return G10ERR_CIPHER_ALGO;
+ return GPG_ERR_CIPHER_ALGO;
}
if(gcry_md_test_algo (sk->protect.s2k.hash_algo))
{
log_info(_("protection digest %d is not supported\n"),
sk->protect.s2k.hash_algo);
- return G10ERR_DIGEST_ALGO;
+ return GPG_ERR_DIGEST_ALGO;
}
keyid_from_sk( sk, keyid );
keyid[2] = keyid[3] = 0;
@@ -249,7 +249,7 @@ xxxx_do_check( PKT_secret_key *sk, const char *tryagain_text, int mode,
csum += checksum_mpi( sk->skey[i] );
}
if( csum != sk->csum )
- return G10ERR_CHECKSUM;
+ return GPG_ERR_CHECKSUM;
}
return 0;
diff --git a/g10/sig-check.c b/g10/sig-check.c
index f56386213..dd475bec2 100644
--- a/g10/sig-check.c
+++ b/g10/sig-check.c
@@ -77,13 +77,15 @@ signature_check2 (PKT_signature *sig, gcry_md_hd_t digest, u32 *r_expiredate,
header is missing or does not match the actual sig. */
log_info(_("WARNING: signature digest conflict in message\n"));
- rc=G10ERR_GENERAL;
+ rc = GPG_ERR_GENERAL;
}
else if( get_pubkey( pk, sig->keyid ) )
- rc = G10ERR_NO_PUBKEY;
+ rc = GPG_ERR_NO_PUBKEY;
else if(!pk->flags.valid && !pk->flags.primary)
- rc=G10ERR_BAD_PUBKEY; /* you cannot have a good sig from an
- invalid subkey */
+ {
+ /* You cannot have a good sig from an invalid subkey. */
+ rc = GPG_ERR_BAD_PUBKEY;
+ }
else
{
if(r_expiredate)
@@ -109,13 +111,13 @@ signature_check2 (PKT_signature *sig, gcry_md_hd_t digest, u32 *r_expiredate,
error. TODO: change the default to require this
after more keys have backsigs. */
if(opt.flags.require_cross_cert)
- rc=G10ERR_GENERAL;
+ rc = GPG_ERR_GENERAL;
}
else if(pk->flags.backsig == 1)
{
log_info(_("WARNING: signing subkey %s has an invalid"
" cross-certification\n"),keystr_from_pk(pk));
- rc=G10ERR_GENERAL;
+ rc = GPG_ERR_GENERAL;
}
}
}
@@ -211,7 +213,7 @@ do_check_messages( PKT_public_key *pk, PKT_signature *sig,
:_("public key %s is %lu seconds newer than the signature\n"),
keystr_from_pk(pk),d );
if( !opt.ignore_time_conflict )
- return G10ERR_TIME_CONFLICT; /* pubkey newer than signature */
+ return GPG_ERR_TIME_CONFLICT; /* pubkey newer than signature. */
}
cur_time = make_timestamp();
@@ -225,7 +227,7 @@ do_check_messages( PKT_public_key *pk, PKT_signature *sig,
" in the future (time warp or clock problem)\n"),
keystr_from_pk(pk),d );
if( !opt.ignore_time_conflict )
- return G10ERR_TIME_CONFLICT;
+ return GPG_ERR_TIME_CONFLICT;
}
/* Check whether the key has expired. We check the has_expired
@@ -320,7 +322,7 @@ do_check( PKT_public_key *pk, PKT_signature *sig, gcry_md_hd_t digest,
result = encode_md_value (pk, digest, sig->digest_algo );
if (!result)
- return G10ERR_GENERAL;
+ return GPG_ERR_GENERAL;
rc = pk_verify( pk->pubkey_algo, result, sig->data, pk->pkey );
gcry_mpi_release (result);
@@ -328,7 +330,7 @@ do_check( PKT_public_key *pk, PKT_signature *sig, gcry_md_hd_t digest,
{
log_info(_("assuming bad signature from key %s"
" due to an unknown critical bit\n"),keystr_from_pk(pk));
- rc = G10ERR_BAD_SIGN;
+ rc = GPG_ERR_BAD_SIGNATURE;
}
if(!rc && ret_pk)
@@ -400,7 +402,7 @@ cache_sig_result ( PKT_signature *sig, int result )
but it matches how PGP does it. -dms */
/* Returns 0 if sig is valid (i.e. pk is revoked), non-0 if not
- revoked. It is important that G10ERR_NO_PUBKEY is only returned
+ revoked. It is important that GPG_ERR_NO_PUBKEY is only returned
when a revocation signature is from a valid revocation key
designated in a revkey subpacket, but the revocation key itself
isn't present. */
@@ -408,7 +410,8 @@ int
check_revocation_keys(PKT_public_key *pk,PKT_signature *sig)
{
static int busy=0;
- int i,rc=G10ERR_GENERAL;
+ int i;
+ int rc = GPG_ERR_GENERAL;
assert(IS_KEY_REV(sig));
assert((sig->keyid[0]!=pk->keyid[0]) || (sig->keyid[0]!=pk->keyid[1]));
@@ -593,7 +596,7 @@ check_key_signature2( KBNODE root, KBNODE node, PKT_public_key *check_pk,
if (opt.verbose)
log_info (_("key %s: no subkey for subkey"
" revocation signature\n"),keystr_from_pk(pk));
- rc = G10ERR_SIG_CLASS;
+ rc = GPG_ERR_SIG_CLASS;
}
}
else if( sig->sig_class == 0x18 ) { /* key binding */
@@ -620,7 +623,7 @@ check_key_signature2( KBNODE root, KBNODE node, PKT_public_key *check_pk,
if (opt.verbose)
log_info(_("key %s: no subkey for subkey"
" binding signature\n"),keystr_from_pk(pk));
- rc = G10ERR_SIG_CLASS;
+ rc = GPG_ERR_SIG_CLASS;
}
}
else if( sig->sig_class == 0x1f ) { /* direct key signature */
@@ -661,7 +664,7 @@ check_key_signature2( KBNODE root, KBNODE node, PKT_public_key *check_pk,
if (!opt.quiet)
log_info ("key %s: no user ID for key signature packet"
" of class %02x\n",keystr_from_pk(pk),sig->sig_class);
- rc = G10ERR_SIG_CLASS;
+ rc = GPG_ERR_SIG_CLASS;
}
}
diff --git a/g10/sign.c b/g10/sign.c
index 272451306..d2f4abf18 100644
--- a/g10/sign.c
+++ b/g10/sign.c
@@ -312,12 +312,12 @@ do_sign (PKT_public_key *pksk, PKT_signature *sig,
}
if (err)
log_error (_("checking created signature failed: %s\n"),
- g10_errstr (err));
+ gpg_strerror (err));
free_public_key (pk);
}
if (err)
- log_error (_("signing failed: %s\n"), g10_errstr (err));
+ log_error (_("signing failed: %s\n"), gpg_strerror (err));
else
{
if (opt.verbose)
@@ -573,7 +573,7 @@ write_onepass_sig_packets (SK_LIST sk_list, IOBUF out, int sigclass )
free_packet (&pkt);
if (rc) {
log_error ("build onepass_sig packet failed: %s\n",
- g10_errstr(rc));
+ gpg_strerror (rc));
return rc;
}
}
@@ -637,7 +637,7 @@ write_plaintext_packet (IOBUF out, IOBUF inp, const char *fname, int ptmode)
/*cfx.datalen = filesize? calc_packet_length( &pkt ) : 0;*/
if( (rc = build_packet (out, &pkt)) )
log_error ("build_packet(PLAINTEXT) failed: %s\n",
- g10_errstr(rc) );
+ gpg_strerror (rc) );
pt->buf = NULL;
}
else {
@@ -1325,7 +1325,7 @@ sign_symencrypt_file (const char *fname, strlist_t locusr)
pkt.pkttype = PKT_SYMKEY_ENC;
pkt.pkt.symkey_enc = enc;
if( (rc = build_packet( out, &pkt )) )
- log_error("build symkey packet failed: %s\n", g10_errstr(rc) );
+ log_error("build symkey packet failed: %s\n", gpg_strerror (rc) );
xfree(enc);
}
@@ -1520,7 +1520,7 @@ update_keysig_packet( PKT_signature **ret_sig,
if ((!orig_sig || !pk || !pksk)
|| (orig_sig->sig_class >= 0x10 && orig_sig->sig_class <= 0x13 && !uid)
|| (orig_sig->sig_class == 0x18 && !subpk))
- return G10ERR_GENERAL;
+ return GPG_ERR_GENERAL;
if ( opt.cert_digest_algo )
digest_algo = opt.cert_digest_algo;
diff --git a/g10/tdbdump.c b/g10/tdbdump.c
index 92d70a734..c12e9b7a3 100644
--- a/g10/tdbdump.c
+++ b/g10/tdbdump.c
@@ -56,7 +56,7 @@ write_record( TRUSTREC *rec )
if( !rc )
return;
log_error(_("trust record %lu, type %d: write failed: %s\n"),
- rec->recnum, rec->rectype, g10_errstr(rc) );
+ rec->recnum, rec->rectype, gpg_strerror (rc) );
tdbio_invalid();
}
@@ -214,7 +214,7 @@ import_ownertrust( const char *fname )
}
else /* error */
log_error (_("error finding trust record in '%s': %s\n"),
- fname, g10_errstr(rc));
+ fname, gpg_strerror (rc));
}
if( ferror(fp) )
log_error ( _("read error in '%s': %s\n"), fname, strerror(errno) );
@@ -226,7 +226,7 @@ import_ownertrust( const char *fname )
revalidation_mark ();
rc = tdbio_sync ();
if (rc)
- log_error (_("trustdb: sync failed: %s\n"), g10_errstr(rc) );
+ log_error (_("trustdb: sync failed: %s\n"), gpg_strerror (rc) );
}
}
diff --git a/g10/tdbio.c b/g10/tdbio.c
index aff565cf6..9bb8a04e0 100644
--- a/g10/tdbio.c
+++ b/g10/tdbio.c
@@ -1,5 +1,5 @@
/* tdbio.c - trust database I/O operations
- * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2012 Free Software Foundation, Inc.
+ * Copyright (C) 1998-2002, 2012 Free Software Foundation, Inc.
*
* This file is part of GnuPG.
*
@@ -250,7 +250,7 @@ put_record_into_cache( ulong recno, const char *data )
return 0;
}
log_info(_("trustdb transaction too large\n"));
- return G10ERR_RESOURCE_LIMIT;
+ return GPG_ERR_RESOURCE_LIMIT;
}
if( dirty_count ) {
int n = dirty_count / 5; /* discard some dirty entries */
@@ -515,7 +515,7 @@ tdbio_set_dbname( const char *new_dbname, int create, int *r_nofile)
if( errno != ENOENT ) {
log_error( _("can't access '%s': %s\n"), fname, strerror(errno) );
xfree(fname);
- return G10ERR_TRUSTDB;
+ return GPG_ERR_TRUSTDB;
}
if (!create)
*r_nofile = 1;
@@ -565,11 +565,13 @@ tdbio_set_dbname( const char *new_dbname, int create, int *r_nofile)
fp =fopen( fname, "wb" );
umask(oldmask);
if( !fp )
- log_fatal( _("can't create '%s': %s\n"), fname, strerror(errno) );
+ log_fatal (_("can't create '%s': %s\n"),
+ fname, strerror (errno));
fclose(fp);
db_fd = open( db_name, O_RDWR | MY_O_BINARY );
if( db_fd == -1 )
- log_fatal( _("can't open '%s': %s\n"), db_name, strerror(errno) );
+ log_fatal (_("can't open '%s': %s\n"),
+ db_name, strerror (errno));
#ifndef __riscos__
if( !lockhandle )
@@ -581,7 +583,7 @@ tdbio_set_dbname( const char *new_dbname, int create, int *r_nofile)
rc = create_version_record ();
if( rc )
log_fatal( _("%s: failed to create version record: %s"),
- fname, g10_errstr(rc));
+ fname, gpg_strerror (rc));
/* and read again to check that we are okay */
if( tdbio_read_record( 0, &rec, RECTYPE_VER ) )
log_fatal( _("%s: invalid trustdb created\n"), db_name );
@@ -689,7 +691,7 @@ create_hashtable( TRUSTREC *vr, int type )
rc = tdbio_write_record( &rec );
if( rc )
log_fatal( _("%s: failed to create hashtable: %s\n"),
- db_name, g10_errstr(rc));
+ db_name, gpg_strerror (rc));
}
/* update the version record */
rc = tdbio_write_record( vr );
@@ -697,7 +699,7 @@ create_hashtable( TRUSTREC *vr, int type )
rc = tdbio_sync();
if( rc )
log_fatal( _("%s: error updating version record: %s\n"),
- db_name, g10_errstr(rc));
+ db_name, gpg_strerror (rc));
}
@@ -714,7 +716,7 @@ tdbio_db_matches_options()
rc = tdbio_read_record( 0, &vr, RECTYPE_VER );
if( rc )
log_fatal( _("%s: error reading version record: %s\n"),
- db_name, g10_errstr(rc) );
+ db_name, gpg_strerror (rc) );
yes_no = vr.r.ver.marginals == opt.marginals_needed
&& vr.r.ver.completes == opt.completes_needed
@@ -735,7 +737,7 @@ tdbio_read_model(void)
rc = tdbio_read_record( 0, &vr, RECTYPE_VER );
if( rc )
log_fatal( _("%s: error reading version record: %s\n"),
- db_name, g10_errstr(rc) );
+ db_name, gpg_strerror (rc) );
return vr.r.ver.trust_model;
}
@@ -751,7 +753,7 @@ tdbio_read_nextcheck ()
rc = tdbio_read_record( 0, &vr, RECTYPE_VER );
if( rc )
log_fatal( _("%s: error reading version record: %s\n"),
- db_name, g10_errstr(rc) );
+ db_name, gpg_strerror (rc));
return vr.r.ver.nextcheck;
}
@@ -765,7 +767,7 @@ tdbio_write_nextcheck (ulong stamp)
rc = tdbio_read_record( 0, &vr, RECTYPE_VER );
if( rc )
log_fatal( _("%s: error reading version record: %s\n"),
- db_name, g10_errstr(rc) );
+ db_name, gpg_strerror (rc) );
if (vr.r.ver.nextcheck == stamp)
return 0;
@@ -774,7 +776,7 @@ tdbio_write_nextcheck (ulong stamp)
rc = tdbio_write_record( &vr );
if( rc )
log_fatal( _("%s: error writing version record: %s\n"),
- db_name, g10_errstr(rc) );
+ db_name, gpg_strerror (rc) );
return 1;
}
@@ -795,7 +797,7 @@ get_trusthashrec(void)
rc = tdbio_read_record( 0, &vr, RECTYPE_VER );
if( rc )
log_fatal( _("%s: error reading version record: %s\n"),
- db_name, g10_errstr(rc) );
+ db_name, gpg_strerror (rc) );
if( !vr.r.ver.trusthashtbl )
create_hashtable( &vr, 0 );
@@ -826,7 +828,7 @@ upd_hashtable( ulong table, byte *key, int keylen, ulong newrecnum )
hashrec += msb / ITEMS_PER_HTBL_RECORD;
rc = tdbio_read_record( hashrec, &rec, RECTYPE_HTBL );
if( rc ) {
- log_error("upd_hashtable: read failed: %s\n", g10_errstr(rc) );
+ log_error("upd_hashtable: read failed: %s\n", gpg_strerror (rc) );
return rc;
}
@@ -836,7 +838,7 @@ upd_hashtable( ulong table, byte *key, int keylen, ulong newrecnum )
rc = tdbio_write_record( &rec );
if( rc ) {
log_error("upd_hashtable: write htbl failed: %s\n",
- g10_errstr(rc) );
+ gpg_strerror (rc) );
return rc;
}
}
@@ -845,7 +847,7 @@ upd_hashtable( ulong table, byte *key, int keylen, ulong newrecnum )
rc = tdbio_read_record( item, &rec, 0 );
if( rc ) {
log_error( "upd_hashtable: read item failed: %s\n",
- g10_errstr(rc) );
+ gpg_strerror (rc) );
return rc;
}
@@ -854,7 +856,7 @@ upd_hashtable( ulong table, byte *key, int keylen, ulong newrecnum )
level++;
if( level >= keylen ) {
log_error( "hashtable has invalid indirections.\n");
- return G10ERR_TRUSTDB;
+ return GPG_ERR_TRUSTDB;
}
goto next_level;
}
@@ -870,8 +872,8 @@ upd_hashtable( ulong table, byte *key, int keylen, ulong newrecnum )
rc = tdbio_read_record( rec.r.hlst.next,
&rec, RECTYPE_HLST);
if( rc ) {
- log_error( "upd_hashtable: read hlst failed: %s\n",
- g10_errstr(rc) );
+ log_error ("upd_hashtable: read hlst failed: %s\n",
+ gpg_strerror (rc) );
return rc;
}
}
@@ -885,8 +887,8 @@ upd_hashtable( ulong table, byte *key, int keylen, ulong newrecnum )
rec.r.hlst.rnum[i] = newrecnum;
rc = tdbio_write_record( &rec );
if( rc )
- log_error( "upd_hashtable: write hlst failed: %s\n",
- g10_errstr(rc) );
+ log_error ("upd_hashtable: write hlst failed: %s\n",
+ gpg_strerror (rc));
return rc; /* done */
}
}
@@ -894,8 +896,8 @@ upd_hashtable( ulong table, byte *key, int keylen, ulong newrecnum )
rc = tdbio_read_record( rec.r.hlst.next,
&rec, RECTYPE_HLST );
if( rc ) {
- log_error( "upd_hashtable: read hlst failed: %s\n",
- g10_errstr(rc) );
+ log_error ("upd_hashtable: read hlst failed: %s\n",
+ gpg_strerror (rc));
return rc;
}
}
@@ -904,7 +906,7 @@ upd_hashtable( ulong table, byte *key, int keylen, ulong newrecnum )
rc = tdbio_write_record( &rec );
if( rc ) {
log_error( "upd_hashtable: write hlst failed: %s\n",
- g10_errstr(rc) );
+ gpg_strerror (rc) );
return rc;
}
memset( &rec, 0, sizeof rec );
@@ -914,7 +916,7 @@ upd_hashtable( ulong table, byte *key, int keylen, ulong newrecnum )
rc = tdbio_write_record( &rec );
if( rc )
log_error( "upd_hashtable: write ext hlst failed: %s\n",
- g10_errstr(rc) );
+ gpg_strerror (rc) );
return rc; /* done */
}
} /* end loop over hlst slots */
@@ -932,22 +934,22 @@ upd_hashtable( ulong table, byte *key, int keylen, ulong newrecnum )
rc = tdbio_write_record( &rec );
if( rc ) {
log_error( "upd_hashtable: write new hlst failed: %s\n",
- g10_errstr(rc) );
+ gpg_strerror (rc) );
return rc;
}
/* update the hashtable record */
lastrec.r.htbl.item[msb % ITEMS_PER_HTBL_RECORD] = rec.recnum;
rc = tdbio_write_record( &lastrec );
if( rc )
- log_error( "upd_hashtable: update htbl failed: %s\n",
- g10_errstr(rc) );
+ log_error ("upd_hashtable: update htbl failed: %s\n",
+ gpg_strerror (rc));
return rc; /* ready */
}
else {
log_error( "hashtbl %lu: %lu/%d points to an invalid record %lu\n",
table, hashrec, (msb % ITEMS_PER_HTBL_RECORD), item);
list_trustdb(NULL);
- return G10ERR_TRUSTDB;
+ return GPG_ERR_TRUSTDB;
}
}
@@ -975,7 +977,7 @@ drop_from_hashtable( ulong table, byte *key, int keylen, ulong recnum )
rc = tdbio_read_record( hashrec, &rec, RECTYPE_HTBL );
if( rc ) {
log_error("drop_from_hashtable: read failed: %s\n",
- g10_errstr(rc) );
+ gpg_strerror (rc) );
return rc;
}
@@ -988,14 +990,14 @@ drop_from_hashtable( ulong table, byte *key, int keylen, ulong recnum )
rc = tdbio_write_record( &rec );
if( rc )
log_error("drop_from_hashtable: write htbl failed: %s\n",
- g10_errstr(rc) );
+ gpg_strerror (rc) );
return rc;
}
rc = tdbio_read_record( item, &rec, 0 );
if( rc ) {
log_error( "drop_from_hashtable: read item failed: %s\n",
- g10_errstr(rc) );
+ gpg_strerror (rc) );
return rc;
}
@@ -1004,7 +1006,7 @@ drop_from_hashtable( ulong table, byte *key, int keylen, ulong recnum )
level++;
if( level >= keylen ) {
log_error( "hashtable has invalid indirections.\n");
- return G10ERR_TRUSTDB;
+ return GPG_ERR_TRUSTDB;
}
goto next_level;
}
@@ -1016,8 +1018,8 @@ drop_from_hashtable( ulong table, byte *key, int keylen, ulong recnum )
rec.r.hlst.rnum[i] = 0; /* drop */
rc = tdbio_write_record( &rec );
if( rc )
- log_error("drop_from_hashtable: write htbl failed: %s\n",
- g10_errstr(rc) );
+ log_error("drop_from_hashtable: write htbl failed: %s\n",
+ gpg_strerror (rc));
return rc;
}
}
@@ -1026,7 +1028,7 @@ drop_from_hashtable( ulong table, byte *key, int keylen, ulong recnum )
&rec, RECTYPE_HLST);
if( rc ) {
log_error( "drop_from_hashtable: read hlst failed: %s\n",
- g10_errstr(rc) );
+ gpg_strerror (rc) );
return rc;
}
}
@@ -1037,7 +1039,7 @@ drop_from_hashtable( ulong table, byte *key, int keylen, ulong recnum )
log_error( "hashtbl %lu: %lu/%d points to wrong record %lu\n",
table, hashrec, (msb % ITEMS_PER_HTBL_RECORD), item);
- return G10ERR_TRUSTDB;
+ return GPG_ERR_TRUSTDB;
}
@@ -1063,7 +1065,7 @@ lookup_hashtable( ulong table, const byte *key, size_t keylen,
hashrec += msb / ITEMS_PER_HTBL_RECORD;
rc = tdbio_read_record( hashrec, rec, RECTYPE_HTBL );
if( rc ) {
- log_error("lookup_hashtable failed: %s\n", g10_errstr(rc) );
+ log_error("lookup_hashtable failed: %s\n", gpg_strerror (rc) );
return rc;
}
@@ -1073,7 +1075,7 @@ lookup_hashtable( ulong table, const byte *key, size_t keylen,
rc = tdbio_read_record( item, rec, 0 );
if( rc ) {
- log_error( "hashtable read failed: %s\n", g10_errstr(rc) );
+ log_error( "hashtable read failed: %s\n", gpg_strerror (rc) );
return rc;
}
if( rec->rectype == RECTYPE_HTBL ) {
@@ -1081,7 +1083,7 @@ lookup_hashtable( ulong table, const byte *key, size_t keylen,
level++;
if( level >= keylen ) {
log_error("hashtable has invalid indirections\n");
- return G10ERR_TRUSTDB;
+ return GPG_ERR_TRUSTDB;
}
goto next_level;
}
@@ -1095,8 +1097,8 @@ lookup_hashtable( ulong table, const byte *key, size_t keylen,
rc = tdbio_read_record( rec->r.hlst.rnum[i], &tmp, 0 );
if( rc ) {
- log_error( "lookup_hashtable: read item failed: %s\n",
- g10_errstr(rc) );
+ log_error ("lookup_hashtable: read item failed: %s\n",
+ gpg_strerror (rc));
return rc;
}
if( (*cmpfnc)( cmpdata, &tmp ) ) {
@@ -1108,8 +1110,8 @@ lookup_hashtable( ulong table, const byte *key, size_t keylen,
if( rec->r.hlst.next ) {
rc = tdbio_read_record( rec->r.hlst.next, rec, RECTYPE_HLST );
if( rc ) {
- log_error( "lookup_hashtable: read hlst failed: %s\n",
- g10_errstr(rc) );
+ log_error ("lookup_hashtable: read hlst failed: %s\n",
+ gpg_strerror (rc) );
return rc;
}
}
@@ -1422,7 +1424,7 @@ tdbio_delete_record( ulong recnum )
rc = tdbio_read_record( 0, &vr, RECTYPE_VER );
if( rc )
log_fatal( _("%s: error reading version record: %s\n"),
- db_name, g10_errstr(rc) );
+ db_name, gpg_strerror (rc) );
rec.recnum = recnum;
rec.rectype = RECTYPE_FREE;
@@ -1449,21 +1451,21 @@ tdbio_new_recnum()
rc = tdbio_read_record( 0, &vr, RECTYPE_VER );
if( rc )
log_fatal( _("%s: error reading version record: %s\n"),
- db_name, g10_errstr(rc) );
+ db_name, gpg_strerror (rc) );
if( vr.r.ver.firstfree ) {
recnum = vr.r.ver.firstfree;
rc = tdbio_read_record( recnum, &rec, RECTYPE_FREE );
if( rc ) {
log_error( _("%s: error reading free record: %s\n"),
- db_name, g10_errstr(rc) );
+ db_name, gpg_strerror (rc) );
return rc;
}
/* update dir record */
vr.r.ver.firstfree = rec.r.free.next;
rc = tdbio_write_record( &vr );
if( rc ) {
- log_error( _("%s: error writing dir record: %s\n"),
- db_name, g10_errstr(rc) );
+ log_error (_("%s: error writing dir record: %s\n"),
+ db_name, gpg_strerror (rc));
return rc;
}
/*zero out the new record */
@@ -1473,7 +1475,7 @@ tdbio_new_recnum()
rc = tdbio_write_record( &rec );
if( rc )
log_fatal(_("%s: failed to zero a record: %s\n"),
- db_name, g10_errstr(rc));
+ db_name, gpg_strerror (rc));
}
else { /* not found, append a new record */
offset = lseek( db_fd, 0, SEEK_END );
@@ -1503,7 +1505,7 @@ tdbio_new_recnum()
if( rc )
log_fatal(_("%s: failed to append a record: %s\n"),
- db_name, g10_errstr(rc));
+ db_name, gpg_strerror (rc));
}
return recnum ;
}
diff --git a/g10/trust.c b/g10/trust.c
index c8a1c2c70..796694d59 100644
--- a/g10/trust.c
+++ b/g10/trust.c
@@ -317,7 +317,7 @@ get_validity (PKT_public_key *pk, PKT_user_id *uid)
{
char *tempkeystr = xstrdup (keystr (pk->main_keyid));
log_error ("error getting main key %s of subkey %s: %s\n",
- tempkeystr, keystr (kid), g10_errstr (rc));
+ tempkeystr, keystr (kid), gpg_strerror (rc));
xfree (tempkeystr);
validity = TRUST_UNKNOWN;
goto leave;
diff --git a/g10/trustdb.c b/g10/trustdb.c
index 1bf664b3d..84179f0b0 100644
--- a/g10/trustdb.c
+++ b/g10/trustdb.c
@@ -328,7 +328,7 @@ read_record (ulong recno, TRUSTREC *rec, int rectype )
if (rc)
{
log_error(_("trust record %lu, req type %d: read failed: %s\n"),
- recno, rec->rectype, g10_errstr(rc) );
+ recno, rec->rectype, gpg_strerror (rc) );
tdbio_invalid();
}
if (rectype != rec->rectype)
@@ -349,7 +349,7 @@ write_record (TRUSTREC *rec)
if (rc)
{
log_error(_("trust record %lu, type %d: write failed: %s\n"),
- rec->recnum, rec->rectype, g10_errstr(rc) );
+ rec->recnum, rec->rectype, gpg_strerror (rc) );
tdbio_invalid();
}
}
@@ -363,7 +363,7 @@ do_sync(void)
int rc = tdbio_sync ();
if(rc)
{
- log_error (_("trustdb: sync failed: %s\n"), g10_errstr(rc) );
+ log_error (_("trustdb: sync failed: %s\n"), gpg_strerror (rc) );
g10_exit(2);
}
}
@@ -434,7 +434,7 @@ init_trustdb ()
{
int rc = tdbio_set_dbname( dbname, !!level, &trustdb_args.no_trustdb);
if( rc )
- log_fatal("can't init trustdb: %s\n", g10_errstr(rc) );
+ log_fatal("can't init trustdb: %s\n", gpg_strerror (rc) );
}
else
BUG();
@@ -603,7 +603,7 @@ read_trust_record (PKT_public_key *pk, TRUSTREC *rec)
if (rc)
{
log_error ("trustdb: searching trust record failed: %s\n",
- g10_errstr (rc));
+ gpg_strerror (rc));
return rc;
}
@@ -611,7 +611,7 @@ read_trust_record (PKT_public_key *pk, TRUSTREC *rec)
{
log_error ("trustdb: record %lu is not a trust record\n",
rec->recnum);
- return G10ERR_TRUSTDB;
+ return GPG_ERR_TRUSTDB;
}
return 0;
@@ -729,7 +729,7 @@ update_min_ownertrust (u32 *kid, unsigned int new_trust )
rc = get_pubkey (pk, kid);
if (rc)
{
- log_error(_("public key %s not found: %s\n"),keystr(kid),g10_errstr(rc));
+ log_error(_("public key %s not found: %s\n"),keystr(kid),gpg_strerror (rc));
return;
}
@@ -1143,7 +1143,7 @@ ask_ownertrust (u32 *kid,int minimum)
if (rc)
{
log_error (_("public key %s not found: %s\n"),
- keystr(kid), g10_errstr(rc) );
+ keystr(kid), gpg_strerror (rc) );
return TRUST_UNKNOWN;
}
@@ -1577,7 +1577,7 @@ validate_key_list (KEYDB_HANDLE hd, KeyHashTable full_trust,
rc = keydb_search_reset (hd);
if (rc)
{
- log_error ("keydb_search_reset failed: %s\n", g10_errstr(rc));
+ log_error ("keydb_search_reset failed: %s\n", gpg_strerror (rc));
xfree (keys);
return NULL;
}
@@ -1594,7 +1594,7 @@ validate_key_list (KEYDB_HANDLE hd, KeyHashTable full_trust,
}
if (rc)
{
- log_error ("keydb_search_first failed: %s\n", g10_errstr(rc));
+ log_error ("keydb_search_first failed: %s\n", gpg_strerror (rc));
xfree (keys);
return NULL;
}
@@ -1607,7 +1607,7 @@ validate_key_list (KEYDB_HANDLE hd, KeyHashTable full_trust,
rc = keydb_get_keyblock (hd, &keyblock);
if (rc)
{
- log_error ("keydb_get_keyblock failed: %s\n", g10_errstr(rc));
+ log_error ("keydb_get_keyblock failed: %s\n", gpg_strerror (rc));
xfree (keys);
return NULL;
}
@@ -1664,7 +1664,7 @@ validate_key_list (KEYDB_HANDLE hd, KeyHashTable full_trust,
if (rc && gpg_err_code (rc) != GPG_ERR_NOT_FOUND)
{
- log_error ("keydb_search_next failed: %s\n", g10_errstr(rc));
+ log_error ("keydb_search_next failed: %s\n", gpg_strerror (rc));
xfree (keys);
return NULL;
}
@@ -1881,7 +1881,7 @@ validate_keys (int interactive)
if (!keys)
{
log_error ("validate_key_list failed\n");
- rc = G10ERR_GENERAL;
+ rc = GPG_ERR_GENERAL;
goto leave;
}
@@ -1971,7 +1971,7 @@ validate_keys (int interactive)
if(tdbio_update_version_record()!=0)
{
log_error(_("unable to update trustdb version record: "
- "write failed: %s\n"), g10_errstr(rc));
+ "write failed: %s\n"), gpg_strerror (rc));
tdbio_invalid();
}
diff --git a/g10/verify.c b/g10/verify.c
index 2d5aab418..2efc89d05 100644
--- a/g10/verify.c
+++ b/g10/verify.c
@@ -113,7 +113,8 @@ verify_signatures (ctrl_t ctrl, int nfiles, char **files )
rc = proc_signature_packets (ctrl, NULL, fp, sl, sigfile );
free_strlist(sl);
iobuf_close(fp);
- if( (afx && afx->no_openpgp_data && rc == -1) || rc == G10ERR_NO_DATA ) {
+ if( (afx && afx->no_openpgp_data && rc == -1)
+ || gpg_err_code (rc) == GPG_ERR_NO_DATA ) {
log_error(_("the signature could not be verified.\n"
"Please remember that the signature file (.sig or .asc)\n"
"should be the first file given on the command line.\n") );
@@ -202,7 +203,7 @@ verify_files (ctrl_t ctrl, int nfiles, char **files )
lno++;
if( !*line || line[strlen(line)-1] != '\n' ) {
log_error(_("input line %u too long or missing LF\n"), lno );
- return G10ERR_GENERAL;
+ return GPG_ERR_GENERAL;
}
/* This code does not work on MSDOS but how cares there are
* also no script languages available. We don't strip any