VLC 4.0.0-dev
|
This file contains functions related to OpenPGP in VLC update management. More...
Macros | |
#define | packet_type(c) ( ( c & 0x3c ) >> 2 ) /* 0x3C = 00111100 */ |
#define | packet_header_len(c) ( ( c & 0x03 ) + 1 ) /* number of bytes in a packet header */ |
#define | READ_MPI(d, bits) |
#define | CRC24_INIT 0xB704CEL |
#define | CRC24_POLY 0x1864CFBL |
#define | PUBLIC_KEY_FOUND 0x01 |
#define | USER_ID_FOUND 0x02 |
#define | SIGNATURE_FOUND 0X04 |
Functions | |
static uint32_t | scalar_number (const uint8_t *p, int header_len) |
static uint32_t | mpi_len (const uint8_t *mpi) |
static size_t | read_mpi (uint8_t *dst, const uint8_t *buf, size_t buflen, size_t bits) |
static int | parse_public_key_packet (public_key_packet_t *p_key, const uint8_t *p_buf, size_t i_packet_len) |
static size_t | parse_signature_v3_packet (signature_packet_t *p_sig, const uint8_t *p_buf, size_t i_sig_len) |
static size_t | parse_signature_v4_packet (signature_packet_t *p_sig, const uint8_t *p_buf, size_t i_sig_len) |
static int | parse_signature_packet (signature_packet_t *p_sig, const uint8_t *p_buf, size_t i_packet_len) |
static long | crc_octets (uint8_t *octets, size_t len) |
static int | pgp_unarmor (const char *p_ibuf, size_t i_ibuf_len, uint8_t *p_obuf, size_t i_obuf_len) |
static int | rsa_pkcs1_encode_sig (gcry_mpi_t *r_result, size_t size, const uint8_t *hash, int algo) |
static int | verify_signature_rsa (signature_packet_t *sign, public_key_packet_t *p_key, uint8_t *p_hash) |
static int | verify_signature_dsa (signature_packet_t *sign, public_key_packet_t *p_key, uint8_t *p_hash) |
int | verify_signature (signature_packet_t *sign, public_key_packet_t *p_key, uint8_t *p_hash) |
int | parse_public_key (const uint8_t *p_key_data, size_t i_key_len, public_key_t *p_key, const uint8_t *p_sig_issuer) |
static int | hash_from_binary_file (const char *psz_file, gcry_md_hd_t hd) |
static uint8_t * | hash_finish (gcry_md_hd_t hd, signature_packet_t *p_sig) |
uint8_t * | hash_from_text (const char *psz_string, signature_packet_t *p_sig) |
uint8_t * | hash_from_file (const char *psz_file, signature_packet_t *p_sig) |
uint8_t * | hash_from_public_key (public_key_t *p_pkey) |
public_key_t * | download_key (vlc_object_t *p_this, const uint8_t *p_longid, const uint8_t *p_signature_issuer) |
int | download_signature (vlc_object_t *p_this, signature_packet_t *p_sig, const char *psz_url) |
This file contains functions related to OpenPGP in VLC update management.
#define CRC24_INIT 0xB704CEL |
#define CRC24_POLY 0x1864CFBL |
#define packet_header_len | ( | c | ) | ( ( c & 0x03 ) + 1 ) /* number of bytes in a packet header */ |
#define packet_type | ( | c | ) | ( ( c & 0x3c ) >> 2 ) /* 0x3C = 00111100 */ |
#define PUBLIC_KEY_FOUND 0x01 |
#define READ_MPI | ( | d, | |
bits | |||
) |
#define SIGNATURE_FOUND 0X04 |
#define USER_ID_FOUND 0x02 |
|
static |
References CRC24_INIT, and CRC24_POLY.
Referenced by pgp_unarmor().
public_key_t * download_key | ( | vlc_object_t * | p_this, |
const uint8_t * | p_longid, | ||
const uint8_t * | p_signature_issuer | ||
) |
References asprintf(), public_key_t::longid, msg_Dbg, parse_public_key(), vlc_stream_Delete(), vlc_stream_GetSize(), vlc_stream_NewURL, vlc_stream_Read(), and VLC_SUCCESS.
Referenced by GetUpdateFile().
int download_signature | ( | vlc_object_t * | p_this, |
signature_packet_t * | p_sig, | ||
const char * | psz_url | ||
) |
References BINARY_SIGNATURE, signature_packet_t::hashed_data, msg_Dbg, packet_header_len, packet_type, parse_signature_packet(), pgp_unarmor(), scalar_number(), SIGNATURE_PACKET, signature_packet_t::specific, TEXT_SIGNATURE, signature_packet_t::type, signature_packet_t::unhashed_data, signature_packet_t::v4, signature_packet_t::version, VLC_EGENERIC, VLC_ENOMEM, vlc_stream_Delete(), vlc_stream_GetSize(), vlc_stream_NewURL, vlc_stream_Read(), and VLC_SUCCESS.
Referenced by GetUpdateFile(), and update_DownloadReal().
|
static |
References signature_packet_t::digest_algo, signature_packet_t::hashed_data, signature_packet_t::hashed_data_len, signature_packet_t::public_key_algo, scalar_number(), signature_packet_t::specific, signature_packet_t::timestamp, signature_packet_t::type, signature_packet_t::v3, signature_packet_t::v4, and signature_packet_t::version.
Referenced by hash_from_file(), hash_from_public_key(), and hash_from_text().
|
static |
References vlc_fopen().
Referenced by hash_from_file().
uint8_t * hash_from_file | ( | const char * | psz_file, |
signature_packet_t * | p_sig | ||
) |
References signature_packet_t::digest_algo, hash_finish(), and hash_from_binary_file().
Referenced by update_DownloadReal().
uint8_t * hash_from_public_key | ( | public_key_t * | p_pkey | ) |
References public_key_packet_t::algo, signature_packet_t::digest_algo, public_key_packet_t::dsa, public_key_packet_t::e, public_key_packet_t::g, GENERIC_KEY_SIGNATURE, hash_finish(), signature_packet_t::hash_verification, public_key_t::key, mpi_len(), public_key_packet_t::n, public_key_packet_t::p, POSITIVE_KEY_SIGNATURE, public_key_t::psz_username, public_key_packet_t::q, public_key_packet_t::rsa, public_key_packet_t::sig, public_key_t::sig, public_key_packet_t::timestamp, signature_packet_t::type, public_key_packet_t::version, signature_packet_t::version, and public_key_packet_t::y.
Referenced by GetUpdateFile().
uint8_t * hash_from_text | ( | const char * | psz_string, |
signature_packet_t * | p_sig | ||
) |
References signature_packet_t::digest_algo, hash_finish(), TEXT_SIGNATURE, and signature_packet_t::type.
Referenced by GetUpdateFile().
|
static |
References scalar_number().
Referenced by hash_from_public_key(), read_mpi(), verify_signature_dsa(), and verify_signature_rsa().
int parse_public_key | ( | const uint8_t * | p_key_data, |
size_t | i_key_len, | ||
public_key_t * | p_key, | ||
const uint8_t * | p_sig_issuer | ||
) |
References signature_packet_t::hashed_data, i_type, signature_packet_t::issuer_longid, public_key_t::key, packet_header_len, packet_type, parse_public_key_packet(), parse_signature_packet(), pgp_unarmor(), public_key_t::psz_username, PUBLIC_KEY_FOUND, PUBLIC_KEY_PACKET, scalar_number(), public_key_t::sig, SIGNATURE_FOUND, SIGNATURE_PACKET, signature_packet_t::specific, signature_packet_t::unhashed_data, USER_ID_FOUND, USER_ID_PACKET, signature_packet_t::v4, signature_packet_t::version, VLC_EGENERIC, VLC_ENOMEM, and VLC_SUCCESS.
Referenced by download_key(), and GetUpdateFile().
|
static |
References public_key_packet_t::algo, public_key_packet_t::dsa, public_key_packet_t::e, public_key_packet_t::g, public_key_packet_t::n, public_key_packet_t::p, public_key_packet_t::q, READ_MPI, public_key_packet_t::rsa, public_key_packet_t::sig, public_key_packet_t::timestamp, public_key_packet_t::version, VLC_EGENERIC, VLC_SUCCESS, and public_key_packet_t::y.
Referenced by parse_public_key().
|
static |
References signature_packet_t::algo_specific, BINARY_SIGNATURE, CASUAL_KEY_SIGNATURE, signature_packet_t::dsa, GENERIC_KEY_SIGNATURE, signature_packet_t::hashed_data, parse_signature_v3_packet(), parse_signature_v4_packet(), PERSONA_KEY_SIGNATURE, POSITIVE_KEY_SIGNATURE, signature_packet_t::public_key_algo, signature_packet_t::r, READ_MPI, signature_packet_t::rsa, signature_packet_t::s, signature_packet_t::specific, TEXT_SIGNATURE, signature_packet_t::type, signature_packet_t::unhashed_data, signature_packet_t::v4, signature_packet_t::version, VLC_EGENERIC, and VLC_SUCCESS.
Referenced by download_signature(), and parse_public_key().
|
static |
References signature_packet_t::digest_algo, signature_packet_t::hash_verification, signature_packet_t::hashed_data_len, signature_packet_t::issuer_longid, signature_packet_t::public_key_algo, signature_packet_t::specific, signature_packet_t::timestamp, signature_packet_t::type, and signature_packet_t::v3.
Referenced by parse_signature_packet().
|
static |
References signature_packet_t::digest_algo, signature_packet_t::hash_verification, signature_packet_t::hashed_data, signature_packet_t::hashed_data_len, signature_packet_t::issuer_longid, ISSUER_SUBPACKET, p, signature_packet_t::public_key_algo, scalar_number(), signature_packet_t::specific, signature_packet_t::type, U32_AT(), signature_packet_t::unhashed_data, signature_packet_t::unhashed_data_len, and signature_packet_t::v4.
Referenced by parse_signature_packet().
|
static |
References crc_octets(), and vlc_b64_decode_binary_to_buffer().
Referenced by download_signature(), and parse_public_key().
|
static |
References mpi_len().
|
static |
References VLC_EGENERIC, and VLC_SUCCESS.
Referenced by verify_signature_rsa().
|
inlinestatic |
References p.
Referenced by download_signature(), hash_finish(), mpi_len(), parse_public_key(), and parse_signature_v4_packet().
int verify_signature | ( | signature_packet_t * | sign, |
public_key_packet_t * | p_key, | ||
uint8_t * | p_hash | ||
) |
References signature_packet_t::public_key_algo, verify_signature_dsa(), verify_signature_rsa(), and VLC_EGENERIC.
Referenced by GetUpdateFile(), and update_DownloadReal().
|
static |
References signature_packet_t::algo_specific, signature_packet_t::digest_algo, public_key_packet_t::dsa, signature_packet_t::dsa, public_key_packet_t::g, mpi_len(), p, public_key_packet_t::p, public_key_packet_t::q, signature_packet_t::r, signature_packet_t::s, public_key_packet_t::sig, VLC_EGENERIC, VLC_SUCCESS, and public_key_packet_t::y.
Referenced by verify_signature().
|
static |
References signature_packet_t::algo_specific, signature_packet_t::digest_algo, public_key_packet_t::e, mpi_len(), public_key_packet_t::n, public_key_packet_t::rsa, signature_packet_t::rsa, rsa_pkcs1_encode_sig(), signature_packet_t::s, public_key_packet_t::sig, VLC_EGENERIC, and VLC_SUCCESS.
Referenced by verify_signature().