rpm  5.4.15
Data Structures | Macros | Typedefs | Functions | Variables
rpmhkp.c File Reference
#include "system.h"
#include <rpmhkp.h>
#include <rpmpgp.h>
#include <rpmlog.h>
#include <rpmmacro.h>
#include "debug.h"
Include dependency graph for rpmhkp.c:

Go to the source code of this file.

Data Structures

struct  _Astats_s
 
struct  _BAstats_s
 

Macros

#define _RPMHKP_INTERNAL
 
#define _RPMPGP_INTERNAL
 
#define SUM   _rpmhkp_stats
 
#define SPEW(_list)   if (_rpmhkp_spew) fprintf _list
 
#define DESPEW(_list)   SPEW(_list)
 
#define HKPDEBUG(_list)   if (_rpmhkp_debug) fprintf _list
 

Typedefs

typedef struct _Astats_s _Astats
 
typedef struct _BAstats_s _BAstats
 

Functions

static rpmhkp rpmhkpI (void)
 
static void rpmhkpFini (void *_hkp)
 
static rpmhkp rpmhkpGetPool (rpmioPool pool)
 
rpmhkp rpmhkpNew (const rpmuint8_t *keyid, uint32_t flags)
 Create a new hkp handle. More...
 
static const rpmuint8_tpgpGrabSubTagVal (const rpmuint8_t *h, size_t hlen, rpmuint8_t subtag, size_t *tlenp)
 
static const rpmuint8_tppSigHash (pgpPkt pp, size_t *plen)
 
static const rpmuint8_tppSigUnhash (pgpPkt pp, size_t *plen)
 
static const rpmuint8_tppSignid (pgpPkt pp)
 
static rpmuint32_t ppSigTime (pgpPkt pp)
 
static rpmuint8_t ppSigType (pgpPkt pp)
 
static const char * rpmhkpEscape (const char *keyname)
 
rpmhkp rpmhkpLookup (const char *keyname)
 Retrieve a pubkey from a SKS server. More...
 
int rpmhkpLoadKey (rpmhkp hkp, pgpDig dig, int keyx, rpmuint8_t pubkey_algo)
 
int rpmhkpFindKey (rpmhkp hkp, pgpDig dig, const rpmuint8_t *signid, rpmuint8_t pubkey_algo)
 
int rpmhkpLoadSignature (rpmhkp hkp, pgpDig dig, pgpPkt pp)
 
int rpmhkpUpdate (DIGEST_CTX ctx, const void *data, size_t len)
 
static DIGEST_CTX rpmhkpHashKey (rpmhkp hkp, int ix, pgpHashAlgo dalgo)
 
static DIGEST_CTX rpmhkpHashUid (rpmhkp hkp, int ix, pgpHashAlgo dalgo)
 
static DIGEST_CTX rpmhkpHashSubkey (rpmhkp hkp, int ix, pgpHashAlgo dalgo)
 
static DIGEST_CTX rpmhkpHash (rpmhkp hkp, int keyx, pgpSigType sigtype, pgpHashAlgo dalgo)
 
static int rpmhkpVerifyHash (rpmhkp hkp, pgpDig dig, DIGEST_CTX ctx)
 
static int rpmhkpVerifySignature (rpmhkp hkp, pgpDig dig, DIGEST_CTX ctx)
 
static int rpmhkpVerify (rpmhkp hkp, pgpPkt pp)
 
rpmRC rpmhkpValidate (rpmhkp hkp, const char *keyname)
 Retrieve/Validate binding and certification signatures on a pubkey. More...
 
void _rpmhkpPrintStats (FILE *fp)
 Display hkp usage statistics. More...
 
void _rpmhkpDumpDigParams (const char *msg, pgpDigParams sigp, FILE *fp)
 
void _rpmhkpDumpDig (const char *msg, pgpDig dig, FILE *fp)
 

Variables

int _rpmhkp_debug
 
rpmhkp _rpmhkpI = NULL
 
struct _filter_s _rpmhkp_awol = {}
 
struct _filter_s _rpmhkp_crl = {}
 
_BAstats _rpmhkp_stats
 
int _rpmhkp_spew
 
int _rpmhkp_lvl = RPMLOG_DEBUG
 
rpmioPool _rpmhkpPool
 

Macro Definition Documentation

#define _RPMHKP_INTERNAL

Definition at line 3 of file rpmhkp.c.

#define _RPMPGP_INTERNAL

Definition at line 6 of file rpmhkp.c.

#define DESPEW (   _list)    SPEW(_list)

Definition at line 61 of file rpmhkp.c.

Referenced by rpmhkpFindKey(), and rpmhkpVerifySignature().

#define HKPDEBUG (   _list)    if (_rpmhkp_debug) fprintf _list
#define SPEW (   _list)    if (_rpmhkp_spew) fprintf _list

Definition at line 57 of file rpmhkp.c.

Referenced by pgpGrabSubTagVal(), rpmhkpUpdate(), rpmhkpValidate(), and rpmhkpVerifyHash().

#define SUM   _rpmhkp_stats

Typedef Documentation

typedef struct _Astats_s _Astats
typedef struct _BAstats_s _BAstats

Function Documentation

void _rpmhkpDumpDig ( const char *  msg,
pgpDig  dig,
FILE *  fp 
)
void _rpmhkpDumpDigParams ( const char *  msg,
pgpDigParams  sigp,
FILE *  fp 
)

Definition at line 1141 of file rpmhkp.c.

References _pgpHashAlgo2Name(), _pgpPubkeyAlgo2Name(), _pgpSigType2Name(), and pgpGrab().

Referenced by _rpmhkpDumpDig().

void _rpmhkpPrintStats ( FILE *  fp)

Display hkp usage statistics.

Parameters
fpfile handle (NULL uses stderr)

Definition at line 1111 of file rpmhkp.c.

References SUM.

static const rpmuint8_t* pgpGrabSubTagVal ( const rpmuint8_t h,
size_t  hlen,
rpmuint8_t  subtag,
size_t *  tlenp 
)
static

Definition at line 181 of file rpmhkp.c.

References len, pgpHexStr(), pgpLen(), PGPSUBTYPE_CRITICAL, and SPEW.

Referenced by ppSignid(), ppSigTime(), and rpmhkpLoadSignature().

static const rpmuint8_t* ppSigHash ( pgpPkt  pp,
size_t *  plen 
)
static

Definition at line 210 of file rpmhkp.c.

References pgpGrab(), and PGPTAG_SIGNATURE.

Referenced by ppSigTime().

static const rpmuint8_t* ppSignid ( pgpPkt  pp)
static

Definition at line 240 of file rpmhkp.c.

References pgpGrabSubTagVal(), PGPSUBTYPE_ISSUER_KEYID, PGPTAG_SIGNATURE, and ppSigUnhash().

Referenced by rpmhkpValidate().

static rpmuint32_t ppSigTime ( pgpPkt  pp)
static

Definition at line 259 of file rpmhkp.c.

References pgpGrab(), pgpGrabSubTagVal(), PGPSUBTYPE_SIG_CREATE_TIME, PGPTAG_SIGNATURE, and ppSigHash().

Referenced by rpmhkpValidate().

static rpmuint8_t ppSigType ( pgpPkt  pp)
static

Definition at line 279 of file rpmhkp.c.

References PGPTAG_SIGNATURE.

Referenced by rpmhkpValidate().

static const rpmuint8_t* ppSigUnhash ( pgpPkt  pp,
size_t *  plen 
)
static

Definition at line 224 of file rpmhkp.c.

References pgpGrab(), and PGPTAG_SIGNATURE.

Referenced by ppSignid().

static const char* rpmhkpEscape ( const char *  keyname)
static

Definition at line 291 of file rpmhkp.c.

References xmalloc.

Referenced by rpmhkpLookup().

int rpmhkpFindKey ( rpmhkp  hkp,
pgpDig  dig,
const rpmuint8_t signid,
rpmuint8_t  pubkey_algo 
)
static void rpmhkpFini ( void *  _hkp)
static

Definition at line 78 of file rpmhkp.c.

References _free(), and rpmbfFree().

Referenced by rpmhkpGetPool().

static rpmhkp rpmhkpGetPool ( rpmioPool  pool)
static

Definition at line 96 of file rpmhkp.c.

References _rpmhkpPool, rpmhkpFini(), rpmioGetPool(), and rpmioNewPool().

Referenced by rpmhkpNew().

static DIGEST_CTX rpmhkpHash ( rpmhkp  hkp,
int  keyx,
pgpSigType  sigtype,
pgpHashAlgo  dalgo 
)
static
static DIGEST_CTX rpmhkpHashKey ( rpmhkp  hkp,
int  ix,
pgpHashAlgo  dalgo 
)
static
static DIGEST_CTX rpmhkpHashSubkey ( rpmhkp  hkp,
int  ix,
pgpHashAlgo  dalgo 
)
static

Definition at line 617 of file rpmhkp.c.

References alloca(), HKPDEBUG, pgpPktLen(), rpmhkpHashKey(), and rpmhkpUpdate().

Referenced by rpmhkpHash().

static DIGEST_CTX rpmhkpHashUid ( rpmhkp  hkp,
int  ix,
pgpHashAlgo  dalgo 
)
static

Definition at line 592 of file rpmhkp.c.

References alloca(), HKPDEBUG, pgpPktLen(), rpmhkpHashKey(), and rpmhkpUpdate().

Referenced by rpmhkpHash().

static rpmhkp rpmhkpI ( void  )
static

Definition at line 69 of file rpmhkp.c.

References _rpmhkpI, and rpmhkpNew().

Referenced by rpmhkpNew().

int rpmhkpLoadKey ( rpmhkp  hkp,
pgpDig  dig,
int  keyx,
rpmuint8_t  pubkey_algo 
)

Definition at line 363 of file rpmhkp.c.

References alloca(), HKPDEBUG, len, pgpGetPubkey(), pgpPktLen(), and pgpPrtPubkeyParams().

Referenced by rpmcliImportPubkey(), and rpmhkpFindKey().

int rpmhkpLoadSignature ( rpmhkp  hkp,
pgpDig  dig,
pgpPkt  pp 
)
rpmhkp rpmhkpLookup ( const char *  keyname)

Retrieve a pubkey from a SKS server.

Parameters
keynamepubkey query string
Returns
hkp handle

Definition at line 318 of file rpmhkp.c.

References _free(), HKPDEBUG, PGPARMOR_ERROR, PGPARMOR_NONE, pgpGrabPkts(), pgpPubkeyFingerprint(), pgpReadPkts(), rpmExpand(), rpmhkpEscape(), rpmhkpFree(), rpmhkpNew(), and SUM.

Referenced by rpmhkpFindKey(), and rpmhkpValidate().

rpmhkp rpmhkpNew ( const rpmuint8_t keyid,
uint32_t  flags 
)

Create a new hkp handle.

Parameters
keyidpubkey fingerprint (or NULL)
flagshkp handle flags ((1<<31): use global handle)
Returns
new hkp handle

Definition at line 112 of file rpmhkp.c.

References rpmbfLink(), rpmbfNew(), rpmbfParams(), rpmhkpGetPool(), rpmhkpI(), and rpmhkpLink().

Referenced by rpmcliImportPubkey(), rpmhkpI(), rpmhkpLookup(), rpmnsProbeSignature(), and rpmtsFindPubkey().

int rpmhkpUpdate ( DIGEST_CTX  ctx,
const void *  data,
size_t  len 
)

Definition at line 562 of file rpmhkp.c.

References pgpHexStr(), rpmDigestUpdate(), and SPEW.

Referenced by rpmhkpHashKey(), rpmhkpHashSubkey(), rpmhkpHashUid(), and rpmhkpVerify().

rpmRC rpmhkpValidate ( rpmhkp  hkp,
const char *  keyname 
)
static int rpmhkpVerify ( rpmhkp  hkp,
pgpPkt  pp 
)
static
static int rpmhkpVerifyHash ( rpmhkp  hkp,
pgpDig  dig,
DIGEST_CTX  ctx 
)
static

Definition at line 694 of file rpmhkp.c.

References _free(), HKPDEBUG, pgpGetSignature(), pgpHexStr(), rpmDigestFinal(), rpmDigestName(), SPEW, SUM, and xstrdup().

Referenced by rpmhkpVerify().

static int rpmhkpVerifySignature ( rpmhkp  hkp,
pgpDig  dig,
DIGEST_CTX  ctx 
)
static

Variable Documentation

struct _filter_s _rpmhkp_awol = {}

Definition at line 24 of file rpmhkp.c.

Referenced by rpmioClean().

struct _filter_s _rpmhkp_crl = {}

Definition at line 25 of file rpmhkp.c.

Referenced by rpmioClean().

int _rpmhkp_debug

Definition at line 19 of file rpmhkp.c.

Referenced by rpmtsFindPubkey(), rpmVerifySignature(), verifyDSA(), verifyECDSA(), and verifyRSA().

int _rpmhkp_lvl = RPMLOG_DEBUG

Definition at line 65 of file rpmhkp.c.

int _rpmhkp_spew

Definition at line 56 of file rpmhkp.c.

_BAstats _rpmhkp_stats

Definition at line 51 of file rpmhkp.c.

rpmhkp _rpmhkpI = NULL

Definition at line 22 of file rpmhkp.c.

Referenced by rpmhkpI(), and rpmioClean().

rpmioPool _rpmhkpPool

Definition at line 94 of file rpmhkp.c.

Referenced by rpmhkpGetPool(), and rpmioClean().