PostgreSQL Source Code
git master
|
Go to the source code of this file.
Data Structures | |
struct | PktData |
struct | MDCBufData |
Macros | |
#define | NO_CTX_SIZE 0 |
#define | ALLOW_CTX_SIZE 1 |
#define | NO_COMPR 0 |
#define | ALLOW_COMPR 1 |
#define | NO_MDC 0 |
#define | NEED_MDC 1 |
#define | PKT_NORMAL 1 |
#define | PKT_STREAM 2 |
#define | PKT_CONTEXT 3 |
#define | MAX_CHUNK (16*1024*1024) |
#define | MDCBUF_LEN 8192 |
Functions | |
static int | parse_new_len (PullFilter *src, int *len_p) |
static int | parse_old_len (PullFilter *src, int *len_p, int lentype) |
int | pgp_parse_pkt_hdr (PullFilter *src, uint8 *tag, int *len_p, int allow_ctx) |
static int | pktreader_pull (void *priv, PullFilter *src, int len, uint8 **data_p, uint8 *buf, int buflen) |
static void | pktreader_free (void *priv) |
int | pgp_create_pkt_reader (PullFilter **pf_p, PullFilter *src, int len, int pkttype, PGP_Context *ctx) |
static int | prefix_init (void **priv_p, void *arg, PullFilter *src) |
static int | decrypt_init (void **priv_p, void *arg, PullFilter *src) |
static int | decrypt_read (void *priv, PullFilter *src, int len, uint8 **data_p, uint8 *buf, int buflen) |
static int | mdc_init (void **priv_p, void *arg, PullFilter *src) |
static void | mdc_free (void *priv) |
static int | mdc_finish (PGP_Context *ctx, PullFilter *src, int len) |
static int | mdc_read (void *priv, PullFilter *src, int len, uint8 **data_p, uint8 *buf, int buflen) |
static int | mdcbuf_init (void **priv_p, void *arg, PullFilter *src) |
static int | mdcbuf_finish (struct MDCBufData *st) |
static void | mdcbuf_load_data (struct MDCBufData *st, uint8 *src, int len) |
static void | mdcbuf_load_mdc (struct MDCBufData *st, uint8 *src, int len) |
static int | mdcbuf_refill (struct MDCBufData *st, PullFilter *src) |
static int | mdcbuf_read (void *priv, PullFilter *src, int len, uint8 **data_p, uint8 *buf, int buflen) |
static void | mdcbuf_free (void *priv) |
static int | decrypt_key (PGP_Context *ctx, const uint8 *src, int len) |
static int | parse_symenc_sesskey (PGP_Context *ctx, PullFilter *src) |
static int | copy_crlf (MBuf *dst, uint8 *data, int len, int *got_cr) |
static int | parse_literal_data (PGP_Context *ctx, MBuf *dst, PullFilter *pkt) |
static int | process_data_packets (PGP_Context *ctx, MBuf *dst, PullFilter *src, int allow_compr, int need_mdc) |
static int | parse_compressed_data (PGP_Context *ctx, MBuf *dst, PullFilter *pkt) |
static int | parse_symenc_data (PGP_Context *ctx, PullFilter *pkt, MBuf *dst) |
static int | parse_symenc_mdc_data (PGP_Context *ctx, PullFilter *pkt, MBuf *dst) |
int | pgp_skip_packet (PullFilter *pkt) |
int | pgp_expect_packet_end (PullFilter *pkt) |
int | pgp_decrypt (PGP_Context *ctx, MBuf *msrc, MBuf *mdst) |
Variables | |
static struct PullFilterOps | pktreader_filter |
static struct PullFilterOps | prefix_filter |
struct PullFilterOps | pgp_decrypt_filter |
static struct PullFilterOps | mdc_filter |
static struct PullFilterOps | mdcbuf_filter |
#define ALLOW_COMPR 1 |
Definition at line 41 of file pgp-decrypt.c.
#define ALLOW_CTX_SIZE 1 |
Definition at line 39 of file pgp-decrypt.c.
#define MAX_CHUNK (16*1024*1024) |
Definition at line 49 of file pgp-decrypt.c.
#define MDCBUF_LEN 8192 |
Definition at line 432 of file pgp-decrypt.c.
#define NEED_MDC 1 |
Definition at line 43 of file pgp-decrypt.c.
#define NO_COMPR 0 |
Definition at line 40 of file pgp-decrypt.c.
#define NO_CTX_SIZE 0 |
Definition at line 38 of file pgp-decrypt.c.
#define NO_MDC 0 |
Definition at line 42 of file pgp-decrypt.c.
#define PKT_CONTEXT 3 |
Definition at line 47 of file pgp-decrypt.c.
#define PKT_NORMAL 1 |
Definition at line 45 of file pgp-decrypt.c.
#define PKT_STREAM 2 |
Definition at line 46 of file pgp-decrypt.c.
Definition at line 694 of file pgp-decrypt.c.
References data, len, mbuf_append(), px_memset(), res, and tmpbuf.
Referenced by parse_literal_data().
|
static |
|
static |
Definition at line 591 of file pgp-decrypt.c.
References PGP_Context::cipher_algo, PGP_S2K::key, PGP_S2K::key_len, len, pgp_cfb_create(), pgp_cfb_decrypt(), pgp_cfb_free(), pgp_get_cipher_key_size(), px_debug(), PXE_PGP_CORRUPT_DATA, res, PGP_Context::s2k, PGP_Context::s2k_cipher_algo, PGP_Context::sess_key, and PGP_Context::sess_key_len.
Referenced by parse_symenc_sesskey().
|
static |
Definition at line 298 of file pgp-decrypt.c.
References buf, len, pgp_cfb_decrypt(), pullf_read(), and res.
|
static |
Definition at line 344 of file pgp-decrypt.c.
References data, hash(), PGP_Context::in_mdc_pkt, len, PGP_Context::mdc_checked, PGP_Context::mdc_ctx, pullf_read_max(), px_debug(), px_md_finish, px_memset(), PXE_BUG, PXE_PGP_CORRUPT_DATA, res, tmpbuf, and PGP_Context::use_mdcbuf_filter.
Referenced by process_data_packets().
|
static |
Definition at line 333 of file pgp-decrypt.c.
References PGP_Context::mdc_ctx, px_md_free, and PGP_Context::use_mdcbuf_filter.
|
static |
Definition at line 324 of file pgp-decrypt.c.
References arg, PGP_Context::mdc_ctx, PGP_DIGEST_SHA1, and pgp_load_digest().
|
static |
Definition at line 396 of file pgp-decrypt.c.
|
static |
Definition at line 463 of file pgp-decrypt.c.
References MDCBufData::ctx, MDCBufData::eof, hash(), MDCBufData::mdc_buf, PGP_Context::mdc_ctx, px_debug(), px_md_finish, px_md_update, px_memset(), PXE_PGP_CORRUPT_DATA, and res.
Referenced by mdcbuf_refill().
|
static |
Definition at line 572 of file pgp-decrypt.c.
|
static |
Definition at line 446 of file pgp-decrypt.c.
References arg, MDCBufData::buf, MDCBufData::buflen, MDCBufData::ctx, palloc0(), and PGP_Context::use_mdcbuf_filter.
|
static |
Definition at line 488 of file pgp-decrypt.c.
References MDCBufData::avail, MDCBufData::ctx, len, PGP_Context::mdc_ctx, MDCBufData::pos, and px_md_update.
Referenced by mdcbuf_refill().
|
static |
Definition at line 498 of file pgp-decrypt.c.
References len, MDCBufData::mdc_avail, and MDCBufData::mdc_buf.
Referenced by mdcbuf_refill().
|
static |
Definition at line 549 of file pgp-decrypt.c.
References MDCBufData::avail, MDCBufData::eof, len, mdcbuf_refill(), MDCBufData::pos, and res.
|
static |
Definition at line 505 of file pgp-decrypt.c.
References MDCBufData::avail, MDCBufData::buf, MDCBufData::buflen, data, MDCBufData::mdc_avail, MDCBufData::mdc_buf, mdcbuf_finish(), mdcbuf_load_data(), mdcbuf_load_mdc(), MDCBufData::pos, pullf_read(), and res.
Referenced by mdcbuf_read().
|
static |
Definition at line 818 of file pgp-decrypt.c.
References PGP_Context::compress_algo, GETBYTE, NO_COMPR, NO_MDC, PGP_COMPR_BZIP2, PGP_COMPR_NONE, PGP_COMPR_ZIP, PGP_COMPR_ZLIB, pgp_decompress_filter(), process_data_packets(), pullf_free(), pullf_read(), px_debug(), PXE_PGP_CORRUPT_DATA, res, type, and PGP_Context::unsupported_compr.
Referenced by process_data_packets().
|
static |
Definition at line 744 of file pgp-decrypt.c.
References buf, PGP_Context::convert_crlf, copy_crlf(), GETBYTE, mbuf_append(), pullf_read(), pullf_read_max(), px_debug(), px_memset(), PXE_PGP_CORRUPT_DATA, res, PGP_Context::text_mode, tmpbuf, type, PGP_Context::unexpected_binary, and PGP_Context::unicode_mode.
Referenced by process_data_packets().
|
static |
Definition at line 52 of file pgp-decrypt.c.
References b, GETBYTE, len, MAX_CHUNK, PKT_NORMAL, PKT_STREAM, px_debug(), and PXE_PGP_CORRUPT_DATA.
Referenced by pgp_parse_pkt_hdr(), and pktreader_pull().
|
static |
Definition at line 95 of file pgp-decrypt.c.
References b, GETBYTE, len, MAX_CHUNK, PKT_NORMAL, px_debug(), and PXE_PGP_CORRUPT_DATA.
Referenced by pgp_parse_pkt_hdr().
|
static |
Definition at line 978 of file pgp-decrypt.c.
References ALLOW_COMPR, PGP_Context::cipher_algo, NO_MDC, pgp_cfb_create(), pgp_cfb_free(), pgp_decrypt_filter, prefix_filter, process_data_packets(), pullf_create(), pullf_free(), res, PGP_Context::sess_key, and PGP_Context::sess_key_len.
Referenced by pgp_decrypt().
|
static |
Definition at line 1012 of file pgp-decrypt.c.
References ALLOW_COMPR, PGP_Context::cipher_algo, GETBYTE, mdc_filter, NEED_MDC, pgp_cfb_create(), pgp_cfb_free(), pgp_decrypt_filter, prefix_filter, process_data_packets(), pullf_create(), pullf_free(), px_debug(), PXE_PGP_CORRUPT_DATA, res, PGP_Context::sess_key, and PGP_Context::sess_key_len.
Referenced by pgp_decrypt().
|
static |
Definition at line 624 of file pgp-decrypt.c.
References PGP_Context::cipher_algo, decrypt_key(), PGP_S2K::digest_algo, GETBYTE, PGP_S2K::iter, PGP_S2K::key, PGP_S2K::key_len, PGP_S2K::mode, PGP_MAX_KEY, pgp_s2k_process(), pgp_s2k_read(), pullf_read_max(), px_debug(), px_memset(), PXE_PGP_CORRUPT_DATA, res, PGP_Context::s2k, PGP_Context::s2k_cipher_algo, PGP_Context::s2k_count, s2k_decode_count, PGP_Context::s2k_digest_algo, PGP_Context::s2k_mode, PGP_Context::sess_key, PGP_Context::sess_key_len, PGP_Context::sym_key, PGP_Context::sym_key_len, tmpbuf, and PGP_Context::use_sess_key.
Referenced by pgp_decrypt().
int pgp_create_pkt_reader | ( | PullFilter ** | pf_p, |
PullFilter * | src, | ||
int | len, | ||
int | pkttype, | ||
PGP_Context * | ctx | ||
) |
Definition at line 223 of file pgp-decrypt.c.
References PktData::len, len, palloc(), pfree(), pktreader_filter, pullf_create(), res, and PktData::type.
Referenced by internal_read_key(), pgp_decrypt(), pgp_get_keyid(), and process_data_packets().
int pgp_decrypt | ( | PGP_Context * | ctx, |
MBuf * | msrc, | ||
MBuf * | mdst | ||
) |
Definition at line 1093 of file pgp-decrypt.c.
References PGP_Context::corrupt_prefix, PGP_Context::disable_mdc, len, NO_CTX_SIZE, parse_symenc_data(), parse_symenc_mdc_data(), parse_symenc_sesskey(), pgp_create_pkt_reader(), pgp_parse_pkt_hdr(), pgp_parse_pubenc_sesskey(), PGP_PKT_MARKER, PGP_PKT_PUBENCRYPTED_SESSKEY, PGP_PKT_SYMENCRYPTED_DATA, PGP_PKT_SYMENCRYPTED_DATA_MDC, PGP_PKT_SYMENCRYPTED_SESSKEY, pgp_skip_packet(), pullf_create_mbuf_reader(), pullf_free(), px_debug(), PXE_PGP_CORRUPT_DATA, PXE_PGP_NOT_TEXT, PXE_PGP_UNSUPPORTED_COMPR, res, PGP_Context::unexpected_binary, and PGP_Context::unsupported_compr.
Referenced by decrypt_internal().
int pgp_expect_packet_end | ( | PullFilter * | pkt | ) |
Definition at line 1078 of file pgp-decrypt.c.
References pullf_read(), px_debug(), PXE_PGP_CORRUPT_DATA, and res.
Referenced by pgp_parse_pubenc_sesskey(), and process_secret_key().
int pgp_parse_pkt_hdr | ( | PullFilter * | src, |
uint8 * | tag, | ||
int * | len_p, | ||
int | allow_ctx | ||
) |
Definition at line 129 of file pgp-decrypt.c.
References parse_new_len(), parse_old_len(), PKT_CONTEXT, pullf_read(), px_debug(), PXE_PGP_CORRUPT_DATA, and res.
Referenced by internal_read_key(), pgp_decrypt(), pgp_get_keyid(), and process_data_packets().
int pgp_skip_packet | ( | PullFilter * | pkt | ) |
Definition at line 1064 of file pgp-decrypt.c.
References pullf_read(), and res.
Referenced by internal_read_key(), pgp_decrypt(), pgp_get_keyid(), read_pubenc_keyid(), and read_pubkey_keyid().
|
static |
Definition at line 209 of file pgp-decrypt.c.
|
static |
Definition at line 175 of file pgp-decrypt.c.
References PktData::len, len, parse_new_len(), PKT_CONTEXT, PKT_NORMAL, pullf_read(), res, and PktData::type.
|
static |
Definition at line 244 of file pgp-decrypt.c.
|
static |
Definition at line 872 of file pgp-decrypt.c.
References ALLOW_CTX_SIZE, len, mdc_finish(), mdcbuf_filter, NO_MDC, parse_compressed_data(), parse_literal_data(), pgp_create_pkt_reader(), pgp_parse_pkt_hdr(), PGP_PKT_COMPRESSED_DATA, PGP_PKT_LITERAL_DATA, PGP_PKT_MDC, PKT_CONTEXT, pullf_create(), pullf_free(), px_debug(), PXE_PGP_CORRUPT_DATA, res, and PGP_Context::use_mdcbuf_filter.
Referenced by parse_compressed_data(), parse_symenc_data(), and parse_symenc_mdc_data().
|
static |
Definition at line 396 of file pgp-decrypt.c.
Referenced by parse_symenc_mdc_data().
|
static |
Definition at line 572 of file pgp-decrypt.c.
Referenced by process_data_packets().
struct PullFilterOps pgp_decrypt_filter |
Definition at line 298 of file pgp-decrypt.c.
Referenced by parse_symenc_data(), parse_symenc_mdc_data(), and process_secret_key().
|
static |
Definition at line 209 of file pgp-decrypt.c.
Referenced by pgp_create_pkt_reader().
|
static |
Definition at line 244 of file pgp-decrypt.c.
Referenced by parse_symenc_data(), and parse_symenc_mdc_data().