PostgreSQL Source Code
git master
|
#include "postgres.h"
#include <openssl/evp.h>
#include <openssl/err.h>
#include <openssl/rand.h>
#include "px.h"
#include "utils/memutils.h"
#include "utils/resowner.h"
Go to the source code of this file.
Data Structures | |
struct | OSSLDigest |
struct | ossl_cipher |
struct | OSSLCipher |
struct | ossl_cipher_lookup |
Macros | |
#define | MAX_KEY (512/8) |
#define | MAX_IV (128/8) |
Typedefs | |
typedef struct OSSLDigest | OSSLDigest |
typedef const EVP_CIPHER *(* | ossl_EVP_cipher_func) (void) |
typedef struct OSSLCipher | OSSLCipher |
Functions | |
static void | free_openssl_digest (OSSLDigest *digest) |
static void | digest_free_callback (ResourceReleasePhase phase, bool isCommit, bool isTopLevel, void *arg) |
static unsigned | digest_result_size (PX_MD *h) |
static unsigned | digest_block_size (PX_MD *h) |
static void | digest_reset (PX_MD *h) |
static void | digest_update (PX_MD *h, const uint8 *data, unsigned dlen) |
static void | digest_finish (PX_MD *h, uint8 *dst) |
static void | digest_free (PX_MD *h) |
int | px_find_digest (const char *name, PX_MD **res) |
static void | free_openssl_cipher (OSSLCipher *od) |
static void | cipher_free_callback (ResourceReleasePhase phase, bool isCommit, bool isTopLevel, void *arg) |
static unsigned | gen_ossl_block_size (PX_Cipher *c) |
static unsigned | gen_ossl_key_size (PX_Cipher *c) |
static unsigned | gen_ossl_iv_size (PX_Cipher *c) |
static void | gen_ossl_free (PX_Cipher *c) |
static int | gen_ossl_decrypt (PX_Cipher *c, int padding, const uint8 *data, unsigned dlen, uint8 *res, unsigned *rlen) |
static int | gen_ossl_encrypt (PX_Cipher *c, int padding, const uint8 *data, unsigned dlen, uint8 *res, unsigned *rlen) |
static int | bf_check_supported_key_len (void) |
static int | bf_init (PX_Cipher *c, const uint8 *key, unsigned klen, const uint8 *iv) |
static int | ossl_des_init (PX_Cipher *c, const uint8 *key, unsigned klen, const uint8 *iv) |
static int | ossl_des3_init (PX_Cipher *c, const uint8 *key, unsigned klen, const uint8 *iv) |
static int | ossl_cast_init (PX_Cipher *c, const uint8 *key, unsigned klen, const uint8 *iv) |
static int | ossl_aes_init (PX_Cipher *c, const uint8 *key, unsigned klen, const uint8 *iv) |
static int | ossl_aes_ecb_init (PX_Cipher *c, const uint8 *key, unsigned klen, const uint8 *iv) |
static int | ossl_aes_cbc_init (PX_Cipher *c, const uint8 *key, unsigned klen, const uint8 *iv) |
int | px_find_cipher (const char *name, PX_Cipher **res) |
Variables | |
static OSSLDigest * | open_digests = NULL |
static bool | digest_resowner_callback_registered = false |
static int | px_openssl_initialized = 0 |
static OSSLCipher * | open_ciphers = NULL |
static bool | cipher_resowner_callback_registered = false |
static PX_Alias | ossl_aliases [] |
static const struct ossl_cipher | ossl_bf_cbc |
static const struct ossl_cipher | ossl_bf_ecb |
static const struct ossl_cipher | ossl_bf_cfb |
static const struct ossl_cipher | ossl_des_ecb |
static const struct ossl_cipher | ossl_des_cbc |
static const struct ossl_cipher | ossl_des3_ecb |
static const struct ossl_cipher | ossl_des3_cbc |
static const struct ossl_cipher | ossl_cast_ecb |
static const struct ossl_cipher | ossl_cast_cbc |
static const struct ossl_cipher | ossl_aes_ecb |
static const struct ossl_cipher | ossl_aes_cbc |
static const struct ossl_cipher_lookup | ossl_cipher_types [] |
typedef struct OSSLCipher OSSLCipher |
typedef struct OSSLDigest OSSLDigest |
|
static |
Definition at line 439 of file openssl.c.
References data, OSSLCipher::evp_ctx, sort-test::key, and res.
Referenced by bf_init().
Definition at line 482 of file openssl.c.
References bf_check_supported_key_len(), gen_ossl_block_size(), OSSLCipher::iv, OSSLCipher::key, sort-test::key, OSSLCipher::klen, and PXE_KEY_TOO_BIG.
|
static |
Definition at line 308 of file openssl.c.
References CurrentResourceOwner, elog(), free_openssl_cipher(), next, OSSLCipher::next, open_ciphers, OSSLCipher::owner, RESOURCE_RELEASE_AFTER_LOCKS, and WARNING.
Referenced by px_find_cipher().
|
static |
Definition at line 126 of file openssl.c.
References OSSLDigest::ctx, elog(), ERROR, px_digest::p, and px_digest::ptr.
Referenced by px_find_digest().
Definition at line 156 of file openssl.c.
References OSSLDigest::ctx, elog(), ERROR, if(), px_digest::p, and px_digest::ptr.
Referenced by px_find_digest().
|
static |
Definition at line 165 of file openssl.c.
References free_openssl_digest(), px_digest::p, pfree(), and px_digest::ptr.
Referenced by px_find_digest().
|
static |
Definition at line 87 of file openssl.c.
References CurrentResourceOwner, elog(), free_openssl_digest(), next, OSSLDigest::next, open_digests, OSSLDigest::owner, RESOURCE_RELEASE_AFTER_LOCKS, and WARNING.
Referenced by px_find_digest().
|
static |
Definition at line 138 of file openssl.c.
References OSSLDigest::algo, OSSLDigest::ctx, elog(), ERROR, if(), px_digest::p, and px_digest::ptr.
Referenced by px_find_digest().
|
static |
Definition at line 114 of file openssl.c.
References OSSLDigest::ctx, elog(), ERROR, px_digest::p, and px_digest::ptr.
Referenced by px_find_digest().
Definition at line 147 of file openssl.c.
References OSSLDigest::ctx, data, elog(), ERROR, if(), px_digest::p, and px_digest::ptr.
Referenced by px_find_digest().
|
static |
Definition at line 292 of file openssl.c.
References OSSLCipher::evp_ctx, OSSLCipher::next, open_ciphers, pfree(), and OSSLCipher::prev.
Referenced by cipher_free_callback(), and gen_ossl_free().
|
static |
Definition at line 71 of file openssl.c.
References OSSLDigest::ctx, OSSLDigest::next, open_digests, pfree(), and OSSLDigest::prev.
Referenced by digest_free(), and digest_free_callback().
|
static |
Definition at line 337 of file openssl.c.
References ossl_cipher::block_size, and OSSLCipher::ciph.
Referenced by bf_init(), ossl_aes_init(), ossl_cast_init(), ossl_des3_init(), ossl_des_init(), and px_find_cipher().
|
static |
Definition at line 372 of file openssl.c.
References data, OSSLCipher::evp_ciph, OSSLCipher::evp_ctx, OSSLCipher::init, OSSLCipher::iv, OSSLCipher::key, OSSLCipher::klen, PXE_CIPHER_INIT, PXE_DECRYPT_FAILED, and res.
Referenced by px_find_cipher().
|
static |
Definition at line 402 of file openssl.c.
References data, OSSLCipher::evp_ciph, OSSLCipher::evp_ctx, OSSLCipher::init, OSSLCipher::iv, OSSLCipher::key, OSSLCipher::klen, PXE_CIPHER_INIT, PXE_ENCRYPT_FAILED, and res.
Referenced by px_find_cipher().
|
static |
Definition at line 363 of file openssl.c.
References free_openssl_cipher(), and pfree().
Referenced by px_find_cipher().
|
static |
Definition at line 353 of file openssl.c.
References ossl_cipher::block_size, and OSSLCipher::ciph.
Referenced by px_find_cipher().
|
static |
Definition at line 345 of file openssl.c.
References OSSLCipher::ciph, and ossl_cipher::max_key_size.
Referenced by px_find_cipher().
|
static |
Definition at line 625 of file openssl.c.
References err(), OSSLCipher::evp_ciph, OSSLCipher::iv, sort-test::key, OSSLCipher::klen, ossl_aes_init(), and PXE_CIPHER_INIT.
|
static |
Definition at line 595 of file openssl.c.
References err(), OSSLCipher::evp_ciph, OSSLCipher::iv, sort-test::key, OSSLCipher::klen, ossl_aes_init(), and PXE_CIPHER_INIT.
|
static |
Definition at line 570 of file openssl.c.
References gen_ossl_block_size(), OSSLCipher::iv, OSSLCipher::key, sort-test::key, OSSLCipher::klen, and PXE_KEY_TOO_BIG.
Referenced by ossl_aes_cbc_init(), and ossl_aes_ecb_init().
|
static |
Definition at line 552 of file openssl.c.
References gen_ossl_block_size(), OSSLCipher::iv, OSSLCipher::key, sort-test::key, and OSSLCipher::klen.
|
static |
Definition at line 533 of file openssl.c.
References gen_ossl_block_size(), OSSLCipher::iv, OSSLCipher::key, sort-test::key, and OSSLCipher::klen.
|
static |
Definition at line 514 of file openssl.c.
References gen_ossl_block_size(), OSSLCipher::iv, OSSLCipher::key, sort-test::key, and OSSLCipher::klen.
int px_find_cipher | ( | const char * | name, |
PX_Cipher ** | res | ||
) |
Definition at line 771 of file openssl.c.
References OSSLCipher::ciph, cipher_free_callback(), cipher_resowner_callback_registered, CurrentResourceOwner, OSSLCipher::evp_ciph, OSSLCipher::evp_ctx, gen_ossl_block_size(), gen_ossl_decrypt(), gen_ossl_encrypt(), gen_ossl_free(), gen_ossl_iv_size(), gen_ossl_key_size(), i, ossl_cipher::init, MemoryContextAllocZero(), name, OSSLCipher::next, open_ciphers, ossl_aliases, ossl_cipher_types, OSSLCipher::owner, palloc(), pfree(), OSSLCipher::prev, px_resolve_alias(), PXE_CIPHER_INIT, PXE_NO_CIPHER, RegisterResourceReleaseCallback(), res, and TopMemoryContext.
Referenced by pgp_load_cipher(), and px_find_combo().
int px_find_digest | ( | const char * | name, |
PX_MD ** | res | ||
) |
Definition at line 178 of file openssl.c.
References OSSLDigest::algo, px_digest::block_size, OSSLDigest::ctx, CurrentResourceOwner, digest_block_size(), digest_finish(), digest_free(), digest_free_callback(), digest_reset(), digest_resowner_callback_registered, digest_result_size(), digest_update(), px_digest::finish, px_digest::free, MemoryContextAlloc(), name, OSSLDigest::next, open_digests, OSSLDigest::owner, px_digest::p, palloc(), pfree(), OSSLDigest::prev, px_digest::ptr, px_openssl_initialized, PXE_CIPHER_INIT, PXE_NO_HASH, RegisterResourceReleaseCallback(), res, px_digest::reset, px_digest::result_size, TopMemoryContext, and px_digest::update.
Referenced by pg_digest(), pgp_load_digest(), px_crypt_md5(), and px_find_hmac().
Definition at line 289 of file openssl.c.
Referenced by px_find_cipher().
Definition at line 68 of file openssl.c.
Referenced by px_find_digest().
|
static |
Definition at line 288 of file openssl.c.
Referenced by cipher_free_callback(), free_openssl_cipher(), and px_find_cipher().
|
static |
Definition at line 67 of file openssl.c.
Referenced by digest_free_callback(), free_openssl_digest(), and px_find_digest().
|
static |
|
static |
|
static |
Definition at line 658 of file openssl.c.
Referenced by px_find_cipher().
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
Definition at line 658 of file openssl.c.
Referenced by px_find_cipher().
|
static |
|
static |
|
static |
|
static |
|
static |
Definition at line 173 of file openssl.c.
Referenced by px_find_digest().