PostgreSQL Source Code git master
pgcrypto.c File Reference
#include "postgres.h"
#include <ctype.h>
#include "parser/scansup.h"
#include "pgcrypto.h"
#include "px-crypt.h"
#include "px.h"
#include "utils/builtins.h"
#include "utils/guc.h"
#include "varatt.h"
Include dependency graph for pgcrypto.c:

Go to the source code of this file.

Typedefs

typedef int(* PFN) (const char *name, void **res)
 

Functions

static void * find_provider (text *name, PFN provider_lookup, const char *desc, int silent)
 
void _PG_init (void)
 
 PG_FUNCTION_INFO_V1 (pg_digest)
 
Datum pg_digest (PG_FUNCTION_ARGS)
 
 PG_FUNCTION_INFO_V1 (pg_hmac)
 
Datum pg_hmac (PG_FUNCTION_ARGS)
 
 PG_FUNCTION_INFO_V1 (pg_gen_salt)
 
Datum pg_gen_salt (PG_FUNCTION_ARGS)
 
 PG_FUNCTION_INFO_V1 (pg_gen_salt_rounds)
 
Datum pg_gen_salt_rounds (PG_FUNCTION_ARGS)
 
 PG_FUNCTION_INFO_V1 (pg_crypt)
 
Datum pg_crypt (PG_FUNCTION_ARGS)
 
 PG_FUNCTION_INFO_V1 (pg_encrypt)
 
Datum pg_encrypt (PG_FUNCTION_ARGS)
 
 PG_FUNCTION_INFO_V1 (pg_decrypt)
 
Datum pg_decrypt (PG_FUNCTION_ARGS)
 
 PG_FUNCTION_INFO_V1 (pg_encrypt_iv)
 
Datum pg_encrypt_iv (PG_FUNCTION_ARGS)
 
 PG_FUNCTION_INFO_V1 (pg_decrypt_iv)
 
Datum pg_decrypt_iv (PG_FUNCTION_ARGS)
 
 PG_FUNCTION_INFO_V1 (pg_random_bytes)
 
Datum pg_random_bytes (PG_FUNCTION_ARGS)
 
 PG_FUNCTION_INFO_V1 (pg_random_uuid)
 
Datum pg_random_uuid (PG_FUNCTION_ARGS)
 
 PG_FUNCTION_INFO_V1 (pg_check_fipsmode)
 
Datum pg_check_fipsmode (PG_FUNCTION_ARGS)
 

Variables

 PG_MODULE_MAGIC
 
static const struct config_enum_entry builtin_crypto_options []
 
int builtin_crypto_enabled = BC_ON
 

Typedef Documentation

◆ PFN

typedef int(* PFN) (const char *name, void **res)

Definition at line 55 of file pgcrypto.c.

Function Documentation

◆ _PG_init()

void _PG_init ( void  )

Definition at line 65 of file pgcrypto.c.

66{
67 DefineCustomEnumVariable("pgcrypto.builtin_crypto_enabled",
68 "Sets if builtin crypto functions are enabled.",
69 "\"on\" enables builtin crypto, \"off\" unconditionally disables and \"fips\" "
70 "will disable builtin crypto if OpenSSL is in FIPS mode",
72 BC_ON,
75 0,
76 NULL,
77 NULL,
78 NULL);
79 MarkGUCPrefixReserved("pgcrypto");
80}
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)
Definition: guc.c:5243
void MarkGUCPrefixReserved(const char *className)
Definition: guc.c:5279
@ PGC_SUSET
Definition: guc.h:78
static const struct config_enum_entry builtin_crypto_options[]
Definition: pgcrypto.c:48
int builtin_crypto_enabled
Definition: pgcrypto.c:59
@ BC_ON
Definition: px.h:94

References BC_ON, builtin_crypto_enabled, builtin_crypto_options, DefineCustomEnumVariable(), MarkGUCPrefixReserved(), and PGC_SUSET.

◆ find_provider()

static void * find_provider ( text name,
PFN  provider_lookup,
const char *  desc,
int  silent 
)
static

Definition at line 493 of file pgcrypto.c.

496{
497 void *res;
498 char *buf;
499 int err;
500
503 false);
504
505 err = provider_lookup(buf, &res);
506
507 if (err && !silent)
509 (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
510 errmsg("Cannot use \"%s\": %s", buf, px_strerror(err))));
511
512 pfree(buf);
513
514 return err ? NULL : res;
515}
int errcode(int sqlerrcode)
Definition: elog.c:853
int errmsg(const char *fmt,...)
Definition: elog.c:1070
#define ERROR
Definition: elog.h:39
#define ereport(elevel,...)
Definition: elog.h:149
void err(int eval, const char *fmt,...)
Definition: err.c:43
void pfree(void *pointer)
Definition: mcxt.c:1521
static char * buf
Definition: pg_test_fsync.c:72
const char * px_strerror(int err)
Definition: px.c:111
char * downcase_truncate_identifier(const char *ident, int len, bool warn)
Definition: scansup.c:37
#define VARDATA_ANY(PTR)
Definition: varatt.h:324
#define VARSIZE_ANY_EXHDR(PTR)
Definition: varatt.h:317
const char * name

References buf, downcase_truncate_identifier(), ereport, err(), errcode(), errmsg(), ERROR, name, pfree(), px_strerror(), res, VARDATA_ANY, and VARSIZE_ANY_EXHDR.

Referenced by pg_decrypt(), pg_decrypt_iv(), pg_digest(), pg_encrypt(), pg_encrypt_iv(), and pg_hmac().

◆ pg_check_fipsmode()

Datum pg_check_fipsmode ( PG_FUNCTION_ARGS  )

Definition at line 487 of file pgcrypto.c.

488{
490}
#define PG_RETURN_BOOL(x)
Definition: fmgr.h:359
bool CheckFIPSMode(void)
Definition: openssl.c:805

References CheckFIPSMode(), and PG_RETURN_BOOL.

◆ pg_crypt()

Datum pg_crypt ( PG_FUNCTION_ARGS  )

Definition at line 210 of file pgcrypto.c.

211{
212 text *arg0 = PG_GETARG_TEXT_PP(0);
213 text *arg1 = PG_GETARG_TEXT_PP(1);
214 char *buf0,
215 *buf1,
216 *cres,
217 *resbuf;
218 text *res;
219
220 buf0 = text_to_cstring(arg0);
221 buf1 = text_to_cstring(arg1);
222
223 resbuf = palloc0(PX_MAX_CRYPT);
224
225 cres = px_crypt(buf0, buf1, resbuf, PX_MAX_CRYPT);
226
227 pfree(buf0);
228 pfree(buf1);
229
230 if (cres == NULL)
232 (errcode(ERRCODE_EXTERNAL_ROUTINE_INVOCATION_EXCEPTION),
233 errmsg("crypt(3) returned NULL")));
234
235 res = cstring_to_text(cres);
236
237 pfree(resbuf);
238
239 PG_FREE_IF_COPY(arg0, 0);
240 PG_FREE_IF_COPY(arg1, 1);
241
243}
#define PG_FREE_IF_COPY(ptr, n)
Definition: fmgr.h:260
#define PG_GETARG_TEXT_PP(n)
Definition: fmgr.h:309
#define PG_RETURN_TEXT_P(x)
Definition: fmgr.h:372
void * palloc0(Size size)
Definition: mcxt.c:1347
char * px_crypt(const char *psw, const char *salt, char *buf, unsigned len)
Definition: px-crypt.c:90
#define PX_MAX_CRYPT
Definition: px-crypt.h:36
Definition: c.h:644
text * cstring_to_text(const char *s)
Definition: varlena.c:184
char * text_to_cstring(const text *t)
Definition: varlena.c:217

References cstring_to_text(), ereport, errcode(), errmsg(), ERROR, palloc0(), pfree(), PG_FREE_IF_COPY, PG_GETARG_TEXT_PP, PG_RETURN_TEXT_P, px_crypt(), PX_MAX_CRYPT, res, and text_to_cstring().

◆ pg_decrypt()

Datum pg_decrypt ( PG_FUNCTION_ARGS  )

Definition at line 298 of file pgcrypto.c.

299{
300 int err;
301 bytea *data,
302 *key,
303 *res;
304 text *type;
305 PX_Combo *c;
306 unsigned dlen,
307 klen,
308 rlen;
309
311 c = find_provider(type, (PFN) px_find_combo, "Cipher", 0);
312
315 dlen = VARSIZE_ANY_EXHDR(data);
316 klen = VARSIZE_ANY_EXHDR(key);
317
318 rlen = px_combo_decrypt_len(c, dlen);
319 res = palloc(VARHDRSZ + rlen);
320
321 err = px_combo_init(c, (uint8 *) VARDATA_ANY(key), klen, NULL, 0);
322 if (!err)
324 (uint8 *) VARDATA(res), &rlen);
325
327
328 if (err)
330 (errcode(ERRCODE_EXTERNAL_ROUTINE_INVOCATION_EXCEPTION),
331 errmsg("decrypt error: %s", px_strerror(err))));
332
333 SET_VARSIZE(res, VARHDRSZ + rlen);
334
338
340}
uint8_t uint8
Definition: c.h:486
#define VARHDRSZ
Definition: c.h:649
#define PG_GETARG_BYTEA_PP(n)
Definition: fmgr.h:308
#define PG_RETURN_BYTEA_P(x)
Definition: fmgr.h:371
void * palloc(Size size)
Definition: mcxt.c:1317
const void * data
static void * find_provider(text *name, PFN provider_lookup, const char *desc, int silent)
Definition: pgcrypto.c:493
int(* PFN)(const char *name, void **res)
Definition: pgcrypto.c:55
char * c
int px_find_combo(const char *name, PX_Combo **res)
Definition: px.c:285
#define px_combo_init(c, key, klen, iv, ivlen)
Definition: px.h:231
#define px_combo_decrypt_len(c, dlen)
Definition: px.h:230
#define px_combo_free(c)
Definition: px.h:237
#define px_combo_decrypt(c, data, dlen, res, rlen)
Definition: px.h:235
Definition: px.h:164
#define VARDATA(PTR)
Definition: varatt.h:278
#define SET_VARSIZE(PTR, len)
Definition: varatt.h:305
const char * type

References data, ereport, err(), errcode(), errmsg(), ERROR, find_provider(), sort-test::key, palloc(), PG_FREE_IF_COPY, PG_GETARG_BYTEA_PP, PG_GETARG_TEXT_PP, PG_RETURN_BYTEA_P, px_combo_decrypt, px_combo_decrypt_len, px_combo_free, px_combo_init, px_find_combo(), px_strerror(), res, SET_VARSIZE, type, VARDATA, VARDATA_ANY, VARHDRSZ, and VARSIZE_ANY_EXHDR.

◆ pg_decrypt_iv()

Datum pg_decrypt_iv ( PG_FUNCTION_ARGS  )

Definition at line 400 of file pgcrypto.c.

401{
402 int err;
403 bytea *data,
404 *key,
405 *iv,
406 *res;
407 text *type;
408 PX_Combo *c;
409 unsigned dlen,
410 klen,
411 rlen,
412 ivlen;
413
415 c = find_provider(type, (PFN) px_find_combo, "Cipher", 0);
416
419 iv = PG_GETARG_BYTEA_PP(2);
420 dlen = VARSIZE_ANY_EXHDR(data);
421 klen = VARSIZE_ANY_EXHDR(key);
422 ivlen = VARSIZE_ANY_EXHDR(iv);
423
424 rlen = px_combo_decrypt_len(c, dlen);
425 res = palloc(VARHDRSZ + rlen);
426
427 err = px_combo_init(c, (uint8 *) VARDATA_ANY(key), klen,
428 (uint8 *) VARDATA_ANY(iv), ivlen);
429 if (!err)
431 (uint8 *) VARDATA(res), &rlen);
432
434
435 if (err)
437 (errcode(ERRCODE_EXTERNAL_ROUTINE_INVOCATION_EXCEPTION),
438 errmsg("decrypt_iv error: %s", px_strerror(err))));
439
440 SET_VARSIZE(res, VARHDRSZ + rlen);
441
444 PG_FREE_IF_COPY(iv, 2);
446
448}

References data, ereport, err(), errcode(), errmsg(), ERROR, find_provider(), sort-test::key, palloc(), PG_FREE_IF_COPY, PG_GETARG_BYTEA_PP, PG_GETARG_TEXT_PP, PG_RETURN_BYTEA_P, px_combo_decrypt, px_combo_decrypt_len, px_combo_free, px_combo_init, px_find_combo(), px_strerror(), res, SET_VARSIZE, type, VARDATA, VARDATA_ANY, VARHDRSZ, and VARSIZE_ANY_EXHDR.

◆ pg_digest()

Datum pg_digest ( PG_FUNCTION_ARGS  )

Definition at line 86 of file pgcrypto.c.

87{
88 bytea *arg;
89 text *name;
90 unsigned len,
91 hlen;
92 PX_MD *md;
93 bytea *res;
94
96
97 /* will give error if fails */
98 md = find_provider(name, (PFN) px_find_digest, "Digest", 0);
99
100 hlen = px_md_result_size(md);
101
102 res = (text *) palloc(hlen + VARHDRSZ);
103 SET_VARSIZE(res, hlen + VARHDRSZ);
104
107
109 px_md_finish(md, (uint8 *) VARDATA(res));
110 px_md_free(md);
111
114
116}
int px_find_digest(const char *name, PX_MD **res)
Definition: openssl.c:161
void * arg
const void size_t len
#define px_md_finish(md, buf)
Definition: px.h:206
#define px_md_free(md)
Definition: px.h:207
#define px_md_update(md, data, dlen)
Definition: px.h:205
#define px_md_result_size(md)
Definition: px.h:202
Definition: px.h:108

References arg, find_provider(), len, name, palloc(), PG_FREE_IF_COPY, PG_GETARG_BYTEA_PP, PG_GETARG_TEXT_PP, PG_RETURN_BYTEA_P, px_find_digest(), px_md_finish, px_md_free, px_md_result_size, px_md_update, res, SET_VARSIZE, VARDATA, VARDATA_ANY, VARHDRSZ, and VARSIZE_ANY_EXHDR.

◆ pg_encrypt()

Datum pg_encrypt ( PG_FUNCTION_ARGS  )

Definition at line 249 of file pgcrypto.c.

250{
251 int err;
252 bytea *data,
253 *key,
254 *res;
255 text *type;
256 PX_Combo *c;
257 unsigned dlen,
258 klen,
259 rlen;
260
262 c = find_provider(type, (PFN) px_find_combo, "Cipher", 0);
263
266 dlen = VARSIZE_ANY_EXHDR(data);
267 klen = VARSIZE_ANY_EXHDR(key);
268
269 rlen = px_combo_encrypt_len(c, dlen);
270 res = palloc(VARHDRSZ + rlen);
271
272 err = px_combo_init(c, (uint8 *) VARDATA_ANY(key), klen, NULL, 0);
273 if (!err)
275 (uint8 *) VARDATA(res), &rlen);
277
281
282 if (err)
283 {
284 pfree(res);
286 (errcode(ERRCODE_EXTERNAL_ROUTINE_INVOCATION_EXCEPTION),
287 errmsg("encrypt error: %s", px_strerror(err))));
288 }
289
290 SET_VARSIZE(res, VARHDRSZ + rlen);
292}
#define px_combo_encrypt_len(c, dlen)
Definition: px.h:229
#define px_combo_encrypt(c, data, dlen, res, rlen)
Definition: px.h:233

References data, ereport, err(), errcode(), errmsg(), ERROR, find_provider(), sort-test::key, palloc(), pfree(), PG_FREE_IF_COPY, PG_GETARG_BYTEA_PP, PG_GETARG_TEXT_PP, PG_RETURN_BYTEA_P, px_combo_encrypt, px_combo_encrypt_len, px_combo_free, px_combo_init, px_find_combo(), px_strerror(), res, SET_VARSIZE, type, VARDATA, VARDATA_ANY, VARHDRSZ, and VARSIZE_ANY_EXHDR.

◆ pg_encrypt_iv()

Datum pg_encrypt_iv ( PG_FUNCTION_ARGS  )

Definition at line 346 of file pgcrypto.c.

347{
348 int err;
349 bytea *data,
350 *key,
351 *iv,
352 *res;
353 text *type;
354 PX_Combo *c;
355 unsigned dlen,
356 klen,
357 ivlen,
358 rlen;
359
361 c = find_provider(type, (PFN) px_find_combo, "Cipher", 0);
362
365 iv = PG_GETARG_BYTEA_PP(2);
366 dlen = VARSIZE_ANY_EXHDR(data);
367 klen = VARSIZE_ANY_EXHDR(key);
368 ivlen = VARSIZE_ANY_EXHDR(iv);
369
370 rlen = px_combo_encrypt_len(c, dlen);
371 res = palloc(VARHDRSZ + rlen);
372
373 err = px_combo_init(c, (uint8 *) VARDATA_ANY(key), klen,
374 (uint8 *) VARDATA_ANY(iv), ivlen);
375 if (!err)
377 (uint8 *) VARDATA(res), &rlen);
378
380
381 if (err)
383 (errcode(ERRCODE_EXTERNAL_ROUTINE_INVOCATION_EXCEPTION),
384 errmsg("encrypt_iv error: %s", px_strerror(err))));
385
386 SET_VARSIZE(res, VARHDRSZ + rlen);
387
390 PG_FREE_IF_COPY(iv, 2);
392
394}

References data, ereport, err(), errcode(), errmsg(), ERROR, find_provider(), sort-test::key, palloc(), PG_FREE_IF_COPY, PG_GETARG_BYTEA_PP, PG_GETARG_TEXT_PP, PG_RETURN_BYTEA_P, px_combo_encrypt, px_combo_encrypt_len, px_combo_free, px_combo_init, px_find_combo(), px_strerror(), res, SET_VARSIZE, type, VARDATA, VARDATA_ANY, VARHDRSZ, and VARSIZE_ANY_EXHDR.

◆ PG_FUNCTION_INFO_V1() [1/12]

PG_FUNCTION_INFO_V1 ( pg_check_fipsmode  )

◆ PG_FUNCTION_INFO_V1() [2/12]

PG_FUNCTION_INFO_V1 ( pg_crypt  )

◆ PG_FUNCTION_INFO_V1() [3/12]

PG_FUNCTION_INFO_V1 ( pg_decrypt  )

◆ PG_FUNCTION_INFO_V1() [4/12]

PG_FUNCTION_INFO_V1 ( pg_decrypt_iv  )

◆ PG_FUNCTION_INFO_V1() [5/12]

PG_FUNCTION_INFO_V1 ( pg_digest  )

◆ PG_FUNCTION_INFO_V1() [6/12]

PG_FUNCTION_INFO_V1 ( pg_encrypt  )

◆ PG_FUNCTION_INFO_V1() [7/12]

PG_FUNCTION_INFO_V1 ( pg_encrypt_iv  )

◆ PG_FUNCTION_INFO_V1() [8/12]

PG_FUNCTION_INFO_V1 ( pg_gen_salt  )

◆ PG_FUNCTION_INFO_V1() [9/12]

PG_FUNCTION_INFO_V1 ( pg_gen_salt_rounds  )

◆ PG_FUNCTION_INFO_V1() [10/12]

PG_FUNCTION_INFO_V1 ( pg_hmac  )

◆ PG_FUNCTION_INFO_V1() [11/12]

PG_FUNCTION_INFO_V1 ( pg_random_bytes  )

◆ PG_FUNCTION_INFO_V1() [12/12]

PG_FUNCTION_INFO_V1 ( pg_random_uuid  )

◆ pg_gen_salt()

Datum pg_gen_salt ( PG_FUNCTION_ARGS  )

Definition at line 165 of file pgcrypto.c.

166{
167 text *arg0 = PG_GETARG_TEXT_PP(0);
168 int len;
169 char buf[PX_MAX_SALT_LEN + 1];
170
171 text_to_cstring_buffer(arg0, buf, sizeof(buf));
172 len = px_gen_salt(buf, buf, 0);
173 if (len < 0)
175 (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
176 errmsg("gen_salt: %s", px_strerror(len))));
177
178 PG_FREE_IF_COPY(arg0, 0);
179
181}
int px_gen_salt(const char *salt_type, char *buf, int rounds)
Definition: px-crypt.c:134
#define PX_MAX_SALT_LEN
Definition: px-crypt.h:39
text * cstring_to_text_with_len(const char *s, int len)
Definition: varlena.c:196
void text_to_cstring_buffer(const text *src, char *dst, size_t dst_len)
Definition: varlena.c:248

References buf, cstring_to_text_with_len(), ereport, errcode(), errmsg(), ERROR, len, PG_FREE_IF_COPY, PG_GETARG_TEXT_PP, PG_RETURN_TEXT_P, px_gen_salt(), PX_MAX_SALT_LEN, px_strerror(), and text_to_cstring_buffer().

◆ pg_gen_salt_rounds()

Datum pg_gen_salt_rounds ( PG_FUNCTION_ARGS  )

Definition at line 187 of file pgcrypto.c.

188{
189 text *arg0 = PG_GETARG_TEXT_PP(0);
190 int rounds = PG_GETARG_INT32(1);
191 int len;
192 char buf[PX_MAX_SALT_LEN + 1];
193
194 text_to_cstring_buffer(arg0, buf, sizeof(buf));
195 len = px_gen_salt(buf, buf, rounds);
196 if (len < 0)
198 (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
199 errmsg("gen_salt: %s", px_strerror(len))));
200
201 PG_FREE_IF_COPY(arg0, 0);
202
204}
#define PG_GETARG_INT32(n)
Definition: fmgr.h:269

References buf, cstring_to_text_with_len(), ereport, errcode(), errmsg(), ERROR, len, PG_FREE_IF_COPY, PG_GETARG_INT32, PG_GETARG_TEXT_PP, PG_RETURN_TEXT_P, px_gen_salt(), PX_MAX_SALT_LEN, px_strerror(), and text_to_cstring_buffer().

◆ pg_hmac()

Datum pg_hmac ( PG_FUNCTION_ARGS  )

Definition at line 122 of file pgcrypto.c.

123{
124 bytea *arg;
125 bytea *key;
126 text *name;
127 unsigned len,
128 hlen,
129 klen;
130 PX_HMAC *h;
131 bytea *res;
132
134
135 /* will give error if fails */
136 h = find_provider(name, (PFN) px_find_hmac, "HMAC", 0);
137
138 hlen = px_hmac_result_size(h);
139
140 res = (text *) palloc(hlen + VARHDRSZ);
141 SET_VARSIZE(res, hlen + VARHDRSZ);
142
146 klen = VARSIZE_ANY_EXHDR(key);
147
148 px_hmac_init(h, (uint8 *) VARDATA_ANY(key), klen);
151 px_hmac_free(h);
152
156
158}
int px_find_hmac(const char *name, PX_HMAC **res)
Definition: px-hmac.c:142
#define px_hmac_result_size(hmac)
Definition: px.h:209
#define px_hmac_finish(hmac, buf)
Definition: px.h:214
#define px_hmac_update(hmac, data, dlen)
Definition: px.h:213
#define px_hmac_init(hmac, key, klen)
Definition: px.h:212
#define px_hmac_free(hmac)
Definition: px.h:215
Definition: px.h:130

References arg, find_provider(), sort-test::key, len, name, palloc(), PG_FREE_IF_COPY, PG_GETARG_BYTEA_PP, PG_GETARG_TEXT_PP, PG_RETURN_BYTEA_P, px_find_hmac(), px_hmac_finish, px_hmac_free, px_hmac_init, px_hmac_result_size, px_hmac_update, res, SET_VARSIZE, VARDATA, VARDATA_ANY, VARHDRSZ, and VARSIZE_ANY_EXHDR.

◆ pg_random_bytes()

Datum pg_random_bytes ( PG_FUNCTION_ARGS  )

Definition at line 454 of file pgcrypto.c.

455{
456 int len = PG_GETARG_INT32(0);
457 bytea *res;
458
459 if (len < 1 || len > 1024)
461 (errcode(ERRCODE_EXTERNAL_ROUTINE_INVOCATION_EXCEPTION),
462 errmsg("Length not in range")));
463
464 res = palloc(VARHDRSZ + len);
466
467 /* generate result */
470
472}
bool pg_strong_random(void *buf, size_t len)
void px_THROW_ERROR(int err)
Definition: px.c:93
#define PXE_NO_RANDOM
Definition: px.h:63

References ereport, errcode(), errmsg(), ERROR, len, palloc(), PG_GETARG_INT32, PG_RETURN_BYTEA_P, pg_strong_random(), px_THROW_ERROR(), PXE_NO_RANDOM, res, SET_VARSIZE, VARDATA, and VARHDRSZ.

◆ pg_random_uuid()

Datum pg_random_uuid ( PG_FUNCTION_ARGS  )

Definition at line 478 of file pgcrypto.c.

479{
480 /* redirect to built-in function */
481 return gen_random_uuid(fcinfo);
482}
Datum gen_random_uuid(PG_FUNCTION_ARGS)
Definition: uuid.c:456

References gen_random_uuid().

Variable Documentation

◆ builtin_crypto_enabled

int builtin_crypto_enabled = BC_ON

Definition at line 59 of file pgcrypto.c.

Referenced by _PG_init(), and CheckBuiltinCryptoMode().

◆ builtin_crypto_options

const struct config_enum_entry builtin_crypto_options[]
static
Initial value:
= {
{"on", BC_ON, false},
{"off", BC_OFF, false},
{"fips", BC_FIPS, false},
{NULL, 0, false}
}
@ BC_OFF
Definition: px.h:95
@ BC_FIPS
Definition: px.h:96

Definition at line 48 of file pgcrypto.c.

Referenced by _PG_init().

◆ PG_MODULE_MAGIC

PG_MODULE_MAGIC

Definition at line 44 of file pgcrypto.c.