Lines Matching refs:pkt

1314 	pgp_packet_t pkt;  in parse_pubkey()  local
1316 if (!parse_pubkey_data(&pkt.u.pubkey, region, stream)) { in parse_pubkey()
1327 CALLBACK(tag, &stream->cbinfo, &pkt); in parse_pubkey()
1344 pgp_packet_t pkt; in parse_userattr() local
1355 if (!read_data(&pkt.u.userattr, region, stream)) { in parse_userattr()
1358 CALLBACK(PGP_PTAG_CT_USER_ATTR, &stream->cbinfo, &pkt); in parse_userattr()
1396 pgp_packet_t pkt; in parse_userid() local
1404 if ((pkt.u.userid = calloc(1, region->length + 1)) == NULL) { in parse_userid()
1410 !limread(pkt.u.userid, region->length, region, in parse_userid()
1414 pkt.u.userid[region->length] = 0x0; in parse_userid()
1415 CALLBACK(PGP_PTAG_CT_USER_ID, &stream->cbinfo, &pkt); in parse_userid()
1452 pgp_packet_t pkt; in parse_v3_sig() local
1456 (void) memset(&pkt.u.sig, 0x0, sizeof(pkt.u.sig)); in parse_v3_sig()
1458 pkt.u.sig.info.version = PGP_V3; in parse_v3_sig()
1465 ERRP(&stream->cbinfo, pkt, "bad hash info length"); in parse_v3_sig()
1471 pkt.u.sig.info.type = (pgp_sig_type_t)c; in parse_v3_sig()
1474 if (!limited_read_time(&pkt.u.sig.info.birthtime, region, stream)) { in parse_v3_sig()
1477 pkt.u.sig.info.birthtime_set = 1; in parse_v3_sig()
1479 if (!limread(pkt.u.sig.info.signer_id, PGP_KEY_ID_SIZE, region, in parse_v3_sig()
1483 pkt.u.sig.info.signer_id_set = 1; in parse_v3_sig()
1488 pkt.u.sig.info.key_alg = (pgp_pubkey_alg_t)c; in parse_v3_sig()
1494 pkt.u.sig.info.hash_alg = (pgp_hash_alg_t)c; in parse_v3_sig()
1497 if (!limread(pkt.u.sig.hash2, 2, region, stream)) { in parse_v3_sig()
1501 switch (pkt.u.sig.info.key_alg) { in parse_v3_sig()
1504 if (!limread_mpi(&pkt.u.sig.info.sig.rsa.sig, region, stream)) { in parse_v3_sig()
1510 if (!limread_mpi(&pkt.u.sig.info.sig.dsa.r, region, stream) || in parse_v3_sig()
1511 !limread_mpi(&pkt.u.sig.info.sig.dsa.s, region, stream)) { in parse_v3_sig()
1517 if (!limread_mpi(&pkt.u.sig.info.sig.ecdsa.r, region, stream) || in parse_v3_sig()
1518 !limread_mpi(&pkt.u.sig.info.sig.ecdsa.s, region, stream)) { in parse_v3_sig()
1524 if (!limread_mpi(&pkt.u.sig.info.sig.elgamal.r, region, in parse_v3_sig()
1526 !limread_mpi(&pkt.u.sig.info.sig.elgamal.s, region, in parse_v3_sig()
1536 pgp_show_pka(pkt.u.sig.info.key_alg)); in parse_v3_sig()
1546 if (pkt.u.sig.info.signer_id_set) { in parse_v3_sig()
1547 pkt.u.sig.hash = parse_hash_find(stream, in parse_v3_sig()
1548 pkt.u.sig.info.signer_id); in parse_v3_sig()
1550 CALLBACK(PGP_PTAG_CT_SIGNATURE, &stream->cbinfo, &pkt); in parse_v3_sig()
1579 pgp_packet_t pkt; in parse_one_sig_subpacket() local
1593 ERRP(&stream->cbinfo, pkt, "Subpacket too long"); in parse_one_sig_subpacket()
1603 pkt.critical = (unsigned)c >> 7; in parse_one_sig_subpacket()
1604 pkt.tag = (pgp_content_enum)(PGP_PTAG_SIG_SUBPKT_BASE + (c & 0x7f)); in parse_one_sig_subpacket()
1608 pkt.u.ss_raw.tag = pkt.tag; in parse_one_sig_subpacket()
1609 pkt.u.ss_raw.length = subregion.length - 1; in parse_one_sig_subpacket()
1610 pkt.u.ss_raw.raw = calloc(1, pkt.u.ss_raw.length); in parse_one_sig_subpacket()
1611 if (pkt.u.ss_raw.raw == NULL) { in parse_one_sig_subpacket()
1615 if (!limread(pkt.u.ss_raw.raw, (unsigned)pkt.u.ss_raw.length, in parse_one_sig_subpacket()
1619 CALLBACK(PGP_PTAG_RAW_SS, &stream->cbinfo, &pkt); in parse_one_sig_subpacket()
1622 switch (pkt.tag) { in parse_one_sig_subpacket()
1626 if (!limited_read_time(&pkt.u.ss_time, &subregion, stream)) in parse_one_sig_subpacket()
1628 if (pkt.tag == PGP_PTAG_SS_CREATION_TIME) { in parse_one_sig_subpacket()
1629 sig->info.birthtime = pkt.u.ss_time; in parse_one_sig_subpacket()
1632 if (pkt.tag == PGP_PTAG_SS_EXPIRATION_TIME) { in parse_one_sig_subpacket()
1633 sig->info.duration = pkt.u.ss_time; in parse_one_sig_subpacket()
1639 if (!limread(&pkt.u.ss_trust.level, 1, &subregion, stream) || in parse_one_sig_subpacket()
1640 !limread(&pkt.u.ss_trust.amount, 1, &subregion, stream)) { in parse_one_sig_subpacket()
1649 pkt.u.ss_revocable = !!bools; in parse_one_sig_subpacket()
1653 if (!limread(pkt.u.ss_issuer, PGP_KEY_ID_SIZE, &subregion, stream)) { in parse_one_sig_subpacket()
1656 (void) memcpy(sig->info.signer_id, pkt.u.ss_issuer, PGP_KEY_ID_SIZE); in parse_one_sig_subpacket()
1661 if (!read_data(&pkt.u.ss_skapref, &subregion, stream)) { in parse_one_sig_subpacket()
1667 if (!read_data(&pkt.u.ss_hashpref, &subregion, stream)) { in parse_one_sig_subpacket()
1673 if (!read_data(&pkt.u.ss_zpref, &subregion, stream)) { in parse_one_sig_subpacket()
1682 pkt.u.ss_primary_userid = !!bools; in parse_one_sig_subpacket()
1686 if (!read_data(&pkt.u.ss_key_flags, &subregion, stream)) { in parse_one_sig_subpacket()
1692 if (!read_data(&pkt.u.ss_key_server_prefs, &subregion, stream)) { in parse_one_sig_subpacket()
1698 if (!read_data(&pkt.u.ss_features, &subregion, stream)) { in parse_one_sig_subpacket()
1704 if (!read_unsig_str(&pkt.u.ss_signer, &subregion, stream)) { in parse_one_sig_subpacket()
1711 if (!read_data(&pkt.u.ss_embedded_sig, &subregion, stream)) { in parse_one_sig_subpacket()
1717 if (!limread_data(&pkt.u.ss_notation.flags, 4, in parse_one_sig_subpacket()
1721 if (!limread_size_t(&pkt.u.ss_notation.name.len, 2, in parse_one_sig_subpacket()
1725 if (!limread_size_t(&pkt.u.ss_notation.value.len, 2, in parse_one_sig_subpacket()
1729 if (!limread_data(&pkt.u.ss_notation.name, in parse_one_sig_subpacket()
1730 (unsigned)pkt.u.ss_notation.name.len, in parse_one_sig_subpacket()
1734 if (!limread_data(&pkt.u.ss_notation.value, in parse_one_sig_subpacket()
1735 (unsigned)pkt.u.ss_notation.value.len, in parse_one_sig_subpacket()
1742 if (!read_string(&pkt.u.ss_policy, &subregion, stream)) { in parse_one_sig_subpacket()
1748 if (!read_string(&pkt.u.ss_regexp, &subregion, stream)) { in parse_one_sig_subpacket()
1754 if (!read_string(&pkt.u.ss_keyserv, &subregion, stream)) { in parse_one_sig_subpacket()
1770 if (!read_data(&pkt.u.ss_userdef, &subregion, stream)) { in parse_one_sig_subpacket()
1776 if (!read_data(&pkt.u.ss_unknown, &subregion, stream)) { in parse_one_sig_subpacket()
1783 if (!limread(&pkt.u.ss_revocation.code, 1, &subregion, stream)) { in parse_one_sig_subpacket()
1787 if (!read_string(&pkt.u.ss_revocation.reason, &subregion, in parse_one_sig_subpacket()
1801 case 0x04: pkt.u.ss_issuer_fingerprint.len = 20; break; in parse_one_sig_subpacket()
1802 case 0x05: pkt.u.ss_issuer_fingerprint.len = 32; break; in parse_one_sig_subpacket()
1807 if (!limread(pkt.u.ss_issuer_fingerprint.fingerprint, in parse_one_sig_subpacket()
1808 pkt.u.ss_issuer_fingerprint.len, &subregion, stream)) { in parse_one_sig_subpacket()
1815 if (!limread(&pkt.u.ss_revocation_key.class, 1, in parse_one_sig_subpacket()
1819 if (!(pkt.u.ss_revocation_key.class & 0x80)) { in parse_one_sig_subpacket()
1825 if (!limread(&pkt.u.ss_revocation_key.algid, 1, in parse_one_sig_subpacket()
1830 if (!limread(&pkt.u.ss_revocation_key.fingerprint[0], in parse_one_sig_subpacket()
1848 if (pkt.critical) { in parse_one_sig_subpacket()
1859 pgp_parser_content_free(&pkt); in parse_one_sig_subpacket()
1869 CALLBACK(pkt.tag, &stream->cbinfo, &pkt); in parse_one_sig_subpacket()
1896 pgp_packet_t pkt; in parse_sig_subpkts() local
1904 ERRP(&stream->cbinfo, pkt, "Subpacket set too long"); in parse_sig_subpkts()
1916 ERRP(&stream->cbinfo, pkt, in parse_sig_subpkts()
1919 ERRP(&stream->cbinfo, pkt, "Subpacket length mismatch"); in parse_sig_subpkts()
1942 pgp_packet_t pkt; in parse_v4_sig() local
1949 (void) memset(&pkt.u.sig, 0x0, sizeof(pkt.u.sig)); in parse_v4_sig()
1956 pkt.u.sig.v4_hashstart = stream->readinfo.alength - 1; in parse_v4_sig()
1960 pkt.u.sig.info.version = PGP_V4; in parse_v4_sig()
1965 pkt.u.sig.info.type = (pgp_sig_type_t)c; in parse_v4_sig()
1968 pkt.u.sig.info.type, in parse_v4_sig()
1969 pgp_show_sig_type(pkt.u.sig.info.type)); in parse_v4_sig()
1976 pkt.u.sig.info.key_alg = (pgp_pubkey_alg_t)c; in parse_v4_sig()
1980 pkt.u.sig.info.key_alg, in parse_v4_sig()
1981 pgp_show_pka(pkt.u.sig.info.key_alg)); in parse_v4_sig()
1986 pkt.u.sig.info.hash_alg = (pgp_hash_alg_t)c; in parse_v4_sig()
1990 pkt.u.sig.info.hash_alg, in parse_v4_sig()
1991 pgp_show_hash_alg(pkt.u.sig.info.hash_alg)); in parse_v4_sig()
1993 CALLBACK(PGP_PTAG_CT_SIGNATURE_HEADER, &stream->cbinfo, &pkt); in parse_v4_sig()
1995 if (!parse_sig_subpkts(&pkt.u.sig, region, stream)) { in parse_v4_sig()
1999 pkt.u.sig.info.v4_hashlen = stream->readinfo.alength in parse_v4_sig()
2000 - pkt.u.sig.v4_hashstart; in parse_v4_sig()
2002 fprintf(stderr, "v4_hashlen=%zd\n", pkt.u.sig.info.v4_hashlen); in parse_v4_sig()
2006 if (pkt.u.sig.info.v4_hashed) { in parse_v4_sig()
2007 free(pkt.u.sig.info.v4_hashed); in parse_v4_sig()
2009 pkt.u.sig.info.v4_hashed = calloc(1, pkt.u.sig.info.v4_hashlen); in parse_v4_sig()
2010 if (pkt.u.sig.info.v4_hashed == NULL) { in parse_v4_sig()
2020 (void) memcpy(pkt.u.sig.info.v4_hashed, in parse_v4_sig()
2021 stream->readinfo.accumulated + pkt.u.sig.v4_hashstart, in parse_v4_sig()
2022 pkt.u.sig.info.v4_hashlen); in parse_v4_sig()
2024 if (!parse_sig_subpkts(&pkt.u.sig, region, stream)) { in parse_v4_sig()
2028 if (!limread(pkt.u.sig.hash2, 2, region, stream)) { in parse_v4_sig()
2032 switch (pkt.u.sig.info.key_alg) { in parse_v4_sig()
2034 if (!limread_mpi(&pkt.u.sig.info.sig.rsa.sig, region, stream)) { in parse_v4_sig()
2039 BN_print_fp(stderr, pkt.u.sig.info.sig.rsa.sig); in parse_v4_sig()
2045 if (!limread_mpi(&pkt.u.sig.info.sig.dsa.r, region, stream)) { in parse_v4_sig()
2056 if (!limread_mpi(&pkt.u.sig.info.sig.dsa.s, region, stream)) { in parse_v4_sig()
2057 ERRP(&stream->cbinfo, pkt, in parse_v4_sig()
2063 if (!limread_mpi(&pkt.u.sig.info.sig.ecdsa.r, region, stream) || in parse_v4_sig()
2064 !limread_mpi(&pkt.u.sig.info.sig.ecdsa.s, region, stream)) { in parse_v4_sig()
2070 if (!limread_mpi(&pkt.u.sig.info.sig.elgamal.r, region, in parse_v4_sig()
2072 !limread_mpi(&pkt.u.sig.info.sig.elgamal.s, region, in parse_v4_sig()
2089 if (!read_data(&pkt.u.sig.info.sig.unknown, region, stream)) { in parse_v4_sig()
2097 pgp_show_pka(pkt.u.sig.info.key_alg)); in parse_v4_sig()
2106 CALLBACK(PGP_PTAG_CT_SIGNATURE_FOOTER, &stream->cbinfo, &pkt); in parse_v4_sig()
2126 pgp_packet_t pkt; in parse_sig() local
2135 (void) memset(&pkt, 0x0, sizeof(pkt)); in parse_sig()
2157 pgp_packet_t pkt; in parse_compressed() local
2164 pkt.u.compressed = (pgp_compression_type_t)c; in parse_compressed()
2166 CALLBACK(PGP_PTAG_CT_COMPRESSED, &stream->cbinfo, &pkt); in parse_compressed()
2173 return pgp_decompress(region, stream, pkt.u.compressed); in parse_compressed()
2211 pgp_packet_t pkt; in parse_one_pass() local
2214 if (!limread(&pkt.u.one_pass_sig.version, 1, region, stream)) { in parse_one_pass()
2217 if (pkt.u.one_pass_sig.version != 3) { in parse_one_pass()
2220 pkt.u.one_pass_sig.version); in parse_one_pass()
2226 pkt.u.one_pass_sig.sig_type = (pgp_sig_type_t)c; in parse_one_pass()
2231 pkt.u.one_pass_sig.hash_alg = (pgp_hash_alg_t)c; in parse_one_pass()
2236 pkt.u.one_pass_sig.key_alg = (pgp_pubkey_alg_t)c; in parse_one_pass()
2238 if (!limread(pkt.u.one_pass_sig.keyid, in parse_one_pass()
2239 (unsigned)sizeof(pkt.u.one_pass_sig.keyid), in parse_one_pass()
2247 pkt.u.one_pass_sig.nested = !!c; in parse_one_pass()
2248 CALLBACK(PGP_PTAG_CT_1_PASS_SIG, &stream->cbinfo, &pkt); in parse_one_pass()
2250 parse_hash_init(stream, pkt.u.one_pass_sig.hash_alg, in parse_one_pass()
2251 pkt.u.one_pass_sig.keyid); in parse_one_pass()
2262 pgp_packet_t pkt; in parse_trust() local
2264 if (!read_data(&pkt.u.trust, region, stream)) { in parse_trust()
2267 CALLBACK(PGP_PTAG_CT_TRUST, &stream->cbinfo, &pkt); in parse_trust()
2290 pgp_packet_t pkt; in parse_litdata() local
2296 pkt.u.litdata_header.format = (pgp_litdata_enum)c; in parse_litdata()
2300 if (!limread((uint8_t *)pkt.u.litdata_header.filename, in parse_litdata()
2304 pkt.u.litdata_header.filename[c] = '\0'; in parse_litdata()
2305 if (!limited_read_time(&pkt.u.litdata_header.mtime, region, stream)) { in parse_litdata()
2308 CALLBACK(PGP_PTAG_CT_LITDATA_HEADER, &stream->cbinfo, &pkt); in parse_litdata()
2309 mem = pkt.u.litdata_body.mem = pgp_memory_new(); in parse_litdata()
2310 pgp_memory_init(pkt.u.litdata_body.mem, in parse_litdata()
2312 pkt.u.litdata_body.data = mem->buf; in parse_litdata()
2320 pkt.u.litdata_body.length = readc; in parse_litdata()
2321 parse_hash_data(stream, pkt.u.litdata_body.data, region->length); in parse_litdata()
2322 CALLBACK(PGP_PTAG_CT_LITDATA_BODY, &stream->cbinfo, &pkt); in parse_litdata()
2372 pgp_packet_t pkt; in consume_packet() local
2376 ERRP(&stream->cbinfo, pkt, in consume_packet()
2402 pgp_packet_t pkt; in parse_seckey() local
2419 (void) memset(&pkt, 0x0, sizeof(pkt)); in parse_seckey()
2420 if (!parse_pubkey_data(&pkt.u.seckey.pubkey, region, stream)) { in parse_seckey()
2425 pgp_print_pubkey(&pkt.u.seckey.pubkey); in parse_seckey()
2427 stream->reading_v3_secret = (pkt.u.seckey.pubkey.version != PGP_V4); in parse_seckey()
2432 pkt.u.seckey.s2k_usage = (pgp_s2k_usage_t)c; in parse_seckey()
2434 if (pkt.u.seckey.s2k_usage == PGP_S2KU_ENCRYPTED || in parse_seckey()
2435 pkt.u.seckey.s2k_usage == PGP_S2KU_ENCRYPTED_AND_HASHED) { in parse_seckey()
2439 pkt.u.seckey.alg = (pgp_symm_alg_t)c; in parse_seckey()
2443 pkt.u.seckey.s2k_specifier = (pgp_s2k_specifier_t)c; in parse_seckey()
2444 switch (pkt.u.seckey.s2k_specifier) { in parse_seckey()
2457 pkt.u.seckey.hash_alg = (pgp_hash_alg_t)c; in parse_seckey()
2458 if (pkt.u.seckey.s2k_specifier != PGP_S2KS_SIMPLE && in parse_seckey()
2459 !limread(pkt.u.seckey.salt, 8, region, stream)) { in parse_seckey()
2462 if (pkt.u.seckey.s2k_specifier == in parse_seckey()
2467 pkt.u.seckey.octetc = in parse_seckey()
2471 } else if (pkt.u.seckey.s2k_usage != PGP_S2KU_NONE) { in parse_seckey()
2473 pkt.u.seckey.alg = (pgp_symm_alg_t)c; in parse_seckey()
2474 pkt.u.seckey.s2k_usage = PGP_S2KU_ENCRYPTED; in parse_seckey()
2475 pkt.u.seckey.s2k_specifier = PGP_S2KS_SIMPLE; in parse_seckey()
2476 pkt.u.seckey.hash_alg = PGP_HASH_MD5; in parse_seckey()
2478 crypted = pkt.u.seckey.s2k_usage == PGP_S2KU_ENCRYPTED || in parse_seckey()
2479 pkt.u.seckey.s2k_usage == PGP_S2KU_ENCRYPTED_AND_HASHED; in parse_seckey()
2494 blocksize = pgp_block_size(pkt.u.seckey.alg); in parse_seckey()
2501 if (!limread(pkt.u.seckey.iv, blocksize, region, stream)) { in parse_seckey()
2507 seckey.u.skey_passphrase.seckey = &pkt.u.seckey; in parse_seckey()
2520 &stream->cbinfo, &pkt); in parse_seckey()
2524 keysize = pgp_key_size(pkt.u.seckey.alg); in parse_seckey()
2532 pkt.u.seckey.hash_alg = PGP_HASH_SHA1; in parse_seckey()
2533 hashsize = pgp_hash_size(pkt.u.seckey.hash_alg); in parse_seckey()
2544 pkt.u.seckey.hash_alg); in parse_seckey()
2560 switch (pkt.u.seckey.s2k_specifier) { in parse_seckey()
2563 pkt.u.seckey.salt, in parse_seckey()
2572 for (i = 0; i < pkt.u.seckey.octetc; in parse_seckey()
2577 if (i + j > pkt.u.seckey.octetc && i != 0) { in parse_seckey()
2578 j = pkt.u.seckey.octetc - i; in parse_seckey()
2581 pkt.u.seckey.salt, in parse_seckey()
2609 pgp_crypt_any(&decrypt, pkt.u.seckey.alg); in parse_seckey()
2611 hexdump(stderr, "input iv", pkt.u.seckey.iv, pgp_block_size(pkt.u.seckey.alg)); in parse_seckey()
2614 decrypt.set_iv(&decrypt, pkt.u.seckey.iv); in parse_seckey()
2628 if (pkt.u.seckey.pubkey.version != PGP_V4) { in parse_seckey()
2637 if (pkt.u.seckey.s2k_usage == PGP_S2KU_ENCRYPTED_AND_HASHED) { in parse_seckey()
2639 pkt.u.seckey.checkhash = calloc(1, PGP_SHA1_HASH_SIZE); in parse_seckey()
2640 if (pkt.u.seckey.checkhash == NULL) { in parse_seckey()
2652 switch (pkt.u.seckey.pubkey.alg) { in parse_seckey()
2656 if (!limread_mpi(&pkt.u.seckey.key.rsa.d, region, stream) || in parse_seckey()
2657 !limread_mpi(&pkt.u.seckey.key.rsa.p, region, stream) || in parse_seckey()
2658 !limread_mpi(&pkt.u.seckey.key.rsa.q, region, stream) || in parse_seckey()
2659 !limread_mpi(&pkt.u.seckey.key.rsa.u, region, stream)) { in parse_seckey()
2665 if (!limread_mpi(&pkt.u.seckey.key.dsa.x, region, stream)) { in parse_seckey()
2671 if (!limread_mpi(&pkt.u.seckey.key.ecdsa.x, region, stream)) { in parse_seckey()
2677 if (!limread_mpi(&pkt.u.seckey.key.elgamal.x, region, stream)) { in parse_seckey()
2686 pkt.u.seckey.pubkey.alg, in parse_seckey()
2687 pgp_show_pka(pkt.u.seckey.pubkey.alg)); in parse_seckey()
2696 if (pkt.u.seckey.s2k_usage == PGP_S2KU_ENCRYPTED_AND_HASHED) { in parse_seckey()
2703 pkt.u.seckey.pubkey.version != PGP_V4) { in parse_seckey()
2708 if (!limread(pkt.u.seckey.checkhash, in parse_seckey()
2713 if (memcmp(hash, pkt.u.seckey.checkhash, in parse_seckey()
2715 ERRP(&stream->cbinfo, pkt, in parse_seckey()
2724 pkt.u.seckey.pubkey.version != PGP_V4) { in parse_seckey()
2729 if (!limread_scalar(&pkt.u.seckey.checksum, 2, in parse_seckey()
2733 if (sum != pkt.u.seckey.checksum) { in parse_seckey()
2734 ERRP(&stream->cbinfo, pkt, in parse_seckey()
2740 if (crypted && pkt.u.seckey.pubkey.version == PGP_V4) { in parse_seckey()
2754 CALLBACK(PGP_PTAG_CT_SECRET_KEY, &stream->cbinfo, &pkt); in parse_seckey()
2771 pgp_packet_t pkt; in parse_pk_sesskey() local
2785 pkt.u.pk_sesskey.version = c; in parse_pk_sesskey()
2786 if (pkt.u.pk_sesskey.version != 3) { in parse_pk_sesskey()
2789 pkt.u.pk_sesskey.version); in parse_pk_sesskey()
2792 if (!limread(pkt.u.pk_sesskey.key_id, in parse_pk_sesskey()
2793 (unsigned)sizeof(pkt.u.pk_sesskey.key_id), region, stream)) { in parse_pk_sesskey()
2797 hexdump(stderr, "sesskey: pubkey id", pkt.u.pk_sesskey.key_id, sizeof(pkt.u.pk_sesskey.key_id)); in parse_pk_sesskey()
2802 pkt.u.pk_sesskey.alg = (pgp_pubkey_alg_t)c; in parse_pk_sesskey()
2803 switch (pkt.u.pk_sesskey.alg) { in parse_pk_sesskey()
2805 if (!limread_mpi(&pkt.u.pk_sesskey.params.rsa.encrypted_m, in parse_pk_sesskey()
2809 enc_m = pkt.u.pk_sesskey.params.rsa.encrypted_m; in parse_pk_sesskey()
2815 if (!limread_mpi(&pkt.u.pk_sesskey.params.elgamal.g_to_k, in parse_pk_sesskey()
2818 &pkt.u.pk_sesskey.params.elgamal.encrypted_m, in parse_pk_sesskey()
2822 g_to_k = pkt.u.pk_sesskey.params.elgamal.g_to_k; in parse_pk_sesskey()
2823 enc_m = pkt.u.pk_sesskey.params.elgamal.encrypted_m; in parse_pk_sesskey()
2830 pgp_show_pka(pkt.u.pk_sesskey.alg)); in parse_pk_sesskey()
2837 sesskey.u.get_seckey.pk_sesskey = &pkt.u.pk_sesskey; in parse_pk_sesskey()
2850 &pkt); in parse_pk_sesskey()
2857 ERRP(&stream->cbinfo, pkt, "decrypted message too short"); in parse_pk_sesskey()
2862 pkt.u.pk_sesskey.symm_alg = (pgp_symm_alg_t)unencoded_m_buf[0]; in parse_pk_sesskey()
2864 (void) fprintf(stderr, "symm alg %d\n", pkt.u.pk_sesskey.symm_alg); in parse_pk_sesskey()
2867 if (!pgp_is_sa_supported(pkt.u.pk_sesskey.symm_alg)) { in parse_pk_sesskey()
2872 pkt.u.pk_sesskey.symm_alg)); in parse_pk_sesskey()
2875 k = pgp_key_size(pkt.u.pk_sesskey.symm_alg); in parse_pk_sesskey()
2886 if (k > sizeof(pkt.u.pk_sesskey.key)) { in parse_pk_sesskey()
2891 (void) memcpy(pkt.u.pk_sesskey.key, unencoded_m_buf + 1, k); in parse_pk_sesskey()
2894 hexdump(stderr, "recovered sesskey", pkt.u.pk_sesskey.key, k); in parse_pk_sesskey()
2896 pkt.u.pk_sesskey.checksum = unencoded_m_buf[k + 1] + in parse_pk_sesskey()
2904 pgp_calc_sesskey_checksum(&pkt.u.pk_sesskey, &cs[0]); in parse_pk_sesskey()
2918 CALLBACK(PGP_PTAG_CT_PK_SESSION_KEY, &stream->cbinfo, &pkt); in parse_pk_sesskey()
2923 pgp_crypt_any(&stream->decrypt, pkt.u.pk_sesskey.symm_alg); in parse_pk_sesskey()
2930 stream->decrypt.set_crypt_key(&stream->decrypt, pkt.u.pk_sesskey.key); in parse_pk_sesskey()
2975 pgp_packet_t pkt; in decrypt_se_data() local
2981 if (len > sizeof(pkt.u.se_data_body.data)) in decrypt_se_data()
2982 len = sizeof(pkt.u.se_data_body.data); in decrypt_se_data()
2984 if (!limread(pkt.u.se_data_body.data, len, in decrypt_se_data()
2988 pkt.u.se_data_body.length = len; in decrypt_se_data()
2989 CALLBACK(tag, &stream->cbinfo, &pkt); in decrypt_se_data()
3017 pgp_packet_t pkt; in decrypt_se_ip_data() local
3026 if (len > sizeof(pkt.u.se_data_body.data)) { in decrypt_se_ip_data()
3027 len = sizeof(pkt.u.se_data_body.data); in decrypt_se_ip_data()
3030 if (!limread(pkt.u.se_data_body.data, in decrypt_se_ip_data()
3035 pkt.u.se_data_body.length = len; in decrypt_se_ip_data()
3037 CALLBACK(tag, &stream->cbinfo, &pkt); in decrypt_se_ip_data()
3051 pgp_packet_t pkt; in parse_se_data() local
3054 CALLBACK(PGP_PTAG_CT_SE_DATA_HEADER, &stream->cbinfo, &pkt); in parse_se_data()
3070 pgp_packet_t pkt; in parse_se_ip_data() local
3076 pkt.u.se_ip_data_header = c; in parse_se_ip_data()
3080 if (pkt.u.se_ip_data_header != PGP_SE_IP_DATA_VERSION) { in parse_se_ip_data()
3104 pgp_packet_t pkt; in parse_mdc() local
3106 pkt.u.mdc.length = PGP_SHA1_HASH_SIZE; in parse_mdc()
3107 if ((pkt.u.mdc.data = calloc(1, PGP_SHA1_HASH_SIZE)) == NULL) { in parse_mdc()
3111 if (!limread(pkt.u.mdc.data, PGP_SHA1_HASH_SIZE, region, stream)) { in parse_mdc()
3114 CALLBACK(PGP_PTAG_CT_MDC, &stream->cbinfo, &pkt); in parse_mdc()
3115 free(pkt.u.mdc.data); in parse_mdc()
3133 pgp_packet_t pkt; in parse_packet() local
3140 pkt.u.ptag.position = stream->readinfo.position; in parse_packet()
3158 pkt.u.error = "Format error (ptag bit not set)"; in parse_packet()
3159 CALLBACK(PGP_PARSER_ERROR, &stream->cbinfo, &pkt); in parse_packet()
3162 pkt.u.ptag.new_format = !!(ptag & PGP_PTAG_NEW_FORMAT); in parse_packet()
3163 if (pkt.u.ptag.new_format) { in parse_packet()
3164 pkt.u.ptag.type = (ptag & PGP_PTAG_NF_CONTENT_TAG_MASK); in parse_packet()
3165 pkt.u.ptag.length_type = 0; in parse_packet()
3166 if (!read_new_length(&pkt.u.ptag.length, stream)) { in parse_packet()
3173 pkt.u.ptag.type = ((unsigned)ptag & in parse_packet()
3176 pkt.u.ptag.length_type = ptag & PGP_PTAG_OF_LENGTH_TYPE_MASK; in parse_packet()
3177 switch (pkt.u.ptag.length_type) { in parse_packet()
3179 rb = _read_scalar(&pkt.u.ptag.length, 1, stream); in parse_packet()
3183 rb = _read_scalar(&pkt.u.ptag.length, 2, stream); in parse_packet()
3187 rb = _read_scalar(&pkt.u.ptag.length, 4, stream); in parse_packet()
3191 pkt.u.ptag.length = 0; in parse_packet()
3201 CALLBACK(PGP_PARSER_PTAG, &stream->cbinfo, &pkt); in parse_packet()
3204 region.length = pkt.u.ptag.length; in parse_packet()
3208 pkt.u.ptag.type); in parse_packet()
3212 tag = pkt.u.ptag.type; in parse_packet()
3213 switch (pkt.u.ptag.type) { in parse_packet()
3220 ret = parse_pubkey((pgp_content_enum)pkt.u.ptag.type, &region, stream); in parse_packet()
3274 pkt.u.ptag.type); in parse_packet()
3301 pkt.u.packet.length = stream->readinfo.alength; in parse_packet()
3302 pkt.u.packet.raw = stream->readinfo.accumulated; in parse_packet()
3303 pkt.u.packet.tag = tag; in parse_packet()
3306 CALLBACK(PGP_PARSER_PACKET_END, &stream->cbinfo, &pkt); in parse_packet()
3506 pgp_callback(const pgp_packet_t *pkt, pgp_cbdata_t *cbinfo) in pgp_callback() argument
3508 return (cbinfo->cbfunc) ? cbinfo->cbfunc(pkt, cbinfo) : PGP_FINISHED; in pgp_callback()
3517 pgp_stacked_callback(const pgp_packet_t *pkt, pgp_cbdata_t *cbinfo) in pgp_stacked_callback() argument
3519 return pgp_callback(pkt, cbinfo->next); in pgp_stacked_callback()