RPM cryptography related APIs and constants.
More...
|
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) |
|
RPM cryptography related APIs and constants.
◆ rpmHashAlgo
At this time these simply mirror PGPHASHALGO numbers. Once they start * growing apart we'll need converters.
◆ 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
|
◆ 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
-
bundle | digest bundle |
algo | type of digest |
flags | bit(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
-
bundle | digest bundle |
algo | type of digest |
id | id of digest (arbitrary, must be > 0) |
flags | bit(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
-
bundle | digest bundle |
id | id 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
-
| bundle | digest bundle |
| id | id of digest to return |
[out] | datap | address of returned digest |
[out] | lenp | address of digest length |
| asAscii | return digest as ascii string? |
- Returns
- 0 on success
◆ rpmDigestBundleFree()
rpmDigestBundle rpmDigestBundleFree |
( |
rpmDigestBundle |
bundle | ) |
|
Free a digest bundle and all contained digest contexts.
- Parameters
-
- 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
-
bundle | digest bundle |
data | next data buffer |
len | no. bytes of data |
- Returns
- 0 on success
◆ rpmDigestDup()
DIGEST_CTX rpmDigestDup |
( |
DIGEST_CTX |
octx | ) |
|
Duplicate a digest context.
- Parameters
-
octx | existing 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
-
| ctx | digest context |
[out] | datap | address of returned digest |
[out] | lenp | address of digest length |
| asAscii | return 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
-
hashalgo | type of digest |
flags | bit(s) to control digest operation |
- Returns
- digest context
◆ rpmDigestLength()
size_t rpmDigestLength |
( |
int |
hashalgo | ) |
|
Obtain digest length in bytes.
- Parameters
-
- 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
-
ctx | digest context |
data | next data buffer |
len | no. bytes of data |
- Returns
- 0 on success
◆ rpmFreeCrypto()
int rpmFreeCrypto |
( |
void |
| ) |
|
◆ 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