~ubuntu-branches/ubuntu/precise/gnupg2/precise-proposed

« back to all changes in this revision

Viewing changes to g10/keyid.c

  • Committer: Bazaar Package Importer
  • Author(s): Eric Dorland
  • Date: 2009-03-08 22:46:47 UTC
  • mfrom: (1.1.11 upstream)
  • Revision ID: james.westby@ubuntu.com-20090308224647-gq17gatcl71lrc2k
Tags: 2.0.11-1
* New upstream release. (Closes: #496663)
* debian/control: Make the description a little more distinctive than
  gnupg v1's. Thanks Jari Aalto. (Closes: #496323)

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
#include "options.h"
34
34
#include "keydb.h"
35
35
#include "i18n.h"
 
36
#include "rmd160.h"
36
37
 
37
38
int
38
39
pubkey_letter( int algo )
448
449
byte *
449
450
namehash_from_uid(PKT_user_id *uid)
450
451
{
451
 
  if(uid->namehash==NULL)
 
452
  if (!uid->namehash)
452
453
    {
453
 
      uid->namehash = xmalloc(20);
454
 
 
 
454
      uid->namehash = xmalloc (20);
 
455
      
455
456
      if(uid->attrib_data)
456
 
        gcry_md_hash_buffer (GCRY_MD_RMD160, uid->namehash,
457
 
                             uid->attrib_data, uid->attrib_len);
 
457
        rmd160_hash_buffer (uid->namehash, uid->attrib_data, uid->attrib_len);
458
458
      else
459
 
        gcry_md_hash_buffer (GCRY_MD_RMD160, uid->namehash,
460
 
                             uid->name, uid->len);
 
459
        rmd160_hash_buffer (uid->namehash, uid->name, uid->len);
461
460
    }
462
461
  
463
462
  return uid->namehash;
607
606
const char *
608
607
colon_strtime (u32 t)
609
608
{
610
 
    if (!t)
611
 
        return "";
612
 
    if (opt.fixed_list_mode) {
613
 
        static char buf[15];
614
 
        sprintf (buf, "%lu", (ulong)t);
615
 
        return buf;
616
 
    }
617
 
    return strtimestamp(t);
 
609
  static char buf[20];
 
610
 
 
611
  if (!t)
 
612
    return "";
 
613
  snprintf (buf, sizeof buf, "%lu", (ulong)t);
 
614
  return buf;
618
615
}
619
616
 
620
617
const char *
621
618
colon_datestr_from_pk (PKT_public_key *pk)
622
619
{
623
 
    if (opt.fixed_list_mode) {
624
 
        static char buf[15];
625
 
        sprintf (buf, "%lu", (ulong)pk->timestamp);
626
 
        return buf;
627
 
    }
628
 
    return datestr_from_pk (pk);
 
620
  static char buf[20];
 
621
 
 
622
  snprintf (buf, sizeof buf, "%lu", (ulong)pk->timestamp);
 
623
  return buf;
629
624
}
630
625
 
631
626
const char *
632
627
colon_datestr_from_sk (PKT_secret_key *sk)
633
628
{
634
 
    if (opt.fixed_list_mode) {
635
 
        static char buf[15];
636
 
        sprintf (buf, "%lu", (ulong)sk->timestamp);
637
 
        return buf;
638
 
    }
639
 
    return datestr_from_sk (sk);
 
629
  static char buf[20];
 
630
 
 
631
  snprintf (buf, sizeof buf, "%lu", (ulong)sk->timestamp);
 
632
  return buf;
640
633
}
641
634
 
642
635
const char *
643
636
colon_datestr_from_sig (PKT_signature *sig)
644
637
{
645
 
    if (opt.fixed_list_mode) {
646
 
        static char buf[15];
647
 
        sprintf (buf, "%lu", (ulong)sig->timestamp);
648
 
        return buf;
649
 
    }
650
 
    return datestr_from_sig (sig);
 
638
  static char buf[20];
 
639
  
 
640
  snprintf (buf, sizeof buf, "%lu", (ulong)sig->timestamp);
 
641
  return buf;
651
642
}
652
643
 
653
644
const char *
654
645
colon_expirestr_from_sig (PKT_signature *sig)
655
646
{
656
 
    if(!sig->expiredate)
657
 
        return "";
658
 
    if (opt.fixed_list_mode) {
659
 
        static char buf[15];
660
 
        sprintf (buf, "%lu", (ulong)sig->expiredate);
661
 
        return buf;
662
 
    }
663
 
    return expirestr_from_sig (sig);
 
647
  static char buf[20];
 
648
 
 
649
  if (!sig->expiredate)
 
650
    return "";
 
651
 
 
652
  snprintf (buf, sizeof buf,"%lu", (ulong)sig->expiredate);
 
653
  return buf;
664
654
}
665
655
 
666
656