Correct PPTP server firewall rules chain.
[tomato/davidwu.git] / release / src / router / nettle / pgp.h
blobb97da5ef17b3421b57b4691735bb0fb233f85e8a
1 /* pgp.h
3 * PGP related functions.
4 */
6 /* nettle, low-level cryptographics library
8 * Copyright (C) 2001, 2002 Niels Möller
9 *
10 * The nettle library is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU Lesser General Public License as published by
12 * the Free Software Foundation; either version 2.1 of the License, or (at your
13 * option) any later version.
15 * The nettle library is distributed in the hope that it will be useful, but
16 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
17 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
18 * License for more details.
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with the nettle library; see the file COPYING.LIB. If not, write to
22 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
23 * MA 02111-1301, USA.
26 #ifndef NETTLE_PGP_H_INCLUDED
27 #define NETTLE_PGP_H_INCLUDED
29 #include <time.h>
31 #include "nettle-types.h"
32 #include "bignum.h"
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
38 /* Name mangling */
39 #define pgp_put_uint32 nettle_pgp_put_uint32
40 #define pgp_put_uint16 nettle_pgp_put_uint16
41 #define pgp_put_mpi nettle_pgp_put_mpi
42 #define pgp_put_string nettle_pgp_put_string
43 #define pgp_put_length nettle_pgp_put_length
44 #define pgp_put_header nettle_pgp_put_header
45 #define pgp_put_header_length nettle_pgp_put_header_length
46 #define pgp_sub_packet_start nettle_pgp_sub_packet_start
47 #define pgp_put_sub_packet nettle_pgp_put_sub_packet
48 #define pgp_sub_packet_end nettle_pgp_sub_packet_end
49 #define pgp_put_public_rsa_key nettle_pgp_put_public_rsa_key
50 #define pgp_put_rsa_sha1_signature nettle_pgp_put_rsa_sha1_signature
51 #define pgp_put_userid nettle_pgp_put_userid
52 #define pgp_crc24 nettle_pgp_crc24
53 #define pgp_armor nettle_pgp_armor
55 struct nettle_buffer;
56 struct rsa_public_key;
57 struct rsa_private_key;
58 struct sha1_ctx;
60 int
61 pgp_put_uint32(struct nettle_buffer *buffer, uint32_t i);
63 int
64 pgp_put_uint16(struct nettle_buffer *buffer, unsigned i);
66 int
67 pgp_put_mpi(struct nettle_buffer *buffer, const mpz_t x);
69 int
70 pgp_put_string(struct nettle_buffer *buffer,
71 unsigned length,
72 const uint8_t *s);
74 int
75 pgp_put_length(struct nettle_buffer *buffer,
76 unsigned length);
78 int
79 pgp_put_header(struct nettle_buffer *buffer,
80 unsigned tag, unsigned length);
82 void
83 pgp_put_header_length(struct nettle_buffer *buffer,
84 /* start of the header */
85 unsigned start,
86 unsigned field_size);
88 unsigned
89 pgp_sub_packet_start(struct nettle_buffer *buffer);
91 int
92 pgp_put_sub_packet(struct nettle_buffer *buffer,
93 unsigned type,
94 unsigned length,
95 const uint8_t *data);
97 void
98 pgp_sub_packet_end(struct nettle_buffer *buffer, unsigned start);
101 pgp_put_public_rsa_key(struct nettle_buffer *,
102 const struct rsa_public_key *key,
103 time_t timestamp);
106 pgp_put_rsa_sha1_signature(struct nettle_buffer *buffer,
107 const struct rsa_private_key *key,
108 const uint8_t *keyid,
109 unsigned type,
110 struct sha1_ctx *hash);
113 pgp_put_userid(struct nettle_buffer *buffer,
114 unsigned length,
115 const uint8_t *name);
117 uint32_t
118 pgp_crc24(unsigned length, const uint8_t *data);
121 pgp_armor(struct nettle_buffer *buffer,
122 const char *tag,
123 unsigned length,
124 const uint8_t *data);
126 /* Values that can be passed to pgp_put_header when the size of the
127 * length field, but not the length itself, is known. Also the minimum length
128 * for the given field size. */
129 enum pgp_lengths
131 PGP_LENGTH_ONE_OCTET = 0,
132 PGP_LENGTH_TWO_OCTETS = 192,
133 PGP_LENGTH_FOUR_OCTETS = 8384,
136 enum pgp_public_key_algorithm
138 PGP_RSA = 1,
139 PGP_RSA_ENCRYPT = 2,
140 PGP_RSA_SIGN = 3,
141 PGP_EL_GAMAL_ENCRYPT = 16,
142 PGP_DSA = 17,
143 PGP_EL_GAMAL = 20,
146 enum pgp_symmetric_algorithm
148 PGP_PLAINTEXT = 0,
149 PGP_IDEA = 1,
150 PGP_3DES = 2,
151 PGP_CAST5 = 3,
152 PGP_BLOWFISH = 4,
153 PGP_SAFER_SK = 5,
154 PGP_AES128 = 7,
155 PGP_AES192 = 8,
156 PGP_AES256 = 9,
159 enum pgp_compression_algorithm
161 PGP_UNCOMPRESSED = 0,
162 PGP_ZIP = 1,
163 PGP_ZLIB = 2,
166 enum pgp_hash_algorithm
168 PGP_MD5 = 1,
169 PGP_SHA1 = 2,
170 PGP_RIPEMD = 3,
171 PGP_MD2 = 5,
172 PGP_TIGER192 = 6,
173 PGP_HAVAL = 7,
176 enum pgp_tag
178 PGP_TAG_PUBLIC_SESSION_KEY = 1,
179 PGP_TAG_SIGNATURE = 2,
180 PGP_TAG_SYMMETRIC_SESSION_KEY = 3,
181 PGP_TAG_ONE_PASS_SIGNATURE = 4,
182 PGP_TAG_SECRET_KEY = 5,
183 PGP_TAG_PUBLIC_KEY = 6,
184 PGP_TAG_SECRET_SUBKEY = 7,
185 PGP_TAG_COMPRESSED = 8,
186 PGP_TAG_ENCRYPTED = 9,
187 PGP_TAG_MARKER = 10,
188 PGP_TAG_LITERAL = 11,
189 PGP_TAG_TRUST = 12,
190 PGP_TAG_USERID = 13,
191 PGP_TAG_PUBLIC_SUBKEY = 14,
194 enum pgp_signature_type
196 PGP_SIGN_BINARY = 0,
197 PGP_SIGN_TEXT = 1,
198 PGP_SIGN_STANDALONE = 2,
199 PGP_SIGN_CERTIFICATION = 0x10,
200 PGP_SIGN_CERTIFICATION_PERSONA = 0x11,
201 PGP_SIGN_CERTIFICATION_CASUAL = 0x12,
202 PGP_SIGN_CERTIFICATION_POSITIVE = 0x13,
203 PGP_SIGN_SUBKEY = 0x18,
204 PGP_SIGN_KEY = 0x1f,
205 PGP_SIGN_REVOCATION = 0x20,
206 PGP_SIGN_REVOCATION_SUBKEY = 0x28,
207 PGP_SIGN_REVOCATION_CERTIFICATE = 0x30,
208 PGP_SIGN_TIMESTAMP = 0x40,
211 enum pgp_subpacket_tag
213 PGP_SUBPACKET_CREATION_TIME = 2,
214 PGP_SUBPACKET_SIGNATURE_EXPIRATION_TIME = 3,
215 PGP_SUBPACKET_EXPORTABLE_CERTIFICATION = 4,
216 PGP_SUBPACKET_TRUST_SIGNATURE = 5,
217 PGP_SUBPACKET_REGULAR_EXPRESSION = 6,
218 PGP_SUBPACKET_REVOCABLE = 7,
219 PGP_SUBPACKET_KEY_EXPIRATION_TIME = 9,
220 PGP_SUBPACKET_PLACEHOLDER = 10 ,
221 PGP_SUBPACKET_PREFERRED_SYMMETRIC_ALGORITHMS = 11,
222 PGP_SUBPACKET_REVOCATION_KEY = 12,
223 PGP_SUBPACKET_ISSUER_KEY_ID = 16,
224 PGP_SUBPACKET_NOTATION_DATA = 20,
225 PGP_SUBPACKET_PREFERRED_HASH_ALGORITHMS = 21,
226 PGP_SUBPACKET_PREFERRED_COMPRESSION_ALGORITHMS = 22,
227 PGP_SUBPACKET_KEY_SERVER_PREFERENCES = 23,
228 PGP_SUBPACKET_PREFERRED_KEY_SERVER = 24,
229 PGP_SUBPACKET_PRIMARY_USER_ID = 25,
230 PGP_SUBPACKET_POLICY_URL = 26,
231 PGP_SUBPACKET_KEY_FLAGS = 27,
232 PGP_SUBPACKET_SIGNERS_USER_ID = 28,
233 PGP_SUBPACKET_REASON_FOR_REVOCATION = 29,
236 #ifdef __cplusplus
238 #endif
240 #endif /* NETTLE_PGP_H_INCLUDED */