rpm  5.4.14
Macros | Functions | Variables
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.

Macros

#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. More...
 
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 voidrpmbcFree (void *impl)
 
static voidrpmbcInit (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
 

Macro Definition 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); \
}
fprintf(stderr,"--> %s(%p,%p,%p) sig %p sigp %p\n", __FUNCTION__, dig, t, rsactx, sig, sigp)

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); \
}
fprintf(stderr,"--> %s(%p,%p,%p) sig %p sigp %p\n", __FUNCTION__, dig, t, rsactx, sig, sigp)

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); \
}
static int _rpmbc_debug
Definition: rpmbc.c:23
fprintf(stderr,"--> %s(%p,%p,%p) sig %p sigp %p\n", __FUNCTION__, dig, t, rsactx, sig, sigp)
int _pgp_debug
Definition: rpmpgp.c:29

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.

References int.

Referenced by rpmbcSetRSA().

static char* pgpMpiHex ( const rpmuint8_t p)
static

Definition at line 681 of file rpmbc.c.

References nb, pgpHexCvt(), pgpMpiLen(), t, void, 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 694 of file rpmbc.c.

References _free(), _pgp_debug, fprintf(), ix, memset(), NULL, pgpMpiBits(), pgpMpiHex(), s, t, void, and xmalloc.

Referenced by rpmbcMpiItem().

static int rpmbcAvailableCipher ( pgpDig  dig,
int  algo 
)
static

Definition at line 559 of file rpmbc.c.

References PGPHASHALGO_MD5, and rc.

static int rpmbcAvailableDigest ( pgpDig  dig,
int  algo 
)
static

Definition at line 569 of file rpmbc.c.

References PGPHASHALGO_MD5, and rc.

static int rpmbcAvailablePubkey ( pgpDig  dig,
int  algo 
)
static

Definition at line 579 of file rpmbc.c.

References rc.

static void rpmbcClean ( void impl)
static

Definition at line 802 of file rpmbc.c.

References _free(), and NULL.

Referenced by rpmbcFree().

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

Definition at line 544 of file rpmbc.c.

References rc.

int rpmbcExportPubkey ( pgpDig  dig)

Definition at line 864 of file rpmbc.c.

References be, NULL, pgpGetPubkey(), pgpPubkeyFingerprint(), PGPTAG_PUBLIC_KEY, pkt, pktlen, xmalloc, and xx.

Referenced by pgpDigNew().

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

Definition at line 834 of file rpmbc.c.

References _free(), NULL, and rpmbcClean().

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

Definition at line 314 of file rpmbc.c.

References if(), rc, SPEW, and xx.

Referenced by rpmbcGenerate().

static int rpmbcGenerateRSA ( pgpDig  dig)
static

Definition at line 221 of file rpmbc.c.

References if(), rc, SPEW, and xx.

Referenced by rpmbcGenerate().

static void* rpmbcInit ( void  )
static

Definition at line 843 of file rpmbc.c.

References bc, and xcalloc().

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

Definition at line 733 of file rpmbc.c.

References _free(), _pgp_debug, _pgp_print, _spewMPB, _spewMPN, assert(), NULL, pgpMpiHex(), pgpMpiSet(), rc, s, switch(), and void.

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 292 of file rpmbc.c.

References rc, SPEW, and xx.

Referenced by rpmbcSign().

static int rpmbcSignRSA ( pgpDig  dig)
static

Definition at line 195 of file rpmbc.c.

References rc, SPEW, and xx.

Referenced by rpmbcSign().

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

Definition at line 272 of file rpmbc.c.

References rc, SPEW, and xx.

Referenced by rpmbcVerify().

static int rpmbcVerifyRSA ( pgpDig  dig)
static

Definition at line 182 of file rpmbc.c.

References rc, and SPEW.

Referenced by rpmbcVerify().

Variable Documentation

int _pgp_debug

Definition at line 29 of file rpmpgp.c.

int _pgp_print

Definition at line 32 of file rpmpgp.c.

int _rpmbc_debug
static

Definition at line 23 of file rpmbc.c.

struct pgpImplVecs_s rpmbcImplVecs
Initial value:
= {
}
static void * rpmbcFree(void *impl)
Definition: rpmbc.c:834
static int rpmbcSetECDSA(DIGEST_CTX ctx, pgpDig dig, pgpDigParams sigp)
Definition: rpmbc.c:482
static int rpmbcSign(pgpDig dig)
Definition: rpmbc.c:618
static int rpmbcSetRSA(DIGEST_CTX ctx, pgpDig dig, pgpDigParams sigp)
Definition: rpmbc.c:109
static int rpmbcErrChk(pgpDig dig, const char *msg, int rc, unsigned expected)
Definition: rpmbc.c:544
static int rpmbcAvailableCipher(pgpDig dig, int algo)
Definition: rpmbc.c:559
static int rpmbcAvailableDigest(pgpDig dig, int algo)
Definition: rpmbc.c:569
static void rpmbcClean(void *impl)
Definition: rpmbc.c:802
static int rpmbcGenerate(pgpDig dig)
Definition: rpmbc.c:648
static int rpmbcSetDSA(DIGEST_CTX ctx, pgpDig dig, pgpDigParams sigp)
Definition: rpmbc.c:248
static int rpmbcSetELG(DIGEST_CTX ctx, pgpDig dig, pgpDigParams sigp)
Definition: rpmbc.c:342
static void * rpmbcInit(void)
Definition: rpmbc.c:843
static int rpmbcVerify(pgpDig dig)
Definition: rpmbc.c:588
static int rpmbcMpiItem(const char *pre, pgpDig dig, int itemno, const rpmuint8_t *p, const rpmuint8_t *pend)
Definition: rpmbc.c:733
static int rpmbcAvailablePubkey(pgpDig dig, int algo)
Definition: rpmbc.c:579

Definition at line 850 of file rpmbc.c.

Referenced by pgpDigNew(), and rpmioAllArgCallback().