don't hide macro.
[apps/madmutt.git] / pgplib.h
1 /*
2  * Copyright notice from original mutt:
3  * Copyright (C) 1996,1997 Michael R. Elkins <me@mutt.org>
4  * Copyright (C) 1999-2000 Thomas Roessler <roessler@does-not-exist.org>
5  *
6  * This file is part of mutt-ng, see http://www.muttng.org/.
7  * It's licensed under the GNU General Public License,
8  * please see the file GPL in the top level source directory.
9  */
10
11 #ifdef CRYPT_BACKEND_CLASSIC_PGP
12
13 #include "mutt_crypt.h"
14
15
16 typedef struct pgp_signature {
17   struct pgp_signature *next;
18   unsigned char sigtype;
19   unsigned long sid1;
20   unsigned long sid2;
21 } pgp_sig_t;
22
23 struct pgp_keyinfo {
24   char *keyid;
25   struct pgp_uid *address;
26   int flags;
27   short keylen;
28   time_t gen_time;
29   int numalg;
30   const char *algorithm;
31   struct pgp_keyinfo *parent;
32   struct pgp_signature *sigs;
33   struct pgp_keyinfo *next;
34
35   short fp_len;                 /* length of fingerprint.
36                                  * 20 for sha-1, 16 for md5.
37                                  */
38   unsigned char fingerprint[20];        /* large enough to hold SHA-1 and RIPEMD160
39                                            hashes (20 bytes), MD5 hashes just use the
40                                            first 16 bytes */
41 };
42
43 /* Note, that pgp_key_t is now pointer and declared in crypt.h */
44
45 typedef struct pgp_uid {
46   char *addr;
47   short trust;
48   int flags;
49   struct pgp_keyinfo *parent;
50   struct pgp_uid *next;
51   struct pgp_signature *sigs;
52 } pgp_uid_t;
53
54 enum pgp_version {
55   PGP_V2,
56   PGP_V3,
57   PGP_GPG,
58   PGP_UNKNOWN
59 };
60
61 /* prototypes */
62
63 const char *pgp_pkalgbytype (unsigned char);
64
65 pgp_key_t pgp_remove_key (pgp_key_t *, pgp_key_t);
66 pgp_uid_t *pgp_copy_uids (pgp_uid_t *, pgp_key_t);
67
68 short pgp_canencrypt (unsigned char);
69 short pgp_cansign (unsigned char);
70 short pgp_get_abilities (unsigned char);
71
72 void pgp_free_key (pgp_key_t * kpp);
73
74 #define pgp_new_keyinfo() xmalloc(sizeof *((pgp_key_t)0))
75
76 #endif /* CRYPT_BACKEND_CLASSIC_PGP */