Skip to content

Commit

Permalink
added randombytes_buf and uniform
Browse files Browse the repository at this point in the history
  • Loading branch information
michelp committed Apr 17, 2017
1 parent 0225515 commit 7da28a0
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,4 @@
# Debug files
*.dSYM/
*.su
*~
9 changes: 6 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
#http://blog.pgxn.org/post/4783001135/extension-makefiles pg makefiles

EXTENSION = pgsodium
PG_CONFIG ?= pg_config
DATA = $(wildcard *--*.sql)
PGXS := $(shell $(PG_CONFIG) --pgxs)
MODULE_big = pgsodium
OBJS = $(patsubst %.c,%.o,$(wildcard src/*.c))
#TESTS = $(wildcard test/sql/*.sql)
#REGRESS = $(patsubst test/sql/%.sql,%,$(TESTS))
#REGRESS_OPTS = --inputdir=test --load-language=plpgsql
SHLIB_LINK = -lsodium

TESTS = $(wildcard test/sql/*.sql)
REGRESS = $(patsubst test/sql/%.sql,%,$(TESTS))
REGRESS_OPTS = --inputdir=test --load-language=plpgsql
include $(PGXS)

16 changes: 16 additions & 0 deletions pgsodium--0.0.1.sql
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
-- complain if script is sourced in psql, rather than via CREATE EXTENSION
\echo Use "CREATE EXTENSION pgsodium" to load this file. \quit

CREATE FUNCTION pgsodium_randombytes_random()
RETURNS integer
AS '$libdir/pgsodium'
LANGUAGE C IMMUTABLE STRICT;

CREATE FUNCTION pgsodium_randombytes_uniform(integer)
RETURNS integer
AS '$libdir/pgsodium'
LANGUAGE C IMMUTABLE STRICT;

CREATE FUNCTION pgsodium_randombytes_buf(integer)
RETURNS bytea
AS '$libdir/pgsodium'
LANGUAGE C IMMUTABLE STRICT;


0 comments on commit 7da28a0

Please sign in to comment.