58typedef int (*
PFN) (
const char *
name,
void **res);
71 "Sets if builtin crypto functions are enabled.",
72 "\"on\" enables builtin crypto, \"off\" unconditionally disables and \"fips\" "
73 "will disable builtin crypto if OpenSSL is in FIPS mode",
178 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
201 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
235 (
errcode(ERRCODE_EXTERNAL_ROUTINE_INVOCATION_EXCEPTION),
236 errmsg(
"crypt(3) returned NULL")));
289 (
errcode(ERRCODE_EXTERNAL_ROUTINE_INVOCATION_EXCEPTION),
333 (
errcode(ERRCODE_EXTERNAL_ROUTINE_INVOCATION_EXCEPTION),
386 (
errcode(ERRCODE_EXTERNAL_ROUTINE_INVOCATION_EXCEPTION),
440 (
errcode(ERRCODE_EXTERNAL_ROUTINE_INVOCATION_EXCEPTION),
462 if (len < 1 || len > 1024)
464 (
errcode(ERRCODE_EXTERNAL_ROUTINE_INVOCATION_EXCEPTION),
465 errmsg(
"Length not in range")));
498 const char *desc,
int silent)
508 err = provider_lookup(
buf, &res);
512 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
517 return err ? NULL : res;
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereport(elevel,...)
void err(int eval, const char *fmt,...)
#define PG_FREE_IF_COPY(ptr, n)
#define PG_GETARG_BYTEA_PP(n)
#define PG_GETARG_TEXT_PP(n)
#define PG_RETURN_BYTEA_P(x)
#define PG_RETURN_TEXT_P(x)
#define PG_GETARG_INT32(n)
#define PG_RETURN_BOOL(x)
void DefineCustomEnumVariable(const char *name, const char *short_desc, const char *long_desc, int *valueAddr, int bootValue, const struct config_enum_entry *options, GucContext context, int flags, GucEnumCheckHook check_hook, GucEnumAssignHook assign_hook, GucShowHook show_hook)
void MarkGUCPrefixReserved(const char *className)
void pfree(void *pointer)
void * palloc0(Size size)
int px_find_digest(const char *name, PX_MD **res)
Datum pg_encrypt_iv(PG_FUNCTION_ARGS)
static const struct config_enum_entry builtin_crypto_options[]
Datum pg_encrypt(PG_FUNCTION_ARGS)
static void * find_provider(text *name, PFN provider_lookup, const char *desc, int silent)
Datum pg_check_fipsmode(PG_FUNCTION_ARGS)
Datum pg_gen_salt_rounds(PG_FUNCTION_ARGS)
Datum pg_decrypt_iv(PG_FUNCTION_ARGS)
PG_MODULE_MAGIC_EXT(.name="pgcrypto",.version=PG_VERSION)
Datum pg_random_uuid(PG_FUNCTION_ARGS)
Datum pg_hmac(PG_FUNCTION_ARGS)
Datum pg_crypt(PG_FUNCTION_ARGS)
int(* PFN)(const char *name, void **res)
Datum pg_random_bytes(PG_FUNCTION_ARGS)
PG_FUNCTION_INFO_V1(pg_digest)
Datum pg_gen_salt(PG_FUNCTION_ARGS)
int builtin_crypto_enabled
Datum pg_digest(PG_FUNCTION_ARGS)
Datum pg_decrypt(PG_FUNCTION_ARGS)
bool pg_strong_random(void *buf, size_t len)
int px_gen_salt(const char *salt_type, char *buf, int rounds)
char * px_crypt(const char *psw, const char *salt, char *buf, unsigned len)
int px_find_hmac(const char *name, PX_HMAC **res)
void px_THROW_ERROR(int err)
const char * px_strerror(int err)
int px_find_combo(const char *name, PX_Combo **res)
#define px_md_finish(md, buf)
#define px_combo_init(c, key, klen, iv, ivlen)
#define px_hmac_result_size(hmac)
#define px_hmac_finish(hmac, buf)
#define px_combo_encrypt_len(c, dlen)
#define px_hmac_update(hmac, data, dlen)
#define px_hmac_init(hmac, key, klen)
#define px_combo_encrypt(c, data, dlen, res, rlen)
#define px_hmac_free(hmac)
#define px_combo_decrypt_len(c, dlen)
#define px_combo_decrypt(c, data, dlen, res, rlen)
#define px_md_update(md, data, dlen)
#define px_md_result_size(md)
char * downcase_truncate_identifier(const char *ident, int len, bool warn)
Datum gen_random_uuid(PG_FUNCTION_ARGS)
#define SET_VARSIZE(PTR, len)
#define VARSIZE_ANY_EXHDR(PTR)
text * cstring_to_text_with_len(const char *s, int len)
text * cstring_to_text(const char *s)
void text_to_cstring_buffer(const text *src, char *dst, size_t dst_len)
char * text_to_cstring(const text *t)