hawq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From h...@apache.org
Subject [10/11] incubator-hawq git commit: HAWQ-394. Remove pgcrypto from code base
Date Mon, 16 May 2016 06:40:41 GMT
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/101adfab/contrib/pgcrypto/crypt-des.c
----------------------------------------------------------------------
diff --git a/contrib/pgcrypto/crypt-des.c b/contrib/pgcrypto/crypt-des.c
deleted file mode 100644
index 0337bfc..0000000
--- a/contrib/pgcrypto/crypt-des.c
+++ /dev/null
@@ -1,775 +0,0 @@
-/*
- * FreeSec: libcrypt for NetBSD
- *
- * $PostgreSQL: pgsql/contrib/pgcrypto/crypt-des.c,v 1.15 2006/07/13 04:15:24 neilc Exp $
- *
- * Copyright (c) 1994 David Burren
- * All rights reserved.
- *
- * Adapted for FreeBSD-2.0 by Geoffrey M. Rehmet
- *	this file should now *only* export crypt(), in order to make
- *	binaries of libcrypt exportable from the USA
- *
- * Adapted for FreeBSD-4.0 by Mark R V Murray
- *	this file should now *only* export crypt_des(), in order to make
- *	a module that can be optionally included in libcrypt.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *	  notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *	  notice, this list of conditions and the following disclaimer in the
- *	  documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the author nor the names of other contributors
- *	  may be used to endorse or promote products derived from this software
- *	  without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.	IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $FreeBSD: src/secure/lib/libcrypt/crypt-des.c,v 1.12 1999/09/20 12:39:20 markm Exp $
- *
- * This is an original implementation of the DES and the crypt(3) interfaces
- * by David Burren <davidb@werj.com.au>.
- *
- * An excellent reference on the underlying algorithm (and related
- * algorithms) is:
- *
- *	B. Schneier, Applied Cryptography: protocols, algorithms,
- *	and source code in C, John Wiley & Sons, 1994.
- *
- * Note that in that book's description of DES the lookups for the initial,
- * pbox, and final permutations are inverted (this has been brought to the
- * attention of the author).  A list of errata for this book has been
- * posted to the sci.crypt newsgroup by the author and is available for FTP.
- *
- * ARCHITECTURE ASSUMPTIONS:
- *	It is assumed that the 8-byte arrays passed by reference can be
- *	addressed as arrays of uint32's (ie. the CPU is not picky about
- *	alignment).
- */
-
-#include "postgres.h"
-
-#include "px.h"
-#include "px-crypt.h"
-
-/* for ntohl/htonl */
-#include <netinet/in.h>
-#include <arpa/inet.h>
-
-#define _PASSWORD_EFMT1 '_'
-
-static const char _crypt_a64[] =
-"./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
-
-static uint8 IP[64] = {
-	58, 50, 42, 34, 26, 18, 10, 2, 60, 52, 44, 36, 28, 20, 12, 4,
-	62, 54, 46, 38, 30, 22, 14, 6, 64, 56, 48, 40, 32, 24, 16, 8,
-	57, 49, 41, 33, 25, 17, 9, 1, 59, 51, 43, 35, 27, 19, 11, 3,
-	61, 53, 45, 37, 29, 21, 13, 5, 63, 55, 47, 39, 31, 23, 15, 7
-};
-
-static uint8 inv_key_perm[64];
-static uint8 u_key_perm[56];
-static uint8 key_perm[56] = {
-	57, 49, 41, 33, 25, 17, 9, 1, 58, 50, 42, 34, 26, 18,
-	10, 2, 59, 51, 43, 35, 27, 19, 11, 3, 60, 52, 44, 36,
-	63, 55, 47, 39, 31, 23, 15, 7, 62, 54, 46, 38, 30, 22,
-	14, 6, 61, 53, 45, 37, 29, 21, 13, 5, 28, 20, 12, 4
-};
-
-static uint8 key_shifts[16] = {
-	1, 1, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 1
-};
-
-static uint8 inv_comp_perm[56];
-static uint8 comp_perm[48] = {
-	14, 17, 11, 24, 1, 5, 3, 28, 15, 6, 21, 10,
-	23, 19, 12, 4, 26, 8, 16, 7, 27, 20, 13, 2,
-	41, 52, 31, 37, 47, 55, 30, 40, 51, 45, 33, 48,
-	44, 49, 39, 56, 34, 53, 46, 42, 50, 36, 29, 32
-};
-
-/*
- *	No E box is used, as it's replaced by some ANDs, shifts, and ORs.
- */
-
-static uint8 u_sbox[8][64];
-static uint8 sbox[8][64] = {
-	{
-		14, 4, 13, 1, 2, 15, 11, 8, 3, 10, 6, 12, 5, 9, 0, 7,
-		0, 15, 7, 4, 14, 2, 13, 1, 10, 6, 12, 11, 9, 5, 3, 8,
-		4, 1, 14, 8, 13, 6, 2, 11, 15, 12, 9, 7, 3, 10, 5, 0,
-		15, 12, 8, 2, 4, 9, 1, 7, 5, 11, 3, 14, 10, 0, 6, 13
-	},
-	{
-		15, 1, 8, 14, 6, 11, 3, 4, 9, 7, 2, 13, 12, 0, 5, 10,
-		3, 13, 4, 7, 15, 2, 8, 14, 12, 0, 1, 10, 6, 9, 11, 5,
-		0, 14, 7, 11, 10, 4, 13, 1, 5, 8, 12, 6, 9, 3, 2, 15,
-		13, 8, 10, 1, 3, 15, 4, 2, 11, 6, 7, 12, 0, 5, 14, 9
-	},
-	{
-		10, 0, 9, 14, 6, 3, 15, 5, 1, 13, 12, 7, 11, 4, 2, 8,
-		13, 7, 0, 9, 3, 4, 6, 10, 2, 8, 5, 14, 12, 11, 15, 1,
-		13, 6, 4, 9, 8, 15, 3, 0, 11, 1, 2, 12, 5, 10, 14, 7,
-		1, 10, 13, 0, 6, 9, 8, 7, 4, 15, 14, 3, 11, 5, 2, 12
-	},
-	{
-		7, 13, 14, 3, 0, 6, 9, 10, 1, 2, 8, 5, 11, 12, 4, 15,
-		13, 8, 11, 5, 6, 15, 0, 3, 4, 7, 2, 12, 1, 10, 14, 9,
-		10, 6, 9, 0, 12, 11, 7, 13, 15, 1, 3, 14, 5, 2, 8, 4,
-		3, 15, 0, 6, 10, 1, 13, 8, 9, 4, 5, 11, 12, 7, 2, 14
-	},
-	{
-		2, 12, 4, 1, 7, 10, 11, 6, 8, 5, 3, 15, 13, 0, 14, 9,
-		14, 11, 2, 12, 4, 7, 13, 1, 5, 0, 15, 10, 3, 9, 8, 6,
-		4, 2, 1, 11, 10, 13, 7, 8, 15, 9, 12, 5, 6, 3, 0, 14,
-		11, 8, 12, 7, 1, 14, 2, 13, 6, 15, 0, 9, 10, 4, 5, 3
-	},
-	{
-		12, 1, 10, 15, 9, 2, 6, 8, 0, 13, 3, 4, 14, 7, 5, 11,
-		10, 15, 4, 2, 7, 12, 9, 5, 6, 1, 13, 14, 0, 11, 3, 8,
-		9, 14, 15, 5, 2, 8, 12, 3, 7, 0, 4, 10, 1, 13, 11, 6,
-		4, 3, 2, 12, 9, 5, 15, 10, 11, 14, 1, 7, 6, 0, 8, 13
-	},
-	{
-		4, 11, 2, 14, 15, 0, 8, 13, 3, 12, 9, 7, 5, 10, 6, 1,
-		13, 0, 11, 7, 4, 9, 1, 10, 14, 3, 5, 12, 2, 15, 8, 6,
-		1, 4, 11, 13, 12, 3, 7, 14, 10, 15, 6, 8, 0, 5, 9, 2,
-		6, 11, 13, 8, 1, 4, 10, 7, 9, 5, 0, 15, 14, 2, 3, 12
-	},
-	{
-		13, 2, 8, 4, 6, 15, 11, 1, 10, 9, 3, 14, 5, 0, 12, 7,
-		1, 15, 13, 8, 10, 3, 7, 4, 12, 5, 6, 11, 0, 14, 9, 2,
-		7, 11, 4, 1, 9, 12, 14, 2, 0, 6, 10, 13, 15, 3, 5, 8,
-		2, 1, 14, 7, 4, 10, 8, 13, 15, 12, 9, 0, 3, 5, 6, 11
-	}
-};
-
-static uint8 un_pbox[32];
-static uint8 pbox[32] = {
-	16, 7, 20, 21, 29, 12, 28, 17, 1, 15, 23, 26, 5, 18, 31, 10,
-	2, 8, 24, 14, 32, 27, 3, 9, 19, 13, 30, 6, 22, 11, 4, 25
-};
-
-static uint32 _crypt_bits32[32] =
-{
-	0x80000000, 0x40000000, 0x20000000, 0x10000000,
-	0x08000000, 0x04000000, 0x02000000, 0x01000000,
-	0x00800000, 0x00400000, 0x00200000, 0x00100000,
-	0x00080000, 0x00040000, 0x00020000, 0x00010000,
-	0x00008000, 0x00004000, 0x00002000, 0x00001000,
-	0x00000800, 0x00000400, 0x00000200, 0x00000100,
-	0x00000080, 0x00000040, 0x00000020, 0x00000010,
-	0x00000008, 0x00000004, 0x00000002, 0x00000001
-};
-
-static uint8 _crypt_bits8[8] = {0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01};
-
-static uint32 saltbits;
-static long old_salt;
-static uint32 *bits28,
-		   *bits24;
-static uint8 init_perm[64],
-			final_perm[64];
-static uint32 en_keysl[16],
-			en_keysr[16];
-static uint32 de_keysl[16],
-			de_keysr[16];
-static int	des_initialised = 0;
-static uint8 m_sbox[4][4096];
-static uint32 psbox[4][256];
-static uint32 ip_maskl[8][256],
-			ip_maskr[8][256];
-static uint32 fp_maskl[8][256],
-			fp_maskr[8][256];
-static uint32 key_perm_maskl[8][128],
-			key_perm_maskr[8][128];
-static uint32 comp_maskl[8][128],
-			comp_maskr[8][128];
-static uint32 old_rawkey0,
-			old_rawkey1;
-
-static inline int
-ascii_to_bin(char ch)
-{
-	if (ch > 'z')
-		return (0);
-	if (ch >= 'a')
-		return (ch - 'a' + 38);
-	if (ch > 'Z')
-		return (0);
-	if (ch >= 'A')
-		return (ch - 'A' + 12);
-	if (ch > '9')
-		return (0);
-	if (ch >= '.')
-		return (ch - '.');
-	return (0);
-}
-
-static void
-des_init(void)
-{
-	int			i,
-				j,
-				b,
-				k,
-				inbit,
-				obit;
-	uint32	   *p,
-			   *il,
-			   *ir,
-			   *fl,
-			   *fr;
-
-	old_rawkey0 = old_rawkey1 = 0L;
-	saltbits = 0L;
-	old_salt = 0L;
-	bits24 = (bits28 = _crypt_bits32 + 4) + 4;
-
-	/*
-	 * Invert the S-boxes, reordering the input bits.
-	 */
-	for (i = 0; i < 8; i++)
-		for (j = 0; j < 64; j++)
-		{
-			b = (j & 0x20) | ((j & 1) << 4) | ((j >> 1) & 0xf);
-			u_sbox[i][j] = sbox[i][b];
-		}
-
-	/*
-	 * Convert the inverted S-boxes into 4 arrays of 8 bits. Each will handle
-	 * 12 bits of the S-box input.
-	 */
-	for (b = 0; b < 4; b++)
-		for (i = 0; i < 64; i++)
-			for (j = 0; j < 64; j++)
-				m_sbox[b][(i << 6) | j] =
-					(u_sbox[(b << 1)][i] << 4) |
-					u_sbox[(b << 1) + 1][j];
-
-	/*
-	 * Set up the initial & final permutations into a useful form, and
-	 * initialise the inverted key permutation.
-	 */
-	for (i = 0; i < 64; i++)
-	{
-		init_perm[final_perm[i] = IP[i] - 1] = i;
-		inv_key_perm[i] = 255;
-	}
-
-	/*
-	 * Invert the key permutation and initialise the inverted key compression
-	 * permutation.
-	 */
-	for (i = 0; i < 56; i++)
-	{
-		u_key_perm[i] = key_perm[i] - 1;
-		inv_key_perm[key_perm[i] - 1] = i;
-		inv_comp_perm[i] = 255;
-	}
-
-	/*
-	 * Invert the key compression permutation.
-	 */
-	for (i = 0; i < 48; i++)
-		inv_comp_perm[comp_perm[i] - 1] = i;
-
-	/*
-	 * Set up the OR-mask arrays for the initial and final permutations, and
-	 * for the key initial and compression permutations.
-	 */
-	for (k = 0; k < 8; k++)
-	{
-		for (i = 0; i < 256; i++)
-		{
-			*(il = &ip_maskl[k][i]) = 0L;
-			*(ir = &ip_maskr[k][i]) = 0L;
-			*(fl = &fp_maskl[k][i]) = 0L;
-			*(fr = &fp_maskr[k][i]) = 0L;
-			for (j = 0; j < 8; j++)
-			{
-				inbit = 8 * k + j;
-				if (i & _crypt_bits8[j])
-				{
-					if ((obit = init_perm[inbit]) < 32)
-						*il |= _crypt_bits32[obit];
-					else
-						*ir |= _crypt_bits32[obit - 32];
-					if ((obit = final_perm[inbit]) < 32)
-						*fl |= _crypt_bits32[obit];
-					else
-						*fr |= _crypt_bits32[obit - 32];
-				}
-			}
-		}
-		for (i = 0; i < 128; i++)
-		{
-			*(il = &key_perm_maskl[k][i]) = 0L;
-			*(ir = &key_perm_maskr[k][i]) = 0L;
-			for (j = 0; j < 7; j++)
-			{
-				inbit = 8 * k + j;
-				if (i & _crypt_bits8[j + 1])
-				{
-					if ((obit = inv_key_perm[inbit]) == 255)
-						continue;
-					if (obit < 28)
-						*il |= bits28[obit];
-					else
-						*ir |= bits28[obit - 28];
-				}
-			}
-			*(il = &comp_maskl[k][i]) = 0L;
-			*(ir = &comp_maskr[k][i]) = 0L;
-			for (j = 0; j < 7; j++)
-			{
-				inbit = 7 * k + j;
-				if (i & _crypt_bits8[j + 1])
-				{
-					if ((obit = inv_comp_perm[inbit]) == 255)
-						continue;
-					if (obit < 24)
-						*il |= bits24[obit];
-					else
-						*ir |= bits24[obit - 24];
-				}
-			}
-		}
-	}
-
-	/*
-	 * Invert the P-box permutation, and convert into OR-masks for handling
-	 * the output of the S-box arrays setup above.
-	 */
-	for (i = 0; i < 32; i++)
-		un_pbox[pbox[i] - 1] = i;
-
-	for (b = 0; b < 4; b++)
-		for (i = 0; i < 256; i++)
-		{
-			*(p = &psbox[b][i]) = 0L;
-			for (j = 0; j < 8; j++)
-			{
-				if (i & _crypt_bits8[j])
-					*p |= _crypt_bits32[un_pbox[8 * b + j]];
-			}
-		}
-
-	des_initialised = 1;
-}
-
-static void
-setup_salt(long salt)
-{
-	uint32		obit,
-				saltbit;
-	int			i;
-
-	if (salt == old_salt)
-		return;
-	old_salt = salt;
-
-	saltbits = 0L;
-	saltbit = 1;
-	obit = 0x800000;
-	for (i = 0; i < 24; i++)
-	{
-		if (salt & saltbit)
-			saltbits |= obit;
-		saltbit <<= 1;
-		obit >>= 1;
-	}
-}
-
-static int
-des_setkey(const char *key)
-{
-	uint32		k0,
-				k1,
-				rawkey0,
-				rawkey1;
-	int			shifts,
-				round;
-
-	if (!des_initialised)
-		des_init();
-
-	rawkey0 = ntohl(*(uint32 *) key);
-	rawkey1 = ntohl(*(uint32 *) (key + 4));
-
-	if ((rawkey0 | rawkey1)
-		&& rawkey0 == old_rawkey0
-		&& rawkey1 == old_rawkey1)
-	{
-		/*
-		 * Already setup for this key. This optimisation fails on a zero key
-		 * (which is weak and has bad parity anyway) in order to simplify the
-		 * starting conditions.
-		 */
-		return (0);
-	}
-	old_rawkey0 = rawkey0;
-	old_rawkey1 = rawkey1;
-
-	/*
-	 * Do key permutation and split into two 28-bit subkeys.
-	 */
-	k0 = key_perm_maskl[0][rawkey0 >> 25]
-		| key_perm_maskl[1][(rawkey0 >> 17) & 0x7f]
-		| key_perm_maskl[2][(rawkey0 >> 9) & 0x7f]
-		| key_perm_maskl[3][(rawkey0 >> 1) & 0x7f]
-		| key_perm_maskl[4][rawkey1 >> 25]
-		| key_perm_maskl[5][(rawkey1 >> 17) & 0x7f]
-		| key_perm_maskl[6][(rawkey1 >> 9) & 0x7f]
-		| key_perm_maskl[7][(rawkey1 >> 1) & 0x7f];
-	k1 = key_perm_maskr[0][rawkey0 >> 25]
-		| key_perm_maskr[1][(rawkey0 >> 17) & 0x7f]
-		| key_perm_maskr[2][(rawkey0 >> 9) & 0x7f]
-		| key_perm_maskr[3][(rawkey0 >> 1) & 0x7f]
-		| key_perm_maskr[4][rawkey1 >> 25]
-		| key_perm_maskr[5][(rawkey1 >> 17) & 0x7f]
-		| key_perm_maskr[6][(rawkey1 >> 9) & 0x7f]
-		| key_perm_maskr[7][(rawkey1 >> 1) & 0x7f];
-
-	/*
-	 * Rotate subkeys and do compression permutation.
-	 */
-	shifts = 0;
-	for (round = 0; round < 16; round++)
-	{
-		uint32		t0,
-					t1;
-
-		shifts += key_shifts[round];
-
-		t0 = (k0 << shifts) | (k0 >> (28 - shifts));
-		t1 = (k1 << shifts) | (k1 >> (28 - shifts));
-
-		de_keysl[15 - round] =
-			en_keysl[round] = comp_maskl[0][(t0 >> 21) & 0x7f]
-			| comp_maskl[1][(t0 >> 14) & 0x7f]
-			| comp_maskl[2][(t0 >> 7) & 0x7f]
-			| comp_maskl[3][t0 & 0x7f]
-			| comp_maskl[4][(t1 >> 21) & 0x7f]
-			| comp_maskl[5][(t1 >> 14) & 0x7f]
-			| comp_maskl[6][(t1 >> 7) & 0x7f]
-			| comp_maskl[7][t1 & 0x7f];
-
-		de_keysr[15 - round] =
-			en_keysr[round] = comp_maskr[0][(t0 >> 21) & 0x7f]
-			| comp_maskr[1][(t0 >> 14) & 0x7f]
-			| comp_maskr[2][(t0 >> 7) & 0x7f]
-			| comp_maskr[3][t0 & 0x7f]
-			| comp_maskr[4][(t1 >> 21) & 0x7f]
-			| comp_maskr[5][(t1 >> 14) & 0x7f]
-			| comp_maskr[6][(t1 >> 7) & 0x7f]
-			| comp_maskr[7][t1 & 0x7f];
-	}
-	return (0);
-}
-
-static int
-do_des(uint32 l_in, uint32 r_in, uint32 *l_out, uint32 *r_out, int count)
-{
-	/*
-	 * l_in, r_in, l_out, and r_out are in pseudo-"big-endian" format.
-	 */
-	uint32		l,
-				r,
-			   *kl,
-			   *kr,
-			   *kl1,
-			   *kr1;
-	uint32		f,
-				r48l,
-				r48r;
-	int			round;
-
-	if (count == 0)
-		return (1);
-	else if (count > 0)
-	{
-		/*
-		 * Encrypting
-		 */
-		kl1 = en_keysl;
-		kr1 = en_keysr;
-	}
-	else
-	{
-		/*
-		 * Decrypting
-		 */
-		count = -count;
-		kl1 = de_keysl;
-		kr1 = de_keysr;
-	}
-
-	/*
-	 * Do initial permutation (IP).
-	 */
-	l = ip_maskl[0][l_in >> 24]
-		| ip_maskl[1][(l_in >> 16) & 0xff]
-		| ip_maskl[2][(l_in >> 8) & 0xff]
-		| ip_maskl[3][l_in & 0xff]
-		| ip_maskl[4][r_in >> 24]
-		| ip_maskl[5][(r_in >> 16) & 0xff]
-		| ip_maskl[6][(r_in >> 8) & 0xff]
-		| ip_maskl[7][r_in & 0xff];
-	r = ip_maskr[0][l_in >> 24]
-		| ip_maskr[1][(l_in >> 16) & 0xff]
-		| ip_maskr[2][(l_in >> 8) & 0xff]
-		| ip_maskr[3][l_in & 0xff]
-		| ip_maskr[4][r_in >> 24]
-		| ip_maskr[5][(r_in >> 16) & 0xff]
-		| ip_maskr[6][(r_in >> 8) & 0xff]
-		| ip_maskr[7][r_in & 0xff];
-
-	while (count--)
-	{
-		/*
-		 * Do each round.
-		 */
-		kl = kl1;
-		kr = kr1;
-		round = 16;
-		while (round--)
-		{
-			/*
-			 * Expand R to 48 bits (simulate the E-box).
-			 */
-			r48l = ((r & 0x00000001) << 23)
-				| ((r & 0xf8000000) >> 9)
-				| ((r & 0x1f800000) >> 11)
-				| ((r & 0x01f80000) >> 13)
-				| ((r & 0x001f8000) >> 15);
-
-			r48r = ((r & 0x0001f800) << 7)
-				| ((r & 0x00001f80) << 5)
-				| ((r & 0x000001f8) << 3)
-				| ((r & 0x0000001f) << 1)
-				| ((r & 0x80000000) >> 31);
-
-			/*
-			 * Do salting for crypt() and friends, and XOR with the permuted
-			 * key.
-			 */
-			f = (r48l ^ r48r) & saltbits;
-			r48l ^= f ^ *kl++;
-			r48r ^= f ^ *kr++;
-
-			/*
-			 * Do sbox lookups (which shrink it back to 32 bits) and do the
-			 * pbox permutation at the same time.
-			 */
-			f = psbox[0][m_sbox[0][r48l >> 12]]
-				| psbox[1][m_sbox[1][r48l & 0xfff]]
-				| psbox[2][m_sbox[2][r48r >> 12]]
-				| psbox[3][m_sbox[3][r48r & 0xfff]];
-
-			/*
-			 * Now that we've permuted things, complete f().
-			 */
-			f ^= l;
-			l = r;
-			r = f;
-		}
-		r = l;
-		l = f;
-	}
-
-	/*
-	 * Do final permutation (inverse of IP).
-	 */
-	*l_out = fp_maskl[0][l >> 24]
-		| fp_maskl[1][(l >> 16) & 0xff]
-		| fp_maskl[2][(l >> 8) & 0xff]
-		| fp_maskl[3][l & 0xff]
-		| fp_maskl[4][r >> 24]
-		| fp_maskl[5][(r >> 16) & 0xff]
-		| fp_maskl[6][(r >> 8) & 0xff]
-		| fp_maskl[7][r & 0xff];
-	*r_out = fp_maskr[0][l >> 24]
-		| fp_maskr[1][(l >> 16) & 0xff]
-		| fp_maskr[2][(l >> 8) & 0xff]
-		| fp_maskr[3][l & 0xff]
-		| fp_maskr[4][r >> 24]
-		| fp_maskr[5][(r >> 16) & 0xff]
-		| fp_maskr[6][(r >> 8) & 0xff]
-		| fp_maskr[7][r & 0xff];
-	return (0);
-}
-
-static int
-des_cipher(const char *in, char *out, long salt, int count)
-{
-	uint32		buffer[2];
-	uint32		l_out,
-				r_out,
-				rawl,
-				rawr;
-	int			retval;
-
-	if (!des_initialised)
-		des_init();
-
-	setup_salt(salt);
-
-	/* copy data to avoid assuming input is word-aligned */
-	memcpy(buffer, in, sizeof(buffer));
-
-	rawl = ntohl(buffer[0]);
-	rawr = ntohl(buffer[1]);
-
-	retval = do_des(rawl, rawr, &l_out, &r_out, count);
-
-	buffer[0] = htonl(l_out);
-	buffer[1] = htonl(r_out);
-
-	/* copy data to avoid assuming output is word-aligned */
-	memcpy(out, buffer, sizeof(buffer));
-
-	return (retval);
-}
-
-char *
-px_crypt_des(const char *key, const char *setting)
-{
-	int			i;
-	uint32		count,
-				salt,
-				l,
-				r0,
-				r1,
-				keybuf[2];
-	char	   *p;
-	uint8	   *q;
-	static char output[21];
-
-	if (!des_initialised)
-		des_init();
-
-
-	/*
-	 * Copy the key, shifting each character up by one bit and padding with
-	 * zeros.
-	 */
-	q = (uint8 *) keybuf;
-	while (q - (uint8 *) keybuf - 8)
-	{
-		*q++ = *key << 1;
-		if (*key != '\0')
-			key++;
-	}
-	if (des_setkey((char *) keybuf))
-		return (NULL);
-
-#ifndef DISABLE_XDES
-	if (*setting == _PASSWORD_EFMT1)
-	{
-		/*
-		 * "new"-style: setting - underscore, 4 bytes of count, 4 bytes of
-		 * salt key - unlimited characters
-		 */
-		for (i = 1, count = 0L; i < 5; i++)
-			count |= ascii_to_bin(setting[i]) << (i - 1) * 6;
-
-		for (i = 5, salt = 0L; i < 9; i++)
-			salt |= ascii_to_bin(setting[i]) << (i - 5) * 6;
-
-		while (*key)
-		{
-			/*
-			 * Encrypt the key with itself.
-			 */
-			if (des_cipher((char *) keybuf, (char *) keybuf, 0L, 1))
-				return (NULL);
-
-			/*
-			 * And XOR with the next 8 characters of the key.
-			 */
-			q = (uint8 *) keybuf;
-			while (q - (uint8 *) keybuf - 8 && *key)
-				*q++ ^= *key++ << 1;
-
-			if (des_setkey((char *) keybuf))
-				return (NULL);
-		}
-		strncpy(output, setting, 9);
-
-		/*
-		 * Double check that we weren't given a short setting. If we were, the
-		 * above code will probably have created wierd values for count and
-		 * salt, but we don't really care. Just make sure the output string
-		 * doesn't have an extra NUL in it.
-		 */
-		output[9] = '\0';
-		p = output + strlen(output);
-	}
-	else
-#endif   /* !DISABLE_XDES */
-	{
-		/*
-		 * "old"-style: setting - 2 bytes of salt key - up to 8 characters
-		 */
-		count = 25;
-
-		salt = (ascii_to_bin(setting[1]) << 6)
-			| ascii_to_bin(setting[0]);
-
-		output[0] = setting[0];
-
-		/*
-		 * If the encrypted password that the salt was extracted from is only
-		 * 1 character long, the salt will be corrupted.  We need to ensure
-		 * that the output string doesn't have an extra NUL in it!
-		 */
-		output[1] = setting[1] ? setting[1] : output[0];
-
-		p = output + 2;
-	}
-	setup_salt(salt);
-
-	/*
-	 * Do it.
-	 */
-	if (do_des(0L, 0L, &r0, &r1, count))
-		return (NULL);
-
-	/*
-	 * Now encode the result...
-	 */
-	l = (r0 >> 8);
-	*p++ = _crypt_a64[(l >> 18) & 0x3f];
-	*p++ = _crypt_a64[(l >> 12) & 0x3f];
-	*p++ = _crypt_a64[(l >> 6) & 0x3f];
-	*p++ = _crypt_a64[l & 0x3f];
-
-	l = (r0 << 16) | ((r1 >> 16) & 0xffff);
-	*p++ = _crypt_a64[(l >> 18) & 0x3f];
-	*p++ = _crypt_a64[(l >> 12) & 0x3f];
-	*p++ = _crypt_a64[(l >> 6) & 0x3f];
-	*p++ = _crypt_a64[l & 0x3f];
-
-	l = r1 << 2;
-	*p++ = _crypt_a64[(l >> 12) & 0x3f];
-	*p++ = _crypt_a64[(l >> 6) & 0x3f];
-	*p++ = _crypt_a64[l & 0x3f];
-	*p = 0;
-
-	return (output);
-}

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/101adfab/contrib/pgcrypto/crypt-gensalt.c
----------------------------------------------------------------------
diff --git a/contrib/pgcrypto/crypt-gensalt.c b/contrib/pgcrypto/crypt-gensalt.c
deleted file mode 100644
index b2ec3da..0000000
--- a/contrib/pgcrypto/crypt-gensalt.c
+++ /dev/null
@@ -1,188 +0,0 @@
-/*
- * Written by Solar Designer and placed in the public domain.
- * See crypt_blowfish.c for more information.
- *
- * $PostgreSQL: pgsql/contrib/pgcrypto/crypt-gensalt.c,v 1.11 2009/06/11 14:48:52 momjian Exp $
- *
- * This file contains salt generation functions for the traditional and
- * other common crypt(3) algorithms, except for bcrypt which is defined
- * entirely in crypt_blowfish.c.
- *
- * Put bcrypt generator also here as crypt-blowfish.c
- * may not be compiled always.		  -- marko
- */
-
-#include "postgres.h"
-
-#include "px.h"
-#include "px-crypt.h"
-
-typedef unsigned int BF_word;
-
-static unsigned char _crypt_itoa64[64 + 1] =
-"./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
-
-char *
-_crypt_gensalt_traditional_rn(unsigned long count,
-				  const char *input, int size, char *output, int output_size)
-{
-	if (size < 2 || output_size < 2 + 1 || (count && count != 25))
-	{
-		if (output_size > 0)
-			output[0] = '\0';
-		return NULL;
-	}
-
-	output[0] = _crypt_itoa64[(unsigned int) input[0] & 0x3f];
-	output[1] = _crypt_itoa64[(unsigned int) input[1] & 0x3f];
-	output[2] = '\0';
-
-	return output;
-}
-
-char *
-_crypt_gensalt_extended_rn(unsigned long count,
-				  const char *input, int size, char *output, int output_size)
-{
-	unsigned long value;
-
-/* Even iteration counts make it easier to detect weak DES keys from a look
- * at the hash, so they should be avoided */
-	if (size < 3 || output_size < 1 + 4 + 4 + 1 ||
-		(count && (count > 0xffffff || !(count & 1))))
-	{
-		if (output_size > 0)
-			output[0] = '\0';
-		return NULL;
-	}
-
-	if (!count)
-		count = 725;
-
-	output[0] = '_';
-	output[1] = _crypt_itoa64[count & 0x3f];
-	output[2] = _crypt_itoa64[(count >> 6) & 0x3f];
-	output[3] = _crypt_itoa64[(count >> 12) & 0x3f];
-	output[4] = _crypt_itoa64[(count >> 18) & 0x3f];
-	value = (unsigned long) (unsigned char) input[0] |
-		((unsigned long) (unsigned char) input[1] << 8) |
-		((unsigned long) (unsigned char) input[2] << 16);
-	output[5] = _crypt_itoa64[value & 0x3f];
-	output[6] = _crypt_itoa64[(value >> 6) & 0x3f];
-	output[7] = _crypt_itoa64[(value >> 12) & 0x3f];
-	output[8] = _crypt_itoa64[(value >> 18) & 0x3f];
-	output[9] = '\0';
-
-	return output;
-}
-
-char *
-_crypt_gensalt_md5_rn(unsigned long count,
-				  const char *input, int size, char *output, int output_size)
-{
-	unsigned long value;
-
-	if (size < 3 || output_size < 3 + 4 + 1 || (count && count != 1000))
-	{
-		if (output_size > 0)
-			output[0] = '\0';
-		return NULL;
-	}
-
-	output[0] = '$';
-	output[1] = '1';
-	output[2] = '$';
-	value = (unsigned long) (unsigned char) input[0] |
-		((unsigned long) (unsigned char) input[1] << 8) |
-		((unsigned long) (unsigned char) input[2] << 16);
-	output[3] = _crypt_itoa64[value & 0x3f];
-	output[4] = _crypt_itoa64[(value >> 6) & 0x3f];
-	output[5] = _crypt_itoa64[(value >> 12) & 0x3f];
-	output[6] = _crypt_itoa64[(value >> 18) & 0x3f];
-	output[7] = '\0';
-
-	if (size >= 6 && output_size >= 3 + 4 + 4 + 1)
-	{
-		value = (unsigned long) (unsigned char) input[3] |
-			((unsigned long) (unsigned char) input[4] << 8) |
-			((unsigned long) (unsigned char) input[5] << 16);
-		output[7] = _crypt_itoa64[value & 0x3f];
-		output[8] = _crypt_itoa64[(value >> 6) & 0x3f];
-		output[9] = _crypt_itoa64[(value >> 12) & 0x3f];
-		output[10] = _crypt_itoa64[(value >> 18) & 0x3f];
-		output[11] = '\0';
-	}
-
-	return output;
-}
-
-
-
-static unsigned char BF_itoa64[64 + 1] =
-"./ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
-
-static void
-BF_encode(char *dst, const BF_word *src, int size)
-{
-	unsigned char *sptr = (unsigned char *) src;
-	unsigned char *end = sptr + size;
-	unsigned char *dptr = (unsigned char *) dst;
-	unsigned int c1,
-				c2;
-
-	do
-	{
-		c1 = *sptr++;
-		*dptr++ = BF_itoa64[c1 >> 2];
-		c1 = (c1 & 0x03) << 4;
-		if (sptr >= end)
-		{
-			*dptr++ = BF_itoa64[c1];
-			break;
-		}
-
-		c2 = *sptr++;
-		c1 |= c2 >> 4;
-		*dptr++ = BF_itoa64[c1];
-		c1 = (c2 & 0x0f) << 2;
-		if (sptr >= end)
-		{
-			*dptr++ = BF_itoa64[c1];
-			break;
-		}
-
-		c2 = *sptr++;
-		c1 |= c2 >> 6;
-		*dptr++ = BF_itoa64[c1];
-		*dptr++ = BF_itoa64[c2 & 0x3f];
-	} while (sptr < end);
-}
-
-char *
-_crypt_gensalt_blowfish_rn(unsigned long count,
-				  const char *input, int size, char *output, int output_size)
-{
-	if (size < 16 || output_size < 7 + 22 + 1 ||
-		(count && (count < 4 || count > 31)))
-	{
-		if (output_size > 0)
-			output[0] = '\0';
-		return NULL;
-	}
-
-	if (!count)
-		count = 5;
-
-	output[0] = '$';
-	output[1] = '2';
-	output[2] = 'a';
-	output[3] = '$';
-	output[4] = '0' + count / 10;
-	output[5] = '0' + count % 10;
-	output[6] = '$';
-
-	BF_encode(&output[7], (BF_word *) input, 16);
-	output[7 + 22] = '\0';
-
-	return output;
-}

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/101adfab/contrib/pgcrypto/crypt-md5.c
----------------------------------------------------------------------
diff --git a/contrib/pgcrypto/crypt-md5.c b/contrib/pgcrypto/crypt-md5.c
deleted file mode 100644
index d70fc34..0000000
--- a/contrib/pgcrypto/crypt-md5.c
+++ /dev/null
@@ -1,163 +0,0 @@
-/*
- * File imported from FreeBSD, original by Poul-Henning Kamp.
- *
- * $FreeBSD: src/lib/libcrypt/crypt-md5.c,v 1.5 1999/12/17 20:21:45 peter Exp $
- *
- * $PostgreSQL: pgsql/contrib/pgcrypto/crypt-md5.c,v 1.9 2009/04/15 18:58:24 mha Exp $
- */
-
-#include "postgres.h"
-
-#include "px.h"
-#include "px-crypt.h"
-
-#define MD5_SIZE 16
-
-static const char _crypt_a64[] =
-"./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
-
-static void
-_crypt_to64(char *s, unsigned long v, int n)
-{
-	while (--n >= 0)
-	{
-		*s++ = _crypt_a64[v & 0x3f];
-		v >>= 6;
-	}
-}
-
-/*
- * UNIX password
- */
-
-char *
-px_crypt_md5(const char *pw, const char *salt, char *passwd, unsigned dstlen)
-{
-	static char *magic = "$1$"; /* This string is magic for this algorithm.
-								 * Having it this way, we can get get better
-								 * later on */
-	static char *p;
-	static const char *sp,
-			   *ep;
-	unsigned char final[MD5_SIZE];
-	int			sl,
-				pl,
-				i;
-	PX_MD	   *ctx,
-			   *ctx1;
-	int			err;
-	unsigned long l;
-
-	if (!passwd || dstlen < 120)
-		return NULL;
-
-	/* Refine the Salt first */
-	sp = salt;
-
-	/* If it starts with the magic string, then skip that */
-	if (!strncmp(sp, magic, strlen(magic)))
-		sp += strlen(magic);
-
-	/* It stops at the first '$', max 8 chars */
-	for (ep = sp; *ep && *ep != '$' && ep < (sp + 8); ep++)
-		continue;
-
-	/* get the length of the true salt */
-	sl = ep - sp;
-
-	/* */
-	err = px_find_digest("md5", &ctx);
-	if (err)
-		return NULL;
-	err = px_find_digest("md5", &ctx1);
-
-	/* The password first, since that is what is most unknown */
-	px_md_update(ctx, (uint8 *) pw, strlen(pw));
-
-	/* Then our magic string */
-	px_md_update(ctx, (uint8 *) magic, strlen(magic));
-
-	/* Then the raw salt */
-	px_md_update(ctx, (uint8 *) sp, sl);
-
-	/* Then just as many characters of the MD5(pw,salt,pw) */
-	px_md_update(ctx1, (uint8 *) pw, strlen(pw));
-	px_md_update(ctx1, (uint8 *) sp, sl);
-	px_md_update(ctx1, (uint8 *) pw, strlen(pw));
-	px_md_finish(ctx1, final);
-	for (pl = strlen(pw); pl > 0; pl -= MD5_SIZE)
-		px_md_update(ctx, final, pl > MD5_SIZE ? MD5_SIZE : pl);
-
-	/* Don't leave anything around in vm they could use. */
-	memset(final, 0, sizeof final);
-
-	/* Then something really weird... */
-	for (i = strlen(pw); i; i >>= 1)
-		if (i & 1)
-			px_md_update(ctx, final, 1);
-		else
-			px_md_update(ctx, (uint8 *) pw, 1);
-
-	/* Now make the output string */
-	strcpy(passwd, magic);
-	strncat(passwd, sp, sl);
-	strcat(passwd, "$");
-
-	px_md_finish(ctx, final);
-
-	/*
-	 * and now, just to make sure things don't run too fast On a 60 Mhz
-	 * Pentium this takes 34 msec, so you would need 30 seconds to build a
-	 * 1000 entry dictionary...
-	 */
-	for (i = 0; i < 1000; i++)
-	{
-		px_md_reset(ctx1);
-		if (i & 1)
-			px_md_update(ctx1, (uint8 *) pw, strlen(pw));
-		else
-			px_md_update(ctx1, final, MD5_SIZE);
-
-		if (i % 3)
-			px_md_update(ctx1, (uint8 *) sp, sl);
-
-		if (i % 7)
-			px_md_update(ctx1, (uint8 *) pw, strlen(pw));
-
-		if (i & 1)
-			px_md_update(ctx1, final, MD5_SIZE);
-		else
-			px_md_update(ctx1, (uint8 *) pw, strlen(pw));
-		px_md_finish(ctx1, final);
-	}
-
-	p = passwd + strlen(passwd);
-
-	l = (final[0] << 16) | (final[6] << 8) | final[12];
-	_crypt_to64(p, l, 4);
-	p += 4;
-	l = (final[1] << 16) | (final[7] << 8) | final[13];
-	_crypt_to64(p, l, 4);
-	p += 4;
-	l = (final[2] << 16) | (final[8] << 8) | final[14];
-	_crypt_to64(p, l, 4);
-	p += 4;
-	l = (final[3] << 16) | (final[9] << 8) | final[15];
-	_crypt_to64(p, l, 4);
-	p += 4;
-	l = (final[4] << 16) | (final[10] << 8) | final[5];
-	_crypt_to64(p, l, 4);
-	p += 4;
-	l = final[11];
-	_crypt_to64(p, l, 2);
-	p += 2;
-	*p = '\0';
-
-	/* Don't leave anything around in vm they could use. */
-	memset(final, 0, sizeof final);
-
-	px_md_free(ctx1);
-	px_md_free(ctx);
-
-	return passwd;
-}

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/101adfab/contrib/pgcrypto/expected/3des.out
----------------------------------------------------------------------
diff --git a/contrib/pgcrypto/expected/3des.out b/contrib/pgcrypto/expected/3des.out
deleted file mode 100755
index 3e6a88e..0000000
--- a/contrib/pgcrypto/expected/3des.out
+++ /dev/null
@@ -1,69 +0,0 @@
---
--- 3DES cipher
---
--- test vector from somewhere
-SELECT encode(encrypt(
-decode('80 00 00 00 00 00 00 00', 'hex'),
-decode('01 01 01 01 01 01 01 01
-	01 01 01 01 01 01 01 01
-	01 01 01 01 01 01 01 01', 'hex'),
-'3des-ecb/pad:none'), 'hex');
-      encode      
-------------------
- 95f8a5e5dd31d900
-(1 row)
-
--- val 95 F8 A5 E5 DD 31 D9 00
-select encode(	encrypt('', 'foo', '3des'), 'hex');
-      encode      
-------------------
- 752111e37a2d7ac3
-(1 row)
-
--- 10 bytes key
-select encode(	encrypt('foo', '0123456789', '3des'), 'hex');
-      encode      
-------------------
- d2fb8baa1717cb02
-(1 row)
-
--- 22 bytes key
-select encode(	encrypt('foo', '0123456789012345678901', '3des'), 'hex');
-      encode      
-------------------
- a44360e699269817
-(1 row)
-
--- decrypt
-select decrypt(encrypt('foo', '0123456', '3des'), '0123456', '3des');
- decrypt 
----------
- foo
-(1 row)
-
--- iv
-select encode(encrypt_iv('foo', '0123456', 'abcd', '3des'), 'hex');
-      encode      
-------------------
- 50735067b073bb93
-(1 row)
-
-select decrypt_iv(decode('50735067b073bb93', 'hex'), '0123456', 'abcd', '3des');
- decrypt_iv 
-------------
- foo
-(1 row)
-
--- long message
-select encode(encrypt('Lets try a longer message.', '0123456789012345678901', '3des'), 'hex');
-                              encode                              
-------------------------------------------------------------------
- b71e3422269d0ded19468f33d65cd663c28e0871984792a7b3ba0ddcecec8d2c
-(1 row)
-
-select decrypt(encrypt('Lets try a longer message.', '0123456789012345678901', '3des'), '0123456789012345678901', '3des');
-          decrypt           
-----------------------------
- Lets try a longer message.
-(1 row)
-

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/101adfab/contrib/pgcrypto/expected/blowfish.out
----------------------------------------------------------------------
diff --git a/contrib/pgcrypto/expected/blowfish.out b/contrib/pgcrypto/expected/blowfish.out
deleted file mode 100755
index 5c09cf5..0000000
--- a/contrib/pgcrypto/expected/blowfish.out
+++ /dev/null
@@ -1,173 +0,0 @@
---
--- Blowfish cipher
---
--- some standard Blowfish testvalues
-SELECT encode(encrypt(
-decode('0000000000000000', 'hex'),
-decode('0000000000000000', 'hex'),
-'bf-ecb/pad:none'), 'hex');
-      encode      
-------------------
- 4ef997456198dd78
-(1 row)
-
-SELECT encode(encrypt(
-decode('ffffffffffffffff', 'hex'),
-decode('ffffffffffffffff', 'hex'),
-'bf-ecb/pad:none'), 'hex');
-      encode      
-------------------
- 51866fd5b85ecb8a
-(1 row)
-
-SELECT encode(encrypt(
-decode('1000000000000001', 'hex'),
-decode('3000000000000000', 'hex'),
-'bf-ecb/pad:none'), 'hex');
-      encode      
-------------------
- 7d856f9a613063f2
-(1 row)
-
-SELECT encode(encrypt(
-decode('1111111111111111', 'hex'),
-decode('1111111111111111', 'hex'),
-'bf-ecb/pad:none'), 'hex');
-      encode      
-------------------
- 2466dd878b963c9d
-(1 row)
-
-SELECT encode(encrypt(
-decode('0123456789abcdef', 'hex'),
-decode('fedcba9876543210', 'hex'),
-'bf-ecb/pad:none'), 'hex');
-      encode      
-------------------
- 0aceab0fc6a0a28d
-(1 row)
-
-SELECT encode(encrypt(
-decode('01a1d6d039776742', 'hex'),
-decode('fedcba9876543210', 'hex'),
-'bf-ecb/pad:none'), 'hex');
-      encode      
-------------------
- 3273b8badc9e9e15
-(1 row)
-
-SELECT encode(encrypt(
-decode('ffffffffffffffff', 'hex'),
-decode('0000000000000000', 'hex'),
-'bf-ecb/pad:none'), 'hex');
-      encode      
-------------------
- 014933e0cdaff6e4
-(1 row)
-
--- setkey
-SELECT encode(encrypt(
-decode('fedcba9876543210', 'hex'),
-decode('f0e1d2c3b4a5968778695a4b3c2d1e0f', 'hex'),
-'bf-ecb/pad:none'), 'hex');
-      encode      
-------------------
- 93142887ee3be15c
-(1 row)
-
--- with padding
-SELECT encode(encrypt(
-decode('01234567890123456789', 'hex'),
-decode('33443344334433443344334433443344', 'hex'),
-'bf-ecb'), 'hex');
-              encode              
-----------------------------------
- 0d04a43a20456dee5ede6ed9e4dcaaa6
-(1 row)
-
--- cbc
--- 28 bytes key
-SELECT encode(encrypt(
-decode('6b77b4d63006dee605b156e27403979358deb9e7154616d959f1652bd5', 'hex'),
-decode('37363534333231204e6f77206973207468652074696d6520666f7220', 'hex'),
-'bf-cbc'), 'hex');
-                              encode                              
-------------------------------------------------------------------
- 4f2beb748c4f689ec755edb9dc252a41b93a3786850b4c75d6a702b6a8e48825
-(1 row)
-
--- 29 bytes key
-SELECT encode(encrypt(
-decode('6b77b4d63006dee605b156e27403979358deb9e7154616d959f1652bd5ff92cc', 'hex'),
-decode('37363534333231204e6f77206973207468652074696d6520666f722000', 'hex'),
-'bf-cbc'), 'hex');
-                                      encode                                      
-----------------------------------------------------------------------------------
- 3ea6357a0ee7fad6d0c4b63464f2aafa40c2e91b4b7e1bba8114932fd92b5c8f111e7e50e7b2e541
-(1 row)
-
--- blowfish-448 
-SELECT encode(encrypt(
-decode('fedcba9876543210', 'hex'),
-decode('f0e1d2c3b4a5968778695a4b3c2d1e0f001122334455667704689104c2fd3b2f584023641aba61761f1f1f1f0e0e0e0effffffffffffffff', 'hex'),
-'bf-ecb/pad:none'), 'hex');
-      encode      
-------------------
- c04504012e4e1f53
-(1 row)
-
--- result: c04504012e4e1f53
--- empty data
-select encode(	encrypt('', 'foo', 'bf'), 'hex');
-      encode      
-------------------
- 1871949bb2311c8e
-(1 row)
-
--- 10 bytes key
-select encode(	encrypt('foo', '0123456789', 'bf'), 'hex');
-      encode      
-------------------
- 42f58af3b2c03f46
-(1 row)
-
--- 22 bytes key
-select encode(	encrypt('foo', '0123456789012345678901', 'bf'), 'hex');
-      encode      
-------------------
- 86ab6f0bc72b5f22
-(1 row)
-
--- decrypt
-select decrypt(encrypt('foo', '0123456', 'bf'), '0123456', 'bf');
- decrypt 
----------
- foo
-(1 row)
-
--- iv
-select encode(encrypt_iv('foo', '0123456', 'abcd', 'bf'), 'hex');
-      encode      
-------------------
- 95c7e89322525d59
-(1 row)
-
-select decrypt_iv(decode('95c7e89322525d59', 'hex'), '0123456', 'abcd', 'bf');
- decrypt_iv 
-------------
- foo
-(1 row)
-
--- long message
-select encode(encrypt('Lets try a longer message.', '0123456789', 'bf'), 'hex');
-                              encode                              
-------------------------------------------------------------------
- a76059f7a1b627b5b84080d9beb337714c7a7f8b70300023e5feb6dfa6813536
-(1 row)
-
-select decrypt(encrypt('Lets try a longer message.', '0123456789', 'bf'), '0123456789', 'bf');
-          decrypt           
-----------------------------
- Lets try a longer message.
-(1 row)
-

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/101adfab/contrib/pgcrypto/expected/cast5.out
----------------------------------------------------------------------
diff --git a/contrib/pgcrypto/expected/cast5.out b/contrib/pgcrypto/expected/cast5.out
deleted file mode 100755
index 4ca824e..0000000
--- a/contrib/pgcrypto/expected/cast5.out
+++ /dev/null
@@ -1,86 +0,0 @@
---
--- Cast5 cipher
---
--- test vectors from RFC2144
--- 128 bit key
-SELECT encode(encrypt(
-decode('01 23 45 67 89 AB CD EF', 'hex'),
-decode('01 23 45 67 12 34 56 78 23 45 67 89 34 56 78 9A', 'hex'),
-'cast5-ecb/pad:none'), 'hex');
-      encode      
-------------------
- 238b4fe5847e44b2
-(1 row)
-
--- result: 23 8B 4F E5 84 7E 44 B2
--- 80 bit key
-SELECT encode(encrypt(
-decode('01 23 45 67 89 AB CD EF', 'hex'),
-decode('01 23 45 67 12 34 56 78 23 45', 'hex'),
-'cast5-ecb/pad:none'), 'hex');
-      encode      
-------------------
- eb6a711a2c02271b
-(1 row)
-
--- result: EB 6A 71 1A 2C 02 27 1B
--- 40 bit key
-SELECT encode(encrypt(
-decode('01 23 45 67 89 AB CD EF', 'hex'),
-decode('01 23 45 67 12', 'hex'),
-'cast5-ecb/pad:none'), 'hex');
-      encode      
-------------------
- 7ac816d16e9b302e
-(1 row)
-
--- result: 7A C8 16 D1 6E 9B 30 2E
--- cbc
--- empty data
-select encode(	encrypt('', 'foo', 'cast5'), 'hex');
-      encode      
-------------------
- a48bd1aabde4de10
-(1 row)
-
--- 10 bytes key
-select encode(	encrypt('foo', '0123456789', 'cast5'), 'hex');
-      encode      
-------------------
- b07f19255e60cb6d
-(1 row)
-
--- decrypt
-select decrypt(encrypt('foo', '0123456', 'cast5'), '0123456', 'cast5');
- decrypt 
----------
- foo
-(1 row)
-
--- iv
-select encode(encrypt_iv('foo', '0123456', 'abcd', 'cast5'), 'hex');
-      encode      
-------------------
- 384a970695ce016a
-(1 row)
-
-select decrypt_iv(decode('384a970695ce016a', 'hex'),
-                '0123456', 'abcd', 'cast5');
- decrypt_iv 
-------------
- foo
-(1 row)
-
--- long message
-select encode(encrypt('Lets try a longer message.', '0123456789', 'cast5'), 'hex');
-                              encode                              
-------------------------------------------------------------------
- 04fcffc91533e1505dadcb10766d9fed0937818e663e402384e049942ba60fff
-(1 row)
-
-select decrypt(encrypt('Lets try a longer message.', '0123456789', 'cast5'), '0123456789', 'cast5');
-          decrypt           
-----------------------------
- Lets try a longer message.
-(1 row)
-

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/101adfab/contrib/pgcrypto/expected/crypt-blowfish.out
----------------------------------------------------------------------
diff --git a/contrib/pgcrypto/expected/crypt-blowfish.out b/contrib/pgcrypto/expected/crypt-blowfish.out
deleted file mode 100755
index 329d78f..0000000
--- a/contrib/pgcrypto/expected/crypt-blowfish.out
+++ /dev/null
@@ -1,27 +0,0 @@
---
--- crypt() and gen_salt(): bcrypt
---
-SELECT crypt('', '$2a$06$RQiOJ.3ELirrXwxIZY8q0O');
-                            crypt                             
---------------------------------------------------------------
- $2a$06$RQiOJ.3ELirrXwxIZY8q0OlGbBEpDmx7IRZlNYvGJ1SHXwNi2cEKK
-(1 row)
-
-SELECT crypt('foox', '$2a$06$RQiOJ.3ELirrXwxIZY8q0O');
-                            crypt                             
---------------------------------------------------------------
- $2a$06$RQiOJ.3ELirrXwxIZY8q0OR3CVJrAfda1z26CCHPnB6mmVZD8p0/C
-(1 row)
-
-CREATE TABLE ctest (data text, res text, salt text);
-INSERT INTO ctest VALUES ('password', '', '');
-UPDATE ctest SET salt = gen_salt('bf', 8);
-UPDATE ctest SET res = crypt(data, salt);
-SELECT res = crypt(data, res) AS "worked"
-FROM ctest;
- worked 
---------
- t
-(1 row)
-
-DROP TABLE ctest;

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/101adfab/contrib/pgcrypto/expected/crypt-des.out
----------------------------------------------------------------------
diff --git a/contrib/pgcrypto/expected/crypt-des.out b/contrib/pgcrypto/expected/crypt-des.out
deleted file mode 100755
index b8b6050..0000000
--- a/contrib/pgcrypto/expected/crypt-des.out
+++ /dev/null
@@ -1,27 +0,0 @@
---
--- crypt() and gen_salt(): crypt-des
---
-SELECT crypt('', 'NB');
-     crypt     
----------------
- NBPx/38Y48kHg
-(1 row)
-
-SELECT crypt('foox', 'NB');
-     crypt     
----------------
- NB53EGGqrrb5E
-(1 row)
-
-CREATE TABLE ctest (data text, res text, salt text);
-INSERT INTO ctest VALUES ('password', '', '');
-UPDATE ctest SET salt = gen_salt('des');
-UPDATE ctest SET res = crypt(data, salt);
-SELECT res = crypt(data, res) AS "worked"
-FROM ctest;
- worked 
---------
- t
-(1 row)
-
-DROP TABLE ctest;

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/101adfab/contrib/pgcrypto/expected/crypt-md5.out
----------------------------------------------------------------------
diff --git a/contrib/pgcrypto/expected/crypt-md5.out b/contrib/pgcrypto/expected/crypt-md5.out
deleted file mode 100755
index a1c8304..0000000
--- a/contrib/pgcrypto/expected/crypt-md5.out
+++ /dev/null
@@ -1,27 +0,0 @@
---
--- crypt() and gen_salt(): md5
---
-SELECT crypt('', '$1$Szzz0yzz');
-               crypt                
-------------------------------------
- $1$Szzz0yzz$To38XrR3BsbXQW2ZpfKjF1
-(1 row)
-
-SELECT crypt('foox', '$1$Szzz0yzz');
-               crypt                
-------------------------------------
- $1$Szzz0yzz$IYL49cd3t9bllsA7Jmz1M1
-(1 row)
-
-CREATE TABLE ctest (data text, res text, salt text);
-INSERT INTO ctest VALUES ('password', '', '');
-UPDATE ctest SET salt = gen_salt('md5');
-UPDATE ctest SET res = crypt(data, salt);
-SELECT res = crypt(data, res) AS "worked"
-FROM ctest;
- worked 
---------
- t
-(1 row)
-
-DROP TABLE ctest;

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/101adfab/contrib/pgcrypto/expected/crypt-xdes.out
----------------------------------------------------------------------
diff --git a/contrib/pgcrypto/expected/crypt-xdes.out b/contrib/pgcrypto/expected/crypt-xdes.out
deleted file mode 100755
index cdcdefb..0000000
--- a/contrib/pgcrypto/expected/crypt-xdes.out
+++ /dev/null
@@ -1,27 +0,0 @@
---
--- crypt() and gen_salt(): extended des
---
-SELECT crypt('', '_J9..j2zz');
-        crypt         
-----------------------
- _J9..j2zzR/nIRDK3pPc
-(1 row)
-
-SELECT crypt('foox', '_J9..j2zz');
-        crypt         
-----------------------
- _J9..j2zzAYKMvO2BYRY
-(1 row)
-
-CREATE TABLE ctest (data text, res text, salt text);
-INSERT INTO ctest VALUES ('password', '', '');
-UPDATE ctest SET salt = gen_salt('xdes', 1001);
-UPDATE ctest SET res = crypt(data, salt);
-SELECT res = crypt(data, res) AS "worked"
-FROM ctest;
- worked 
---------
- t
-(1 row)
-
-DROP TABLE ctest;

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/101adfab/contrib/pgcrypto/expected/des.out
----------------------------------------------------------------------
diff --git a/contrib/pgcrypto/expected/des.out b/contrib/pgcrypto/expected/des.out
deleted file mode 100755
index 00513c4..0000000
--- a/contrib/pgcrypto/expected/des.out
+++ /dev/null
@@ -1,61 +0,0 @@
---
--- DES cipher
---
--- no official test vectors atm
--- from blowfish.sql
-SELECT encode(encrypt(
-decode('0123456789abcdef', 'hex'),
-decode('fedcba9876543210', 'hex'),
-'des-ecb/pad:none'), 'hex');
-      encode      
-------------------
- ed39d950fa74bcc4
-(1 row)
-
--- empty data
-select encode(	encrypt('', 'foo', 'des'), 'hex');
-      encode      
-------------------
- 752111e37a2d7ac3
-(1 row)
-
--- 8 bytes key
-select encode(	encrypt('foo', '01234589', 'des'), 'hex');
-      encode      
-------------------
- dec0f9c602b647a8
-(1 row)
-
--- decrypt
-select decrypt(encrypt('foo', '0123456', 'des'), '0123456', 'des');
- decrypt 
----------
- foo
-(1 row)
-
--- iv
-select encode(encrypt_iv('foo', '0123456', 'abcd', 'des'), 'hex');
-      encode      
-------------------
- 50735067b073bb93
-(1 row)
-
-select decrypt_iv(decode('50735067b073bb93', 'hex'), '0123456', 'abcd', 'des');
- decrypt_iv 
-------------
- foo
-(1 row)
-
--- long message
-select encode(encrypt('Lets try a longer message.', '01234567', 'des'), 'hex');
-                              encode                              
-------------------------------------------------------------------
- 5ad146043e5f30967e06a0fcbae602daf4ff2a5fd0ed12d6c5913cf85f1e36ca
-(1 row)
-
-select decrypt(encrypt('Lets try a longer message.', '01234567', 'des'), '01234567', 'des');
-          decrypt           
-----------------------------
- Lets try a longer message.
-(1 row)
-

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/101adfab/contrib/pgcrypto/expected/hmac-md5.out
----------------------------------------------------------------------
diff --git a/contrib/pgcrypto/expected/hmac-md5.out b/contrib/pgcrypto/expected/hmac-md5.out
deleted file mode 100755
index 9eded3b..0000000
--- a/contrib/pgcrypto/expected/hmac-md5.out
+++ /dev/null
@@ -1,72 +0,0 @@
---
--- HMAC-MD5
---
-SELECT encode(hmac(
-'Hi There',
-decode('0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b', 'hex'),
-'md5'), 'hex');
-              encode              
-----------------------------------
- 9294727a3638bb1c13f48ef8158bfc9d
-(1 row)
-
--- 2
-SELECT encode(hmac(
-'Jefe',
-'what do ya want for nothing?',
-'md5'), 'hex');
-              encode              
-----------------------------------
- 813aead7c4a34bff01a16d61368e7c13
-(1 row)
-
--- 3
-SELECT encode(hmac(
-decode('dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd', 'hex'),
-decode('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 'hex'),
-'md5'), 'hex');
-              encode              
-----------------------------------
- 56be34521d144c88dbb8c733f0e8b3f6
-(1 row)
-
--- 4
-SELECT encode(hmac(
-decode('cdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcd', 'hex'),
-decode('0102030405060708090a0b0c0d0e0f10111213141516171819', 'hex'),
-'md5'), 'hex');
-              encode              
-----------------------------------
- 697eaf0aca3a3aea3a75164746ffaa79
-(1 row)
-
--- 5
-SELECT encode(hmac(
-'Test With Truncation',
-decode('0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c', 'hex'),
-'md5'), 'hex');
-              encode              
-----------------------------------
- 56461ef2342edc00f9bab995690efd4c
-(1 row)
-
--- 6
-SELECT encode(hmac(
-'Test Using Larger Than Block-Size Key - Hash Key First',
-decode('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 'hex'),
-'md5'), 'hex');
-              encode              
-----------------------------------
- 6b1ab7fe4bd7bf8f0b62e6ce61b9d0cd
-(1 row)
-
--- 7
-SELECT encode(hmac(
-'Test Using Larger Than Block-Size Key and Larger Than One Block-Size Data',
-decode('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 'hex'),
-'md5'), 'hex');
-              encode              
-----------------------------------
- 6f630fad67cda0ee1fb1f562db3aa53e
-(1 row)
-

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/101adfab/contrib/pgcrypto/expected/hmac-sha1.out
----------------------------------------------------------------------
diff --git a/contrib/pgcrypto/expected/hmac-sha1.out b/contrib/pgcrypto/expected/hmac-sha1.out
deleted file mode 100755
index d5f1cf2..0000000
--- a/contrib/pgcrypto/expected/hmac-sha1.out
+++ /dev/null
@@ -1,72 +0,0 @@
---
--- HMAC-MD5
---
-SELECT encode(hmac(
-'Hi There',
-decode('0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b', 'hex'),
-'sha1'), 'hex');
-                  encode                  
-------------------------------------------
- 675b0b3a1b4ddf4e124872da6c2f632bfed957e9
-(1 row)
-
--- 2
-SELECT encode(hmac(
-'Jefe',
-'what do ya want for nothing?',
-'sha1'), 'hex');
-                  encode                  
-------------------------------------------
- 156d4c35468a0339f3fa57a067bf47f814eb7a57
-(1 row)
-
--- 3
-SELECT encode(hmac(
-decode('dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd', 'hex'),
-decode('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 'hex'),
-'sha1'), 'hex');
-                  encode                  
-------------------------------------------
- d730594d167e35d5956fd8003d0db3d3f46dc7bb
-(1 row)
-
--- 4
-SELECT encode(hmac(
-decode('cdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcd', 'hex'),
-decode('0102030405060708090a0b0c0d0e0f10111213141516171819', 'hex'),
-'sha1'), 'hex');
-                  encode                  
-------------------------------------------
- 4c9007f4026250c6bc8414f9bf50c86c2d7235da
-(1 row)
-
--- 5
-SELECT encode(hmac(
-'Test With Truncation',
-decode('0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c', 'hex'),
-'sha1'), 'hex');
-                  encode                  
-------------------------------------------
- 37268b7e21e84da5720c53c4ba03ad1104039fa7
-(1 row)
-
--- 6
-SELECT encode(hmac(
-'Test Using Larger Than Block-Size Key - Hash Key First',
-decode('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 'hex'),
-'sha1'), 'hex');
-                  encode                  
-------------------------------------------
- aa4ae5e15272d00e95705637ce8a3b55ed402112
-(1 row)
-
--- 7
-SELECT encode(hmac(
-'Test Using Larger Than Block-Size Key and Larger Than One Block-Size Data',
-decode('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 'hex'),
-'sha1'), 'hex');
-                  encode                  
-------------------------------------------
- e8e99d0f45237d786d6bbaa7965c7808bbff1a91
-(1 row)
-

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/101adfab/contrib/pgcrypto/expected/init.out
----------------------------------------------------------------------
diff --git a/contrib/pgcrypto/expected/init.out b/contrib/pgcrypto/expected/init.out
deleted file mode 100755
index 649f9e8..0000000
--- a/contrib/pgcrypto/expected/init.out
+++ /dev/null
@@ -1,26 +0,0 @@
---
--- init pgcrypto
---
-\set ECHO none
--- check for encoding fn's
-SELECT encode('foo', 'hex');
- encode 
---------
- 666f6f
-(1 row)
-
-SELECT pg_catalog.decode('666f6f', 'hex');
- decode 
---------
- foo
-(1 row)
-
--- check error handling
-select gen_salt('foo');
-ERROR:  gen_salt: Unknown salt algorithm
-select digest('foo', 'foo');
-ERROR:  Cannot use "foo": No such hash algorithm
-select hmac('foo', 'foo', 'foo');
-ERROR:  Cannot use "foo": No such hash algorithm
-select encrypt('foo', 'foo', 'foo');
-ERROR:  Cannot use "foo": No such cipher algorithm

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/101adfab/contrib/pgcrypto/expected/md5.out
----------------------------------------------------------------------
diff --git a/contrib/pgcrypto/expected/md5.out b/contrib/pgcrypto/expected/md5.out
deleted file mode 100755
index e3301af..0000000
--- a/contrib/pgcrypto/expected/md5.out
+++ /dev/null
@@ -1,45 +0,0 @@
---
--- MD5 message digest
---
-SELECT encode(digest('', 'md5'), 'hex');
-              encode              
-----------------------------------
- d41d8cd98f00b204e9800998ecf8427e
-(1 row)
-
-SELECT encode(digest('a', 'md5'), 'hex');
-              encode              
-----------------------------------
- 0cc175b9c0f1b6a831c399e269772661
-(1 row)
-
-SELECT encode(digest('abc', 'md5'), 'hex');
-              encode              
-----------------------------------
- 900150983cd24fb0d6963f7d28e17f72
-(1 row)
-
-SELECT encode(digest('message digest', 'md5'), 'hex');
-              encode              
-----------------------------------
- f96b697d7cb7938d525a2f31aaf161d0
-(1 row)
-
-SELECT encode(digest('abcdefghijklmnopqrstuvwxyz', 'md5'), 'hex');
-              encode              
-----------------------------------
- c3fcd3d76192e4007dfb496cca67e13b
-(1 row)
-
-SELECT encode(digest('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789', 'md5'), 'hex');
-              encode              
-----------------------------------
- d174ab98d277d9f5a5611c2c9f419d9f
-(1 row)
-
-SELECT encode(digest('12345678901234567890123456789012345678901234567890123456789012345678901234567890', 'md5'), 'hex');
-              encode              
-----------------------------------
- 57edf4a22be3c955ac49da2e2107b67a
-(1 row)
-

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/101adfab/contrib/pgcrypto/expected/pgp-armor.out
----------------------------------------------------------------------
diff --git a/contrib/pgcrypto/expected/pgp-armor.out b/contrib/pgcrypto/expected/pgp-armor.out
deleted file mode 100755
index 60a89e5..0000000
--- a/contrib/pgcrypto/expected/pgp-armor.out
+++ /dev/null
@@ -1,102 +0,0 @@
---
--- PGP Armor
---
-select armor('');
-                             armor                             
----------------------------------------------------------------
- -----BEGIN PGP MESSAGE-----
-
-=twTO
------END PGP MESSAGE-----
-
-(1 row)
-
-select armor('test');
-                                 armor                                  
-------------------------------------------------------------------------
- -----BEGIN PGP MESSAGE-----
-
-dGVzdA==
-=+G7Q
------END PGP MESSAGE-----
-
-(1 row)
-
-select dearmor(armor(''));
- dearmor 
----------
- 
-(1 row)
-
-select dearmor(armor('zooka'));
- dearmor 
----------
- zooka
-(1 row)
-
-select armor('0123456789abcdef0123456789abcdef0123456789abcdef
-0123456789abcdef0123456789abcdef0123456789abcdef');
-                                                                                                armor                                                                                                
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- -----BEGIN PGP MESSAGE-----
-
-MDEyMzQ1Njc4OWFiY2RlZjAxMjM0NTY3ODlhYmNkZWYwMTIzNDU2Nzg5YWJjZGVmCjAxMjM0NTY3
-ODlhYmNkZWYwMTIzNDU2Nzg5YWJjZGVmMDEyMzQ1Njc4OWFiY2RlZg==
-=JFw5
------END PGP MESSAGE-----
-
-(1 row)
-
--- lots formatting
-select dearmor(' a pgp msg:
-
------BEGIN PGP MESSAGE-----
-Comment: Some junk
-
-em9va2E=
-
-  =D5cR
-
------END PGP MESSAGE-----');
- dearmor 
----------
- zooka
-(1 row)
-
--- lots messages
-select dearmor('
-wrong packet:
-  -----BEGIN PGP MESSAGE-----
-
-  d3Jvbmc=
-  =vCYP
-  -----END PGP MESSAGE-----
-
-right packet:
------BEGIN PGP MESSAGE-----
-
-cmlnaHQ=
-=nbpj
------END PGP MESSAGE-----
-
-use only first packet
------BEGIN PGP MESSAGE-----
-
-d3Jvbmc=
-=vCYP
------END PGP MESSAGE-----
-');
- dearmor 
----------
- right
-(1 row)
-
--- bad crc
-select dearmor('
------BEGIN PGP MESSAGE-----
-
-em9va2E=
-=ZZZZ
------END PGP MESSAGE-----
-');
-ERROR:  Corrupt ascii-armor

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/101adfab/contrib/pgcrypto/expected/pgp-compression.out
----------------------------------------------------------------------
diff --git a/contrib/pgcrypto/expected/pgp-compression.out b/contrib/pgcrypto/expected/pgp-compression.out
deleted file mode 100755
index 32b350b..0000000
--- a/contrib/pgcrypto/expected/pgp-compression.out
+++ /dev/null
@@ -1,50 +0,0 @@
---
--- PGP compression support
---
-select pgp_sym_decrypt(dearmor('
------BEGIN PGP MESSAGE-----
-
-ww0ECQMCsci6AdHnELlh0kQB4jFcVwHMJg0Bulop7m3Mi36s15TAhBo0AnzIrRFrdLVCkKohsS6+
-DMcmR53SXfLoDJOv/M8uKj3QSq7oWNIp95pxfA==
-=tbSn
------END PGP MESSAGE-----
-'), 'key', 'expect-compress-algo=1');
- pgp_sym_decrypt 
------------------
- Secret message
-(1 row)
-
-select pgp_sym_decrypt(
-	pgp_sym_encrypt('Secret message', 'key', 'compress-algo=0'),
-	'key', 'expect-compress-algo=0');
- pgp_sym_decrypt 
------------------
- Secret message
-(1 row)
-
-select pgp_sym_decrypt(
-	pgp_sym_encrypt('Secret message', 'key', 'compress-algo=1'),
-	'key', 'expect-compress-algo=1');
- pgp_sym_decrypt 
------------------
- Secret message
-(1 row)
-
-select pgp_sym_decrypt(
-	pgp_sym_encrypt('Secret message', 'key', 'compress-algo=2'),
-	'key', 'expect-compress-algo=2');
- pgp_sym_decrypt 
------------------
- Secret message
-(1 row)
-
--- level=0 should turn compression off
-select pgp_sym_decrypt(
-	pgp_sym_encrypt('Secret message', 'key',
-			'compress-algo=2, compress-level=0'),
-	'key', 'expect-compress-algo=0');
- pgp_sym_decrypt 
------------------
- Secret message
-(1 row)
-

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/101adfab/contrib/pgcrypto/expected/pgp-decrypt.out
----------------------------------------------------------------------
diff --git a/contrib/pgcrypto/expected/pgp-decrypt.out b/contrib/pgcrypto/expected/pgp-decrypt.out
deleted file mode 100755
index 8ecb56f..0000000
--- a/contrib/pgcrypto/expected/pgp-decrypt.out
+++ /dev/null
@@ -1,366 +0,0 @@
---
--- pgp_descrypt tests
---
---  Checking ciphers
-select pgp_sym_decrypt(dearmor('
------BEGIN PGP MESSAGE-----
-Comment: dat1.blowfish.sha1.mdc.s2k3.z0
-
-jA0EBAMCfFNwxnvodX9g0jwB4n4s26/g5VmKzVab1bX1SmwY7gvgvlWdF3jKisvS
-yA6Ce1QTMK3KdL2MPfamsTUSAML8huCJMwYQFfE=
-=JcP+
------END PGP MESSAGE-----
-'), 'foobar');
-   pgp_sym_decrypt   
------------------
- Secret message.
-(1 row)
-
-select pgp_sym_decrypt(dearmor('
------BEGIN PGP MESSAGE-----
-Comment: dat1.aes.sha1.mdc.s2k3.z0
-
-jA0EBwMCci97v0Q6Z0Zg0kQBsVf5Oe3iC+FBzUmuMV9KxmAyOMyjCc/5i8f1Eest
-UTAsG35A1vYs02VARKzGz6xI2UHwFUirP+brPBg3Ee7muOx8pA==
-=XtrP
------END PGP MESSAGE-----
-'), 'foobar');
-   pgp_sym_decrypt   
------------------
- Secret message.
-(1 row)
-
-select pgp_sym_decrypt(dearmor('
------BEGIN PGP MESSAGE-----
-Comment: dat1.aes192.sha1.mdc.s2k3.z0
-
-jA0ECAMCI7YQpWqp3D1g0kQBCjB7GlX7+SQeXNleXeXQ78ZAPNliquGDq9u378zI
-5FPTqAhIB2/2fjY8QEIs1ai00qphjX2NitxV/3Wn+6dufB4Q4g==
-=rCZt
------END PGP MESSAGE-----
-'), 'foobar');
-   pgp_sym_decrypt   
------------------
- Secret message.
-(1 row)
-
-select pgp_sym_decrypt(dearmor('
------BEGIN PGP MESSAGE-----
-Comment: dat1.aes256.sha1.mdc.s2k3.z0
-
-jA0ECQMC4f/5djqCC1Rg0kQBTHEPsD+Sw7biBsM2er3vKyGPAQkuTBGKC5ie7hT/
-lceMfQdbAg6oTFyJpk/wH18GzRDphCofg0X8uLgkAKMrpcmgog==
-=fB6S
------END PGP MESSAGE-----
-'), 'foobar');
-   pgp_sym_decrypt   
------------------
- Secret message.
-(1 row)
-
--- Checking MDC modes
-select pgp_sym_decrypt(dearmor('
------BEGIN PGP MESSAGE-----
-Comment: dat1.aes.sha1.nomdc.s2k3.z0
-
-jA0EBwMCnv07rlXqWctgyS2Dm2JfOKCRL4sLSLJUC8RS2cH7cIhKSuLitOtyquB+
-u9YkgfJfsuRJmgQ9tmo=
-=60ui
------END PGP MESSAGE-----
-'), 'foobar');
-   pgp_sym_decrypt   
------------------
- Secret message.
-(1 row)
-
-select pgp_sym_decrypt(dearmor('
------BEGIN PGP MESSAGE-----
-Comment: dat1.aes.sha1.mdc.s2k3.z0
-
-jA0EBwMCEeP3idNjQ1Bg0kQBf4G0wX+2QNzLh2YNwYkQgQkfYhn/hLXjV4nK9nsE
-8Ex1Dsdt5UPvOz8W8VKQRS6loOfOe+yyXil8W3IYFwUpdDUi+Q==
-=moGf
------END PGP MESSAGE-----
-'), 'foobar');
-   pgp_sym_decrypt   
------------------
- Secret message.
-(1 row)
-
--- Checking hashes
-select pgp_sym_decrypt(dearmor('
------BEGIN PGP MESSAGE-----
-Comment: dat1.aes.md5.mdc.s2k3.z0
-
-jA0EBwMClrXXtOXetohg0kQBn0Kl1ymevQZRHkdoYRHgzCwSQEiss7zYff2UNzgO
-KyRrHf7zEBuZiZ2AG34jNVMOLToj1jJUg5zTSdecUzQVCykWTA==
-=NyLk
------END PGP MESSAGE-----
-'), 'foobar');
-   pgp_sym_decrypt   
------------------
- Secret message.
-(1 row)
-
-select pgp_sym_decrypt(dearmor('
------BEGIN PGP MESSAGE-----
-Comment: dat1.aes.sha1.mdc.s2k3.z0
-
-jA0EBwMCApbdlrURoWJg0kQBzHM/E0o7djY82bNuspjxjAcPFrrtp0uvDdMQ4z2m
-/PM8jhgI5vxFYfNQjLl8y3fHYIomk9YflN9K/Q13iq8A8sjeTw==
-=FxbQ
------END PGP MESSAGE-----
-'), 'foobar');
-   pgp_sym_decrypt   
------------------
- Secret message.
-(1 row)
-
--- Checking S2K modes
-select pgp_sym_decrypt(dearmor('
------BEGIN PGP MESSAGE-----
-Comment: dat1.aes.sha1.mdc.s2k0.z0
-
-jAQEBwAC0kQBKTaLAKE3xzps+QIZowqRNb2eAdzBw2LxEW2YD5PgNlbhJdGg+dvw
-Ah9GXjGS1TVALzTImJbz1uHUZRfhJlFbc5yGQw==
-=YvkV
------END PGP MESSAGE-----
-'), 'foobar');
-   pgp_sym_decrypt   
------------------
- Secret message.
-(1 row)
-
-select pgp_sym_decrypt(dearmor('
------BEGIN PGP MESSAGE-----
-Comment: dat1.aes.sha1.mdc.s2k1.z0
-
-jAwEBwEC/QTByBLI3b/SRAHPxKzI6SZBo5lAEOD+EsvKQWO4adL9tDY+++Iqy1xK
-4IaWXVKEj9R2Lr2xntWWMGZtcKtjD2lFFRXXd9dZp1ZThNDz
-=dbXm
------END PGP MESSAGE-----
-'), 'foobar');
-   pgp_sym_decrypt   
------------------
- Secret message.
-(1 row)
-
-select pgp_sym_decrypt(dearmor('
------BEGIN PGP MESSAGE-----
-Comment: dat1.aes.sha1.mdc.s2k3.z0
-
-jA0EBwMCEq4Su3ZqNEJg0kQB4QG5jBTKF0i04xtH+avzmLhstBNRxvV3nsmB3cwl
-z+9ZaA/XdSx5ZiFnMym8P6r8uY9rLjjNptvvRHlxIReF+p9MNg==
-=VJKg
------END PGP MESSAGE-----
-'), 'foobar');
-   pgp_sym_decrypt   
------------------
- Secret message.
-(1 row)
-
-select pgp_sym_decrypt(dearmor('
------BEGIN PGP MESSAGE-----
-Comment: dat1.aes192.sha1.mdc.s2k0.z0
-
-jAQECAAC0kQBBDnQWkgsx9YFaqDfWmpsiyAJ6y2xG/sBvap1dySYEMuZ+wJTXQ9E
-Cr3i2M7TgVZ0M4jp4QL0adG1lpN5iK7aQeOwMw==
-=cg+i
------END PGP MESSAGE-----
-'), 'foobar');
-   pgp_sym_decrypt   
------------------
- Secret message.
-(1 row)
-
-select pgp_sym_decrypt(dearmor('
------BEGIN PGP MESSAGE-----
-Comment: dat1.aes192.sha1.mdc.s2k1.z0
-
-jAwECAECruOfyNDFiTnSRAEVoGXm4A9UZKkWljdzjEO/iaE7mIraltIpQMkiqCh9
-7h8uZ2u9uRBOv222fZodGvc6bvq/4R4hAa/6qSHtm8mdmvGt
-=aHmC
------END PGP MESSAGE-----
-'), 'foobar');
-   pgp_sym_decrypt   
------------------
- Secret message.
-(1 row)
-
-select pgp_sym_decrypt(dearmor('
------BEGIN PGP MESSAGE-----
-Comment: dat1.aes192.sha1.mdc.s2k3.z0
-
-jA0ECAMCjFn6SRi3SONg0kQBqtSHPaD0m7rXfDAhCWU/ypAsI93GuHGRyM99cvMv
-q6eF6859ZVnli3BFSDSk3a4e/pXhglxmDYCfjAXkozKNYLo6yw==
-=K0LS
------END PGP MESSAGE-----
-'), 'foobar');
-   pgp_sym_decrypt   
------------------
- Secret message.
-(1 row)
-
-select pgp_sym_decrypt(dearmor('
------BEGIN PGP MESSAGE-----
-Comment: dat1.aes256.sha1.mdc.s2k0.z0
-
-jAQECQAC0kQB4L1eMbani07XF2ZYiXNK9LW3v8w41oUPl7dStmrJPQFwsdxmrDHu
-rQr3WbdKdY9ufjOE5+mXI+EFkSPrF9rL9NCq6w==
-=RGts
------END PGP MESSAGE-----
-'), 'foobar');
-   pgp_sym_decrypt   
------------------
- Secret message.
-(1 row)
-
-select pgp_sym_decrypt(dearmor('
------BEGIN PGP MESSAGE-----
-Comment: dat1.aes256.sha1.mdc.s2k1.z0
-
-jAwECQECKHhrou7ZOIXSRAHWIVP+xjVQcjAVBTt+qh9SNzYe248xFTwozkwev3mO
-+KVJW0qhk0An+Y2KF99/bYFl9cL5D3Tl43fC8fXGl3x3m7pR
-=SUrU
------END PGP MESSAGE-----
-'), 'foobar');
-   pgp_sym_decrypt   
------------------
- Secret message.
-(1 row)
-
-select pgp_sym_decrypt(dearmor('
------BEGIN PGP MESSAGE-----
-Comment: dat1.aes256.sha1.mdc.s2k3.z0
-
-jA0ECQMCjc8lwZu8Fz1g0kQBkEzjImi21liep5jj+3dAJ2aZFfUkohi8b3n9z+7+
-4+NRzL7cMW2RLAFnJbiqXDlRHMwleeuLN1up2WIxsxtYYuaBjA==
-=XZrG
------END PGP MESSAGE-----
-'), 'foobar');
-   pgp_sym_decrypt   
------------------
- Secret message.
-(1 row)
-
--- Checking longer passwords
-select pgp_sym_decrypt(dearmor('
------BEGIN PGP MESSAGE-----
-Comment: dat1.aes.sha1.mdc.s2k3.z0
-
-jA0EBwMCx6dBiuqrYNRg0kQBEo63AvA1SCslxP7ayanLf1H0/hlk2nONVhTwVEWi
-tTGup1mMz6Cfh1uDRErUuXpx9A0gdMu7zX0o5XjrL7WGDAZdSw==
-=XKKG
------END PGP MESSAGE-----
-'), '0123456789abcdefghij');
-   pgp_sym_decrypt   
------------------
- Secret message.
-(1 row)
-
-select pgp_sym_decrypt(dearmor('
------BEGIN PGP MESSAGE-----
-Comment: dat1.aes.sha1.mdc.s2k3.z0
-
-jA0EBwMCBDvYuS990iFg0kQBW31UK5OiCjWf5x6KJ8qNNT2HZWQCjCBZMU0XsOC6
-CMxFKadf144H/vpoV9GA0f22keQgCl0EsTE4V4lweVOPTKCMJg==
-=gWDh
------END PGP MESSAGE-----
-'), '0123456789abcdefghij2jk4h5g2j54khg23h54g2kh54g2khj54g23hj54');
-   pgp_sym_decrypt   
------------------
- Secret message.
-(1 row)
-
-select pgp_sym_decrypt(dearmor('
------BEGIN PGP MESSAGE-----
-Comment: dat1.aes.sha1.mdc.s2k3.z0
-
-jA0EBwMCqXbFafC+ofVg0kQBejyiPqH0QMERVGfmPOjtAxvyG5KDIJPYojTgVSDt
-FwsDabdQUz5O7bgNSnxfmyw1OifGF+W2bIn/8W+0rDf8u3+O+Q==
-=OxOF
------END PGP MESSAGE-----
-'), 'x');
-   pgp_sym_decrypt   
------------------
- Secret message.
-(1 row)
-
--- Checking various data
-select encode(digest(pgp_sym_decrypt(dearmor('
------BEGIN PGP MESSAGE-----
-Comment: dat1.aes.sha1.mdc.s2k3.z0
-
-jA0EBwMCGJ+SpuOysINg0kQBJfSjzsW0x4OVcAyr17O7FBvMTwIGeGcJd99oTQU8
-Xtx3kDqnhUq9Z1fS3qPbi5iNP2A9NxOBxPWz2JzxhydANlgbxg==
-=W/ik
------END PGP MESSAGE-----
-'), '0123456789abcdefghij'), 'sha1'), 'hex');
-                  encode                  
-------------------------------------------
- 0225e3ede6f2587b076d021a189ff60aad67e066
-(1 row)
-
--- expected: 0225e3ede6f2587b076d021a189ff60aad67e066
-select encode(digest(pgp_sym_decrypt(dearmor('
------BEGIN PGP MESSAGE-----
-Comment: dat2.aes.sha1.mdc.s2k3.z0
-
-jA0EBwMCvdpDvidNzMxg0jUBvj8eS2+1t/9/zgemxvhtc0fvdKGGbjH7dleaTJRB
-SaV9L04ky1qECNDx3XjnoKLC+H7IOQ==
-=Fxen
------END PGP MESSAGE-----
-'), '0123456789abcdefghij'), 'sha1'), 'hex');
-                  encode                  
-------------------------------------------
- da39a3ee5e6b4b0d3255bfef95601890afd80709
-(1 row)
-
--- expected: da39a3ee5e6b4b0d3255bfef95601890afd80709
-select encode(digest(pgp_sym_decrypt(dearmor('
------BEGIN PGP MESSAGE-----
-Comment: dat3.aes.sha1.mdc.s2k3.z0
-
-jA0EBwMCxQvxJZ3G/HRg0lgBeYmTa7/uDAjPyFwSX4CYBgpZWVn/JS8JzILrcWF8
-gFnkUKIE0PSaYFp+Yi1VlRfUtRQ/X/LYNGa7tWZS+4VQajz2Xtz4vUeAEiYFYPXk
-73Hb8m1yRhQK
-=ivrD
------END PGP MESSAGE-----
-'), '0123456789abcdefghij'), 'sha1'), 'hex');
-                  encode                  
-------------------------------------------
- 5e5c135efc0dd00633efc6dfd6e731ea408a5b4c
-(1 row)
-
--- expected: 5e5c135efc0dd00633efc6dfd6e731ea408a5b4c
--- Checking CRLF
-select encode(digest(pgp_sym_decrypt(dearmor('
------BEGIN PGP MESSAGE-----
-Comment: crlf mess
-
-ww0ECQMCt7VAtby6l4Bi0lgB5KMIZiiF/b3CfMfUyY0eDncsGXtkbu1X+l9brjpMP8eJnY79Amms
-a3nsOzKTXUfS9VyaXo8IrncM6n7fdaXpwba/3tNsAhJG4lDv1k4g9v8Ix2dfv6Rs
-=mBP9
------END PGP MESSAGE-----
-'), 'key', 'convert-crlf=0'), 'sha1'), 'hex');
-                  encode                  
-------------------------------------------
- 9353062be7720f1446d30b9e75573a4833886784
-(1 row)
-
--- expected: 9353062be7720f1446d30b9e75573a4833886784
-select encode(digest(pgp_sym_decrypt(dearmor('
------BEGIN PGP MESSAGE-----
-Comment: crlf mess
-
-ww0ECQMCt7VAtby6l4Bi0lgB5KMIZiiF/b3CfMfUyY0eDncsGXtkbu1X+l9brjpMP8eJnY79Amms
-a3nsOzKTXUfS9VyaXo8IrncM6n7fdaXpwba/3tNsAhJG4lDv1k4g9v8Ix2dfv6Rs
-=mBP9
------END PGP MESSAGE-----
-'), 'key', 'convert-crlf=1'), 'sha1'), 'hex');
-                  encode                  
-------------------------------------------
- 7efefcab38467f7484d6fa43dc86cf5281bd78e2
-(1 row)
-
--- expected: 7efefcab38467f7484d6fa43dc86cf5281bd78e2

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/101adfab/contrib/pgcrypto/expected/pgp-encrypt-DISABLED.out
----------------------------------------------------------------------
diff --git a/contrib/pgcrypto/expected/pgp-encrypt-DISABLED.out b/contrib/pgcrypto/expected/pgp-encrypt-DISABLED.out
deleted file mode 100755
index 4122300..0000000
--- a/contrib/pgcrypto/expected/pgp-encrypt-DISABLED.out
+++ /dev/null
@@ -1 +0,0 @@
--- no random source

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/101adfab/contrib/pgcrypto/expected/pgp-encrypt.out
----------------------------------------------------------------------
diff --git a/contrib/pgcrypto/expected/pgp-encrypt.out b/contrib/pgcrypto/expected/pgp-encrypt.out
deleted file mode 100755
index ab33a04..0000000
--- a/contrib/pgcrypto/expected/pgp-encrypt.out
+++ /dev/null
@@ -1,189 +0,0 @@
---
--- PGP encrypt
---
-select pgp_sym_decrypt(pgp_sym_encrypt('Secret.', 'key'), 'key');
- pgp_sym_decrypt 
------------------
- Secret.
-(1 row)
-
--- check whether the defaults are ok
-select pgp_sym_decrypt(pgp_sym_encrypt('Secret.', 'key'),
- 	'key', 'expect-cipher-algo=aes128,
-		expect-disable-mdc=0,
-		expect-sess-key=0,
-		expect-s2k-mode=3,
-		expect-s2k-digest-algo=sha1,
-		expect-compress-algo=0
-		');
- pgp_sym_decrypt 
------------------
- Secret.
-(1 row)
-
--- maybe the expect- stuff simply does not work
-select pgp_sym_decrypt(pgp_sym_encrypt('Secret.', 'key'),
- 	'key', 'expect-cipher-algo=bf,
-		expect-disable-mdc=1,
-		expect-sess-key=1,
-		expect-s2k-mode=0,
-		expect-s2k-digest-algo=md5,
-		expect-compress-algo=1
-		');
-NOTICE:  pgp_decrypt: unexpected cipher_algo: expected 4 got 7
-NOTICE:  pgp_decrypt: unexpected s2k_mode: expected 0 got 3
-NOTICE:  pgp_decrypt: unexpected s2k_digest_algo: expected 1 got 2
-NOTICE:  pgp_decrypt: unexpected use_sess_key: expected 1 got 0
-NOTICE:  pgp_decrypt: unexpected disable_mdc: expected 1 got 0
-NOTICE:  pgp_decrypt: unexpected compress_algo: expected 1 got 0
- pgp_sym_decrypt 
------------------
- Secret.
-(1 row)
-
--- bytea as text
-select pgp_sym_decrypt(pgp_sym_encrypt_bytea('Binary', 'baz'), 'baz');
-ERROR:  Not text data
--- text as bytea
-select pgp_sym_decrypt_bytea(pgp_sym_encrypt('Text', 'baz'), 'baz');
- pgp_sym_decrypt_bytea 
------------------------
- Text
-(1 row)
-
--- algorithm change
-select pgp_sym_decrypt(
-	pgp_sym_encrypt('Secret.', 'key', 'cipher-algo=bf'),
- 	'key', 'expect-cipher-algo=bf');
- pgp_sym_decrypt 
------------------
- Secret.
-(1 row)
-
-select pgp_sym_decrypt(
-	pgp_sym_encrypt('Secret.', 'key', 'cipher-algo=aes'),
- 	'key', 'expect-cipher-algo=aes128');
- pgp_sym_decrypt 
------------------
- Secret.
-(1 row)
-
-select pgp_sym_decrypt(
-	pgp_sym_encrypt('Secret.', 'key', 'cipher-algo=aes192'),
- 	'key', 'expect-cipher-algo=aes192');
- pgp_sym_decrypt 
------------------
- Secret.
-(1 row)
-
--- s2k change
-select pgp_sym_decrypt(
-	pgp_sym_encrypt('Secret.', 'key', 's2k-mode=0'),
- 	'key', 'expect-s2k-mode=0');
- pgp_sym_decrypt 
------------------
- Secret.
-(1 row)
-
-select pgp_sym_decrypt(
-	pgp_sym_encrypt('Secret.', 'key', 's2k-mode=1'),
- 	'key', 'expect-s2k-mode=1');
- pgp_sym_decrypt 
------------------
- Secret.
-(1 row)
-
-select pgp_sym_decrypt(
-	pgp_sym_encrypt('Secret.', 'key', 's2k-mode=3'),
- 	'key', 'expect-s2k-mode=3');
- pgp_sym_decrypt 
------------------
- Secret.
-(1 row)
-
--- s2k digest change
-select pgp_sym_decrypt(
-	pgp_sym_encrypt('Secret.', 'key', 's2k-digest-algo=md5'),
- 	'key', 'expect-s2k-digest-algo=md5');
- pgp_sym_decrypt 
------------------
- Secret.
-(1 row)
-
-select pgp_sym_decrypt(
-		pgp_sym_encrypt('Secret.', 'key', 's2k-digest-algo=sha1'),
- 	'key', 'expect-s2k-digest-algo=sha1');
- pgp_sym_decrypt 
------------------
- Secret.
-(1 row)
-
--- sess key
-select pgp_sym_decrypt(
-	pgp_sym_encrypt('Secret.', 'key', 'sess-key=0'),
- 	'key', 'expect-sess-key=0');
- pgp_sym_decrypt 
------------------
- Secret.
-(1 row)
-
-select pgp_sym_decrypt(
-	pgp_sym_encrypt('Secret.', 'key', 'sess-key=1'),
- 	'key', 'expect-sess-key=1');
- pgp_sym_decrypt 
------------------
- Secret.
-(1 row)
-
-select pgp_sym_decrypt(
-	pgp_sym_encrypt('Secret.', 'key', 'sess-key=1, cipher-algo=bf'),
- 	'key', 'expect-sess-key=1, expect-cipher-algo=bf');
- pgp_sym_decrypt 
------------------
- Secret.
-(1 row)
-
-select pgp_sym_decrypt(
-	pgp_sym_encrypt('Secret.', 'key', 'sess-key=1, cipher-algo=aes192'),
- 	'key', 'expect-sess-key=1, expect-cipher-algo=aes192');
- pgp_sym_decrypt 
------------------
- Secret.
-(1 row)
-
-select pgp_sym_decrypt(
-	pgp_sym_encrypt('Secret.', 'key', 'sess-key=1, cipher-algo=aes256'),
- 	'key', 'expect-sess-key=1, expect-cipher-algo=aes256');
- pgp_sym_decrypt 
------------------
- Secret.
-(1 row)
-
--- no mdc
-select pgp_sym_decrypt(
-		pgp_sym_encrypt('Secret.', 'key', 'disable-mdc=1'),
- 	'key', 'expect-disable-mdc=1');
- pgp_sym_decrypt 
------------------
- Secret.
-(1 row)
-
--- crlf
-select encode(pgp_sym_decrypt_bytea(
-	pgp_sym_encrypt('1\n2\n3\r\n', 'key', 'convert-crlf=1'),
- 	'key'), 'hex');
-        encode        
-----------------------
- 310d0a320d0a330d0d0a
-(1 row)
-
--- conversion should be lossless
-select encode(digest(pgp_sym_decrypt(
-  pgp_sym_encrypt('\r\n0\n1\r\r\n\n2\r', 'key', 'convert-crlf=1'),
- 	'key', 'convert-crlf=1'), 'sha1'), 'hex') as result,
-  encode(digest('\r\n0\n1\r\r\n\n2\r', 'sha1'), 'hex') as expect;
-                  result                  |                  expect                  
-------------------------------------------+------------------------------------------
- 47bde5d88d6ef8770572b9cbb4278b402aa69966 | 47bde5d88d6ef8770572b9cbb4278b402aa69966
-(1 row)
-

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/101adfab/contrib/pgcrypto/expected/pgp-info.out
----------------------------------------------------------------------
diff --git a/contrib/pgcrypto/expected/pgp-info.out b/contrib/pgcrypto/expected/pgp-info.out
deleted file mode 100755
index 1fe0088..0000000
--- a/contrib/pgcrypto/expected/pgp-info.out
+++ /dev/null
@@ -1,78 +0,0 @@
---
--- PGP info functions
---
--- pgp_key_id
-select pgp_key_id(dearmor(pubkey)) from keytbl where id=1;
-    pgp_key_id    
-------------------
- D936CF64BB73F466
-(1 row)
-
-select pgp_key_id(dearmor(pubkey)) from keytbl where id=2;
-    pgp_key_id    
-------------------
- 2C226E1FFE5CC7D4
-(1 row)
-
-select pgp_key_id(dearmor(pubkey)) from keytbl where id=3;
-    pgp_key_id    
-------------------
- B68504FD128E1FF9
-(1 row)
-
-select pgp_key_id(dearmor(pubkey)) from keytbl where id=4; -- should fail
-ERROR:  No encryption key found
-select pgp_key_id(dearmor(pubkey)) from keytbl where id=5;
-    pgp_key_id    
-------------------
- D936CF64BB73F466
-(1 row)
-
-select pgp_key_id(dearmor(pubkey)) from keytbl where id=6;
-    pgp_key_id    
-------------------
- FD0206C409B74875
-(1 row)
-
-select pgp_key_id(dearmor(seckey)) from keytbl where id=1;
-    pgp_key_id    
-------------------
- D936CF64BB73F466
-(1 row)
-
-select pgp_key_id(dearmor(seckey)) from keytbl where id=2;
-    pgp_key_id    
-------------------
- 2C226E1FFE5CC7D4
-(1 row)
-
-select pgp_key_id(dearmor(seckey)) from keytbl where id=3;
-    pgp_key_id    
-------------------
- B68504FD128E1FF9
-(1 row)
-
-select pgp_key_id(dearmor(seckey)) from keytbl where id=4; -- should fail
-ERROR:  No encryption key found
-select pgp_key_id(dearmor(seckey)) from keytbl where id=5;
-    pgp_key_id    
-------------------
- D936CF64BB73F466
-(1 row)
-
-select pgp_key_id(dearmor(seckey)) from keytbl where id=6;
-    pgp_key_id    
-------------------
- FD0206C409B74875
-(1 row)
-
-select pgp_key_id(dearmor(data)) as data_key_id
-from encdata order by id;
-   data_key_id    
-------------------
- D936CF64BB73F466
- 2C226E1FFE5CC7D4
- B68504FD128E1FF9
- FD0206C409B74875
-(4 rows)
-

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/101adfab/contrib/pgcrypto/expected/pgp-pubkey-DISABLED.out
----------------------------------------------------------------------
diff --git a/contrib/pgcrypto/expected/pgp-pubkey-DISABLED.out b/contrib/pgcrypto/expected/pgp-pubkey-DISABLED.out
deleted file mode 100755
index d35c097..0000000
--- a/contrib/pgcrypto/expected/pgp-pubkey-DISABLED.out
+++ /dev/null
@@ -1 +0,0 @@
--- no bignum support


Mime
View raw message