Tizen 2.0 Release
[external/libgnutls26.git] / lib / opencdk / context.h
1 /* context.h
2  * Copyright (C) 2002, 2003, 2007, 2008, 2010 Free Software Foundation,
3  * Inc.
4  *
5  * Author: Timo Schulz
6  *
7  * This file is part of OpenCDK.
8  *
9  * The OpenCDK library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public License
11  * as published by the Free Software Foundation; either version 2.1 of
12  * the License, or (at your option) any later version.
13  *
14  * This library is distributed in the hope that it will be useful, but
15  * WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17  * Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with this library; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
22  * USA
23  *
24  */
25 #ifndef CDK_CONTEXT_H
26 #define CDK_CONTEXT_H
27
28 #include "types.h"
29
30 struct cdk_listkey_s
31 {
32   unsigned init:1;
33   cdk_stream_t inp;
34   cdk_keydb_hd_t db;
35   int type;
36   union
37   {
38     char *patt;
39     cdk_strlist_t fpatt;
40   } u;
41   cdk_strlist_t t;
42 };
43
44
45 struct cdk_s2k_s
46 {
47   int mode;
48   byte hash_algo;
49   byte salt[8];
50   u32 count;
51 };
52
53
54 struct cdk_ctx_s
55 {
56   int cipher_algo;
57   int digest_algo;
58   struct
59   {
60     int algo;
61     int level;
62   } compress;
63   struct
64   {
65     int mode;
66     int digest_algo;
67   } _s2k;
68   struct
69   {
70     unsigned blockmode:1;
71     unsigned armor:1;
72     unsigned textmode:1;
73     unsigned compress:1;
74     unsigned mdc:1;
75     unsigned overwrite;
76     unsigned force_digest:1;
77   } opt;
78   struct
79   {
80     cdk_pkt_seckey_t sk;
81     unsigned on:1;
82   } cache;
83   struct
84   {
85     cdk_keydb_hd_t sec;
86     cdk_keydb_hd_t pub;
87     unsigned int close_db:1;
88   } db;
89   char *(*passphrase_cb) (void *opaque, const char *prompt);
90   void *passphrase_cb_value;
91 };
92
93 struct cdk_prefitem_s
94 {
95   byte type;
96   byte value;
97 };
98
99 struct cdk_desig_revoker_s
100 {
101   struct cdk_desig_revoker_s *next;
102   byte r_class;
103   byte algid;
104   byte fpr[KEY_FPR_LEN];
105 };
106
107 struct cdk_subpkt_s
108 {
109   struct cdk_subpkt_s *next;
110   u32 size;
111   byte type;
112   byte *d;
113 };
114
115 struct cdk_keylist_s
116 {
117   struct cdk_keylist_s *next;
118   union
119   {
120     cdk_pkt_pubkey_t pk;
121     cdk_pkt_seckey_t sk;
122   } key;
123   int version;
124   int type;
125 };
126
127 struct cdk_dek_s
128 {
129   int algo;
130   int keylen;
131   int use_mdc;
132   byte key[32];                 /* 256-bit */
133 };
134
135 struct cdk_strlist_s
136 {
137   struct cdk_strlist_s *next;
138   char *d;
139 };
140
141 #endif /* CDK_CONTEXT_H */