43 memset(pk, 0,
sizeof(*pk));
101 len += 2 + pk->
pub.
elg.p->bytes;
102 len += 2 + pk->
pub.
elg.g->bytes;
103 len += 2 + pk->
pub.
elg.y->bytes;
108 len += 2 + pk->
pub.
rsa.n->bytes;
109 len += 2 + pk->
pub.
rsa.e->bytes;
112 len += 2 + pk->
pub.
dsa.p->bytes;
113 len += 2 + pk->
pub.
dsa.q->bytes;
114 len += 2 + pk->
pub.
dsa.g->bytes;
115 len += 2 + pk->
pub.
dsa.y->bytes;
152 memcpy(pk->
key_id, hash + 12, 8);
250 #define HIDE_CKSUM 255 251 #define HIDE_SHA1 254 288 if (memcmp(my_sha1, got_sha1, 20) != 0)
311 got_cksum = ((unsigned) buf[0] << 8) + buf[1];
329 if (my_cksum != got_cksum)
377 px_debug(
"unknown cipher algo=%d", cipher_algo);
460 const uint8 *psw,
int psw_len,
int pubtype)
468 int got_main_key = 0;
520 px_debug(
"unknown/unexpected packet: %d", tag);
567 const uint8 *
key,
int key_len,
int pubtype)
583 return res < 0 ? res : 0;
#define PXE_PGP_KEYPKT_CORRUPT
unsigned pgp_mpi_cksum(unsigned cksum, PGP_MPI *n)
int pgp_mpi_hash(PX_MD *md, PGP_MPI *n)
struct PGP_PubKey::@5::@7 elg
int pgp_set_pubkey(PGP_Context *ctx, MBuf *keypkt, const uint8 *key, int key_len, int pubtype)
void pullf_free(PullFilter *pf)
int pullf_create(PullFilter **pf_p, const PullFilterOps *op, void *init_arg, PullFilter *src)
int pullf_read_fixed(PullFilter *src, int len, uint8 *dst)
struct PGP_PubKey::@5::@9 dsa
#define PXE_PGP_UNSUPPORTED_CIPHER
int pgp_parse_pkt_hdr(PullFilter *src, uint8 *tag, int *len_p, int allow_ctx)
#define px_md_update(md, data, dlen)
#define PXE_PGP_EXPECT_SECRET_KEY
static int calc_key_id(PGP_PubKey *pk)
#define PXE_PGP_MULTIPLE_SUBKEYS
int pullf_create_mbuf_reader(PullFilter **mp_p, MBuf *src)
int pgp_key_alloc(PGP_PubKey **pk_p)
int pgp_skip_packet(PullFilter *pkt)
#define px_md_finish(md, buf)
#define PXE_PGP_NO_USABLE_KEY
struct PGP_PubKey::@5::@8 rsa
static int check_key_cksum(PullFilter *src, PGP_PubKey *pk)
void pgp_key_free(PGP_PubKey *pk)
int pgp_create_pkt_reader(PullFilter **pf_p, PullFilter *src, int len, int pkttype, PGP_Context *ctx)
static int internal_read_key(PullFilter *src, PGP_PubKey **pk_p, const uint8 *psw, int psw_len, int pubtype)
#define PXE_PGP_UNEXPECTED_PKT
int pgp_mpi_read(PullFilter *src, PGP_MPI **mpi)
int pgp_mpi_free(PGP_MPI *mpi)
#define PXE_PGP_MULTIPLE_KEYS
int pgp_expect_packet_end(PullFilter *pkt)
int pgp_s2k_process(PGP_S2K *s2k, int cipher, const uint8 *key, int key_len)
static int process_secret_key(PullFilter *pkt, PGP_PubKey **pk_p, const uint8 *key, int key_len)
struct PullFilterOps pgp_decrypt_filter
void pgp_cfb_free(PGP_CFB *ctx)
int pgp_load_digest(int code, PX_MD **res)
#define PXE_PGP_EXPECT_PUBLIC_KEY
#define PXE_PGP_NEED_SECRET_PSW
int pgp_s2k_read(PullFilter *src, PGP_S2K *s2k)
static int check_key_sha1(PullFilter *src, PGP_PubKey *pk)
void px_debug(const char *fmt,...)
int pgp_get_cipher_block_size(int code)
#define PXE_PGP_UNKNOWN_PUBALGO
int pgp_cfb_create(PGP_CFB **ctx_p, int algo, const uint8 *key, int key_len, int resync, uint8 *iv)
#define PXE_PGP_NOT_V4_KEYPKT
int _pgp_read_public_key(PullFilter *pkt, PGP_PubKey **pk_p)
static unsigned hash(unsigned *uv, int n)
void px_memset(void *ptr, int c, size_t len)