PostgreSQL Source Code
git master
|
#include "postgres.h"
#include <openssl/err.h>
#include <openssl/evp.h>
#include "common/cryptohash.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_cryptohash_ctx |
Macros | |
#define | ALLOC(size) MemoryContextAlloc(TopMemoryContext, size) |
#define | FREE(ptr) pfree(ptr) |
Typedefs | |
typedef enum pg_cryptohash_errno | pg_cryptohash_errno |
Enumerations | |
enum | pg_cryptohash_errno { PG_CRYPTOHASH_ERROR_NONE = 0 , PG_CRYPTOHASH_ERROR_DEST_LEN , PG_CRYPTOHASH_ERROR_NONE = 0 , PG_CRYPTOHASH_ERROR_DEST_LEN , PG_CRYPTOHASH_ERROR_OPENSSL } |
Functions | |
static void | ResOwnerReleaseCryptoHash (Datum res) |
static void | ResourceOwnerRememberCryptoHash (ResourceOwner owner, pg_cryptohash_ctx *ctx) |
static void | ResourceOwnerForgetCryptoHash (ResourceOwner owner, pg_cryptohash_ctx *ctx) |
static const char * | SSLerrmessage (unsigned long ecode) |
pg_cryptohash_ctx * | pg_cryptohash_create (pg_cryptohash_type type) |
int | pg_cryptohash_init (pg_cryptohash_ctx *ctx) |
int | pg_cryptohash_update (pg_cryptohash_ctx *ctx, const uint8 *data, size_t len) |
int | pg_cryptohash_final (pg_cryptohash_ctx *ctx, uint8 *dest, size_t len) |
void | pg_cryptohash_free (pg_cryptohash_ctx *ctx) |
const char * | pg_cryptohash_error (pg_cryptohash_ctx *ctx) |
Variables | |
static const ResourceOwnerDesc | cryptohash_resowner_desc |
#define ALLOC | ( | size | ) | MemoryContextAlloc(TopMemoryContext, size) |
Definition at line 42 of file cryptohash_openssl.c.
#define FREE | ( | ptr | ) | pfree(ptr) |
Definition at line 43 of file cryptohash_openssl.c.
typedef enum pg_cryptohash_errno pg_cryptohash_errno |
enum pg_cryptohash_errno |
Enumerator | |
---|---|
PG_CRYPTOHASH_ERROR_NONE | |
PG_CRYPTOHASH_ERROR_DEST_LEN | |
PG_CRYPTOHASH_ERROR_NONE | |
PG_CRYPTOHASH_ERROR_DEST_LEN | |
PG_CRYPTOHASH_ERROR_OPENSSL |
Definition at line 50 of file cryptohash_openssl.c.
pg_cryptohash_ctx* pg_cryptohash_create | ( | pg_cryptohash_type | type | ) |
Definition at line 122 of file cryptohash_openssl.c.
References ALLOC, CurrentResourceOwner, ereport, errcode(), errmsg(), pg_cryptohash_ctx::error, ERROR, pg_cryptohash_ctx::errreason, pg_cryptohash_ctx::evpctx, explicit_bzero(), FREE, PG_CRYPTOHASH_ERROR_NONE, ResourceOwnerEnlarge(), ResourceOwnerRememberCryptoHash(), pg_cryptohash_ctx::resowner, type, and pg_cryptohash_ctx::type.
const char* pg_cryptohash_error | ( | pg_cryptohash_ctx * | ctx | ) |
Definition at line 349 of file cryptohash_openssl.c.
References _, Assert, pg_cryptohash_ctx::error, pg_cryptohash_ctx::errreason, PG_CRYPTOHASH_ERROR_DEST_LEN, PG_CRYPTOHASH_ERROR_NONE, and PG_CRYPTOHASH_ERROR_OPENSSL.
int pg_cryptohash_final | ( | pg_cryptohash_ctx * | ctx, |
uint8 * | dest, | ||
size_t | len | ||
) |
Definition at line 255 of file cryptohash_openssl.c.
References generate_unaccent_rules::dest, pg_cryptohash_ctx::error, pg_cryptohash_ctx::errreason, pg_cryptohash_ctx::evpctx, len, MD5_DIGEST_LENGTH, PG_CRYPTOHASH_ERROR_DEST_LEN, PG_CRYPTOHASH_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_cryptohash_ctx::type.
void pg_cryptohash_free | ( | pg_cryptohash_ctx * | ctx | ) |
Definition at line 326 of file cryptohash_openssl.c.
References pg_cryptohash_ctx::evpctx, explicit_bzero(), FREE, ResourceOwnerForgetCryptoHash(), and pg_cryptohash_ctx::resowner.
Referenced by ResOwnerReleaseCryptoHash().
int pg_cryptohash_init | ( | pg_cryptohash_ctx * | ctx | ) |
Definition at line 178 of file cryptohash_openssl.c.
References pg_cryptohash_ctx::error, pg_cryptohash_ctx::errreason, pg_cryptohash_ctx::evpctx, PG_CRYPTOHASH_ERROR_OPENSSL, PG_MD5, PG_SHA1, PG_SHA224, PG_SHA256, PG_SHA384, PG_SHA512, SSLerrmessage(), and pg_cryptohash_ctx::type.
int pg_cryptohash_update | ( | pg_cryptohash_ctx * | ctx, |
const uint8 * | data, | ||
size_t | len | ||
) |
Definition at line 230 of file cryptohash_openssl.c.
References data, pg_cryptohash_ctx::error, pg_cryptohash_ctx::errreason, pg_cryptohash_ctx::evpctx, len, PG_CRYPTOHASH_ERROR_OPENSSL, and SSLerrmessage().
|
inlinestatic |
Definition at line 96 of file cryptohash_openssl.c.
References cryptohash_resowner_desc, PointerGetDatum(), and ResourceOwnerForget().
Referenced by pg_cryptohash_free().
|
inlinestatic |
Definition at line 91 of file cryptohash_openssl.c.
References cryptohash_resowner_desc, PointerGetDatum(), and ResourceOwnerRemember().
Referenced by pg_cryptohash_create().
|
static |
Definition at line 383 of file cryptohash_openssl.c.
References DatumGetPointer(), pg_cryptohash_free(), res, and pg_cryptohash_ctx::resowner.
|
static |
Definition at line 103 of file cryptohash_openssl.c.
Referenced by pg_cryptohash_final(), pg_cryptohash_init(), and pg_cryptohash_update().
|
static |
Definition at line 80 of file cryptohash_openssl.c.
Referenced by ResourceOwnerForgetCryptoHash(), and ResourceOwnerRememberCryptoHash().