~ubuntu-branches/ubuntu/hardy/postgresql-8.4/hardy-backports

« back to all changes in this revision

Viewing changes to contrib/pgcrypto/pgp.h

  • Committer: Bazaar Package Importer
  • Author(s): Ubuntu Archive Backport
  • Date: 2009-11-09 13:46:16 UTC
  • mfrom: (5.2.2 sid)
  • Revision ID: james.westby@ubuntu.com-20091109134616-ae14l9tr3g7p2t9y
Tags: 8.4.1-1~hardy1
Automated backport upload; no source changes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27
27
 * SUCH DAMAGE.
28
28
 *
29
 
 * $PostgreSQL: pgsql/contrib/pgcrypto/pgp.h,v 1.5 2009/03/25 15:03:13 tgl Exp $
 
29
 * $PostgreSQL: pgsql/contrib/pgcrypto/pgp.h,v 1.6 2009/06/11 14:48:52 momjian Exp $
30
30
 */
31
31
 
32
32
enum PGP_S2K_TYPE
224
224
        int                     can_encrypt;
225
225
};
226
226
 
227
 
int                     pgp_init(PGP_Context ** ctx);
228
 
int                     pgp_encrypt(PGP_Context * ctx, MBuf * src, MBuf * dst);
229
 
int                     pgp_decrypt(PGP_Context * ctx, MBuf * src, MBuf * dst);
230
 
int                     pgp_free(PGP_Context * ctx);
 
227
int                     pgp_init(PGP_Context **ctx);
 
228
int                     pgp_encrypt(PGP_Context *ctx, MBuf *src, MBuf *dst);
 
229
int                     pgp_decrypt(PGP_Context *ctx, MBuf *src, MBuf *dst);
 
230
int                     pgp_free(PGP_Context *ctx);
231
231
 
232
232
int                     pgp_get_digest_code(const char *name);
233
233
int                     pgp_get_cipher_code(const char *name);
234
234
const char *pgp_get_digest_name(int code);
235
235
const char *pgp_get_cipher_name(int code);
236
236
 
237
 
int                     pgp_set_cipher_algo(PGP_Context * ctx, const char *name);
238
 
int                     pgp_set_s2k_mode(PGP_Context * ctx, int type);
239
 
int                     pgp_set_s2k_cipher_algo(PGP_Context * ctx, const char *name);
240
 
int                     pgp_set_s2k_digest_algo(PGP_Context * ctx, const char *name);
241
 
int                     pgp_set_convert_crlf(PGP_Context * ctx, int doit);
242
 
int                     pgp_disable_mdc(PGP_Context * ctx, int disable);
243
 
int                     pgp_set_sess_key(PGP_Context * ctx, int use);
244
 
int                     pgp_set_compress_algo(PGP_Context * ctx, int algo);
245
 
int                     pgp_set_compress_level(PGP_Context * ctx, int level);
246
 
int                     pgp_set_text_mode(PGP_Context * ctx, int mode);
247
 
int                     pgp_set_unicode_mode(PGP_Context * ctx, int mode);
248
 
int                     pgp_get_unicode_mode(PGP_Context * ctx);
 
237
int                     pgp_set_cipher_algo(PGP_Context *ctx, const char *name);
 
238
int                     pgp_set_s2k_mode(PGP_Context *ctx, int type);
 
239
int                     pgp_set_s2k_cipher_algo(PGP_Context *ctx, const char *name);
 
240
int                     pgp_set_s2k_digest_algo(PGP_Context *ctx, const char *name);
 
241
int                     pgp_set_convert_crlf(PGP_Context *ctx, int doit);
 
242
int                     pgp_disable_mdc(PGP_Context *ctx, int disable);
 
243
int                     pgp_set_sess_key(PGP_Context *ctx, int use);
 
244
int                     pgp_set_compress_algo(PGP_Context *ctx, int algo);
 
245
int                     pgp_set_compress_level(PGP_Context *ctx, int level);
 
246
int                     pgp_set_text_mode(PGP_Context *ctx, int mode);
 
247
int                     pgp_set_unicode_mode(PGP_Context *ctx, int mode);
 
248
int                     pgp_get_unicode_mode(PGP_Context *ctx);
249
249
 
250
 
int                     pgp_set_symkey(PGP_Context * ctx, const uint8 *key, int klen);
251
 
int pgp_set_pubkey(PGP_Context * ctx, MBuf * keypkt,
 
250
int                     pgp_set_symkey(PGP_Context *ctx, const uint8 *key, int klen);
 
251
int pgp_set_pubkey(PGP_Context *ctx, MBuf *keypkt,
252
252
                           const uint8 *key, int klen, int pubtype);
253
253
 
254
 
int                     pgp_get_keyid(MBuf * pgp_data, char *dst);
 
254
int                     pgp_get_keyid(MBuf *pgp_data, char *dst);
255
255
 
256
256
/* internal functions */
257
257
 
258
 
int                     pgp_load_digest(int c, PX_MD ** res);
259
 
int                     pgp_load_cipher(int c, PX_Cipher ** res);
 
258
int                     pgp_load_digest(int c, PX_MD **res);
 
259
int                     pgp_load_cipher(int c, PX_Cipher **res);
260
260
int                     pgp_get_cipher_key_size(int c);
261
261
int                     pgp_get_cipher_block_size(int c);
262
262
 
263
 
int                     pgp_s2k_fill(PGP_S2K * s2k, int mode, int digest_algo);
264
 
int                     pgp_s2k_read(PullFilter * src, PGP_S2K * s2k);
265
 
int                     pgp_s2k_process(PGP_S2K * s2k, int cipher, const uint8 *key, int klen);
 
263
int                     pgp_s2k_fill(PGP_S2K *s2k, int mode, int digest_algo);
 
264
int                     pgp_s2k_read(PullFilter *src, PGP_S2K *s2k);
 
265
int                     pgp_s2k_process(PGP_S2K *s2k, int cipher, const uint8 *key, int klen);
266
266
 
267
267
typedef struct PGP_CFB PGP_CFB;
268
268
int
269
 
pgp_cfb_create(PGP_CFB ** ctx_p, int algo,
 
269
pgp_cfb_create(PGP_CFB **ctx_p, int algo,
270
270
                           const uint8 *key, int key_len, int recync, uint8 *iv);
271
 
void            pgp_cfb_free(PGP_CFB * ctx);
272
 
int                     pgp_cfb_encrypt(PGP_CFB * ctx, const uint8 *data, int len, uint8 *dst);
273
 
int                     pgp_cfb_decrypt(PGP_CFB * ctx, const uint8 *data, int len, uint8 *dst);
 
271
void            pgp_cfb_free(PGP_CFB *ctx);
 
272
int                     pgp_cfb_encrypt(PGP_CFB *ctx, const uint8 *data, int len, uint8 *dst);
 
273
int                     pgp_cfb_decrypt(PGP_CFB *ctx, const uint8 *data, int len, uint8 *dst);
274
274
 
275
275
int                     pgp_armor_encode(const uint8 *src, unsigned len, uint8 *dst);
276
276
int                     pgp_armor_decode(const uint8 *src, unsigned len, uint8 *dst);
277
277
unsigned        pgp_armor_enc_len(unsigned len);
278
278
unsigned        pgp_armor_dec_len(unsigned len);
279
279
 
280
 
int                     pgp_compress_filter(PushFilter ** res, PGP_Context * ctx, PushFilter * dst);
281
 
int                     pgp_decompress_filter(PullFilter ** res, PGP_Context * ctx, PullFilter * src);
282
 
 
283
 
int                     pgp_key_alloc(PGP_PubKey ** pk_p);
284
 
void            pgp_key_free(PGP_PubKey * pk);
285
 
int                     _pgp_read_public_key(PullFilter * pkt, PGP_PubKey ** pk_p);
286
 
 
287
 
int                     pgp_parse_pubenc_sesskey(PGP_Context * ctx, PullFilter * pkt);
288
 
int pgp_create_pkt_reader(PullFilter ** pf_p, PullFilter * src, int len,
289
 
                                          int pkttype, PGP_Context * ctx);
290
 
int pgp_parse_pkt_hdr(PullFilter * src, uint8 *tag, int *len_p,
 
280
int                     pgp_compress_filter(PushFilter **res, PGP_Context *ctx, PushFilter *dst);
 
281
int                     pgp_decompress_filter(PullFilter **res, PGP_Context *ctx, PullFilter *src);
 
282
 
 
283
int                     pgp_key_alloc(PGP_PubKey **pk_p);
 
284
void            pgp_key_free(PGP_PubKey *pk);
 
285
int                     _pgp_read_public_key(PullFilter *pkt, PGP_PubKey **pk_p);
 
286
 
 
287
int                     pgp_parse_pubenc_sesskey(PGP_Context *ctx, PullFilter *pkt);
 
288
int pgp_create_pkt_reader(PullFilter **pf_p, PullFilter *src, int len,
 
289
                                          int pkttype, PGP_Context *ctx);
 
290
int pgp_parse_pkt_hdr(PullFilter *src, uint8 *tag, int *len_p,
291
291
                                  int allow_ctx);
292
292
 
293
 
int                     pgp_skip_packet(PullFilter * pkt);
294
 
int                     pgp_expect_packet_end(PullFilter * pkt);
295
 
 
296
 
int                     pgp_write_pubenc_sesskey(PGP_Context * ctx, PushFilter * dst);
297
 
int                     pgp_create_pkt_writer(PushFilter * dst, int tag, PushFilter ** res_p);
298
 
 
299
 
int                     pgp_mpi_alloc(int bits, PGP_MPI ** mpi);
300
 
int                     pgp_mpi_create(uint8 *data, int bits, PGP_MPI ** mpi);
301
 
int                     pgp_mpi_free(PGP_MPI * mpi);
302
 
int                     pgp_mpi_read(PullFilter * src, PGP_MPI ** mpi);
303
 
int                     pgp_mpi_write(PushFilter * dst, PGP_MPI * n);
304
 
int                     pgp_mpi_hash(PX_MD * md, PGP_MPI * n);
305
 
unsigned        pgp_mpi_cksum(unsigned cksum, PGP_MPI * n);
306
 
 
307
 
int pgp_elgamal_encrypt(PGP_PubKey * pk, PGP_MPI * m,
308
 
                                        PGP_MPI ** c1, PGP_MPI ** c2);
309
 
int pgp_elgamal_decrypt(PGP_PubKey * pk, PGP_MPI * c1, PGP_MPI * c2,
310
 
                                        PGP_MPI ** m);
311
 
int                     pgp_rsa_encrypt(PGP_PubKey * pk, PGP_MPI * m, PGP_MPI ** c);
312
 
int                     pgp_rsa_decrypt(PGP_PubKey * pk, PGP_MPI * c, PGP_MPI ** m);
 
293
int                     pgp_skip_packet(PullFilter *pkt);
 
294
int                     pgp_expect_packet_end(PullFilter *pkt);
 
295
 
 
296
int                     pgp_write_pubenc_sesskey(PGP_Context *ctx, PushFilter *dst);
 
297
int                     pgp_create_pkt_writer(PushFilter *dst, int tag, PushFilter **res_p);
 
298
 
 
299
int                     pgp_mpi_alloc(int bits, PGP_MPI **mpi);
 
300
int                     pgp_mpi_create(uint8 *data, int bits, PGP_MPI **mpi);
 
301
int                     pgp_mpi_free(PGP_MPI *mpi);
 
302
int                     pgp_mpi_read(PullFilter *src, PGP_MPI **mpi);
 
303
int                     pgp_mpi_write(PushFilter *dst, PGP_MPI *n);
 
304
int                     pgp_mpi_hash(PX_MD *md, PGP_MPI *n);
 
305
unsigned        pgp_mpi_cksum(unsigned cksum, PGP_MPI *n);
 
306
 
 
307
int pgp_elgamal_encrypt(PGP_PubKey *pk, PGP_MPI *m,
 
308
                                        PGP_MPI **c1, PGP_MPI **c2);
 
309
int pgp_elgamal_decrypt(PGP_PubKey *pk, PGP_MPI *c1, PGP_MPI *c2,
 
310
                                        PGP_MPI **m);
 
311
int                     pgp_rsa_encrypt(PGP_PubKey *pk, PGP_MPI *m, PGP_MPI **c);
 
312
int                     pgp_rsa_decrypt(PGP_PubKey *pk, PGP_MPI *c, PGP_MPI **m);
313
313
 
314
314
extern struct PullFilterOps pgp_decrypt_filter;