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 | ResOwnerReleaseOSSLDigest (Datum res) |
static void | ResourceOwnerRememberOSSLDigest (ResourceOwner owner, OSSLDigest *digest) |
static void | ResourceOwnerForgetOSSLDigest (ResourceOwner owner, OSSLDigest *digest) |
static void | free_openssl_digest (OSSLDigest *digest) |
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 | ResOwnerReleaseOSSLCipher (Datum res) |
static void | ResourceOwnerRememberOSSLCipher (ResourceOwner owner, OSSLCipher *od) |
static void | ResourceOwnerForgetOSSLCipher (ResourceOwner owner, OSSLCipher *od) |
static void | free_openssl_cipher (OSSLCipher *od) |
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 const ResourceOwnerDesc | ossldigest_resowner_desc |
static const ResourceOwnerDesc | osslcipher_resowner_desc |
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 447 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 110 of file openssl.c.
References OSSLDigest::ctx, elog, ERROR, px_digest::p, and px_digest::ptr.
Referenced by px_find_digest().
Definition at line 140 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 149 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 122 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 98 of file openssl.c.
References OSSLDigest::ctx, elog, ERROR, px_digest::p, and px_digest::ptr.
Referenced by px_find_digest().
Definition at line 131 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 291 of file openssl.c.
References OSSLCipher::evp_ctx, OSSLCipher::owner, pfree(), and ResourceOwnerForgetOSSLCipher().
Referenced by gen_ossl_free(), and ResOwnerReleaseOSSLCipher().
|
static |
Definition at line 89 of file openssl.c.
References OSSLDigest::ctx, OSSLDigest::owner, pfree(), and ResourceOwnerForgetOSSLDigest().
Referenced by digest_free(), and ResOwnerReleaseOSSLDigest().
|
static |
Definition at line 302 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 337 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 367 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 328 of file openssl.c.
References free_openssl_cipher(), and pfree().
Referenced by px_find_cipher().
|
static |
Definition at line 318 of file openssl.c.
References ossl_cipher::block_size, and OSSLCipher::ciph.
Referenced by px_find_cipher().
|
static |
Definition at line 310 of file openssl.c.
References OSSLCipher::ciph, and ossl_cipher::max_key_size.
Referenced by px_find_cipher().
|
static |
Definition at line 590 of file openssl.c.
References err(), OSSLCipher::evp_ciph, sort-test::key, OSSLCipher::klen, ossl_aes_init(), and PXE_CIPHER_INIT.
|
static |
Definition at line 560 of file openssl.c.
References err(), OSSLCipher::evp_ciph, sort-test::key, OSSLCipher::klen, ossl_aes_init(), and PXE_CIPHER_INIT.
|
static |
Definition at line 535 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 517 of file openssl.c.
References gen_ossl_block_size(), OSSLCipher::iv, OSSLCipher::key, sort-test::key, and OSSLCipher::klen.
|
static |
Definition at line 498 of file openssl.c.
References gen_ossl_block_size(), OSSLCipher::iv, OSSLCipher::key, sort-test::key, and OSSLCipher::klen.
|
static |
Definition at line 479 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 736 of file openssl.c.
References OSSLCipher::ciph, 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, ossl_aliases, ossl_cipher_types, OSSLCipher::owner, palloc(), pfree(), px_resolve_alias(), PXE_CIPHER_INIT, PXE_NO_CIPHER, res, ResourceOwnerEnlarge(), ResourceOwnerRememberOSSLCipher(), and TopMemoryContext.
Referenced by pgp_load_cipher(), and px_find_combo().
int px_find_digest | ( | const char * | name, |
PX_MD ** | res | ||
) |
Definition at line 160 of file openssl.c.
References OSSLDigest::algo, px_digest::block_size, OSSLDigest::ctx, CurrentResourceOwner, digest_block_size(), digest_finish(), digest_free(), digest_reset(), digest_result_size(), digest_update(), px_digest::finish, px_digest::free, MemoryContextAlloc(), name, OSSLDigest::owner, px_digest::p, palloc(), pfree(), px_digest::ptr, PXE_CIPHER_INIT, PXE_NO_HASH, res, px_digest::reset, ResourceOwnerEnlarge(), ResourceOwnerRememberOSSLDigest(), px_digest::result_size, TopMemoryContext, and px_digest::update.
Referenced by pg_digest(), pgp_load_digest(), px_crypt_md5(), and px_find_hmac().
|
inlinestatic |
Definition at line 285 of file openssl.c.
References osslcipher_resowner_desc, PointerGetDatum(), and ResourceOwnerForget().
Referenced by free_openssl_cipher().
|
inlinestatic |
Definition at line 83 of file openssl.c.
References ossldigest_resowner_desc, PointerGetDatum(), and ResourceOwnerForget().
Referenced by free_openssl_digest().
|
inlinestatic |
Definition at line 280 of file openssl.c.
References osslcipher_resowner_desc, PointerGetDatum(), and ResourceOwnerRemember().
Referenced by px_find_cipher().
|
inlinestatic |
Definition at line 78 of file openssl.c.
References ossldigest_resowner_desc, PointerGetDatum(), and ResourceOwnerRemember().
Referenced by px_find_digest().
|
static |
Definition at line 793 of file openssl.c.
References DatumGetPointer(), free_openssl_cipher(), and res.
|
static |
Definition at line 215 of file openssl.c.
References DatumGetPointer(), free_openssl_digest(), OSSLDigest::owner, and res.
|
static |
|
static |
|
static |
Definition at line 623 of file openssl.c.
Referenced by px_find_cipher().
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
Definition at line 623 of file openssl.c.
Referenced by px_find_cipher().
|
static |
|
static |
|
static |
|
static |
|
static |
Definition at line 269 of file openssl.c.
Referenced by ResourceOwnerForgetOSSLCipher(), and ResourceOwnerRememberOSSLCipher().
|
static |
Definition at line 67 of file openssl.c.
Referenced by ResourceOwnerForgetOSSLDigest(), and ResourceOwnerRememberOSSLDigest().