PostgreSQL Source Code
git master
|
#include "postgres.h"
#include <time.h>
#include "blf.h"
#include "px.h"
#include "rijndael.h"
#include "sha1.h"
#include "common/cryptohash.h"
#include "common/md5.h"
Go to the source code of this file.
Data Structures | |
struct | int_digest |
struct | int_ctx |
struct | int_cipher |
Macros | |
#define | SHA1_DIGEST_LENGTH SHA1_RESULTLEN |
#define | SHA1_BLOCK_SIZE 64 |
#define | MD5_BLOCK_SIZE 64 |
#define | INT_MAX_KEY (512/8) |
#define | INT_MAX_IV (128/8) |
#define | MODE_ECB 0 |
#define | MODE_CBC 1 |
Functions | |
static void | init_md5 (PX_MD *h) |
static void | init_sha1 (PX_MD *h) |
void | init_sha224 (PX_MD *h) |
void | init_sha256 (PX_MD *h) |
void | init_sha384 (PX_MD *h) |
void | init_sha512 (PX_MD *h) |
static unsigned | int_md5_len (PX_MD *h) |
static unsigned | int_md5_block_len (PX_MD *h) |
static void | int_md5_update (PX_MD *h, const uint8 *data, unsigned dlen) |
static void | int_md5_reset (PX_MD *h) |
static void | int_md5_finish (PX_MD *h, uint8 *dst) |
static void | int_md5_free (PX_MD *h) |
static unsigned | int_sha1_len (PX_MD *h) |
static unsigned | int_sha1_block_len (PX_MD *h) |
static void | int_sha1_update (PX_MD *h, const uint8 *data, unsigned dlen) |
static void | int_sha1_reset (PX_MD *h) |
static void | int_sha1_finish (PX_MD *h, uint8 *dst) |
static void | int_sha1_free (PX_MD *h) |
static void | intctx_free (PX_Cipher *c) |
static unsigned | rj_block_size (PX_Cipher *c) |
static unsigned | rj_key_size (PX_Cipher *c) |
static unsigned | rj_iv_size (PX_Cipher *c) |
static int | rj_init (PX_Cipher *c, const uint8 *key, unsigned klen, const uint8 *iv) |
static int | rj_real_init (struct int_ctx *cx, int dir) |
static int | rj_encrypt (PX_Cipher *c, const uint8 *data, unsigned dlen, uint8 *res) |
static int | rj_decrypt (PX_Cipher *c, const uint8 *data, unsigned dlen, uint8 *res) |
static PX_Cipher * | rj_load (int mode) |
static unsigned | bf_block_size (PX_Cipher *c) |
static unsigned | bf_key_size (PX_Cipher *c) |
static unsigned | bf_iv_size (PX_Cipher *c) |
static int | bf_init (PX_Cipher *c, const uint8 *key, unsigned klen, const uint8 *iv) |
static int | bf_encrypt (PX_Cipher *c, const uint8 *data, unsigned dlen, uint8 *res) |
static int | bf_decrypt (PX_Cipher *c, const uint8 *data, unsigned dlen, uint8 *res) |
static PX_Cipher * | bf_load (int mode) |
static PX_Cipher * | rj_128_ecb (void) |
static PX_Cipher * | rj_128_cbc (void) |
static PX_Cipher * | bf_ecb_load (void) |
static PX_Cipher * | bf_cbc_load (void) |
int | px_find_digest (const char *name, PX_MD **res) |
int | px_find_cipher (const char *name, PX_Cipher **res) |
Variables | |
static const struct int_digest | int_digest_list [] |
static const struct int_cipher | int_ciphers [] |
static const PX_Alias | int_aliases [] |
#define INT_MAX_IV (128/8) |
Definition at line 223 of file internal.c.
#define INT_MAX_KEY (512/8) |
Definition at line 222 of file internal.c.
#define MD5_BLOCK_SIZE 64 |
Definition at line 53 of file internal.c.
Referenced by int_md5_block_len().
#define MODE_CBC 1 |
Definition at line 257 of file internal.c.
Referenced by bf_cbc_load(), bf_decrypt(), bf_encrypt(), rj_128_cbc(), rj_decrypt(), and rj_encrypt().
#define MODE_ECB 0 |
Definition at line 256 of file internal.c.
Referenced by bf_decrypt(), bf_ecb_load(), bf_encrypt(), and rj_128_ecb().
#define SHA1_BLOCK_SIZE 64 |
Definition at line 52 of file internal.c.
Referenced by int_sha1_block_len().
#define SHA1_DIGEST_LENGTH SHA1_RESULTLEN |
Definition at line 46 of file internal.c.
Referenced by int_sha1_len().
|
static |
|
static |
Definition at line 451 of file internal.c.
References int_ctx::bf, blowfish_decrypt_cbc(), blowfish_decrypt_ecb(), int_ctx::ctx, cx(), int_ctx::mode, MODE_CBC, MODE_ECB, px_cipher::ptr, and PXE_NOTBLOCKSIZE.
Referenced by bf_load().
|
static |
Definition at line 426 of file internal.c.
References int_ctx::bf, blowfish_encrypt_cbc(), blowfish_encrypt_ecb(), int_ctx::ctx, cx(), int_ctx::mode, MODE_CBC, MODE_ECB, px_cipher::ptr, and PXE_NOTBLOCKSIZE.
Referenced by bf_load().
Definition at line 414 of file internal.c.
References int_ctx::bf, blowfish_setiv(), blowfish_setkey(), int_ctx::ctx, cx(), and px_cipher::ptr.
Referenced by bf_load().
|
static |
|
static |
|
static |
Definition at line 476 of file internal.c.
References bf_block_size(), bf_decrypt(), bf_encrypt(), bf_init(), bf_iv_size(), bf_key_size(), px_cipher::block_size, cx(), px_cipher::decrypt, px_cipher::encrypt, px_cipher::free, px_cipher::init, intctx_free(), px_cipher::iv_size, px_cipher::key_size, mode, int_ctx::mode, palloc0(), and px_cipher::ptr.
Referenced by bf_cbc_load(), and bf_ecb_load().
|
static |
Definition at line 181 of file internal.c.
References px_digest::block_size, px_digest::finish, px_digest::free, int_md5_block_len(), int_md5_finish(), int_md5_free(), int_md5_len(), int_md5_reset(), int_md5_update(), px_digest::p, pg_cryptohash_create(), PG_MD5, px_digest::ptr, px_digest::reset, px_digest::result_size, and px_digest::update.
|
static |
Definition at line 200 of file internal.c.
References px_digest::block_size, px_digest::finish, px_digest::free, int_sha1_block_len(), int_sha1_finish(), int_sha1_free(), int_sha1_len(), int_sha1_reset(), int_sha1_update(), px_digest::p, palloc0(), px_digest::ptr, px_digest::reset, px_digest::result_size, and px_digest::update.
void init_sha224 | ( | PX_MD * | h | ) |
Definition at line 137 of file internal-sha2.c.
References px_digest::block_size, px_digest::finish, px_digest::free, int_sha224_block_len(), int_sha224_len(), int_sha2_finish(), int_sha2_free(), int_sha2_reset(), int_sha2_update(), px_digest::p, pg_cryptohash_create(), PG_SHA224, px_digest::ptr, px_digest::reset, px_digest::result_size, and px_digest::update.
void init_sha256 | ( | PX_MD * | h | ) |
Definition at line 155 of file internal-sha2.c.
References px_digest::block_size, px_digest::finish, px_digest::free, int_sha256_block_len(), int_sha256_len(), int_sha2_finish(), int_sha2_free(), int_sha2_reset(), int_sha2_update(), px_digest::p, pg_cryptohash_create(), PG_SHA256, px_digest::ptr, px_digest::reset, px_digest::result_size, and px_digest::update.
void init_sha384 | ( | PX_MD * | h | ) |
Definition at line 173 of file internal-sha2.c.
References px_digest::block_size, px_digest::finish, px_digest::free, int_sha2_finish(), int_sha2_free(), int_sha2_reset(), int_sha2_update(), int_sha384_block_len(), int_sha384_len(), px_digest::p, pg_cryptohash_create(), PG_SHA384, px_digest::ptr, px_digest::reset, px_digest::result_size, and px_digest::update.
void init_sha512 | ( | PX_MD * | h | ) |
Definition at line 191 of file internal-sha2.c.
References px_digest::block_size, px_digest::finish, px_digest::free, int_sha2_finish(), int_sha2_free(), int_sha2_reset(), int_sha2_update(), int_sha512_block_len(), int_sha512_len(), px_digest::p, pg_cryptohash_create(), PG_SHA512, px_digest::ptr, px_digest::reset, px_digest::result_size, and px_digest::update.
|
static |
Definition at line 113 of file internal.c.
References elog, ERROR, px_digest::p, pg_cryptohash_final(), and px_digest::ptr.
Referenced by init_md5().
|
static |
Definition at line 122 of file internal.c.
References px_digest::p, pfree(), pg_cryptohash_free(), and px_digest::ptr.
Referenced by init_md5().
|
static |
|
static |
Definition at line 104 of file internal.c.
References elog, ERROR, px_digest::p, pg_cryptohash_init(), and px_digest::ptr.
Referenced by init_md5().
Definition at line 95 of file internal.c.
References elog, ERROR, px_digest::p, pg_cryptohash_update(), and px_digest::ptr.
Referenced by init_md5().
|
static |
Definition at line 161 of file internal.c.
References px_digest::p, px_digest::ptr, and SHA1Final.
Referenced by init_sha1().
|
static |
Definition at line 169 of file internal.c.
References px_digest::p, pfree(), px_digest::ptr, and px_memset().
Referenced by init_sha1().
|
static |
Definition at line 133 of file internal.c.
References SHA1_DIGEST_LENGTH.
Referenced by init_sha1().
|
static |
Definition at line 153 of file internal.c.
References px_digest::p, px_digest::ptr, and SHA1Init.
Referenced by init_sha1().
Definition at line 145 of file internal.c.
References px_digest::p, px_digest::ptr, and SHA1Update.
Referenced by init_sha1().
|
static |
Definition at line 240 of file internal.c.
References cx(), pfree(), px_cipher::ptr, and px_memset().
Referenced by bf_load(), and rj_load().
int px_find_cipher | ( | const char * | name, |
PX_Cipher ** | res | ||
) |
Definition at line 572 of file internal.c.
Referenced by pgp_load_cipher(), and px_find_combo().
int px_find_digest | ( | const char * | name, |
PX_MD ** | res | ||
) |
Definition at line 553 of file internal.c.
Referenced by pg_digest(), pgp_load_digest(), px_crypt_md5(), and px_find_hmac().
|
static |
|
static |
|
static |
Definition at line 337 of file internal.c.
References aes_cbc_decrypt(), aes_ecb_decrypt(), int_ctx::ctx, cx(), int_ctx::is_init, int_ctx::iv, int_ctx::mode, MODE_CBC, px_cipher::ptr, PXE_CIPHER_INIT, PXE_NOTBLOCKSIZE, int_ctx::rj, and rj_real_init().
Referenced by rj_load().
Definition at line 307 of file internal.c.
References aes_cbc_encrypt(), aes_ecb_encrypt(), int_ctx::ctx, cx(), int_ctx::is_init, int_ctx::iv, int_ctx::mode, MODE_CBC, px_cipher::ptr, PXE_CIPHER_INIT, PXE_NOTBLOCKSIZE, int_ctx::rj, and rj_real_init().
Referenced by rj_load().
Definition at line 278 of file internal.c.
References cx(), int_ctx::iv, int_ctx::keybuf, int_ctx::keylen, px_cipher::ptr, and PXE_KEY_TOO_BIG.
Referenced by rj_load().
|
static |
|
static |
|
static |
Definition at line 369 of file internal.c.
References px_cipher::block_size, cx(), px_cipher::decrypt, px_cipher::encrypt, px_cipher::free, px_cipher::init, intctx_free(), px_cipher::iv_size, px_cipher::key_size, mode, int_ctx::mode, palloc0(), px_cipher::ptr, rj_block_size(), rj_decrypt(), rj_encrypt(), rj_init(), rj_iv_size(), and rj_key_size().
Referenced by rj_128_cbc(), and rj_128_ecb().
|
static |
Definition at line 300 of file internal.c.
References aes_set_key(), int_ctx::ctx, int_ctx::keybuf, int_ctx::keylen, and int_ctx::rj.
Referenced by rj_decrypt(), and rj_encrypt().
|
static |
Definition at line 538 of file internal.c.
|
static |
Definition at line 530 of file internal.c.
|
static |
Definition at line 70 of file internal.c.