PostgreSQL Source Code
git master
|
#include "postgres.h"
#include <openssl/err.h>
#include <openssl/hmac.h>
#include "common/hmac.h"
#include "common/md5.h"
#include "common/sha1.h"
#include "common/sha2.h"
#include "utils/memutils.h"
#include "utils/resowner.h"
Go to the source code of this file.
Data Structures | |
struct | pg_hmac_ctx |
Macros | |
#define | USE_RESOWNER_FOR_HMAC |
#define | ALLOC(size) MemoryContextAlloc(TopMemoryContext, size) |
#define | FREE(ptr) pfree(ptr) |
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 | |
static void | ResOwnerReleaseHMAC (Datum res) |
static void | ResourceOwnerRememberHMAC (ResourceOwner owner, pg_hmac_ctx *ctx) |
static void | ResourceOwnerForgetHMAC (ResourceOwner owner, pg_hmac_ctx *ctx) |
static const char * | SSLerrmessage (unsigned long ecode) |
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) |
Variables | |
static const ResourceOwnerDesc | hmac_resowner_desc |
#define ALLOC | ( | size | ) | MemoryContextAlloc(TopMemoryContext, size) |
Definition at line 43 of file hmac_openssl.c.
#define FREE | ( | ptr | ) | pfree(ptr) |
Definition at line 44 of file hmac_openssl.c.
#define USE_RESOWNER_FOR_HMAC |
Definition at line 42 of file hmac_openssl.c.
typedef enum pg_hmac_errno pg_hmac_errno |
enum pg_hmac_errno |
Enumerator | |
---|---|
PG_HMAC_ERROR_NONE | |
PG_HMAC_ERROR_OOM | |
PG_HMAC_ERROR_INTERNAL | |
PG_HMAC_ERROR_NONE | |
PG_HMAC_ERROR_DEST_LEN | |
PG_HMAC_ERROR_OPENSSL |
Definition at line 51 of file hmac_openssl.c.
pg_hmac_ctx* pg_hmac_create | ( | pg_cryptohash_type | type | ) |
Definition at line 117 of file hmac_openssl.c.
References ALLOC, CurrentResourceOwner, ereport, errcode(), errmsg(), pg_hmac_ctx::error, ERROR, pg_hmac_ctx::errreason, explicit_bzero(), FREE, pg_hmac_ctx::hmacctx, PG_HMAC_ERROR_NONE, ResourceOwnerEnlarge(), ResourceOwnerRememberHMAC(), pg_hmac_ctx::resowner, type, and pg_hmac_ctx::type.
const char* pg_hmac_error | ( | pg_hmac_ctx * | ctx | ) |
Definition at line 336 of file hmac_openssl.c.
References _, Assert, pg_hmac_ctx::error, pg_hmac_ctx::errreason, PG_HMAC_ERROR_DEST_LEN, PG_HMAC_ERROR_NONE, and PG_HMAC_ERROR_OPENSSL.
int pg_hmac_final | ( | pg_hmac_ctx * | ctx, |
uint8 * | dest, | ||
size_t | len | ||
) |
Definition at line 242 of file hmac_openssl.c.
References generate_unaccent_rules::dest, pg_hmac_ctx::error, pg_hmac_ctx::errreason, pg_hmac_ctx::hmacctx, len, MD5_DIGEST_LENGTH, PG_HMAC_ERROR_DEST_LEN, PG_HMAC_ERROR_OPENSSL, PG_MD5, PG_SHA1, PG_SHA224, PG_SHA224_DIGEST_LENGTH, PG_SHA256, PG_SHA256_DIGEST_LENGTH, PG_SHA384, PG_SHA384_DIGEST_LENGTH, PG_SHA512, PG_SHA512_DIGEST_LENGTH, SHA1_DIGEST_LENGTH, SSLerrmessage(), and pg_hmac_ctx::type.
void pg_hmac_free | ( | pg_hmac_ctx * | ctx | ) |
Definition at line 314 of file hmac_openssl.c.
References explicit_bzero(), FREE, pg_hmac_ctx::hmacctx, ResourceOwnerForgetHMAC(), and pg_hmac_ctx::resowner.
Referenced by ResOwnerReleaseHMAC().
int pg_hmac_init | ( | pg_hmac_ctx * | ctx, |
const uint8 * | key, | ||
size_t | len | ||
) |
Definition at line 171 of file hmac_openssl.c.
References pg_hmac_ctx::error, pg_hmac_ctx::errreason, pg_hmac_ctx::hmacctx, sort-test::key, len, PG_HMAC_ERROR_OPENSSL, PG_MD5, PG_SHA1, PG_SHA224, PG_SHA256, PG_SHA384, PG_SHA512, SSLerrmessage(), and pg_hmac_ctx::type.
int pg_hmac_update | ( | pg_hmac_ctx * | ctx, |
const uint8 * | data, | ||
size_t | len | ||
) |
Definition at line 217 of file hmac_openssl.c.
References data, pg_hmac_ctx::error, pg_hmac_ctx::errreason, pg_hmac_ctx::hmacctx, len, PG_HMAC_ERROR_OPENSSL, and SSLerrmessage().
|
inlinestatic |
Definition at line 91 of file hmac_openssl.c.
References hmac_resowner_desc, PointerGetDatum(), and ResourceOwnerForget().
Referenced by pg_hmac_free().
|
inlinestatic |
Definition at line 86 of file hmac_openssl.c.
References hmac_resowner_desc, PointerGetDatum(), and ResourceOwnerRemember().
Referenced by pg_hmac_create().
|
static |
Definition at line 366 of file hmac_openssl.c.
References DatumGetPointer(), pg_hmac_free(), res, and pg_hmac_ctx::resowner.
|
static |
Definition at line 98 of file hmac_openssl.c.
Referenced by pg_hmac_final(), pg_hmac_init(), and pg_hmac_update().
|
static |
Definition at line 75 of file hmac_openssl.c.
Referenced by ResourceOwnerForgetHMAC(), and ResourceOwnerRememberHMAC().