1
0
mirror of git://git.gnupg.org/gnupg.git synced 2025-01-10 13:04:23 +01:00

* misc.c (pct_expando): Minor performance tweak. Don't bother to re-fetch

the primary key if the key making the signature is the primary key.

* parse-packet.c (parse_signature): No need to reserve 8 bytes for the
unhashed signature cache any longer.
This commit is contained in:
David Shaw 2003-07-05 04:02:38 +00:00
parent c1142ffd27
commit c7698f6cb3
3 changed files with 24 additions and 11 deletions

View File

@ -1,3 +1,12 @@
2003-07-04 David Shaw <dshaw@jabberwocky.com>
* misc.c (pct_expando): Minor performance tweak. Don't bother to
re-fetch the primary key if the key making the signature is the
primary key.
* parse-packet.c (parse_signature): No need to reserve 8 bytes for
the unhashed signature cache any longer.
2003-07-01 David Shaw <dshaw@jabberwocky.com>
* misc.c (pct_expando): Add two new expandos - signer's

View File

@ -391,16 +391,23 @@ pct_expando(const char *string,struct expando_args *args)
size_t len;
int i;
if((*(ch+1))=='p' && args->sk
&& (args->sk->main_keyid[0] || args->sk->main_keyid[1]))
if((*(ch+1))=='p' && args->sk)
{
PKT_public_key *pk=m_alloc_clear(sizeof(PKT_public_key));
if(args->sk->is_primary)
fingerprint_from_sk(args->sk,array,&len);
else if(args->sk->main_keyid[0] || args->sk->main_keyid[1])
{
PKT_public_key *pk=
m_alloc_clear(sizeof(PKT_public_key));
if(get_pubkey_fast(pk,args->sk->main_keyid)==0)
fingerprint_from_pk(pk,array,&len);
if(get_pubkey_fast(pk,args->sk->main_keyid)==0)
fingerprint_from_pk(pk,array,&len);
else
memset(array,0,(len=MAX_FINGERPRINT_LEN));
free_public_key(pk);
}
else
memset(array,0,(len=MAX_FINGERPRINT_LEN));
free_public_key(pk);
}
else if((*(ch+1))=='f' && args->pk)
fingerprint_from_pk(args->pk,array,&len);

View File

@ -1238,11 +1238,8 @@ parse_signature( IOBUF inp, int pkttype, unsigned long pktlen,
goto leave;
}
if( n ) {
/* we add 8 extra bytes so that we have space for the signature
* status cache. Well we are wastin this if there is a cache
* packet already, but in the other case it avoids an realloc */
sig->unhashed = m_alloc (sizeof(*sig->unhashed) + n + 8 - 1 );
sig->unhashed->size = n + 8;
sig->unhashed = m_alloc (sizeof(*sig->unhashed) + n - 1 );
sig->unhashed->size = n;
sig->unhashed->len = n;
if( iobuf_read(inp, sig->unhashed->data, n ) != n ) {
log_error("premature eof while reading "