mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-22 10:19:57 +01:00
Continued with merging.
Still does not build.
This commit is contained in:
parent
29b23dea97
commit
d0907e64f4
@ -51,7 +51,7 @@ write_header( cipher_filter_context_t *cfx, IOBUF a )
|
||||
unsigned int blocksize;
|
||||
unsigned int nprefix;
|
||||
|
||||
blocksize = gcry_cipher_algo_blklen (cfx->dek->algo);
|
||||
blocksize = gcry_cipher_get_algo_blklen (cfx->dek->algo);
|
||||
if ( blocksize < 8 || blocksize > 16 )
|
||||
log_fatal("unsupported blocksize %u\n", blocksize );
|
||||
|
||||
@ -88,8 +88,8 @@ write_header( cipher_filter_context_t *cfx, IOBUF a )
|
||||
GCRY_CIPHER_MODE_CFB,
|
||||
(GCRY_CIPHER_SECURE
|
||||
| ((cfx->dek->use_mdc || cfx->dek->algo >= 100)?
|
||||
0 : GCRY_CIPHER_ENABLE_SYNC));
|
||||
if (rc) {
|
||||
0 : GCRY_CIPHER_ENABLE_SYNC)));
|
||||
if (err) {
|
||||
/* We should never get an error here cause we already checked,
|
||||
* that the algorithm is available. */
|
||||
BUG();
|
||||
|
@ -58,9 +58,9 @@ dearmor_file( const char *fname )
|
||||
errno = EPERM;
|
||||
}
|
||||
if (!inp) {
|
||||
rc = gpg_error_from_errno (errno);
|
||||
log_error(_("can't open `%s': %s\n"), fname? fname: "[stdin]",
|
||||
strerror(errno) );
|
||||
rc = G10ERR_OPEN_FILE;
|
||||
goto leave;
|
||||
}
|
||||
|
||||
@ -107,9 +107,9 @@ enarmor_file( const char *fname )
|
||||
errno = EPERM;
|
||||
}
|
||||
if (!inp) {
|
||||
rc = gpg_error_from_errno (errno);
|
||||
log_error(_("can't open `%s': %s\n"), fname? fname: "[stdin]",
|
||||
strerror(errno) );
|
||||
rc = G10ERR_OPEN_FILE;
|
||||
goto leave;
|
||||
}
|
||||
|
||||
|
23
g10/encode.c
23
g10/encode.c
@ -92,7 +92,7 @@ encode_seskey( DEK *dek, DEK **seskey, byte *enckey )
|
||||
BUG ();
|
||||
if (gcry_cipher_setkey (hd, dek->key, dek->keylen))
|
||||
BUG ();
|
||||
gry_cipher_setiv (hd, NULL, 0);
|
||||
gcry_cipher_setiv (hd, NULL, 0);
|
||||
gcry_cipher_encrypt (hd, buf, (*seskey)->keylen + 1, NULL, 0);
|
||||
gcry_cipher_close (hd);
|
||||
|
||||
@ -190,7 +190,7 @@ encode_simple( const char *filename, int mode, int use_seskey )
|
||||
}
|
||||
if( !inp ) {
|
||||
rc = gpg_error_from_errno (errno);
|
||||
log_error(_("can't open `%s': %s\n"), filename? filename: "[stdin]"
|
||||
log_error(_("can't open `%s': %s\n"), filename? filename: "[stdin]",
|
||||
strerror(errno) );
|
||||
return rc;
|
||||
}
|
||||
@ -365,9 +365,9 @@ encode_simple( const char *filename, int mode, int use_seskey )
|
||||
byte copy_buffer[4096];
|
||||
int bytes_copied;
|
||||
while ((bytes_copied = iobuf_read(inp, copy_buffer, 4096)) != -1)
|
||||
if (iobuf_write(out, copy_buffer, bytes_copied) == -1) {
|
||||
rc = G10ERR_WRITE_FILE;
|
||||
log_error("copying input to output failed: %s\n", g10_errstr(rc) );
|
||||
if ( (rc=iobuf_write(out, copy_buffer, bytes_copied)) ) {
|
||||
log_error ("copying input to output failed: %s\n",
|
||||
gpg_strerror (rc) );
|
||||
break;
|
||||
}
|
||||
wipememory(copy_buffer, 4096); /* burn buffer */
|
||||
@ -403,7 +403,7 @@ setup_symkey(STRING2KEY **symkey_s2k,DEK **symkey_dek)
|
||||
{
|
||||
xfree(*symkey_dek);
|
||||
xfree(*symkey_s2k);
|
||||
return G10ERR_PASSPHRASE;
|
||||
return gpg_error (GPG_ERR_BAD_PASSPHRASE);
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -412,7 +412,7 @@ setup_symkey(STRING2KEY **symkey_s2k,DEK **symkey_dek)
|
||||
static int
|
||||
write_symkey_enc(STRING2KEY *symkey_s2k,DEK *symkey_dek,DEK *dek,IOBUF out)
|
||||
{
|
||||
int rc,seskeylen=cipher_get_keylen(dek->algo)/8;
|
||||
int rc, seskeylen = gcry_cipher_get_algo_keylen (dek->algo);
|
||||
|
||||
PKT_symkey_enc *enc;
|
||||
byte enckey[33];
|
||||
@ -674,10 +674,9 @@ encode_crypt( const char *filename, STRLIST remusr, int use_symkey )
|
||||
byte copy_buffer[4096];
|
||||
int bytes_copied;
|
||||
while ((bytes_copied = iobuf_read(inp, copy_buffer, 4096)) != -1)
|
||||
if (iobuf_write(out, copy_buffer, bytes_copied) == -1) {
|
||||
rc = G10ERR_WRITE_FILE;
|
||||
log_error("copying input to output failed: %s\n",
|
||||
g10_errstr(rc) );
|
||||
if ( (rc=iobuf_write(out, copy_buffer, bytes_copied)) ) {
|
||||
log_error ("copying input to output failed: %s\n",
|
||||
gpg_strerror (rc));
|
||||
break;
|
||||
}
|
||||
wipememory(copy_buffer, 4096); /* burn buffer */
|
||||
@ -795,7 +794,7 @@ write_pubkey_enc_from_list( PK_LIST pk_list, DEK *dek, IOBUF out )
|
||||
int rc;
|
||||
|
||||
for( ; pk_list; pk_list = pk_list->next ) {
|
||||
MPI frame;
|
||||
gcry_mpi_t frame;
|
||||
|
||||
pk = pk_list->pk;
|
||||
|
||||
|
@ -438,8 +438,8 @@ int exec_write(struct exec_info **info,const char *program,
|
||||
(*info)->tochild=fdopen(to[1],binary?"wb":"w");
|
||||
if((*info)->tochild==NULL)
|
||||
{
|
||||
ret = gpg_error_from_errno (errno);
|
||||
close(to[1]);
|
||||
ret=G10ERR_WRITE_FILE;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
@ -448,8 +448,8 @@ int exec_write(struct exec_info **info,const char *program,
|
||||
(*info)->fromchild=iobuf_fdopen(from[0],"r");
|
||||
if((*info)->fromchild==NULL)
|
||||
{
|
||||
ret = gpg_error_from_errno (errno);
|
||||
close(from[0]);
|
||||
ret=G10ERR_READ_FILE;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
@ -547,9 +547,9 @@ int exec_read(struct exec_info *info)
|
||||
}
|
||||
if(info->fromchild==NULL)
|
||||
{
|
||||
ret = gpg_error_from_errno (errno);
|
||||
log_error(_("unable to read external program response: %s\n"),
|
||||
strerror(errno));
|
||||
ret=G10ERR_READ_FILE;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
@ -594,7 +594,6 @@ do_export_stream( IOBUF out, STRLIST users, int secret,
|
||||
if( rc ) {
|
||||
log_error("build_packet(%d) failed: %s\n",
|
||||
node->pkt->pkttype, g10_errstr(rc) );
|
||||
rc = G10ERR_WRITE_FILE;
|
||||
goto leave;
|
||||
}
|
||||
}
|
||||
|
20
g10/filter.h
20
g10/filter.h
@ -126,36 +126,36 @@ typedef struct {
|
||||
/* encrypt_filter_context_t defined in main.h */
|
||||
|
||||
/*-- mdfilter.c --*/
|
||||
int md_filter( void *opaque, int control, IOBUF a, byte *buf, size_t *ret_len);
|
||||
int md_filter( void *opaque, int control, iobuf_t a, byte *buf, size_t *ret_len);
|
||||
void free_md_filter_context( md_filter_context_t *mfx );
|
||||
|
||||
/*-- armor.c --*/
|
||||
int use_armor_filter( IOBUF a );
|
||||
int use_armor_filter( iobuf_t a );
|
||||
int armor_filter( void *opaque, int control,
|
||||
IOBUF chain, byte *buf, size_t *ret_len);
|
||||
iobuf_t chain, byte *buf, size_t *ret_len);
|
||||
UnarmorPump unarmor_pump_new (void);
|
||||
void unarmor_pump_release (UnarmorPump x);
|
||||
int unarmor_pump (UnarmorPump x, int c);
|
||||
|
||||
/*-- compress.c --*/
|
||||
void push_compress_filter(IOBUF out,compress_filter_context_t *zfx,int algo);
|
||||
void push_compress_filter2(IOBUF out,compress_filter_context_t *zfx,
|
||||
void push_compress_filter(iobuf_t out,compress_filter_context_t *zfx,int algo);
|
||||
void push_compress_filter2(iobuf_t out,compress_filter_context_t *zfx,
|
||||
int algo,int rel);
|
||||
|
||||
/*-- cipher.c --*/
|
||||
int cipher_filter( void *opaque, int control,
|
||||
IOBUF chain, byte *buf, size_t *ret_len);
|
||||
iobuf_t chain, byte *buf, size_t *ret_len);
|
||||
|
||||
/*-- textfilter.c --*/
|
||||
int text_filter( void *opaque, int control,
|
||||
IOBUF chain, byte *buf, size_t *ret_len);
|
||||
int copy_clearsig_text (IOBUF out, IOBUF inp, gcry_md_hd_t md,
|
||||
iobuf_t chain, byte *buf, size_t *ret_len);
|
||||
int copy_clearsig_text (iobuf_t out, iobuf_t inp, gcry_md_hd_t md,
|
||||
int escape_dash, int escape_from, int pgp2mode);
|
||||
|
||||
/*-- progress.c --*/
|
||||
int progress_filter (void *opaque, int control,
|
||||
IOBUF a, byte *buf, size_t *ret_len);
|
||||
iobuf_t a, byte *buf, size_t *ret_len);
|
||||
void handle_progress (progress_filter_context_t *pfx,
|
||||
IOBUF inp, const char *name);
|
||||
iobuf_t inp, const char *name);
|
||||
|
||||
#endif /*G10_FILTER_H*/
|
||||
|
18
g10/gpgv.c
18
g10/gpgv.c
@ -49,8 +49,6 @@
|
||||
#include "ttyio.h"
|
||||
#include "i18n.h"
|
||||
#include "status.h"
|
||||
#include "g10defs.h"
|
||||
#include "cardglue.h"
|
||||
|
||||
|
||||
enum cmd_and_opt_values { aNull = 0,
|
||||
@ -379,15 +377,15 @@ void disable_cipher_algo( int algo ) {}
|
||||
int check_cipher_algo( int algo ) { return -1;}
|
||||
unsigned int cipher_get_keylen( int algo ) { return 0; }
|
||||
unsigned int cipher_get_blocksize( int algo ) {return 0;}
|
||||
CIPHER_HANDLE cipher_open( int algo, int mode, int secure ) { return NULL;}
|
||||
void cipher_close( CIPHER_HANDLE c ) {}
|
||||
int cipher_setkey( CIPHER_HANDLE c, byte *key, unsigned keylen ) { return -1;}
|
||||
void cipher_setiv( CIPHER_HANDLE c, const byte *iv, unsigned ivlen ){}
|
||||
void cipher_encrypt( CIPHER_HANDLE c, byte *outbuf,
|
||||
gcry_cipher_hd_t cipher_open( int algo, int mode, int secure ) { return NULL;}
|
||||
void cipher_close( gcry_cipher_hd_t c ) {}
|
||||
int cipher_setkey( gcry_cipher_hd_t c, byte *key, unsigned keylen ) { return -1;}
|
||||
void cipher_setiv( gcry_cipher_hd_t c, const byte *iv, unsigned ivlen ){}
|
||||
void cipher_encrypt( gcry_cipher_hd_t c, byte *outbuf,
|
||||
byte *inbuf, unsigned nbytes ) {}
|
||||
void cipher_decrypt( CIPHER_HANDLE c, byte *outbuf,
|
||||
void cipher_decrypt( gcry_cipher_hd_t c, byte *outbuf,
|
||||
byte *inbuf, unsigned nbytes ) {}
|
||||
void cipher_sync( CIPHER_HANDLE c ) {}
|
||||
void cipher_sync( gcry_cipher_hd_t c ) {}
|
||||
|
||||
/* Stubs to avoid linking to ../cipher/random.c */
|
||||
void random_dump_stats(void) {}
|
||||
@ -404,7 +402,7 @@ void register_primegen_progress ( void (*cb)( void *, int), void *cb_data ) {}
|
||||
MPI generate_secret_prime( unsigned nbits ) { return NULL;}
|
||||
MPI generate_public_prime( unsigned nbits ) { return NULL;}
|
||||
MPI generate_elg_prime( int mode, unsigned pbits, unsigned qbits,
|
||||
MPI g, MPI **ret_factors ) { return NULL;}
|
||||
gcry_mpi_t g, gcry_mpi_t **ret_factors ) { return NULL;}
|
||||
|
||||
/* Do not link to ../cipher/rndlinux.c */
|
||||
void rndlinux_constructor(void) {}
|
||||
|
16
g10/import.c
16
g10/import.c
@ -596,9 +596,9 @@ check_prefs(KBNODE keyblock)
|
||||
|
||||
if(prefs->type==PREFTYPE_SYM)
|
||||
{
|
||||
if(check_cipher_algo(prefs->value))
|
||||
if (openpgp_cipher_algo_test (prefs->value))
|
||||
{
|
||||
const char *algo=cipher_algo_to_string(prefs->value);
|
||||
const char *algo = gcry_cipher_algo_name (prefs->value);
|
||||
if(!problem)
|
||||
check_prefs_warning(pk);
|
||||
log_info(_(" \"%s\": preference for cipher"
|
||||
@ -608,9 +608,9 @@ check_prefs(KBNODE keyblock)
|
||||
}
|
||||
else if(prefs->type==PREFTYPE_HASH)
|
||||
{
|
||||
if(check_digest_algo(prefs->value))
|
||||
if(openpgp_md_test_algo(prefs->value))
|
||||
{
|
||||
const char *algo=digest_algo_to_string(prefs->value);
|
||||
const char *algo = gcry_md_algo_name (prefs->value);
|
||||
if(!problem)
|
||||
check_prefs_warning(pk);
|
||||
log_info(_(" \"%s\": preference for digest"
|
||||
@ -620,7 +620,7 @@ check_prefs(KBNODE keyblock)
|
||||
}
|
||||
else if(prefs->type==PREFTYPE_ZIP)
|
||||
{
|
||||
if(check_compress_algo(prefs->value))
|
||||
if(check_compress_algo (prefs->value))
|
||||
{
|
||||
const char *algo=compress_algo_to_string(prefs->value);
|
||||
if(!problem)
|
||||
@ -1541,9 +1541,9 @@ delete_inv_parts( const char *fname, KBNODE keyblock,
|
||||
else
|
||||
subkey_seen = 1;
|
||||
}
|
||||
else if( node->pkt->pkttype == PKT_SIGNATURE
|
||||
&& check_pubkey_algo( node->pkt->pkt.signature->pubkey_algo)
|
||||
&& node->pkt->pkt.signature->pubkey_algo != PUBKEY_ALGO_RSA )
|
||||
else if (node->pkt->pkttype == PKT_SIGNATURE
|
||||
&& openpgp_pk_test_algo (node->pkt->pkt.signature->pubkey_algo)
|
||||
&& node->pkt->pkt.signature->pubkey_algo != PUBKEY_ALGO_RSA )
|
||||
delete_kbnode( node ); /* build_packet() can't handle this */
|
||||
else if( node->pkt->pkttype == PKT_SIGNATURE &&
|
||||
!node->pkt->pkt.signature->flags.exportable &&
|
||||
|
@ -2311,7 +2311,7 @@ show_prefs (PKT_user_id *uid, PKT_signature *selfsig, int verbose)
|
||||
tty_printf (_("Cipher: "));
|
||||
for(i=any=0; prefs[i].type; i++ ) {
|
||||
if( prefs[i].type == PREFTYPE_SYM ) {
|
||||
const char *s = cipher_algo_to_string (prefs[i].value);
|
||||
const char *s = gcry_cipher_algo_name (prefs[i].value);
|
||||
|
||||
if (any)
|
||||
tty_printf (", ");
|
||||
@ -2328,13 +2328,13 @@ show_prefs (PKT_user_id *uid, PKT_signature *selfsig, int verbose)
|
||||
if (!des_seen) {
|
||||
if (any)
|
||||
tty_printf (", ");
|
||||
tty_printf ("%s",cipher_algo_to_string(CIPHER_ALGO_3DES));
|
||||
tty_printf ("%s", gcry_cipher_algo_name (CIPHER_ALGO_3DES));
|
||||
}
|
||||
tty_printf ("\n ");
|
||||
tty_printf (_("Digest: "));
|
||||
for(i=any=0; prefs[i].type; i++ ) {
|
||||
if( prefs[i].type == PREFTYPE_HASH ) {
|
||||
const char *s = digest_algo_to_string (prefs[i].value);
|
||||
const char *s = gcry_md_algo_name (prefs[i].value);
|
||||
|
||||
if (any)
|
||||
tty_printf (", ");
|
||||
@ -2351,7 +2351,7 @@ show_prefs (PKT_user_id *uid, PKT_signature *selfsig, int verbose)
|
||||
if (!sha1_seen) {
|
||||
if (any)
|
||||
tty_printf (", ");
|
||||
tty_printf ("%s",digest_algo_to_string(DIGEST_ALGO_SHA1));
|
||||
tty_printf ("%s", gcry_md_algo_name (DIGEST_ALGO_SHA1));
|
||||
}
|
||||
tty_printf ("\n ");
|
||||
tty_printf (_("Compression: "));
|
||||
@ -2686,7 +2686,7 @@ show_key_with_all_names( KBNODE keyblock, int only_marked, int with_revoker,
|
||||
if(pk->is_revoked)
|
||||
{
|
||||
char *user=get_user_id_string_native(pk->revoked.keyid);
|
||||
const char *algo=pubkey_algo_to_string(pk->revoked.algo);
|
||||
const char *algo = gcry_pk_algo_name (pk->revoked.algo);
|
||||
tty_printf(_("This key was revoked on %s by %s key %s\n"),
|
||||
revokestr_from_pk(pk),algo?algo:"?",user);
|
||||
xfree(user);
|
||||
@ -2701,9 +2701,9 @@ show_key_with_all_names( KBNODE keyblock, int only_marked, int with_revoker,
|
||||
{
|
||||
u32 r_keyid[2];
|
||||
char *user;
|
||||
const char *algo=
|
||||
pubkey_algo_to_string(pk->revkey[i].algid);
|
||||
const char *algo;
|
||||
|
||||
algo = gcry_pk_algo_name (pk->revkey[i].algid);
|
||||
keyid_from_fingerprint(pk->revkey[i].fpr,
|
||||
MAX_FINGERPRINT_LEN,r_keyid);
|
||||
|
||||
|
30
g10/keygen.c
30
g10/keygen.c
@ -319,13 +319,13 @@ keygen_set_std_prefs (const char *string,int personal)
|
||||
/* Make sure we do not add more than 15 items here, as we
|
||||
could overflow the size of dummy_string. We currently
|
||||
have at most 12. */
|
||||
if(!check_cipher_algo(CIPHER_ALGO_AES256))
|
||||
if ( !openpgp_cipher_test_algo (CIPHER_ALGO_AES256) )
|
||||
strcat(dummy_string,"S9 ");
|
||||
if(!check_cipher_algo(CIPHER_ALGO_AES192))
|
||||
if ( !openpgp_cipher_test_algo (CIPHER_ALGO_AES192) )
|
||||
strcat(dummy_string,"S8 ");
|
||||
if(!check_cipher_algo(CIPHER_ALGO_AES))
|
||||
if ( !openpgp_cipher_test_algo (CIPHER_ALGO_AES) )
|
||||
strcat(dummy_string,"S7 ");
|
||||
if(!check_cipher_algo(CIPHER_ALGO_CAST5))
|
||||
if ( !openpgp_cipher_test_algo (CIPHER_ALGO_CAST5) )
|
||||
strcat(dummy_string,"S3 ");
|
||||
strcat(dummy_string,"S2 "); /* 3DES */
|
||||
/* If we have it, IDEA goes *after* 3DES so it won't be
|
||||
@ -335,7 +335,7 @@ keygen_set_std_prefs (const char *string,int personal)
|
||||
break PGP2, but that is difficult with the current
|
||||
code, and not really worth checking as a non-RSA <=2048
|
||||
bit key wouldn't be usable by PGP2 anyway. -dms */
|
||||
if(!check_cipher_algo(CIPHER_ALGO_IDEA))
|
||||
if ( !openpgp_cipher_test_algo (CIPHER_ALGO_IDEA) )
|
||||
strcat(dummy_string,"S1 ");
|
||||
|
||||
/* SHA-1 */
|
||||
@ -370,12 +370,12 @@ keygen_set_std_prefs (const char *string,int personal)
|
||||
|
||||
while((tok=strsep(&prefstring," ,")))
|
||||
{
|
||||
if((val=string_to_cipher_algo(tok)))
|
||||
if((val=openpgp_cipher_map_name (tok)))
|
||||
{
|
||||
if(set_one_pref(val,1,tok,sym,&nsym))
|
||||
rc=-1;
|
||||
}
|
||||
else if((val=string_to_digest_algo(tok)))
|
||||
else if((val=openpgp_md_map_name (tok)))
|
||||
{
|
||||
if(set_one_pref(val,2,tok,hash,&nhash))
|
||||
rc=-1;
|
||||
@ -1071,6 +1071,7 @@ genhelp_protect (DEK *dek, STRING2KEY *s2k, PKT_secret_key *sk)
|
||||
static void
|
||||
genhelp_factors (gcry_sexp_t misc_key_info, KBNODE sec_root)
|
||||
{
|
||||
#if 0 /* Not used anymore */
|
||||
size_t n;
|
||||
char *buf;
|
||||
|
||||
@ -1093,6 +1094,7 @@ genhelp_factors (gcry_sexp_t misc_key_info, KBNODE sec_root)
|
||||
xfree (buf);
|
||||
gcry_sexp_release (misc_key_info);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -1484,7 +1486,7 @@ ask_key_flags(int algo,int subkey)
|
||||
{
|
||||
tty_printf("\n");
|
||||
tty_printf(_("Possible actions for a %s key: "),
|
||||
pubkey_algo_to_string(algo));
|
||||
gcry_pk_algo_name (algo));
|
||||
print_key_flags(possible);
|
||||
tty_printf("\n");
|
||||
tty_printf(_("Current allowed actions: "));
|
||||
@ -1649,7 +1651,7 @@ ask_keysize( int algo )
|
||||
}
|
||||
|
||||
tty_printf(_("%s keys may be between %u and %u bits long.\n"),
|
||||
pubkey_algo_to_string(algo),min,max);
|
||||
gcry_pk_algo_name (algo), min, max);
|
||||
|
||||
for(;;)
|
||||
{
|
||||
@ -1670,7 +1672,7 @@ ask_keysize( int algo )
|
||||
|
||||
if(nbits<min || nbits>max)
|
||||
tty_printf(_("%s keysizes must be in the range %u-%u\n"),
|
||||
pubkey_algo_to_string(algo),min,max);
|
||||
gcry_pk_algo_name (algo), min, max);
|
||||
else
|
||||
break;
|
||||
}
|
||||
@ -2136,7 +2138,7 @@ get_parameter_algo( struct para_data_s *para, enum para_name key )
|
||||
if( digitp( r->u.value ) )
|
||||
i = atoi( r->u.value );
|
||||
else
|
||||
i = string_to_pubkey_algo( r->u.value );
|
||||
i = openpgp_pk_map_name (r->u.value);
|
||||
if (i == PUBKEY_ALGO_RSA_E || i == PUBKEY_ALGO_RSA_S)
|
||||
i = 0; /* we don't want to allow generation of these algorithms */
|
||||
return i;
|
||||
@ -2287,7 +2289,7 @@ proc_parameter_file( struct para_data_s *para, const char *fname,
|
||||
if(r)
|
||||
{
|
||||
algo=get_parameter_algo(para,pKEYTYPE);
|
||||
if(check_pubkey_algo2(algo,PUBKEY_USAGE_SIG))
|
||||
if (openpgp_pk_test_algo (algo, PUBKEY_USAGE_SIG))
|
||||
{
|
||||
log_error("%s:%d: invalid algorithm\n", fname, r->lnr );
|
||||
return -1;
|
||||
@ -2316,7 +2318,7 @@ proc_parameter_file( struct para_data_s *para, const char *fname,
|
||||
if(r)
|
||||
{
|
||||
algo=get_parameter_algo( para, pSUBKEYTYPE);
|
||||
if(check_pubkey_algo(algo))
|
||||
if (openpgp_pk_test_algo (algo))
|
||||
{
|
||||
log_error("%s:%d: invalid algorithm\n", fname, r->lnr );
|
||||
return -1;
|
||||
@ -3504,7 +3506,7 @@ write_keyblock( IOBUF out, KBNODE node )
|
||||
{
|
||||
log_error("build_packet(%d) failed: %s\n",
|
||||
node->pkt->pkttype, g10_errstr(rc) );
|
||||
return G10ERR_WRITE_FILE;
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -917,7 +917,8 @@ list_keyblock_print ( KBNODE keyblock, int secret, int fpr, void *opaque )
|
||||
rc = check_key_signature( keyblock, node, NULL );
|
||||
switch( gpg_err_code (rc) ) {
|
||||
case 0: sigrc = '!'; break;
|
||||
case GPG_ERR_BAD_SIGN: stats->inv_sigs++; sigrc = '-'; break;
|
||||
case GPG_ERR_BAD_SIGNATURE:
|
||||
stats->inv_sigs++; sigrc = '-'; break;
|
||||
case GPG_ERR_NO_PUBKEY:
|
||||
case GPG_ERR_UNUSABLE_PUBKEY: stats->no_key++; continue;
|
||||
default: stats->oth_err++; sigrc = '%'; break;
|
||||
@ -1306,11 +1307,11 @@ list_keyblock_colon( KBNODE keyblock, int secret, int fpr )
|
||||
rc = check_key_signature2( keyblock, node, NULL, signer_pk,
|
||||
NULL, NULL, NULL );
|
||||
switch ( gpg_err_code (rc) ) {
|
||||
case 0: sigrc = '!'; break;
|
||||
case GPG_ERR_BAD_SIGN: sigrc = '-'; break;
|
||||
case 0: sigrc = '!'; break;
|
||||
case GPG_ERR_BAD_SIGNATURE: sigrc = '-'; break;
|
||||
case GPG_ERR_NO_PUBKEY:
|
||||
case GPG_ERR_UNU_PUBKEY: sigrc = '?'; break;
|
||||
default: sigrc = '%'; break;
|
||||
case Gpg_Err_UNUSABLE_PUBKEY: sigrc = '?'; break;
|
||||
default: sigrc = '%'; break;
|
||||
}
|
||||
|
||||
if(opt.no_sig_cache)
|
||||
|
@ -478,7 +478,7 @@ print_keyrec(int number,struct keyrec *keyrec)
|
||||
|
||||
if(keyrec->type)
|
||||
{
|
||||
const char *str=pubkey_algo_to_string(keyrec->type);
|
||||
const char *str = gcry_pk_algo_name (keyrec->type);
|
||||
|
||||
if(str)
|
||||
printf("%s ",str);
|
||||
@ -1402,7 +1402,7 @@ keyserver_spawn(enum ks_action action,STRLIST list,KEYDB_SEARCH_DESC *desc,
|
||||
maxlen=1024;
|
||||
if(iobuf_read_line(spawn->fromchild,&line,&buflen,&maxlen)==0)
|
||||
{
|
||||
ret=G10ERR_READ_FILE;
|
||||
ret = gpg_error_from_errno (errno);
|
||||
goto fail; /* i.e. EOF */
|
||||
}
|
||||
|
||||
|
@ -639,7 +639,7 @@ proc_plaintext( CTX c, PACKET *pkt )
|
||||
* documents */
|
||||
clearsig = (*data == 0x01);
|
||||
for( data++, datalen--; datalen; datalen--, data++ )
|
||||
md_enable( c->mfx.md, *data );
|
||||
gcry_md_enable (c->mfx.md, *data);
|
||||
any = 1;
|
||||
break; /* Stop here as one-pass signature packets are not
|
||||
expected. */
|
||||
@ -679,7 +679,7 @@ proc_plaintext( CTX c, PACKET *pkt )
|
||||
}
|
||||
|
||||
rc = handle_plaintext( pt, &c->mfx, c->sigs_only, clearsig );
|
||||
if( gpg_err_code (rc) == G10ERR_CREATE_FILE && !c->sigs_only)
|
||||
if( gpg_err_code (rc) == GPG_ERR_ENOENT && !c->sigs_only)
|
||||
{
|
||||
#warning We need to change the test for the error code
|
||||
/* Can't write output but we hash it anyway to
|
||||
@ -1194,7 +1194,7 @@ do_proc_packets( CTX c, IOBUF a )
|
||||
free_packet(pkt);
|
||||
/* stop processing when an invalid packet has been encountered
|
||||
* but don't do so when we are doing a --list-packets. */
|
||||
if (gpg_err_code (rc) == GPG_ERR_INVALID_PACKET
|
||||
if (gpg_err_code (rc) == GPG_ERR_INV_PACKET
|
||||
&& opt.list_packets != 2 )
|
||||
break;
|
||||
continue;
|
||||
@ -2002,7 +2002,7 @@ proc_tree( CTX c, KBNODE node )
|
||||
/* detached signature */
|
||||
free_md_filter_context( &c->mfx );
|
||||
if (gcry_md_open (&c->mfx.md, sig->digest_algo, 0))
|
||||
BUG ():
|
||||
BUG ();
|
||||
|
||||
if( !opt.pgp2_workarounds )
|
||||
;
|
||||
|
@ -491,11 +491,10 @@ parse( IOBUF inp, PACKET *pkt, int onlykeypkts, off_t *retpos,
|
||||
}
|
||||
|
||||
if( out && pkttype ) {
|
||||
if( iobuf_write( out, hdr, hdrlen ) == -1 )
|
||||
rc = G10ERR_WRITE_FILE;
|
||||
else
|
||||
rc = iobuf_write (out, hdr, hdrlen);
|
||||
if (!rc)
|
||||
rc = copy_packet(inp, out, pkttype, pktlen, partial );
|
||||
goto leave;
|
||||
goto leave;
|
||||
}
|
||||
|
||||
if (with_uid && pkttype == PKT_USER_ID)
|
||||
|
@ -897,7 +897,7 @@ passphrase_to_dek( u32 *keyid, int pubkey_algo,
|
||||
xfree(p);
|
||||
|
||||
if( !get_pubkey( pk, keyid ) ) {
|
||||
const char *s = pubkey_algo_to_string( pk->pubkey_algo );
|
||||
const char *s = gcry_pk_algo_name ( pk->pubkey_algo );
|
||||
tty_printf( _("%u-bit %s key, ID %s, created %s"),
|
||||
nbits_from_pk( pk ), s?s:"?", keystr(keyid),
|
||||
strtimestamp(pk->timestamp) );
|
||||
@ -1011,22 +1011,23 @@ passphrase_to_dek( u32 *keyid, int pubkey_algo,
|
||||
static void
|
||||
hash_passphrase( DEK *dek, char *pw, STRING2KEY *s2k, int create )
|
||||
{
|
||||
MD_HANDLE md;
|
||||
gcry_md_hd_t md;
|
||||
int pass, i;
|
||||
int used = 0;
|
||||
int pwlen = strlen(pw);
|
||||
|
||||
assert( s2k->hash_algo );
|
||||
dek->keylen = cipher_get_keylen( dek->algo ) / 8;
|
||||
dek->keylen = gcry_cipher_algo_get_keylen (dek->algo );
|
||||
if( !(dek->keylen > 0 && dek->keylen <= DIM(dek->key)) )
|
||||
BUG();
|
||||
|
||||
md = md_open( s2k->hash_algo, 1);
|
||||
if (gcry_md_open (&md, s2k->hash_algo, 1))
|
||||
BUG ();
|
||||
for(pass=0; used < dek->keylen ; pass++ ) {
|
||||
if( pass ) {
|
||||
md_reset(md);
|
||||
gcry_md_reset (md);
|
||||
for(i=0; i < pass; i++ ) /* preset the hash context */
|
||||
md_putc(md, 0 );
|
||||
gcry_md_putc (md, 0 );
|
||||
}
|
||||
|
||||
if( s2k->mode == 1 || s2k->mode == 3 ) {
|
||||
@ -1034,7 +1035,7 @@ hash_passphrase( DEK *dek, char *pw, STRING2KEY *s2k, int create )
|
||||
ulong count = len2;
|
||||
|
||||
if( create && !pass ) {
|
||||
randomize_buffer(s2k->salt, 8, 1);
|
||||
gcry_randomize (s2k->salt, 8, GCRY_STRONG_RANDOM);
|
||||
if( s2k->mode == 3 )
|
||||
s2k->count = 96; /* 65536 iterations */
|
||||
}
|
||||
@ -1046,27 +1047,27 @@ hash_passphrase( DEK *dek, char *pw, STRING2KEY *s2k, int create )
|
||||
}
|
||||
/* a little bit complicated because we need a ulong for count */
|
||||
while( count > len2 ) { /* maybe iterated+salted */
|
||||
md_write( md, s2k->salt, 8 );
|
||||
md_write( md, pw, pwlen );
|
||||
gcry_md_write ( md, s2k->salt, 8 );
|
||||
gcry_md_write ( md, pw, pwlen );
|
||||
count -= len2;
|
||||
}
|
||||
if( count < 8 )
|
||||
md_write( md, s2k->salt, count );
|
||||
gcry_md_write ( md, s2k->salt, count );
|
||||
else {
|
||||
md_write( md, s2k->salt, 8 );
|
||||
gcry_md_write ( md, s2k->salt, 8 );
|
||||
count -= 8;
|
||||
md_write( md, pw, count );
|
||||
gcry_md_write ( md, pw, count );
|
||||
}
|
||||
}
|
||||
else
|
||||
md_write( md, pw, pwlen );
|
||||
md_final( md );
|
||||
i = md_digest_length( s2k->hash_algo );
|
||||
gcry_md_write ( md, pw, pwlen );
|
||||
gcry_md_final( md );
|
||||
i = gcry_md_get_algo_dlen ( s2k->hash_algo );
|
||||
if( i > dek->keylen - used )
|
||||
i = dek->keylen - used;
|
||||
memcpy( dek->key+used, md_read(md, s2k->hash_algo), i );
|
||||
used += i;
|
||||
}
|
||||
md_close(md);
|
||||
gcry_md_close(md);
|
||||
}
|
||||
|
||||
|
@ -958,7 +958,7 @@ build_pk_list( STRLIST rcpts, PK_LIST *ret_pk_list, unsigned int use )
|
||||
rc = get_pubkey_byname( pk, answer, NULL, NULL, 0 );
|
||||
if (rc)
|
||||
tty_printf(_("No such user ID.\n"));
|
||||
else if ( !(rc=check_pubkey_algo2(pk->pubkey_algo, use)) )
|
||||
else if ( !(rc=openpgp_pk_test_algo2 (pk->pubkey_algo, use)) )
|
||||
{
|
||||
if ( have_def_rec )
|
||||
{
|
||||
|
@ -96,8 +96,8 @@ handle_plaintext( PKT_plaintext *pt, md_filter_context_t *mfx,
|
||||
if( !fname )
|
||||
fname = ask_outfile_name( pt->name, pt->namelen );
|
||||
if( !fname ) {
|
||||
rc = gpg_error (GPG_ERR_GENERAL) /* Can't create file. */
|
||||
goto leave;
|
||||
rc = gpg_error (GPG_ERR_GENERAL); /* Can't create file. */
|
||||
goto leave;
|
||||
}
|
||||
}
|
||||
else {
|
||||
@ -119,7 +119,7 @@ handle_plaintext( PKT_plaintext *pt, md_filter_context_t *mfx,
|
||||
char *tmp = ask_outfile_name (NULL, 0);
|
||||
if ( !tmp || !*tmp ) {
|
||||
xfree (tmp);
|
||||
rc = G10ERR_CREATE_FILE;
|
||||
rc = gpg_error (GPG_ERR_GENERAL); /* G10ERR_CREATE_FILE*/
|
||||
goto leave;
|
||||
}
|
||||
xfree (fname);
|
||||
@ -203,16 +203,19 @@ handle_plaintext( PKT_plaintext *pt, md_filter_context_t *mfx,
|
||||
{
|
||||
if(opt.max_output && (++count)>opt.max_output)
|
||||
{
|
||||
log_error("Error writing to `%s': %s\n",
|
||||
fname,"exceeded --max-output limit\n");
|
||||
log_error ("error writing to `%s': %s\n",
|
||||
fname,"exceeded --max-output limit\n");
|
||||
rc = gpg_error (GPG_ERR_GENERAL);
|
||||
goto leave;
|
||||
}
|
||||
else if( putc( c, fp ) == EOF )
|
||||
{
|
||||
log_error("Error writing to `%s': %s\n",
|
||||
fname, strerror(errno) );
|
||||
rc = G10ERR_WRITE_FILE;
|
||||
if (ferror (fp))
|
||||
rc = gpg_error_from_errno (errno);
|
||||
else
|
||||
rc = gpg_error (GPG_ERR_EOF);
|
||||
log_error ("error writing to `%s': %s\n",
|
||||
fname, strerror(errno) );
|
||||
goto leave;
|
||||
}
|
||||
}
|
||||
@ -224,9 +227,9 @@ handle_plaintext( PKT_plaintext *pt, md_filter_context_t *mfx,
|
||||
int len = pt->len > 32768 ? 32768 : pt->len;
|
||||
len = iobuf_read( pt->buf, buffer, len );
|
||||
if( len == -1 ) {
|
||||
log_error("Problem reading source (%u bytes remaining)\n",
|
||||
(unsigned)pt->len);
|
||||
rc = G10ERR_READ_FILE;
|
||||
rc = gpg_error_from_errno (errno);
|
||||
log_error ("problem reading source (%u bytes remaining)\n",
|
||||
(unsigned)pt->len);
|
||||
xfree( buffer );
|
||||
goto leave;
|
||||
}
|
||||
@ -260,7 +263,7 @@ handle_plaintext( PKT_plaintext *pt, md_filter_context_t *mfx,
|
||||
if( convert ) { /* text mode */
|
||||
while( (c = iobuf_get(pt->buf)) != -1 ) {
|
||||
if( mfx->md )
|
||||
md_putc(mfx->md, c );
|
||||
gcry_md_putc (mfx->md, c );
|
||||
#ifndef HAVE_DOSISH_SYSTEM
|
||||
if( convert && c == '\r' )
|
||||
continue; /* fixme: this hack might be too simple */
|
||||
@ -300,7 +303,7 @@ handle_plaintext( PKT_plaintext *pt, md_filter_context_t *mfx,
|
||||
if( len < 32768 )
|
||||
eof = 1;
|
||||
if( mfx->md )
|
||||
md_write( mfx->md, buffer, len );
|
||||
gcry_md_write ( mfx->md, buffer, len );
|
||||
if( fp )
|
||||
{
|
||||
if(opt.max_output && (count+=len)>opt.max_output)
|
||||
@ -479,8 +482,8 @@ ask_for_detached_datafile (gcry_md_hd_t md, gcry_md_hd_t md2,
|
||||
}
|
||||
else if( !fp )
|
||||
{
|
||||
rc = gpg_error_from_errno (errno);
|
||||
log_error(_("can't open `%s': %s\n"), answer, strerror(errno));
|
||||
rc = G10ERR_READ_FILE;
|
||||
goto leave;
|
||||
}
|
||||
} while( !fp );
|
||||
@ -536,9 +539,10 @@ hash_datafiles( gcry_md_hd_t md, gcry_md_hd_t md2, STRLIST files,
|
||||
errno = EPERM;
|
||||
}
|
||||
if( !fp ) {
|
||||
int rc = gpg_error_from_errno (errno);
|
||||
log_error(_("can't open signed data `%s'\n"),
|
||||
print_fname_stdin(sl->d));
|
||||
return G10ERR_OPEN_FILE;
|
||||
return rc;
|
||||
}
|
||||
handle_progress (&pfx, fp, sl->d);
|
||||
do_hash( md, md2, fp, textmode );
|
||||
|
@ -232,7 +232,7 @@ do_check( PKT_secret_key *sk, const char *tryagain_text, int mode,
|
||||
copy_secret_key( sk, save_sk );
|
||||
passphrase_clear_cache ( keyid, NULL, sk->pubkey_algo );
|
||||
free_secret_key( save_sk );
|
||||
return G10ERR_BAD_PASS;
|
||||
return gpg_error (GPG_ERR_BAD_PASSPHRASE);
|
||||
}
|
||||
|
||||
/* The checksum may fail, so we also check the key itself. */
|
||||
@ -241,7 +241,7 @@ do_check( PKT_secret_key *sk, const char *tryagain_text, int mode,
|
||||
copy_secret_key( sk, save_sk );
|
||||
passphrase_clear_cache ( keyid, NULL, sk->pubkey_algo );
|
||||
free_secret_key( save_sk );
|
||||
return G10ERR_BAD_PASS;
|
||||
return gpg_error (GPG_ERR_BAD_PASSPHRASE);
|
||||
}
|
||||
free_secret_key( save_sk );
|
||||
sk->is_protected = 0;
|
||||
@ -286,7 +286,7 @@ check_secret_key( PKT_secret_key *sk, int n )
|
||||
if( n < 1 )
|
||||
n = (opt.batch && !opt.use_agent)? 1 : 3; /* use the default value */
|
||||
|
||||
for(i=0; i < n && gpg_err_code (rc) == G10ERR_BAD_PASS; i++ ) {
|
||||
for(i=0; i < n && gpg_err_code (rc) == GPG_ERR_BAD_PASSPHRASE; i++ ) {
|
||||
int canceled = 0;
|
||||
const char *tryagain = NULL;
|
||||
if (i) {
|
||||
|
@ -309,7 +309,7 @@ do_check( PKT_public_key *pk, PKT_signature *sig, gcry_md_hd_t digest,
|
||||
|
||||
|
||||
static void
|
||||
hash_uid_node( KBNODE unode, MD_HANDLE md, PKT_signature *sig )
|
||||
hash_uid_node( KBNODE unode, gcry_md_hd_t md, PKT_signature *sig )
|
||||
{
|
||||
PKT_user_id *uid = unode->pkt->pkt.user_id;
|
||||
|
||||
|
66
g10/sign.c
66
g10/sign.c
@ -189,7 +189,7 @@ mk_notation_policy_etc( PKT_signature *sig,
|
||||
* Helper to hash a user ID packet.
|
||||
*/
|
||||
static void
|
||||
hash_uid (MD_HANDLE md, int sigversion, const PKT_user_id *uid)
|
||||
hash_uid (gcry_md_hd_t md, int sigversion, const PKT_user_id *uid)
|
||||
{
|
||||
if ( sigversion >= 4 ) {
|
||||
byte buf[5];
|
||||
@ -222,7 +222,7 @@ hash_uid (MD_HANDLE md, int sigversion, const PKT_user_id *uid)
|
||||
* Helper to hash some parts from the signature
|
||||
*/
|
||||
static void
|
||||
hash_sigversion_to_magic (MD_HANDLE md, const PKT_signature *sig)
|
||||
hash_sigversion_to_magic (gcry_md_hd_t md, const PKT_signature *sig)
|
||||
{
|
||||
if (sig->version >= 4)
|
||||
gcry_md_putc (md, sig->version);
|
||||
@ -266,7 +266,7 @@ hash_sigversion_to_magic (MD_HANDLE md, const PKT_signature *sig)
|
||||
|
||||
static int
|
||||
do_sign( PKT_secret_key *sk, PKT_signature *sig,
|
||||
MD_HANDLE md, int digest_algo )
|
||||
gcry_md_hd_t md, int digest_algo )
|
||||
{
|
||||
gcry_mpi_t frame;
|
||||
byte *dp;
|
||||
@ -315,7 +315,7 @@ do_sign( PKT_secret_key *sk, PKT_signature *sig,
|
||||
xfree (rbuf);
|
||||
}
|
||||
#else
|
||||
return G10ERR_UNSUPPORTED;
|
||||
return gpg_error (GPG_ERR_NOT_SUPPORTED);
|
||||
#endif /* ENABLE_CARD_SUPPORT */
|
||||
}
|
||||
else
|
||||
@ -324,7 +324,7 @@ do_sign( PKT_secret_key *sk, PKT_signature *sig,
|
||||
variable-q DSA stuff makes it into the standard. */
|
||||
if(!opt.expert
|
||||
&& sk->pubkey_algo==PUBKEY_ALGO_DSA
|
||||
&& md_digest_length(digest_algo)!=20)
|
||||
&& gcry_md_get_algo_dlen (digest_algo)!=20)
|
||||
{
|
||||
log_error(_("DSA requires the use of a 160 bit hash algorithm\n"));
|
||||
return G10ERR_GENERAL;
|
||||
@ -375,7 +375,7 @@ do_sign( PKT_secret_key *sk, PKT_signature *sig,
|
||||
|
||||
|
||||
int
|
||||
complete_sig( PKT_signature *sig, PKT_secret_key *sk, MD_HANDLE md )
|
||||
complete_sig( PKT_signature *sig, PKT_secret_key *sk, gcry_md_hd_t md )
|
||||
{
|
||||
int rc=0;
|
||||
|
||||
@ -419,7 +419,7 @@ hash_for(PKT_secret_key *sk)
|
||||
prefitem_t *prefs;
|
||||
|
||||
for(prefs=opt.personal_digest_prefs;prefs->type;prefs++)
|
||||
if (gcry_md_get_algo-dlen (prefs->value) == 20)
|
||||
if (gcry_md_get_algo_dlen (prefs->value) == 20)
|
||||
return prefs->value;
|
||||
}
|
||||
|
||||
@ -604,10 +604,9 @@ write_plaintext_packet (IOBUF out, IOBUF inp, const char *fname, int ptmode)
|
||||
int bytes_copied;
|
||||
|
||||
while ((bytes_copied = iobuf_read(inp, copy_buffer, 4096)) != -1)
|
||||
if (iobuf_write(out, copy_buffer, bytes_copied) == -1) {
|
||||
rc = G10ERR_WRITE_FILE;
|
||||
if ( (rc=iobuf_write(out, copy_buffer, bytes_copied)) ) {
|
||||
log_error ("copying input to output failed: %s\n",
|
||||
g10_errstr(rc));
|
||||
gpg_strerror (rc));
|
||||
break;
|
||||
}
|
||||
wipememory(copy_buffer,4096); /* burn buffer */
|
||||
@ -622,7 +621,7 @@ write_plaintext_packet (IOBUF out, IOBUF inp, const char *fname, int ptmode)
|
||||
* hash which will not be changes here.
|
||||
*/
|
||||
static int
|
||||
write_signature_packets (SK_LIST sk_list, IOBUF out, MD_HANDLE hash,
|
||||
write_signature_packets (SK_LIST sk_list, IOBUF out, gcry_md_hd_t hash,
|
||||
int sigclass, u32 timestamp, u32 duration,
|
||||
int status_letter)
|
||||
{
|
||||
@ -632,7 +631,7 @@ write_signature_packets (SK_LIST sk_list, IOBUF out, MD_HANDLE hash,
|
||||
for (sk_rover = sk_list; sk_rover; sk_rover = sk_rover->next) {
|
||||
PKT_secret_key *sk;
|
||||
PKT_signature *sig;
|
||||
MD_HANDLE md;
|
||||
gcry_md_hd_t md;
|
||||
int rc;
|
||||
|
||||
sk = sk_rover->sk;
|
||||
@ -774,11 +773,12 @@ sign_file( STRLIST filenames, int detached, STRLIST locusr,
|
||||
inp = NULL;
|
||||
errno = EPERM;
|
||||
}
|
||||
if( !inp ) {
|
||||
log_error(_("can't open `%s': %s\n"), fname? fname: "[stdin]",
|
||||
strerror(errno) );
|
||||
rc = G10ERR_OPEN_FILE;
|
||||
goto leave;
|
||||
if( !inp )
|
||||
{
|
||||
rc = gpg_error_from_errno (errno);
|
||||
log_error (_("can't open `%s': %s\n"), fname? fname: "[stdin]",
|
||||
strerror(errno) );
|
||||
goto leave;
|
||||
}
|
||||
|
||||
handle_progress (&pfx, inp, fname);
|
||||
@ -793,8 +793,8 @@ sign_file( STRLIST filenames, int detached, STRLIST locusr,
|
||||
out = iobuf_create( outfile );
|
||||
if( !out )
|
||||
{
|
||||
rc = gpg_error_from_errno (errno);
|
||||
log_error(_("can't create `%s': %s\n"), outfile, strerror(errno) );
|
||||
rc = G10ERR_CREATE_FILE;
|
||||
goto leave;
|
||||
}
|
||||
else if( opt.verbose )
|
||||
@ -810,7 +810,7 @@ sign_file( STRLIST filenames, int detached, STRLIST locusr,
|
||||
iobuf_push_filter( inp, text_filter, &tfx );
|
||||
}
|
||||
|
||||
if ( gcry_md_open (&,mfx.md, 0, 0) )
|
||||
if ( gcry_md_open (&mfx.md, 0, 0) )
|
||||
BUG ();
|
||||
if (DBG_HASHING)
|
||||
gcry_md_start_debug (mfx.md, "sign");
|
||||
@ -1008,7 +1008,7 @@ clearsign_file( const char *fname, STRLIST locusr, const char *outfile )
|
||||
{
|
||||
armor_filter_context_t afx;
|
||||
progress_filter_context_t pfx;
|
||||
MD_HANDLE textmd = NULL;
|
||||
gcry_md_hd_t textmd = NULL;
|
||||
IOBUF inp = NULL, out = NULL;
|
||||
PACKET pkt;
|
||||
int rc = 0;
|
||||
@ -1051,9 +1051,9 @@ clearsign_file( const char *fname, STRLIST locusr, const char *outfile )
|
||||
errno = EPERM;
|
||||
}
|
||||
if( !inp ) {
|
||||
log_error(_("can't open `%s': %s\n"), fname? fname: "[stdin]",
|
||||
strerror(errno) );
|
||||
rc = G10ERR_OPEN_FILE;
|
||||
rc = gpg_error_from_errno (errno);
|
||||
log_error (_("can't open `%s': %s\n"),
|
||||
fname? fname: "[stdin]", strerror(errno) );
|
||||
goto leave;
|
||||
}
|
||||
handle_progress (&pfx, inp, fname);
|
||||
@ -1067,8 +1067,8 @@ clearsign_file( const char *fname, STRLIST locusr, const char *outfile )
|
||||
out = iobuf_create( outfile );
|
||||
if( !out )
|
||||
{
|
||||
rc = gpg_error_from_errno (errno);
|
||||
log_error(_("can't create `%s': %s\n"), outfile, strerror(errno) );
|
||||
rc = G10ERR_CREATE_FILE;
|
||||
goto leave;
|
||||
}
|
||||
else if( opt.verbose )
|
||||
@ -1101,7 +1101,7 @@ clearsign_file( const char *fname, STRLIST locusr, const char *outfile )
|
||||
int i = hash_for(sk);
|
||||
|
||||
if( !hashs_seen[ i & 0xff ] ) {
|
||||
s = gcry_md_ago_name ( i );
|
||||
s = gcry_md_algo_name ( i );
|
||||
if( s ) {
|
||||
hashs_seen[ i & 0xff ] = 1;
|
||||
if( any )
|
||||
@ -1203,9 +1203,9 @@ sign_symencrypt_file (const char *fname, STRLIST locusr)
|
||||
errno = EPERM;
|
||||
}
|
||||
if( !inp ) {
|
||||
log_error(_("can't open `%s': %s\n"),
|
||||
fname? fname: "[stdin]", strerror(errno) );
|
||||
rc = G10ERR_OPEN_FILE;
|
||||
rc = gpg_error_from_errno (errno);
|
||||
log_error (_("can't open `%s': %s\n"),
|
||||
fname? fname: "[stdin]", strerror(errno) );
|
||||
goto leave;
|
||||
}
|
||||
handle_progress (&pfx, inp, fname);
|
||||
@ -1222,8 +1222,8 @@ sign_symencrypt_file (const char *fname, STRLIST locusr)
|
||||
cfx.dek = passphrase_to_dek( NULL, 0, algo, s2k, 2, NULL, NULL);
|
||||
|
||||
if (!cfx.dek || !cfx.dek->keylen) {
|
||||
rc = G10ERR_PASSPHRASE;
|
||||
log_error(_("error creating passphrase: %s\n"), g10_errstr(rc) );
|
||||
rc = gpg_error (GPG_ERR_BAD_PASSPHRASE);
|
||||
log_error(_("error creating passphrase: %s\n"), gpg_strerror (rc) );
|
||||
goto leave;
|
||||
}
|
||||
|
||||
@ -1341,7 +1341,7 @@ make_keysig_packet( PKT_signature **ret_sig, PKT_public_key *pk,
|
||||
{
|
||||
PKT_signature *sig;
|
||||
int rc=0;
|
||||
MD_HANDLE md;
|
||||
gcry_md_hd_t md;
|
||||
|
||||
assert( (sigclass >= 0x10 && sigclass <= 0x13) || sigclass == 0x1F
|
||||
|| sigclass == 0x20 || sigclass == 0x18 || sigclass == 0x19
|
||||
@ -1455,7 +1455,7 @@ update_keysig_packet( PKT_signature **ret_sig,
|
||||
{
|
||||
PKT_signature *sig;
|
||||
int rc=0;
|
||||
MD_HANDLE md;
|
||||
gcry_md_hd_t md;
|
||||
|
||||
if ((!orig_sig || !pk || !sk)
|
||||
|| (orig_sig->sig_class >= 0x10 && orig_sig->sig_class <= 0x13 && !uid)
|
||||
@ -1506,7 +1506,7 @@ update_keysig_packet( PKT_signature **ret_sig,
|
||||
|
||||
if (!rc) {
|
||||
hash_sigversion_to_magic (md, sig);
|
||||
md_final(md);
|
||||
gcry_md_final (md);
|
||||
|
||||
rc = complete_sig( sig, sk, md );
|
||||
}
|
||||
|
@ -176,7 +176,7 @@ build_sk_list( STRLIST locusr, SK_LIST *ret_sk_list,
|
||||
log_error(_("skipped \"%s\": %s\n"),
|
||||
locusr->d, g10_errstr(rc) );
|
||||
}
|
||||
else if( !(rc=openpgp_pk_test_algo (sk->pubkey_algo, use)) ) {
|
||||
else if( !(rc=openpgp_pk_test_algo2 (sk->pubkey_algo, use)) ) {
|
||||
SK_LIST r;
|
||||
|
||||
if( sk->version == 4 && (use & PUBKEY_USAGE_SIG)
|
||||
|
@ -94,7 +94,6 @@ static int db_fd = -1;
|
||||
static int in_transaction;
|
||||
|
||||
static void open_db(void);
|
||||
static void migrate_from_v2 (void);
|
||||
|
||||
|
||||
|
||||
@ -580,8 +579,6 @@ tdbio_get_dbname()
|
||||
static void
|
||||
open_db()
|
||||
{
|
||||
byte buf[10];
|
||||
int n;
|
||||
TRUSTREC rec;
|
||||
|
||||
assert( db_fd == -1 );
|
||||
|
Loading…
x
Reference in New Issue
Block a user