Skip to content

Commit 7d4838d

Browse files
committed
Remove pgcrypto functions that were deprecated and slated for removal.
Marko Kreen
1 parent 7bae5a2 commit 7d4838d

File tree

5 files changed

+6
-106
lines changed

5 files changed

+6
-106
lines changed

contrib/pgcrypto/README.pgcrypto

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
pgcrypto - cryptographic functions for PostgreSQL
22
=================================================
3-
Marko Kreen <marko@l-t.ee>
3+
Marko Kreen <markokr@gmail.com>
44

55
// Note: this document is in asciidoc format.
66

@@ -79,14 +79,7 @@ As standard in SQL, all functions return NULL, if any of the arguments
7979
are NULL. This may create security risks on careless usage.
8080

8181

82-
2.3. Deprecated functions
83-
~~~~~~~~~~~~~~~~~~~~~~~~~~~
84-
85-
The `digest_exists()`, `hmac_exists()` and `cipher_exists()` functions
86-
are deprecated. The plan is to remove them in PostgreSQL 8.2.
87-
88-
89-
2.4. Security
82+
2.3. Security
9083
~~~~~~~~~~~~~~~
9184

9285
All the functions here run inside database server. That means that all
@@ -714,4 +707,4 @@ http://www.cs.ut.ee/~helger/crypto/[]::
714707
Collection of cryptology pointers.
715708

716709

717-
// $PostgreSQL: pgsql/contrib/pgcrypto/README.pgcrypto,v 1.17 2006/08/05 00:29:11 neilc Exp $
710+
// $PostgreSQL: pgsql/contrib/pgcrypto/README.pgcrypto,v 1.18 2006/09/05 21:26:48 tgl Exp $

contrib/pgcrypto/pgcrypto.c

Lines changed: 1 addition & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2727
* SUCH DAMAGE.
2828
*
29-
* $PostgreSQL: pgsql/contrib/pgcrypto/pgcrypto.c,v 1.22 2006/07/13 04:15:25 neilc Exp $
29+
* $PostgreSQL: pgsql/contrib/pgcrypto/pgcrypto.c,v 1.23 2006/09/05 21:26:48 tgl Exp $
3030
*/
3131

3232
#include "postgres.h"
@@ -87,32 +87,6 @@ pg_digest(PG_FUNCTION_ARGS)
8787
PG_RETURN_BYTEA_P(res);
8888
}
8989

90-
/* check if given hash exists */
91-
PG_FUNCTION_INFO_V1(pg_digest_exists);
92-
93-
Datum
94-
pg_digest_exists(PG_FUNCTION_ARGS)
95-
{
96-
text *name;
97-
PX_MD *res;
98-
99-
if (PG_ARGISNULL(0))
100-
PG_RETURN_NULL();
101-
102-
name = PG_GETARG_TEXT_P(0);
103-
104-
res = find_provider(name, (PFN) px_find_digest, "Digest", 1);
105-
106-
PG_FREE_IF_COPY(name, 0);
107-
108-
if (res == NULL)
109-
PG_RETURN_BOOL(false);
110-
111-
res->free(res);
112-
113-
PG_RETURN_BOOL(true);
114-
}
115-
11690
/* SQL function: hmac(data:bytea, key:bytea, type:text) returns bytea */
11791
PG_FUNCTION_INFO_V1(pg_hmac);
11892

@@ -158,32 +132,6 @@ pg_hmac(PG_FUNCTION_ARGS)
158132
PG_RETURN_BYTEA_P(res);
159133
}
160134

161-
/* check if given hmac type exists */
162-
PG_FUNCTION_INFO_V1(pg_hmac_exists);
163-
164-
Datum
165-
pg_hmac_exists(PG_FUNCTION_ARGS)
166-
{
167-
text *name;
168-
PX_HMAC *h;
169-
170-
if (PG_ARGISNULL(0))
171-
PG_RETURN_NULL();
172-
173-
name = PG_GETARG_TEXT_P(0);
174-
175-
h = find_provider(name, (PFN) px_find_hmac, "HMAC", 1);
176-
177-
PG_FREE_IF_COPY(name, 0);
178-
179-
if (h != NULL)
180-
{
181-
px_hmac_free(h);
182-
PG_RETURN_BOOL(true);
183-
}
184-
PG_RETURN_BOOL(false);
185-
}
186-
187135

188136
/* SQL function: pg_gen_salt(text) returns text */
189137
PG_FUNCTION_INFO_V1(pg_gen_salt);
@@ -565,27 +513,6 @@ pg_random_bytes(PG_FUNCTION_ARGS)
565513
PG_RETURN_BYTEA_P(res);
566514
}
567515

568-
/* SQL function: pg_cipher_exists(text) returns bool */
569-
PG_FUNCTION_INFO_V1(pg_cipher_exists);
570-
571-
Datum
572-
pg_cipher_exists(PG_FUNCTION_ARGS)
573-
{
574-
text *arg;
575-
PX_Combo *c;
576-
577-
if (PG_ARGISNULL(0))
578-
PG_RETURN_NULL();
579-
580-
arg = PG_GETARG_TEXT_P(0);
581-
582-
c = find_provider(arg, (PFN) px_find_combo, "Cipher", 1);
583-
if (c != NULL)
584-
px_combo_free(c);
585-
586-
PG_RETURN_BOOL((c != NULL) ? true : false);
587-
}
588-
589516
static void *
590517
find_provider(text *name,
591518
PFN provider_lookup,

contrib/pgcrypto/pgcrypto.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2727
* SUCH DAMAGE.
2828
*
29-
* $PostgreSQL: pgsql/contrib/pgcrypto/pgcrypto.h,v 1.10 2006/07/13 04:15:25 neilc Exp $
29+
* $PostgreSQL: pgsql/contrib/pgcrypto/pgcrypto.h,v 1.11 2006/09/05 21:26:48 tgl Exp $
3030
*/
3131

3232
#ifndef _PG_CRYPTO_H
@@ -36,17 +36,14 @@
3636

3737
/* exported functions */
3838
Datum pg_digest(PG_FUNCTION_ARGS);
39-
Datum pg_digest_exists(PG_FUNCTION_ARGS);
4039
Datum pg_hmac(PG_FUNCTION_ARGS);
41-
Datum pg_hmac_exists(PG_FUNCTION_ARGS);
4240
Datum pg_gen_salt(PG_FUNCTION_ARGS);
4341
Datum pg_gen_salt_rounds(PG_FUNCTION_ARGS);
4442
Datum pg_crypt(PG_FUNCTION_ARGS);
4543
Datum pg_encrypt(PG_FUNCTION_ARGS);
4644
Datum pg_decrypt(PG_FUNCTION_ARGS);
4745
Datum pg_encrypt_iv(PG_FUNCTION_ARGS);
4846
Datum pg_decrypt_iv(PG_FUNCTION_ARGS);
49-
Datum pg_cipher_exists(PG_FUNCTION_ARGS);
5047
Datum pg_random_bytes(PG_FUNCTION_ARGS);
5148

5249
#endif

contrib/pgcrypto/pgcrypto.sql.in

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,6 @@ RETURNS bytea
1111
AS 'MODULE_PATHNAME', 'pg_digest'
1212
LANGUAGE C IMMUTABLE STRICT;
1313

14-
CREATE OR REPLACE FUNCTION digest_exists(text)
15-
RETURNS bool
16-
AS 'MODULE_PATHNAME', 'pg_digest_exists'
17-
LANGUAGE C IMMUTABLE STRICT;
18-
1914
CREATE OR REPLACE FUNCTION hmac(text, text, text)
2015
RETURNS bytea
2116
AS 'MODULE_PATHNAME', 'pg_hmac'
@@ -26,11 +21,6 @@ RETURNS bytea
2621
AS 'MODULE_PATHNAME', 'pg_hmac'
2722
LANGUAGE C IMMUTABLE STRICT;
2823

29-
CREATE OR REPLACE FUNCTION hmac_exists(text)
30-
RETURNS bool
31-
AS 'MODULE_PATHNAME', 'pg_hmac_exists'
32-
LANGUAGE C IMMUTABLE STRICT;
33-
3424
CREATE OR REPLACE FUNCTION crypt(text, text)
3525
RETURNS text
3626
AS 'MODULE_PATHNAME', 'pg_crypt'
@@ -66,11 +56,6 @@ RETURNS bytea
6656
AS 'MODULE_PATHNAME', 'pg_decrypt_iv'
6757
LANGUAGE C IMMUTABLE STRICT;
6858

69-
CREATE OR REPLACE FUNCTION cipher_exists(text)
70-
RETURNS bool
71-
AS 'MODULE_PATHNAME', 'pg_cipher_exists'
72-
LANGUAGE C IMMUTABLE STRICT;
73-
7459
CREATE OR REPLACE FUNCTION gen_random_bytes(int4)
7560
RETURNS bytea
7661
AS 'MODULE_PATHNAME', 'pg_random_bytes'

contrib/pgcrypto/uninstall_pgcrypto.sql

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,9 @@ SET search_path = public;
33

44
DROP FUNCTION digest(text, text);
55
DROP FUNCTION digest(bytea, text);
6-
DROP FUNCTION digest_exists(text);
76

87
DROP FUNCTION hmac(text, text, text);
98
DROP FUNCTION hmac(bytea, bytea, text);
10-
DROP FUNCTION hmac_exists(text);
119

1210
DROP FUNCTION crypt(text, text);
1311
DROP FUNCTION gen_salt(text);
@@ -17,7 +15,7 @@ DROP FUNCTION encrypt(bytea, bytea, text);
1715
DROP FUNCTION decrypt(bytea, bytea, text);
1816
DROP FUNCTION encrypt_iv(bytea, bytea, bytea, text);
1917
DROP FUNCTION decrypt_iv(bytea, bytea, bytea, text);
20-
DROP FUNCTION cipher_exists(text);
18+
2119
DROP FUNCTION gen_random_bytes(int4);
2220

2321
DROP FUNCTION pgp_sym_encrypt(text, text);

0 commit comments

Comments
 (0)