RPM cryptography related APIs and constants.
More...
|
| int | rpmInitCrypto (void) |
| | Perform cryptography initialization. More...
|
| |
| int | rpmFreeCrypto (void) |
| | Shutdown cryptography. More...
|
| |
| DIGEST_CTX | rpmDigestDup (DIGEST_CTX octx) |
| | Duplicate a digest context. More...
|
| |
| size_t | rpmDigestLength (int hashalgo) |
| | Obtain digest length in bytes. More...
|
| |
| DIGEST_CTX | rpmDigestInit (int 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...
|
| |
| rpmDigestBundle | rpmDigestBundleNew (void) |
| | Create a new digest bundle. More...
|
| |
| rpmDigestBundle | rpmDigestBundleFree (rpmDigestBundle bundle) |
| | Free a digest bundle and all contained digest contexts. More...
|
| |
| int | rpmDigestBundleAdd (rpmDigestBundle bundle, int algo, rpmDigestFlags flags) |
| | Add a new type of digest to a bundle. More...
|
| |
| int | rpmDigestBundleAddID (rpmDigestBundle bundle, int algo, int id, rpmDigestFlags flags) |
| | Add a new type of digest to a bundle. More...
|
| |
| int | rpmDigestBundleUpdate (rpmDigestBundle bundle, const void *data, size_t len) |
| | Update contexts within bundle with next plain text buffer. More...
|
| |
| int | rpmDigestBundleFinal (rpmDigestBundle bundle, int id, void **datap, size_t *lenp, int asAscii) |
| | Return digest from a bundle and destroy context, see rpmDigestFinal(). More...
|
| |
| DIGEST_CTX | rpmDigestBundleDupCtx (rpmDigestBundle bundle, int id) |
| | Duplicate a digest context from a bundle. More...
|
| |
RPM cryptography related APIs and constants.
At this time these simply mirror PGPHASHALGO numbers.
Once they start * growing apart we'll need converters.
Bit(s) to control digest operation.
Definition at line 35 of file rpmcrypto.h.
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
|
Definition at line 19 of file rpmcrypto.h.
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
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
Duplicate a digest context from a bundle.
- Parameters
-
| bundle | digest bundle |
| id | id of digest to dup |
- Returns
- duplicated digest context
| 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
Free a digest bundle and all contained digest contexts.
- Parameters
-
- Returns
- NULL always
Create a new digest bundle.
- Returns
- New digest bundle
| 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
Duplicate a digest context.
- Parameters
-
| octx | existing digest context |
- Returns
- duplicated digest context
| 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
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
| size_t rpmDigestLength |
( |
int |
hashalgo | ) |
|
Obtain digest length in bytes.
- Parameters
-
- Returns
- digest length, zero on invalid algorithm
| 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
| int rpmFreeCrypto |
( |
void |
| ) |
|
| 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