Made error code consistent with the other text parsing functions.
[gnutls.git] / lib / opencdk / context.h
blob83c0c522674413f16e6778fd96b6ecadc74b4b06
1 /* context.h
2 * Copyright (C) 2002-2012 Free Software Foundation, Inc.
4 * Author: Timo Schulz
6 * This file is part of OpenCDK.
8 * The OpenCDK library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public License
10 * as published by the Free Software Foundation; either version 3 of
11 * the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>
23 #ifndef CDK_CONTEXT_H
24 #define CDK_CONTEXT_H
26 #include "types.h"
28 struct cdk_listkey_s
30 unsigned init:1;
31 cdk_stream_t inp;
32 cdk_keydb_hd_t db;
33 int type;
34 union
36 char *patt;
37 cdk_strlist_t fpatt;
38 } u;
39 cdk_strlist_t t;
43 struct cdk_s2k_s
45 int mode;
46 byte hash_algo;
47 byte salt[8];
48 u32 count;
52 struct cdk_ctx_s
54 int cipher_algo;
55 int digest_algo;
56 struct
58 int algo;
59 int level;
60 } compress;
61 struct
63 int mode;
64 int digest_algo;
65 } _s2k;
66 struct
68 unsigned blockmode:1;
69 unsigned armor:1;
70 unsigned textmode:1;
71 unsigned compress:1;
72 unsigned mdc:1;
73 unsigned overwrite;
74 unsigned force_digest:1;
75 } opt;
76 struct
78 cdk_pkt_seckey_t sk;
79 unsigned on:1;
80 } cache;
81 struct
83 cdk_keydb_hd_t sec;
84 cdk_keydb_hd_t pub;
85 unsigned int close_db:1;
86 } db;
87 char *(*passphrase_cb) (void *uint8_t, const char *prompt);
88 void *passphrase_cb_value;
91 struct cdk_prefitem_s
93 byte type;
94 byte value;
97 struct cdk_desig_revoker_s
99 struct cdk_desig_revoker_s *next;
100 byte r_class;
101 byte algid;
102 byte fpr[KEY_FPR_LEN];
105 struct cdk_subpkt_s
107 struct cdk_subpkt_s *next;
108 u32 size;
109 byte type;
110 byte *d;
113 struct cdk_keylist_s
115 struct cdk_keylist_s *next;
116 union
118 cdk_pkt_pubkey_t pk;
119 cdk_pkt_seckey_t sk;
120 } key;
121 int version;
122 int type;
125 struct cdk_dek_s
127 int algo;
128 int keylen;
129 int use_mdc;
130 byte key[32]; /* 256-bit */
133 struct cdk_strlist_s
135 struct cdk_strlist_s *next;
136 char *d;
139 #endif /* CDK_CONTEXT_H */