40 #define MDC_DIGEST_LEN 20
41 #define STREAM_ID 0xE0
42 #define STREAM_BLOCK_SHIFT 14
51 else if (
len > 191 &&
len <= 8383)
53 *h++ = ((
len - 192) >> 8) + 192;
54 *h++ = (
len - 192) & 255;
59 *h++ = (
len >> 24) & 255;
60 *h++ = (
len >> 16) & 255;
61 *h++ = (
len >> 8) & 255;
70 uint8 hdr = 0xC0 | tag;
333 static const uint8 crlf[] = {
'\r',
'\n'};
336 while (p1 < data_end)
338 p2 = memchr(p1,
'\n', data_end - p1);
355 while (p1 < data_end && *p1 ==
'\n')
400 hdr[2] = (t >> 24) & 255;
401 hdr[3] = (t >> 16) & 255;
402 hdr[4] = (t >> 8) & 255;
488 prefix[bs + 0] = prefix[bs - 2];
489 prefix[bs + 1] = prefix[bs - 1];
static void PGresult const char * p2
static void PGresult * res
int pushf_write(PushFilter *mp, const uint8 *data, int len)
int mbuf_avail(MBuf *mbuf)
int pushf_create(PushFilter **mp_p, const PushFilterOps *op, void *init_arg, PushFilter *next)
int pushf_create_mbuf_writer(PushFilter **res, MBuf *dst)
void pushf_free_all(PushFilter *mp)
int pushf_flush(PushFilter *mp)
int mbuf_grab(MBuf *mbuf, int len, uint8 **data_p)
void pushf_free(PushFilter *mp)
void pfree(void *pointer)
void * palloc0(Size size)
int pgp_cfb_encrypt(PGP_CFB *ctx, const uint8 *data, int len, uint8 *dst)
void pgp_cfb_free(PGP_CFB *ctx)
int pgp_cfb_create(PGP_CFB **ctx_p, int algo, const uint8 *key, int key_len, int resync, uint8 *iv)
int pgp_compress_filter(PushFilter **res, PGP_Context *ctx, PushFilter *dst)
static int write_symenc_sesskey(PGP_Context *ctx, PushFilter *dst)
static int init_litdata_packet(PushFilter **pf_res, PGP_Context *ctx, PushFilter *dst)
static int write_normal_header(PushFilter *dst, int tag, int len)
#define STREAM_BLOCK_SHIFT
static int mdc_init(PushFilter *dst, void *init_arg, void **priv_p)
static void mdc_free(void *priv)
static int write_prefix(PGP_Context *ctx, PushFilter *dst)
static uint8 * render_newlen(uint8 *h, int len)
static const PushFilterOps crlf_filter
static int init_compress(PushFilter **pf_res, PGP_Context *ctx, PushFilter *dst)
static void encrypt_free(void *priv)
static int write_tag_only(PushFilter *dst, int tag)
static int init_encdata_packet(PushFilter **pf_res, PGP_Context *ctx, PushFilter *dst)
static int symencrypt_sesskey(PGP_Context *ctx, uint8 *dst)
static void pkt_stream_free(void *priv)
static int pkt_stream_process(PushFilter *next, void *priv, const uint8 *data, int len)
static const PushFilterOps encrypt_filter
static const PushFilterOps pkt_stream_filter
static int encrypt_init(PushFilter *next, void *init_arg, void **priv_p)
static int init_s2k_key(PGP_Context *ctx)
static int pkt_stream_flush(PushFilter *next, void *priv)
static int encrypt_process(PushFilter *next, void *priv, const uint8 *data, int len)
int pgp_encrypt(PGP_Context *ctx, MBuf *src, MBuf *dst)
static int mdc_write(PushFilter *dst, void *priv, const uint8 *data, int len)
static int pkt_stream_init(PushFilter *next, void *init_arg, void **priv_p)
static int mdc_flush(PushFilter *dst, void *priv)
static int init_sess_key(PGP_Context *ctx)
static const PushFilterOps mdc_filter
int pgp_create_pkt_writer(PushFilter *dst, int tag, PushFilter **res_p)
static int crlf_process(PushFilter *dst, void *priv, const uint8 *data, int len)
int pgp_write_pubenc_sesskey(PGP_Context *ctx, PushFilter *dst)
int pgp_s2k_process(PGP_S2K *s2k, int cipher, const uint8 *key, int key_len)
int pgp_s2k_fill(PGP_S2K *s2k, int mode, int digest_algo, int count)
int pgp_get_cipher_block_size(int code)
int pgp_get_cipher_key_size(int code)
int pgp_load_digest(int code, PX_MD **res)
@ PGP_PKT_SYMENCRYPTED_DATA
@ PGP_PKT_COMPRESSED_DATA
@ PGP_PKT_SYMENCRYPTED_SESSKEY
@ PGP_PKT_SYMENCRYPTED_DATA_MDC
bool pg_strong_random(void *buf, size_t len)
void px_memset(void *ptr, int c, size_t len)
#define px_md_finish(md, buf)
#define PXE_ARGUMENT_ERROR
#define px_md_update(md, data, dlen)
uint8 sess_key[PGP_MAX_KEY]