![]() |
libfortuna
1
FortunalibraryfunctionsextractedfromPostgreSQLsource
|
#include <stdlib.h>
#include <sys/types.h>
#include <sys/param.h>
#include <malloc_np.h>
#include "c.h"
Go to the source code of this file.
Data Structures | |
struct | px_digest |
struct | px_alias |
struct | px_hmac |
struct | px_cipher |
struct | px_combo |
Macros | |
#define | PX_DEBUG |
#define | PX_MAX_NAMELEN 128 |
#define | PX_MAX_SALT_LEN 128 |
#define | PXE_OK 0 |
#define | PXE_ERR_GENERIC -1 |
#define | PXE_NO_HASH -2 |
#define | PXE_NO_CIPHER -3 |
#define | PXE_NOTBLOCKSIZE -4 |
#define | PXE_BAD_OPTION -5 |
#define | PXE_BAD_FORMAT -6 |
#define | PXE_KEY_TOO_BIG -7 |
#define | PXE_CIPHER_INIT -8 |
#define | PXE_HASH_UNUSABLE_FOR_HMAC -9 |
#define | PXE_DEV_READ_ERROR -10 |
#define | PXE_OSSL_RAND_ERROR -11 |
#define | PXE_BUG -12 |
#define | PXE_ARGUMENT_ERROR -13 |
#define | PXE_UNKNOWN_SALT_ALGO -14 |
#define | PXE_BAD_SALT_ROUNDS -15 |
#define | PXE_MCRYPT_INTERNAL -16 |
#define | PXE_NO_RANDOM -17 |
#define | PXE_DECRYPT_FAILED -18 |
#define | PXE_MBUF_SHORT_READ -50 |
#define | PXE_PGP_CORRUPT_DATA -100 |
#define | PXE_PGP_CORRUPT_ARMOR -101 |
#define | PXE_PGP_UNSUPPORTED_COMPR -102 |
#define | PXE_PGP_UNSUPPORTED_CIPHER -103 |
#define | PXE_PGP_UNSUPPORTED_HASH -104 |
#define | PXE_PGP_COMPRESSION_ERROR -105 |
#define | PXE_PGP_NOT_TEXT -106 |
#define | PXE_PGP_UNEXPECTED_PKT -107 |
#define | PXE_PGP_NO_BIGNUM -108 |
#define | PXE_PGP_MATH_FAILED -109 |
#define | PXE_PGP_SHORT_ELGAMAL_KEY -110 |
#define | PXE_PGP_RSA_UNSUPPORTED -111 |
#define | PXE_PGP_UNKNOWN_PUBALGO -112 |
#define | PXE_PGP_WRONG_KEY -113 |
#define | PXE_PGP_MULTIPLE_KEYS -114 |
#define | PXE_PGP_EXPECT_PUBLIC_KEY -115 |
#define | PXE_PGP_EXPECT_SECRET_KEY -116 |
#define | PXE_PGP_NOT_V4_KEYPKT -117 |
#define | PXE_PGP_KEYPKT_CORRUPT -118 |
#define | PXE_PGP_NO_USABLE_KEY -119 |
#define | PXE_PGP_NEED_SECRET_PSW -120 |
#define | PXE_PGP_BAD_S2K_MODE -121 |
#define | PXE_PGP_UNSUPPORTED_PUBALGO -122 |
#define | PXE_PGP_MULTIPLE_SUBKEYS -123 |
#define | px_md_result_size(md) (md)->result_size(md) |
#define | px_md_block_size(md) (md)->block_size(md) |
#define | px_md_reset(md) (md)->reset(md) |
#define | px_md_update(md, data, dlen) (md)->update(md, data, dlen) |
#define | px_md_finish(md, buf) (md)->finish(md, buf) |
#define | px_md_free(md) (md)->free(md) |
#define | px_hmac_result_size(hmac) (hmac)->result_size(hmac) |
#define | px_hmac_block_size(hmac) (hmac)->block_size(hmac) |
#define | px_hmac_reset(hmac) (hmac)->reset(hmac) |
#define | px_hmac_init(hmac, key, klen) (hmac)->init(hmac, key, klen) |
#define | px_hmac_update(hmac, data, dlen) (hmac)->update(hmac, data, dlen) |
#define | px_hmac_finish(hmac, buf) (hmac)->finish(hmac, buf) |
#define | px_hmac_free(hmac) (hmac)->free(hmac) |
#define | px_cipher_key_size(c) (c)->key_size(c) |
#define | px_cipher_block_size(c) (c)->block_size(c) |
#define | px_cipher_iv_size(c) (c)->iv_size(c) |
#define | px_cipher_init(c, k, klen, iv) (c)->init(c, k, klen, iv) |
#define | px_cipher_encrypt(c, data, dlen, res) (c)->encrypt(c, data, dlen, res) |
#define | px_cipher_decrypt(c, data, dlen, res) (c)->decrypt(c, data, dlen, res) |
#define | px_cipher_free(c) (c)->free(c) |
#define | px_combo_encrypt_len(c, dlen) (c)->encrypt_len(c, dlen) |
#define | px_combo_decrypt_len(c, dlen) (c)->decrypt_len(c, dlen) |
#define | px_combo_init(c, key, klen, iv, ivlen) (c)->init(c, key, klen, iv, ivlen) |
#define | px_combo_encrypt(c, data, dlen, res, rlen) (c)->encrypt(c, data, dlen, res, rlen) |
#define | px_combo_decrypt(c, data, dlen, res, rlen) (c)->decrypt(c, data, dlen, res, rlen) |
#define | px_combo_free(c) (c)->free(c) |
Typedefs | |
typedef struct px_digest | PX_MD |
typedef struct px_alias | PX_Alias |
typedef struct px_hmac | PX_HMAC |
typedef struct px_cipher | PX_Cipher |
typedef struct px_combo | PX_Combo |
Functions | |
int | px_find_digest (const char *name, PX_MD **res) |
int | px_find_hmac (const char *name, PX_HMAC **res) |
int | px_find_cipher (const char *name, PX_Cipher **res) |
int | px_find_combo (const char *name, PX_Combo **res) |
int | px_get_random_bytes (uint8 *dst, unsigned count) |
int | px_get_pseudo_random_bytes (uint8 *dst, unsigned count) |
int | px_add_entropy (const uint8 *data, unsigned count) |
unsigned | px_acquire_system_randomness (uint8 *dst) |
const char * | px_strerror (int err) |
const char * | px_resolve_alias (const PX_Alias *aliases, const char *name) |
void | px_set_debug_handler (void(*handler)(const char *)) |
#define px_cipher_block_size | ( | c | ) | (c)->block_size(c) |
#define px_cipher_decrypt | ( | c, | |
data, | |||
dlen, | |||
res | |||
) | (c)->decrypt(c, data, dlen, res) |
#define px_cipher_encrypt | ( | c, | |
data, | |||
dlen, | |||
res | |||
) | (c)->encrypt(c, data, dlen, res) |
#define px_cipher_free | ( | c | ) | (c)->free(c) |
#define px_cipher_init | ( | c, | |
k, | |||
klen, | |||
iv | |||
) | (c)->init(c, k, klen, iv) |
#define px_cipher_iv_size | ( | c | ) | (c)->iv_size(c) |
#define px_cipher_key_size | ( | c | ) | (c)->key_size(c) |
#define px_combo_decrypt | ( | c, | |
data, | |||
dlen, | |||
res, | |||
rlen | |||
) | (c)->decrypt(c, data, dlen, res, rlen) |
#define px_combo_decrypt_len | ( | c, | |
dlen | |||
) | (c)->decrypt_len(c, dlen) |
#define px_combo_encrypt | ( | c, | |
data, | |||
dlen, | |||
res, | |||
rlen | |||
) | (c)->encrypt(c, data, dlen, res, rlen) |
#define px_combo_encrypt_len | ( | c, | |
dlen | |||
) | (c)->encrypt_len(c, dlen) |
#define px_combo_free | ( | c | ) | (c)->free(c) |
#define px_combo_init | ( | c, | |
key, | |||
klen, | |||
iv, | |||
ivlen | |||
) | (c)->init(c, key, klen, iv, ivlen) |
#define PX_DEBUG |
#define px_hmac_block_size | ( | hmac | ) | (hmac)->block_size(hmac) |
#define px_hmac_finish | ( | hmac, | |
buf | |||
) | (hmac)->finish(hmac, buf) |
#define px_hmac_free | ( | hmac | ) | (hmac)->free(hmac) |
#define px_hmac_init | ( | hmac, | |
key, | |||
klen | |||
) | (hmac)->init(hmac, key, klen) |
#define px_hmac_reset | ( | hmac | ) | (hmac)->reset(hmac) |
#define px_hmac_result_size | ( | hmac | ) | (hmac)->result_size(hmac) |
#define px_hmac_update | ( | hmac, | |
data, | |||
dlen | |||
) | (hmac)->update(hmac, data, dlen) |
#define PX_MAX_NAMELEN 128 |
#define PX_MAX_SALT_LEN 128 |
#define px_md_block_size | ( | md | ) | (md)->block_size(md) |
#define px_md_finish | ( | md, | |
buf | |||
) | (md)->finish(md, buf) |
#define px_md_free | ( | md | ) | (md)->free(md) |
#define px_md_reset | ( | md | ) | (md)->reset(md) |
#define px_md_result_size | ( | md | ) | (md)->result_size(md) |
#define px_md_update | ( | md, | |
data, | |||
dlen | |||
) | (md)->update(md, data, dlen) |
#define PXE_ARGUMENT_ERROR -13 |
#define PXE_BAD_FORMAT -6 |
#define PXE_BAD_OPTION -5 |
#define PXE_BAD_SALT_ROUNDS -15 |
#define PXE_BUG -12 |
#define PXE_CIPHER_INIT -8 |
#define PXE_DECRYPT_FAILED -18 |
#define PXE_DEV_READ_ERROR -10 |
#define PXE_ERR_GENERIC -1 |
#define PXE_HASH_UNUSABLE_FOR_HMAC -9 |
#define PXE_KEY_TOO_BIG -7 |
#define PXE_MBUF_SHORT_READ -50 |
#define PXE_MCRYPT_INTERNAL -16 |
#define PXE_NO_CIPHER -3 |
#define PXE_NO_HASH -2 |
#define PXE_NO_RANDOM -17 |
#define PXE_NOTBLOCKSIZE -4 |
#define PXE_OK 0 |
#define PXE_OSSL_RAND_ERROR -11 |
#define PXE_PGP_BAD_S2K_MODE -121 |
#define PXE_PGP_COMPRESSION_ERROR -105 |
#define PXE_PGP_CORRUPT_ARMOR -101 |
#define PXE_PGP_CORRUPT_DATA -100 |
#define PXE_PGP_EXPECT_PUBLIC_KEY -115 |
#define PXE_PGP_EXPECT_SECRET_KEY -116 |
#define PXE_PGP_KEYPKT_CORRUPT -118 |
#define PXE_PGP_MATH_FAILED -109 |
#define PXE_PGP_MULTIPLE_KEYS -114 |
#define PXE_PGP_MULTIPLE_SUBKEYS -123 |
#define PXE_PGP_NEED_SECRET_PSW -120 |
#define PXE_PGP_NO_BIGNUM -108 |
#define PXE_PGP_NO_USABLE_KEY -119 |
#define PXE_PGP_NOT_TEXT -106 |
#define PXE_PGP_NOT_V4_KEYPKT -117 |
#define PXE_PGP_RSA_UNSUPPORTED -111 |
#define PXE_PGP_SHORT_ELGAMAL_KEY -110 |
#define PXE_PGP_UNEXPECTED_PKT -107 |
#define PXE_PGP_UNKNOWN_PUBALGO -112 |
#define PXE_PGP_UNSUPPORTED_CIPHER -103 |
#define PXE_PGP_UNSUPPORTED_COMPR -102 |
#define PXE_PGP_UNSUPPORTED_HASH -104 |
#define PXE_PGP_UNSUPPORTED_PUBALGO -122 |
#define PXE_PGP_WRONG_KEY -113 |
#define PXE_UNKNOWN_SALT_ALGO -14 |
unsigned px_acquire_system_randomness | ( | uint8 * | dst | ) |
int px_add_entropy | ( | const uint8 * | data, |
unsigned | count | ||
) |
int px_find_cipher | ( | const char * | name, |
PX_Cipher ** | res | ||
) |
int px_find_combo | ( | const char * | name, |
PX_Combo ** | res | ||
) |
int px_find_digest | ( | const char * | name, |
PX_MD ** | res | ||
) |
int px_find_hmac | ( | const char * | name, |
PX_HMAC ** | res | ||
) |
int px_get_pseudo_random_bytes | ( | uint8 * | dst, |
unsigned | count | ||
) |
int px_get_random_bytes | ( | uint8 * | dst, |
unsigned | count | ||
) |
const char* px_resolve_alias | ( | const PX_Alias * | aliases, |
const char * | name | ||
) |
void px_set_debug_handler | ( | void(*)(const char *) | handler | ) |
const char* px_strerror | ( | int | err | ) |