PostgreSQL Source Code
git master
|
#include "postgres.h"
#include <time.h>
#include "blf.h"
#include "md5.h"
#include "px.h"
#include "rijndael.h"
#include "sha1.h"
Go to the source code of this file.
Data Structures | |
struct | int_digest |
struct | int_ctx |
struct | int_cipher |
Macros | |
#define | MD5_DIGEST_LENGTH 16 |
#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 225 of file internal.c.
#define INT_MAX_KEY (512/8) |
Definition at line 224 of file internal.c.
#define MD5_BLOCK_SIZE 64 |
Definition at line 55 of file internal.c.
Referenced by int_md5_block_len().
#define MD5_DIGEST_LENGTH 16 |
Definition at line 43 of file internal.c.
Referenced by int_md5_len().
#define MODE_CBC 1 |
Definition at line 259 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 258 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 54 of file internal.c.
Referenced by int_sha1_block_len().
#define SHA1_DIGEST_LENGTH SHA1_RESULTLEN |
Definition at line 48 of file internal.c.
Referenced by int_sha1_len().
|
static |
|
static |
Definition at line 455 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 430 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 418 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 480 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, px_cipher::ptr, and px_alloc.
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(), MD5_CTX, px_digest::p, px_digest::ptr, px_alloc, px_digest::reset, px_digest::result_size, and px_digest::update.
|
static |
Definition at line 201 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, px_digest::ptr, px_alloc, px_digest::reset, px_digest::result_size, and px_digest::update.
void init_sha224 | ( | PX_MD * | h | ) |
Definition at line 239 of file internal-sha2.c.
References px_digest::block_size, px_digest::finish, px_digest::free, int_sha224_block_len(), int_sha224_finish(), int_sha224_free(), int_sha224_len(), int_sha224_reset(), int_sha224_update(), px_digest::p, px_digest::ptr, px_alloc, px_digest::reset, px_digest::result_size, and px_digest::update.
void init_sha256 | ( | PX_MD * | h | ) |
Definition at line 259 of file internal-sha2.c.
References px_digest::block_size, px_digest::finish, px_digest::free, int_sha256_block_len(), int_sha256_finish(), int_sha256_free(), int_sha256_len(), int_sha256_reset(), int_sha256_update(), px_digest::p, px_digest::ptr, px_alloc, px_digest::reset, px_digest::result_size, and px_digest::update.
void init_sha384 | ( | PX_MD * | h | ) |
Definition at line 279 of file internal-sha2.c.
References px_digest::block_size, px_digest::finish, px_digest::free, int_sha384_block_len(), int_sha384_finish(), int_sha384_free(), int_sha384_len(), int_sha384_reset(), int_sha384_update(), px_digest::p, px_digest::ptr, px_alloc, px_digest::reset, px_digest::result_size, and px_digest::update.
void init_sha512 | ( | PX_MD * | h | ) |
Definition at line 299 of file internal-sha2.c.
References px_digest::block_size, px_digest::finish, px_digest::free, int_sha512_block_len(), int_sha512_finish(), int_sha512_free(), int_sha512_len(), int_sha512_reset(), int_sha512_update(), px_digest::p, px_digest::ptr, px_alloc, px_digest::reset, px_digest::result_size, and px_digest::update.
|
static |
Definition at line 113 of file internal.c.
References MD5_CTX, MD5Final, px_digest::p, and px_digest::ptr.
Referenced by init_md5().
|
static |
Definition at line 121 of file internal.c.
References MD5_CTX, px_digest::p, px_digest::ptr, px_free, and px_memset().
Referenced by init_md5().
|
static |
|
static |
Definition at line 105 of file internal.c.
References MD5_CTX, MD5Init, px_digest::p, and px_digest::ptr.
Referenced by init_md5().
Definition at line 97 of file internal.c.
References MD5_CTX, MD5Update, px_digest::p, 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, px_digest::ptr, px_free, 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 242 of file internal.c.
References cx(), px_cipher::ptr, px_free, and px_memset().
Referenced by bf_load(), and rj_load().
int px_find_cipher | ( | const char * | name, |
PX_Cipher ** | res | ||
) |
Definition at line 578 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 559 of file internal.c.
Referenced by pg_digest(), pgp_load_digest(), px_crypt_md5(), and px_find_hmac().
|
static |
|
static |
|
static |
Definition at line 339 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 309 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 280 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 371 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, px_cipher::ptr, px_alloc, 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 302 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 544 of file internal.c.
|
static |
Definition at line 536 of file internal.c.
|
static |
Definition at line 72 of file internal.c.