VLC  4.0.0-dev
Macros | Functions
update_crypto.c File Reference
Include dependency graph for update_crypto.c:

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_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

◆ CRC24_POLY

#define CRC24_POLY   0x1864CFBL

◆ packet_header_len

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

◆ packet_type

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

◆ PUBLIC_KEY_FOUND

#define PUBLIC_KEY_FOUND   0x01

◆ 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)

◆ SIGNATURE_FOUND

#define SIGNATURE_FOUND   0X04

◆ USER_ID_FOUND

#define USER_ID_FOUND   0x02

Function Documentation

◆ crc_octets()

static 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()

int download_signature ( vlc_object_t p_this,
signature_packet_t p_sig,
const char *  psz_url 
)

◆ hash_finish()

static uint8_t* hash_finish ( gcry_md_hd_t  hd,
signature_packet_t p_sig 
)
static

◆ hash_from_binary_file()

static 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()

uint8_t* hash_from_public_key ( public_key_t p_pkey)

◆ hash_from_text()

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

◆ mpi_len()

static uint32_t mpi_len ( const uint8_t *  mpi)
static

◆ parse_public_key()

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 
)

◆ parse_public_key_packet()

static int parse_public_key_packet ( public_key_packet_t p_key,
const uint8_t *  p_buf,
size_t  i_packet_len 
)
static

◆ parse_signature_packet()

static int parse_signature_packet ( signature_packet_t p_sig,
const uint8_t *  p_buf,
size_t  i_packet_len 
)
static

◆ parse_signature_v3_packet()

static size_t parse_signature_v3_packet ( signature_packet_t p_sig,
const uint8_t *  p_buf,
size_t  i_sig_len 
)
static

◆ parse_signature_v4_packet()

static size_t parse_signature_v4_packet ( signature_packet_t p_sig,
const uint8_t *  p_buf,
size_t  i_sig_len 
)
static

◆ pgp_unarmor()

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

◆ read_mpi()

static 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()

static 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()

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

◆ verify_signature()

int verify_signature ( signature_packet_t sign,
public_key_packet_t p_key,
uint8_t *  p_hash 
)

◆ verify_signature_dsa()

static int verify_signature_dsa ( signature_packet_t sign,
public_key_packet_t p_key,
uint8_t *  p_hash 
)
static

◆ verify_signature_rsa()

static int verify_signature_rsa ( signature_packet_t sign,
public_key_packet_t p_key,
uint8_t *  p_hash 
)
static
read_mpi
static size_t read_mpi(uint8_t *dst, const uint8_t *buf, size_t buflen, size_t bits)
Definition: update_crypto.c:77