rpm 5.3.12
Defines | Functions | Variables
rpmio/rpmbc.c File Reference
#include "system.h"
#include <rpmbc.h>
#include "debug.h"
Include dependency graph for rpmbc.c:

Go to the source code of this file.

Defines

#define _RPMBC_INTERNAL
#define _RPMPGP_INTERNAL
#define SPEW(_t, _rc, _dig)
#define _spewMPB(_N, _MPB)
#define _spewMPN(_N, _MPN)

Functions

static const char * _pgpHashAlgo2Name (uint32_t algo)
static const char * _pgpPubkeyAlgo2Name (uint32_t algo)
static unsigned char nibble (char c)
 Convert hex to binary nibble.
static int rpmbcSetRSA (DIGEST_CTX ctx, pgpDig dig, pgpDigParams sigp)
static int rpmbcVerifyRSA (pgpDig dig)
static int rpmbcSignRSA (pgpDig dig)
static int rpmbcGenerateRSA (pgpDig dig)
static int rpmbcSetDSA (DIGEST_CTX ctx, pgpDig dig, pgpDigParams sigp)
static int rpmbcVerifyDSA (pgpDig dig)
static int rpmbcSignDSA (pgpDig dig)
static int rpmbcGenerateDSA (pgpDig dig)
static int rpmbcSetELG (DIGEST_CTX ctx, pgpDig dig, pgpDigParams sigp)
static int rpmbcSetECDSA (DIGEST_CTX ctx, pgpDig dig, pgpDigParams sigp)
static int rpmbcErrChk (pgpDig dig, const char *msg, int rc, unsigned expected)
static int rpmbcAvailableCipher (pgpDig dig, int algo)
static int rpmbcAvailableDigest (pgpDig dig, int algo)
static int rpmbcAvailablePubkey (pgpDig dig, int algo)
static int rpmbcVerify (pgpDig dig)
static int rpmbcSign (pgpDig dig)
static int rpmbcGenerate (pgpDig dig)
static char * pgpMpiHex (const rpmuint8_t *p)
static int pgpMpiSet (const char *pre, unsigned int lbits, void *dest, const rpmuint8_t *p, const rpmuint8_t *pend)
static int rpmbcMpiItem (const char *pre, pgpDig dig, int itemno, const rpmuint8_t *p, const rpmuint8_t *pend)
static void rpmbcClean (void *impl)
static void * rpmbcFree (void *impl)
static void * rpmbcInit (void)
int rpmbcExportPubkey (pgpDig dig)
int rpmbcExportSignature (pgpDig dig, DIGEST_CTX ctx)

Variables

int _pgp_debug
int _pgp_print
static int _rpmbc_debug
struct pgpImplVecs_s rpmbcImplVecs

Detailed Description

Definition in file rpmbc.c.


Define Documentation

#define _RPMBC_INTERNAL

Definition at line 6 of file rpmbc.c.

#define _RPMPGP_INTERNAL

Definition at line 7 of file rpmbc.c.

#define _spewMPB (   _N,
  _MPB 
)
Value:
{ mpbarrett * mpb = &(_MPB); \
    fprintf(stderr, "\t" _N ": "); mpfprintln(stderr, mpb->size, mpb->modl); \
  }

Definition at line 59 of file rpmbc.c.

Referenced by rpmbcMpiItem().

#define _spewMPN (   _N,
  _MPN 
)
Value:
{ mpnumber * mpn = &(_MPN); \
    fprintf(stderr, "\t" _N ": "); mpfprintln(stderr, mpn->size, mpn->data); \
  }

Definition at line 64 of file rpmbc.c.

Referenced by rpmbcMpiItem().

#define SPEW (   _t,
  _rc,
  _dig 
)
Value:
{ if ((_t) || _rpmbc_debug || _pgp_debug < 0) \
        fprintf(stderr, "<-- %s(%p) %s\t%s\n", __FUNCTION__, (_dig), \
                ((_rc) ? "OK" : "BAD"), (_dig)->pubkey_algoN); \
  }

Definition at line 25 of file rpmbc.c.

Referenced by rpmbcGenerate(), rpmbcGenerateDSA(), rpmbcGenerateRSA(), rpmbcSetDSA(), rpmbcSetECDSA(), rpmbcSetELG(), rpmbcSetRSA(), rpmbcSign(), rpmbcSignDSA(), rpmbcSignRSA(), rpmbcVerify(), rpmbcVerifyDSA(), and rpmbcVerifyRSA().


Function Documentation

static const char* _pgpHashAlgo2Name ( uint32_t  algo) [static]

Definition at line 31 of file rpmbc.c.

References pgpHashTbl, and pgpValStr().

Referenced by rpmbcGenerate(), rpmbcSetDSA(), rpmbcSetECDSA(), rpmbcSetELG(), rpmbcSetRSA(), rpmbcSign(), and rpmbcVerify().

static const char* _pgpPubkeyAlgo2Name ( uint32_t  algo) [static]
static unsigned char nibble ( char  c) [static]

Convert hex to binary nibble.

Parameters:
chex character
Returns:
binary nibble

Definition at line 47 of file rpmbc.c.

Referenced by rpmbcSetRSA().

static char* pgpMpiHex ( const rpmuint8_t p) [static]

Definition at line 677 of file rpmbc.c.

References pgpHexCvt(), pgpMpiLen(), and xmalloc().

Referenced by pgpMpiSet(), and rpmbcMpiItem().

static int pgpMpiSet ( const char *  pre,
unsigned int  lbits,
void *  dest,
const rpmuint8_t p,
const rpmuint8_t pend 
) [static]
Returns:
0 on success

Definition at line 690 of file rpmbc.c.

References _free(), _pgp_debug, pgpMpiBits(), pgpMpiHex(), and xmalloc().

Referenced by rpmbcMpiItem().

static int rpmbcAvailableCipher ( pgpDig  dig,
int  algo 
) [static]

Definition at line 555 of file rpmbc.c.

References PGPHASHALGO_MD5.

static int rpmbcAvailableDigest ( pgpDig  dig,
int  algo 
) [static]

Definition at line 565 of file rpmbc.c.

References PGPHASHALGO_MD5.

static int rpmbcAvailablePubkey ( pgpDig  dig,
int  algo 
) [static]

Definition at line 575 of file rpmbc.c.

static void rpmbcClean ( void *  impl) [static]

Definition at line 798 of file rpmbc.c.

References _free().

Referenced by rpmbcFree().

static int rpmbcErrChk ( pgpDig  dig,
const char *  msg,
int  rc,
unsigned  expected 
) [static]

Definition at line 540 of file rpmbc.c.

int rpmbcExportPubkey ( pgpDig  dig)

Definition at line 860 of file rpmbc.c.

References pgpGetPubkey(), pgpPubkeyFingerprint(), PGPTAG_PUBLIC_KEY, and xmalloc().

Referenced by pgpDigNew().

int rpmbcExportSignature ( pgpDig  dig,
DIGEST_CTX  ctx 
)
static void* rpmbcFree ( void *  impl) [static]

Definition at line 830 of file rpmbc.c.

References _free(), and rpmbcClean().

static int rpmbcGenerate ( pgpDig  dig) [static]
static int rpmbcGenerateDSA ( pgpDig  dig) [static]

Definition at line 310 of file rpmbc.c.

References SPEW.

Referenced by rpmbcGenerate().

static int rpmbcGenerateRSA ( pgpDig  dig) [static]

Definition at line 217 of file rpmbc.c.

References SPEW.

Referenced by rpmbcGenerate().

static void* rpmbcInit ( void  ) [static]

Definition at line 839 of file rpmbc.c.

References xcalloc().

static int rpmbcMpiItem ( const char *  pre,
pgpDig  dig,
int  itemno,
const rpmuint8_t p,
const rpmuint8_t pend 
) [static]

Definition at line 729 of file rpmbc.c.

References _free(), _pgp_debug, _pgp_print, _spewMPB, _spewMPN, pgpMpiHex(), and pgpMpiSet().

static int rpmbcSetDSA ( DIGEST_CTX  ctx,
pgpDig  dig,
pgpDigParams  sigp 
) [static]
static int rpmbcSetECDSA ( DIGEST_CTX  ctx,
pgpDig  dig,
pgpDigParams  sigp 
) [static]
static int rpmbcSetELG ( DIGEST_CTX  ctx,
pgpDig  dig,
pgpDigParams  sigp 
) [static]
static int rpmbcSetRSA ( DIGEST_CTX  ctx,
pgpDig  dig,
pgpDigParams  sigp 
) [static]
static int rpmbcSign ( pgpDig  dig) [static]
static int rpmbcSignDSA ( pgpDig  dig) [static]

Definition at line 288 of file rpmbc.c.

References SPEW.

Referenced by rpmbcSign().

static int rpmbcSignRSA ( pgpDig  dig) [static]

Definition at line 191 of file rpmbc.c.

References SPEW.

Referenced by rpmbcSign().

static int rpmbcVerify ( pgpDig  dig) [static]
static int rpmbcVerifyDSA ( pgpDig  dig) [static]

Definition at line 268 of file rpmbc.c.

References SPEW.

Referenced by rpmbcVerify().

static int rpmbcVerifyRSA ( pgpDig  dig) [static]

Definition at line 178 of file rpmbc.c.

References SPEW.

Referenced by rpmbcVerify().


Variable Documentation

Definition at line 26 of file rpmpgp.c.

Definition at line 29 of file rpmpgp.c.

int _rpmbc_debug [static]

Definition at line 23 of file rpmbc.c.