VLC 4.0.0-dev
Loading...
Searching...
No Matches
update_crypto.c File Reference

This file contains functions related to OpenPGP in VLC update management. More...

Include dependency graph for update_crypto.c:

Macros

#define packet_type(c)
#define packet_header_len(c)
#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_tdownload_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)

Detailed Description

This file contains functions related to OpenPGP in VLC update management.

Macro Definition Documentation

◆ CRC24_INIT

#define CRC24_INIT   0xB704CEL

Referenced by crc_octets().

◆ CRC24_POLY

#define CRC24_POLY   0x1864CFBL

Referenced by crc_octets().

◆ packet_header_len

#define packet_header_len ( c)
Value:
( ( c & 0x03 ) + 1 ) /* number of bytes in a packet header */

Referenced by download_signature(), and parse_public_key().

◆ packet_type

#define packet_type ( c)
Value:
( ( c & 0x3c ) >> 2 ) /* 0x3C = 00111100 */

Referenced by download_signature(), and parse_public_key().

◆ PUBLIC_KEY_FOUND

#define PUBLIC_KEY_FOUND   0x01

Referenced by parse_public_key().

◆ READ_MPI

#define READ_MPI ( d,
bits )
Value:
do { \
size_t n = read_mpi(d, p_buf, i_packet_len - i_read, bits); \
if (!n) goto error; \
p_buf += n; \
i_read += n; \
} while(0)
static size_t read_mpi(uint8_t *dst, const uint8_t *buf, size_t buflen, size_t bits)
Definition update_crypto.c:77

Referenced by parse_public_key_packet(), and parse_signature_packet().

◆ SIGNATURE_FOUND

#define SIGNATURE_FOUND   0X04

Referenced by parse_public_key().

◆ USER_ID_FOUND

#define USER_ID_FOUND   0x02

Referenced by parse_public_key().

Function Documentation

◆ crc_octets()

long crc_octets ( uint8_t * octets,
size_t len )
static

References CRC24_INIT, and CRC24_POLY.

Referenced by pgp_unarmor().

◆ download_key()

public_key_t * download_key ( vlc_object_t * p_this,
const uint8_t * p_longid,
const uint8_t * p_signature_issuer )

◆ download_signature()

◆ hash_finish()

◆ hash_from_binary_file()

int hash_from_binary_file ( const char * psz_file,
gcry_md_hd_t hd )
static

References vlc_fopen().

Referenced by hash_from_file().

◆ hash_from_file()

uint8_t * hash_from_file ( const char * psz_file,
signature_packet_t * p_sig )

◆ hash_from_public_key()

◆ hash_from_text()

uint8_t * hash_from_text ( const char * psz_string,
signature_packet_t * p_sig )

◆ mpi_len()

uint32_t mpi_len ( const uint8_t * mpi)
static

◆ parse_public_key()

◆ parse_public_key_packet()

◆ parse_signature_packet()

◆ parse_signature_v3_packet()

◆ parse_signature_v4_packet()

◆ pgp_unarmor()

int pgp_unarmor ( const char * p_ibuf,
size_t i_ibuf_len,
uint8_t * p_obuf,
size_t i_obuf_len )
static

◆ read_mpi()

size_t read_mpi ( uint8_t * dst,
const uint8_t * buf,
size_t buflen,
size_t bits )
static

References mpi_len().

◆ rsa_pkcs1_encode_sig()

int rsa_pkcs1_encode_sig ( gcry_mpi_t * r_result,
size_t size,
const uint8_t * hash,
int algo )
static

References VLC_EGENERIC, and VLC_SUCCESS.

Referenced by verify_signature_rsa().

◆ scalar_number()

uint32_t scalar_number ( const uint8_t * p,
int header_len )
inlinestatic

◆ verify_signature()

◆ verify_signature_dsa()

◆ verify_signature_rsa()