44 int pad_len = res_len - 2 - data_len;
60 while (p <
buf + 1 + pad_len)
76 memcpy(
buf + pad_len + 2,
data, data_len);
94 for (
i = 0;
i < klen;
i++)
100 secmsg =
palloc(klen + 3);
102 memcpy(secmsg + 1, ctx->
sess_key, klen);
103 secmsg[klen + 1] = (cksum >> 8) & 0xFF;
104 secmsg[klen + 2] = cksum & 0xFF;
113 int full_bits = full_bytes * 8 - 6;
static void PGresult * res
void err(int eval, const char *fmt,...)
int pushf_write(PushFilter *mp, const uint8 *data, int len)
int pushf_flush(PushFilter *mp)
void pushf_free(PushFilter *mp)
void pfree(void *pointer)
int pgp_create_pkt_writer(PushFilter *dst, int tag, PushFilter **res_p)
int pgp_elgamal_encrypt(PGP_PubKey *pk, PGP_MPI *_m, PGP_MPI **c1_p, PGP_MPI **c2_p)
int pgp_rsa_encrypt(PGP_PubKey *pk, PGP_MPI *_m, PGP_MPI **c_p)
int pgp_mpi_create(uint8 *data, int bits, PGP_MPI **mpi)
int pgp_mpi_free(PGP_MPI *mpi)
int pgp_mpi_write(PushFilter *dst, PGP_MPI *n)
static int encrypt_and_write_elgamal(PGP_Context *ctx, PGP_PubKey *pk, PushFilter *pkt)
static int pad_eme_pkcs1_v15(uint8 *data, int data_len, int res_len, uint8 **res_p)
static int encrypt_and_write_rsa(PGP_Context *ctx, PGP_PubKey *pk, PushFilter *pkt)
static int create_secmsg(PGP_Context *ctx, PGP_MPI **msg_p, int full_bytes)
int pgp_write_pubenc_sesskey(PGP_Context *ctx, PushFilter *dst)
@ PGP_PKT_PUBENCRYPTED_SESSKEY
@ PGP_PUB_RSA_ENCRYPT_SIGN
bool pg_strong_random(void *buf, size_t len)
void px_debug(const char *fmt,...)
void px_memset(void *ptr, int c, size_t len)
uint8 sess_key[PGP_MAX_KEY]
struct PGP_PubKey::@0::@3 rsa
struct PGP_PubKey::@0::@2 elg