rpm 4.19.92
The RPM Package Manager
Loading...
Searching...
No Matches
Typedefs | Enumerations | Functions
RPM crypto API.

RPM cryptography related APIs and constants. More...

Typedefs

typedef struct DIGEST_CTX_s * DIGEST_CTX
 
typedef enum rpmHashAlgo_e rpmHashAlgo
 

Enumerations

enum  rpmHashAlgo_e {
  RPM_HASH_MD5 = 1 , RPM_HASH_SHA1 = 2 , RPM_HASH_RIPEMD160 = 3 , RPM_HASH_MD2 = 5 ,
  RPM_HASH_TIGER192 = 6 , RPM_HASH_HAVAL_5_160 = 7 , RPM_HASH_SHA256 = 8 , RPM_HASH_SHA384 = 9 ,
  RPM_HASH_SHA512 = 10 , RPM_HASH_SHA224 = 11
}
 
enum  rpmDigestFlags_e { RPMDIGEST_NONE = 0 }
 

Functions

int rpmInitCrypto (void)
 
int rpmFreeCrypto (void)
 
DIGEST_CTX rpmDigestDup (DIGEST_CTX octx)
 
size_t rpmDigestLength (int hashalgo)
 
DIGEST_CTX rpmDigestInit (int hashalgo, rpmDigestFlags flags)
 
int rpmDigestUpdate (DIGEST_CTX ctx, const void *data, size_t len)
 
int rpmDigestFinal (DIGEST_CTX ctx, void **datap, size_t *lenp, int asAscii)
 
rpmDigestBundle rpmDigestBundleNew (void)
 
rpmDigestBundle rpmDigestBundleFree (rpmDigestBundle bundle)
 
int rpmDigestBundleAdd (rpmDigestBundle bundle, int algo, rpmDigestFlags flags)
 
int rpmDigestBundleAddID (rpmDigestBundle bundle, int algo, int id, rpmDigestFlags flags)
 
int rpmDigestBundleUpdate (rpmDigestBundle bundle, const void *data, size_t len)
 
int rpmDigestBundleFinal (rpmDigestBundle bundle, int id, void **datap, size_t *lenp, int asAscii)
 
DIGEST_CTX rpmDigestBundleDupCtx (rpmDigestBundle bundle, int id)
 

Detailed Description

RPM cryptography related APIs and constants.

Typedef Documentation

◆ rpmHashAlgo

typedef enum rpmHashAlgo_e rpmHashAlgo

At this time these simply mirror PGPHASHALGO numbers. Once they start * growing apart we'll need converters.

Enumeration Type Documentation

◆ rpmDigestFlags_e

Bit(s) to control digest operation.

◆ rpmHashAlgo_e

At this time these simply mirror PGPHASHALGO numbers. Once they start * growing apart we'll need converters.

Enumerator
RPM_HASH_MD5 

MD5

RPM_HASH_SHA1 

SHA1

RPM_HASH_RIPEMD160 

RIPEMD160

RPM_HASH_MD2 

MD2

RPM_HASH_TIGER192 

TIGER192

RPM_HASH_HAVAL_5_160 

HAVAL-5-160

RPM_HASH_SHA256 

SHA256

RPM_HASH_SHA384 

SHA384

RPM_HASH_SHA512 

SHA512

RPM_HASH_SHA224 

SHA224

Function Documentation

◆ rpmDigestBundleAdd()

int rpmDigestBundleAdd ( rpmDigestBundle  bundle,
int  algo,
rpmDigestFlags  flags 
)

Add a new type of digest to a bundle. Same as calling rpmDigestBundleAddID() with algo == id value.

Parameters
bundledigest bundle
algotype of digest
flagsbit(s) to control digest operation
Returns
0 on success

◆ rpmDigestBundleAddID()

int rpmDigestBundleAddID ( rpmDigestBundle  bundle,
int  algo,
int  id,
rpmDigestFlags  flags 
)

Add a new type of digest to a bundle.

Parameters
bundledigest bundle
algotype of digest
idid of digest (arbitrary, must be > 0)
flagsbit(s) to control digest operation
Returns
0 on success

◆ rpmDigestBundleDupCtx()

DIGEST_CTX rpmDigestBundleDupCtx ( rpmDigestBundle  bundle,
int  id 
)

Duplicate a digest context from a bundle.

Parameters
bundledigest bundle
idid of digest to dup
Returns
duplicated digest context

◆ rpmDigestBundleFinal()

int rpmDigestBundleFinal ( rpmDigestBundle  bundle,
int  id,
void **  datap,
size_t *  lenp,
int  asAscii 
)

Return digest from a bundle and destroy context, see rpmDigestFinal().

Parameters
bundledigest bundle
idid of digest to return
[out]datapaddress of returned digest
[out]lenpaddress of digest length
asAsciireturn digest as ascii string?
Returns
0 on success

◆ rpmDigestBundleFree()

rpmDigestBundle rpmDigestBundleFree ( rpmDigestBundle  bundle)

Free a digest bundle and all contained digest contexts.

Parameters
bundledigest bundle
Returns
NULL always

◆ rpmDigestBundleNew()

rpmDigestBundle rpmDigestBundleNew ( void  )

Create a new digest bundle.

Returns
New digest bundle

◆ rpmDigestBundleUpdate()

int rpmDigestBundleUpdate ( rpmDigestBundle  bundle,
const void *  data,
size_t  len 
)

Update contexts within bundle with next plain text buffer.

Parameters
bundledigest bundle
datanext data buffer
lenno. bytes of data
Returns
0 on success

◆ rpmDigestDup()

DIGEST_CTX rpmDigestDup ( DIGEST_CTX  octx)

Duplicate a digest context.

Parameters
octxexisting digest context
Returns
duplicated digest context

◆ rpmDigestFinal()

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

Return digest and destroy context. Final wrapup - pad to 64-byte boundary with the bit pattern 1 0* (64-bit count of bits processed, MSB-first)

Parameters
ctxdigest context
[out]datapaddress of returned digest
[out]lenpaddress of digest length
asAsciireturn digest as ascii string?
Returns
0 on success

◆ rpmDigestInit()

DIGEST_CTX rpmDigestInit ( int  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

◆ rpmDigestLength()

size_t rpmDigestLength ( int  hashalgo)

Obtain digest length in bytes.

Parameters
hashalgotype of digest
Returns
digest length, zero on invalid algorithm

◆ rpmDigestUpdate()

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

Update context with next plain text buffer.

Parameters
ctxdigest context
datanext data buffer
lenno. bytes of data
Returns
0 on success

◆ rpmFreeCrypto()

int rpmFreeCrypto ( void  )

Shutdown cryptography

◆ rpmInitCrypto()

int rpmInitCrypto ( void  )

Perform cryptography initialization. It must be called before any cryptography can be used within rpm. It's not normally necessary to call it directly as it's called in general rpm initialization routines.

Returns
0 on success, -1 on failure