PostgreSQL Source Code
git master
|
#include "postgres.h"
#include "common/cryptohash.h"
#include "common/hmac.h"
#include "common/md5.h"
#include "common/sha1.h"
#include "common/sha2.h"
Go to the source code of this file.
Data Structures | |
struct | pg_hmac_ctx |
Macros | |
#define | ALLOC(size) palloc(size) |
#define | FREE(ptr) pfree(ptr) |
#define | HMAC_IPAD 0x36 |
#define | HMAC_OPAD 0x5C |
Typedefs | |
typedef enum pg_hmac_errno | pg_hmac_errno |
Enumerations | |
enum | pg_hmac_errno { PG_HMAC_ERROR_NONE = 0 , PG_HMAC_ERROR_OOM , PG_HMAC_ERROR_INTERNAL , PG_HMAC_ERROR_NONE = 0 , PG_HMAC_ERROR_DEST_LEN , PG_HMAC_ERROR_OPENSSL } |
Functions | |
pg_hmac_ctx * | pg_hmac_create (pg_cryptohash_type type) |
int | pg_hmac_init (pg_hmac_ctx *ctx, const uint8 *key, size_t len) |
int | pg_hmac_update (pg_hmac_ctx *ctx, const uint8 *data, size_t len) |
int | pg_hmac_final (pg_hmac_ctx *ctx, uint8 *dest, size_t len) |
void | pg_hmac_free (pg_hmac_ctx *ctx) |
const char * | pg_hmac_error (pg_hmac_ctx *ctx) |
typedef enum pg_hmac_errno pg_hmac_errno |
enum pg_hmac_errno |
pg_hmac_ctx* pg_hmac_create | ( | pg_cryptohash_type | type | ) |
Definition at line 77 of file hmac.c.
References ALLOC, pg_hmac_ctx::block_size, pg_hmac_ctx::digest_size, pg_hmac_ctx::error, pg_hmac_ctx::errreason, explicit_bzero(), FREE, pg_hmac_ctx::hash, MD5_BLOCK_SIZE, MD5_DIGEST_LENGTH, pg_cryptohash_create(), PG_HMAC_ERROR_NONE, PG_MD5, PG_SHA1, PG_SHA224, PG_SHA224_BLOCK_LENGTH, PG_SHA224_DIGEST_LENGTH, PG_SHA256, PG_SHA256_BLOCK_LENGTH, PG_SHA256_DIGEST_LENGTH, PG_SHA384, PG_SHA384_BLOCK_LENGTH, PG_SHA384_DIGEST_LENGTH, PG_SHA512, PG_SHA512_BLOCK_LENGTH, PG_SHA512_DIGEST_LENGTH, SHA1_BLOCK_SIZE, SHA1_DIGEST_LENGTH, type, and pg_hmac_ctx::type.
Referenced by build_server_final_message(), calculate_client_proof(), scram_ClientKey(), scram_SaltedPassword(), scram_ServerKey(), verify_client_proof(), and verify_server_signature().
const char* pg_hmac_error | ( | pg_hmac_ctx * | ctx | ) |
Definition at line 306 of file hmac.c.
References _, Assert, pg_hmac_ctx::error, pg_hmac_ctx::errreason, PG_HMAC_ERROR_INTERNAL, PG_HMAC_ERROR_NONE, and PG_HMAC_ERROR_OOM.
Referenced by build_server_final_message(), calculate_client_proof(), scram_ClientKey(), scram_SaltedPassword(), scram_ServerKey(), verify_client_proof(), and verify_server_signature().
int pg_hmac_final | ( | pg_hmac_ctx * | ctx, |
uint8 * | dest, | ||
size_t | len | ||
) |
Definition at line 244 of file hmac.c.
References ALLOC, pg_hmac_ctx::block_size, generate_unaccent_rules::dest, pg_hmac_ctx::digest_size, pg_hmac_ctx::error, pg_hmac_ctx::errreason, FREE, pg_hmac_ctx::hash, pg_hmac_ctx::k_opad, len, pg_cryptohash_error(), pg_cryptohash_final(), pg_cryptohash_init(), pg_cryptohash_update(), PG_HMAC_ERROR_INTERNAL, and PG_HMAC_ERROR_OOM.
Referenced by build_server_final_message(), calculate_client_proof(), scram_ClientKey(), scram_SaltedPassword(), scram_ServerKey(), verify_client_proof(), and verify_server_signature().
void pg_hmac_free | ( | pg_hmac_ctx * | ctx | ) |
Definition at line 289 of file hmac.c.
References explicit_bzero(), FREE, pg_hmac_ctx::hash, and pg_cryptohash_free().
Referenced by build_server_final_message(), calculate_client_proof(), scram_ClientKey(), scram_SaltedPassword(), scram_ServerKey(), verify_client_proof(), and verify_server_signature().
int pg_hmac_init | ( | pg_hmac_ctx * | ctx, |
const uint8 * | key, | ||
size_t | len | ||
) |
Definition at line 138 of file hmac.c.
References ALLOC, block_size, pg_hmac_ctx::block_size, pg_hmac_ctx::digest_size, pg_hmac_ctx::error, pg_hmac_ctx::errreason, FREE, pg_hmac_ctx::hash, HMAC_IPAD, HMAC_OPAD, i, pg_hmac_ctx::k_ipad, pg_hmac_ctx::k_opad, sort-test::key, len, pg_cryptohash_create(), pg_cryptohash_error(), pg_cryptohash_final(), pg_cryptohash_free(), pg_cryptohash_init(), pg_cryptohash_update(), PG_HMAC_ERROR_INTERNAL, PG_HMAC_ERROR_OOM, and pg_hmac_ctx::type.
Referenced by build_server_final_message(), calculate_client_proof(), scram_ClientKey(), scram_SaltedPassword(), scram_ServerKey(), verify_client_proof(), and verify_server_signature().
int pg_hmac_update | ( | pg_hmac_ctx * | ctx, |
const uint8 * | data, | ||
size_t | len | ||
) |
Definition at line 223 of file hmac.c.
References data, pg_hmac_ctx::error, pg_hmac_ctx::errreason, pg_hmac_ctx::hash, len, pg_cryptohash_error(), pg_cryptohash_update(), and PG_HMAC_ERROR_INTERNAL.
Referenced by build_server_final_message(), calculate_client_proof(), scram_ClientKey(), scram_SaltedPassword(), scram_ServerKey(), verify_client_proof(), and verify_server_signature().