rpm  5.4.10
Data Structures | Macros | Functions | Variables
digest.c File Reference
#include "system.h"
#include "rpmio_internal.h"
#include <rpmbc.h>
#include "crc.h"
#include "arirang.h"
#include "blake.h"
#include "bmw.h"
#include "chi.h"
#include "cubehash.h"
#include "echo.h"
#include "edon-r.h"
#include "fugue.h"
#include "groestl.h"
#include "hamsi.h"
#include "jh.h"
#include "keccak.h"
#include "lane.h"
#include "luffa.h"
#include "md2.h"
#include "md6.h"
#include "shabal.h"
#include "shavite3.h"
#include "simd.h"
#include "salsa10.h"
#include "salsa20.h"
#include "skein.h"
#include "tib3.h"
#include "tiger.h"
#include "debug.h"
#include "lookup3.c"
Include dependency graph for digest.c:

Go to the source code of this file.

Data Structures

struct  DIGEST_CTX_s
 Digest private data. More...
 

Macros

#define DPRINTF(_a)
 
#define _JLU3_jlu32l
 
#define HMAC_IPAD   0x36
 
#define HMAC_OPAD   0x5c
 

Functions

static void ctxFini (void *_ctx)
 
static DIGEST_CTX ctxGetPool (rpmioPool pool)
 
pgpHashAlgo rpmDigestAlgo (DIGEST_CTX ctx)
 Return digest algorithm identifier. More...
 
rpmDigestFlags rpmDigestF (DIGEST_CTX ctx)
 Return digest flags. More...
 
const char * rpmDigestName (DIGEST_CTX ctx)
 Return digest name. More...
 
const char * rpmDigestASN1 (DIGEST_CTX ctx)
 Return digest ASN1 oid string. More...
 
DIGEST_CTX rpmDigestDup (DIGEST_CTX octx)
 Duplicate a digest context. More...
 
static int noopReset (void *param)
 
static int md6_Update (void *param, const byte *_data, size_t _len)
 
DIGEST_CTX rpmDigestInit (pgpHashAlgo hashalgo, rpmDigestFlags flags)
 Initialize digest. More...
 
int rpmDigestUpdate (DIGEST_CTX ctx, const void *data, size_t len)
 Update context with next plain text buffer. More...
 
int rpmDigestFinal (DIGEST_CTX ctx, void *datap, size_t *lenp, int asAscii)
 Return digest and destroy context. More...
 
int rpmHmacInit (DIGEST_CTX ctx, const void *key, size_t keylen)
 Compute key material and add to digest context. More...
 

Variables

int _ctx_debug = 0
 
rpmioPool _ctxPool
 

Macro Definition Documentation

§ _JLU3_jlu32l

#define _JLU3_jlu32l

Definition at line 119 of file digest.c.

§ DPRINTF

#define DPRINTF (   _a)

Definition at line 115 of file digest.c.

Referenced by rpmDigestFinal(), rpmDigestInit(), rpmDigestUpdate(), and rpmHmacInit().

§ HMAC_IPAD

#define HMAC_IPAD   0x36

Definition at line 917 of file digest.c.

Referenced by rpmHmacInit().

§ HMAC_OPAD

#define HMAC_OPAD   0x5c

Definition at line 918 of file digest.c.

Referenced by rpmDigestFinal().

Function Documentation

§ ctxFini()

static void ctxFini ( void *  _ctx)
static

§ ctxGetPool()

static DIGEST_CTX ctxGetPool ( rpmioPool  pool)
static

§ md6_Update()

static int md6_Update ( void *  param,
const byte *  _data,
size_t  _len 
)
static

Definition at line 238 of file digest.c.

Referenced by rpmDigestInit().

§ noopReset()

static int noopReset ( void *  param)
static

Definition at line 232 of file digest.c.

Referenced by rpmDigestInit().

§ rpmDigestAlgo()

pgpHashAlgo rpmDigestAlgo ( DIGEST_CTX  ctx)

Return digest algorithm identifier.

Parameters
ctxdigest context
Returns
digest hash algorithm identifier

Definition at line 188 of file digest.c.

References DIGEST_CTX_s::hashalgo, and PGPHASHALGO_NONE.

Referenced by fdFiniDigest(), fdStealDigest(), rpmbcSetDSA(), rpmbcSetECDSA(), rpmbcSetELG(), rpmbcSetRSA(), verifyDSA(), and verifyRSA().

§ rpmDigestASN1()

const char* rpmDigestASN1 ( DIGEST_CTX  ctx)

Return digest ASN1 oid string.

Values from PKCS#1 v2.1 (aka RFC-3447).

Parameters
ctxdigest context
Returns
digest ASN1 oid string

Definition at line 203 of file digest.c.

References DIGEST_CTX_s::asn1.

Referenced by rpmbcSetRSA().

§ rpmDigestDup()

DIGEST_CTX rpmDigestDup ( DIGEST_CTX  octx)

§ rpmDigestF()

rpmDigestFlags rpmDigestF ( DIGEST_CTX  ctx)

Return digest flags.

Parameters
ctxdigest context
Returns
digest flags

Definition at line 193 of file digest.c.

References DIGEST_CTX_s::flags, and RPMDIGEST_NONE.

§ rpmDigestFinal()

int rpmDigestFinal ( DIGEST_CTX  ctx,
void *  datap,
size_t *  lenp,
int  asAscii 
)

§ rpmDigestInit()

DIGEST_CTX rpmDigestInit ( pgpHashAlgo  hashalgo,
rpmDigestFlags  flags 
)

Initialize digest.

Set bit count to 0 and buffer to mysterious initialization constants.

Parameters
hashalgotype of digest
flagsbit(s) to control digest operation
Returns
digest context

Definition at line 244 of file digest.c.

References __adler32(), __adler32_combine(), __crc32(), __crc32_combine(), __crc64(), __crc64_combine(), DIGEST_CTX_s::asn1, DIGEST_CTX_s::blocksize, sum32Param::combine, sum64Param::combine, ctxGetPool(), DIGEST_CTX_s::Digest, DIGEST_CTX_s::digestsize, DPRINTF, DRD_xcalloc, DIGEST_CTX_s::flags, DIGEST_CTX_s::hashalgo, L, md6_Update(), DIGEST_CTX_s::name, noopReset(), DIGEST_CTX_s::param, DIGEST_CTX_s::paramsize, PGPHASHALGO_ADLER32, PGPHASHALGO_ARIRANG_224, PGPHASHALGO_ARIRANG_256, PGPHASHALGO_ARIRANG_384, PGPHASHALGO_ARIRANG_512, PGPHASHALGO_BLAKE_224, PGPHASHALGO_BLAKE_256, PGPHASHALGO_BLAKE_384, PGPHASHALGO_BLAKE_512, PGPHASHALGO_BMW_224, PGPHASHALGO_BMW_256, PGPHASHALGO_BMW_384, PGPHASHALGO_BMW_512, PGPHASHALGO_CHI_224, PGPHASHALGO_CHI_256, PGPHASHALGO_CHI_384, PGPHASHALGO_CHI_512, PGPHASHALGO_CRC32, PGPHASHALGO_CRC64, PGPHASHALGO_CUBEHASH_224, PGPHASHALGO_CUBEHASH_256, PGPHASHALGO_CUBEHASH_384, PGPHASHALGO_CUBEHASH_512, PGPHASHALGO_ECHO_224, PGPHASHALGO_ECHO_256, PGPHASHALGO_ECHO_384, PGPHASHALGO_ECHO_512, PGPHASHALGO_EDONR_224, PGPHASHALGO_EDONR_256, PGPHASHALGO_EDONR_384, PGPHASHALGO_EDONR_512, PGPHASHALGO_FUGUE_224, PGPHASHALGO_FUGUE_256, PGPHASHALGO_FUGUE_384, PGPHASHALGO_FUGUE_512, PGPHASHALGO_GROESTL_224, PGPHASHALGO_GROESTL_256, PGPHASHALGO_GROESTL_384, PGPHASHALGO_GROESTL_512, PGPHASHALGO_HAMSI_224, PGPHASHALGO_HAMSI_256, PGPHASHALGO_HAMSI_384, PGPHASHALGO_HAMSI_512, PGPHASHALGO_HAVAL_5_160, PGPHASHALGO_JH_224, PGPHASHALGO_JH_256, PGPHASHALGO_JH_384, PGPHASHALGO_JH_512, PGPHASHALGO_JLU32, PGPHASHALGO_KECCAK_224, PGPHASHALGO_KECCAK_256, PGPHASHALGO_KECCAK_384, PGPHASHALGO_KECCAK_512, PGPHASHALGO_LANE_224, PGPHASHALGO_LANE_256, PGPHASHALGO_LANE_384, PGPHASHALGO_LANE_512, PGPHASHALGO_LUFFA_224, PGPHASHALGO_LUFFA_256, PGPHASHALGO_LUFFA_384, PGPHASHALGO_LUFFA_512, PGPHASHALGO_MD2, PGPHASHALGO_MD4, PGPHASHALGO_MD5, PGPHASHALGO_MD6_224, PGPHASHALGO_MD6_256, PGPHASHALGO_MD6_384, PGPHASHALGO_MD6_512, PGPHASHALGO_RIPEMD128, PGPHASHALGO_RIPEMD160, PGPHASHALGO_RIPEMD256, PGPHASHALGO_RIPEMD320, PGPHASHALGO_SALSA10, PGPHASHALGO_SALSA20, PGPHASHALGO_SHA1, PGPHASHALGO_SHA224, PGPHASHALGO_SHA256, PGPHASHALGO_SHA384, PGPHASHALGO_SHA512, PGPHASHALGO_SHABAL_224, PGPHASHALGO_SHABAL_256, PGPHASHALGO_SHABAL_384, PGPHASHALGO_SHABAL_512, PGPHASHALGO_SHAVITE3_224, PGPHASHALGO_SHAVITE3_256, PGPHASHALGO_SHAVITE3_384, PGPHASHALGO_SHAVITE3_512, PGPHASHALGO_SIMD_224, PGPHASHALGO_SIMD_256, PGPHASHALGO_SIMD_384, PGPHASHALGO_SIMD_512, PGPHASHALGO_SKEIN_1024, PGPHASHALGO_SKEIN_224, PGPHASHALGO_SKEIN_256, PGPHASHALGO_SKEIN_384, PGPHASHALGO_SKEIN_512, PGPHASHALGO_TIB3_224, PGPHASHALGO_TIB3_256, PGPHASHALGO_TIB3_384, PGPHASHALGO_TIB3_512, PGPHASHALGO_TIGER192, DIGEST_CTX_s::Reset, rpmioFreePoolItem(), rpmioLinkPoolItem(), DIGEST_CTX_s::salt, sum32Digest(), sum32Reset(), sum32Update(), sum64Digest(), sum64Reset(), sum64Update(), sum32Param::update, sum64Param::update, and DIGEST_CTX_s::Update.

Referenced by _tagGenerate(), digestFormat(), dodigest(), fdInitDigest(), headerCheck(), makeHDRSignature(), pgpPubkeyFingerprint(), readFile(), rpmcliImportPubkey(), rpmdcParseZeroInstall(), rpmDigestFinal(), rpmHmacInit(), rpmnsProbeSignature(), rpmReadPackageFile(), rpmrepoRfileDigest(), and unsatisfiedDepend().

§ rpmDigestName()

const char* rpmDigestName ( DIGEST_CTX  ctx)

Return digest name.

Parameters
ctxdigest context
Returns
digest name

Definition at line 198 of file digest.c.

References DIGEST_CTX_s::name.

Referenced by verifyDSA(), verifyMD5(), verifyRSA(), and verifySHA1().

§ rpmDigestUpdate()

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

§ rpmHmacInit()

int rpmHmacInit ( DIGEST_CTX  ctx,
const void *  key,
size_t  keylen 
)

Compute key material and add to digest context.

Parameters
ctxdigest context
keyHMAC key (NULL does digest instead)
keylenHMAC key length(bytes) (0 uses strlen(key))
Returns
0 on success

Definition at line 983 of file digest.c.

References _free(), DIGEST_CTX_s::blocksize, DPRINTF, DRD_xcalloc, DIGEST_CTX_s::hashalgo, HMAC_IPAD, DIGEST_CTX_s::name, RPMDIGEST_NONE, rpmDigestFinal(), rpmDigestInit(), rpmDigestUpdate(), and DIGEST_CTX_s::salt.

Referenced by dodigest(), fdInitHmac(), and rpmdcParseZeroInstall().

Variable Documentation

§ _ctx_debug

int _ctx_debug = 0

Definition at line 110 of file digest.c.

Referenced by ctxGetPool().

§ _ctxPool

rpmioPool _ctxPool

Definition at line 171 of file digest.c.

Referenced by ctxGetPool(), and rpmioClean().