Browse Source

Be less noisy

master
David Lanzendörfer 11 months ago
parent
commit
e934320d37
3 changed files with 4 additions and 74 deletions
  1. +1
    -70
      src/create.c
  2. +1
    -3
      src/keyring.c
  3. +2
    -1
      src/packet-parse.c

+ 1
- 70
src/create.c View File

@ -590,80 +590,12 @@ pgp_write_struct_crypted_seckey_ptag(const pgp_seckey_t *key, pgp_output_t *outp
return 0;
}
/* Ref: RFC4880 Section 5.5.3 */
/* pubkey, excluding MPIs */
length += 1 + 4 + 1;
/* s2k usage */
length += 1;
switch (key->s2k_usage) {
case PGP_S2KU_NONE:
/* nothing to add */
break;
case PGP_S2KU_ENCRYPTED_AND_HASHED: /* 254 */
case PGP_S2KU_ENCRYPTED: /* 255 */
/* Ref: RFC4880 Section 3.7 */
length += 1; /* s2k_specifier */
switch (key->s2k_specifier) {
case PGP_S2KS_SIMPLE:
length += 1; /* hash algorithm */
break;
case PGP_S2KS_SALTED:
length += 1 + 8; /* hash algorithm + salt */
break;
case PGP_S2KS_ITERATED_AND_SALTED:
length += 1 + 8 + 1; /* hash algorithm, salt +
* count */
break;
default:
(void) fprintf(stderr,
"pgp_write_struct_seckey: s2k spec\n");
return 0;
}
break;
default:
(void) fprintf(stderr,
"pgp_write_struct_seckey: s2k usage\n");
return 0;
}
/* IV */
if (key->s2k_usage) {
length += pgp_block_size(key->alg);
}
/* checksum or hash */
switch (key->s2k_usage) {
case PGP_S2KU_NONE:
case PGP_S2KU_ENCRYPTED:
length += 2;
break;
case PGP_S2KU_ENCRYPTED_AND_HASHED:
length += PGP_CHECKHASH_SIZE;
break;
default:
(void) fprintf(stderr,
"pgp_write_struct_seckey: s2k cksum usage\n");
if (!write_pubkey_body(&key->pubkey, output)) {
return 0;
}
/* secret key and public key MPIs */
//length += (unsigned)seckey_length(key);
pgp_write_ptag(output, ptag);
if (!write_pubkey_body(&key->pubkey, output)) {
return 0;
}
//&&
/* pgp_write_length(output,1+4+1+1+seckey_length(key)+2) && */
@ -754,7 +686,6 @@ pgp_write_xfer_key(pgp_output_t *output,
/* Loop over key's subkeys */
subkeyp = key->subkeys;
printf("Having %d subkeys\n", key->subkeyc);
for (subkeyidx = 0 ; subkeyidx < key->subkeyc; subkeyidx++, subkeyp++)
{
if (key->type == PGP_PTAG_CT_PUBLIC_KEY) {


+ 1
- 3
src/keyring.c View File

@ -1546,7 +1546,6 @@ unsigned pgp_update_subkey(
const pgp_subpacket_t *sigpkt,
pgp_sig_info_t *siginfo)
{
printf("pgp_update_subkey\n");
unsigned subkeyidx = 0;
unsigned subkeysigidx = 0;
pgp_subkey_t *subkeyp;
@ -1570,8 +1569,7 @@ unsigned pgp_update_subkey(
{
if(subkeysigp->subkey == subkeyidx &&
subkeysigp->packet.length == sigpkt->length &&
memcmp(subkeysigp->packet.raw, sigpkt->raw,
sigpkt->length) == 0)
memcmp(subkeysigp->packet.raw, sigpkt->raw, sigpkt->length) == 0)
{
/* signature already exists */
return 1;


+ 2
- 1
src/packet-parse.c View File

@ -2806,6 +2806,7 @@ parse_seckey(pgp_content_enum tag, pgp_region_t *region, pgp_stream_t *stream)
if (!parse_pubkey_data(&pkt.u.seckey.pubkey, region, stream)) {
return 0;
}
if (pgp_get_debug_level(__FILE__)) {
printf(stderr, "parse_seckey: public key parsed\n");
}
@ -2900,7 +2901,7 @@ parse_seckey(pgp_content_enum tag, pgp_region_t *region, pgp_stream_t *stream)
return PGP_PASSWORD_REQUIRED;
}
pkt.u.seckey.encrypted = 1;
//CALLBACK(PGP_PTAG_CT_ENCRYPTED_SECRET_KEY, &stream->cbinfo, &pkt);
CALLBACK(PGP_PTAG_CT_ENCRYPTED_SECRET_KEY, &stream->cbinfo, &pkt);
return PGP_PASSWORD_REQUIRED;
}
pkt.u.seckey.passphrase = strdup(passphrase);


Loading…
Cancel
Save