1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-31 22:04:40 +03:00

pgindent run for 8.3.

This commit is contained in:
Bruce Momjian
2007-11-15 21:14:46 +00:00
parent 3adc760fb9
commit fdf5a5efb7
486 changed files with 10044 additions and 9664 deletions

View File

@ -1,7 +1,7 @@
/*
* Butchered version of sshblowf.c from putty-0.59.
*
* $PostgreSQL: pgsql/contrib/pgcrypto/blf.c,v 1.8 2007/03/28 22:48:58 neilc Exp $
* $PostgreSQL: pgsql/contrib/pgcrypto/blf.c,v 1.9 2007/11/15 21:14:31 momjian Exp $
*/
/*
@ -251,7 +251,7 @@ static const uint32 sbox3[] = {
static void
blowfish_encrypt(uint32 xL, uint32 xR, uint32 *output,
BlowfishContext *ctx)
BlowfishContext * ctx)
{
uint32 *S0 = ctx->S0;
uint32 *S1 = ctx->S1;
@ -285,7 +285,7 @@ blowfish_encrypt(uint32 xL, uint32 xR, uint32 *output,
static void
blowfish_decrypt(uint32 xL, uint32 xR, uint32 *output,
BlowfishContext *ctx)
BlowfishContext * ctx)
{
uint32 *S0 = ctx->S0;
uint32 *S1 = ctx->S1;
@ -318,7 +318,7 @@ blowfish_decrypt(uint32 xL, uint32 xR, uint32 *output,
}
void
blowfish_encrypt_cbc(uint8 *blk, int len, BlowfishContext *ctx)
blowfish_encrypt_cbc(uint8 *blk, int len, BlowfishContext * ctx)
{
uint32 xL,
xR,
@ -351,7 +351,7 @@ blowfish_encrypt_cbc(uint8 *blk, int len, BlowfishContext *ctx)
}
void
blowfish_decrypt_cbc(uint8 *blk, int len, BlowfishContext *ctx)
blowfish_decrypt_cbc(uint8 *blk, int len, BlowfishContext * ctx)
{
uint32 xL,
xR,
@ -384,7 +384,7 @@ blowfish_decrypt_cbc(uint8 *blk, int len, BlowfishContext *ctx)
}
void
blowfish_encrypt_ecb(uint8 *blk, int len, BlowfishContext *ctx)
blowfish_encrypt_ecb(uint8 *blk, int len, BlowfishContext * ctx)
{
uint32 xL,
xR,
@ -405,7 +405,7 @@ blowfish_encrypt_ecb(uint8 *blk, int len, BlowfishContext *ctx)
}
void
blowfish_decrypt_ecb(uint8 *blk, int len, BlowfishContext *ctx)
blowfish_decrypt_ecb(uint8 *blk, int len, BlowfishContext * ctx)
{
uint32 xL,
xR,
@ -426,7 +426,7 @@ blowfish_decrypt_ecb(uint8 *blk, int len, BlowfishContext *ctx)
}
void
blowfish_setkey(BlowfishContext *ctx,
blowfish_setkey(BlowfishContext * ctx,
const uint8 *key, short keybytes)
{
uint32 *S0 = ctx->S0;
@ -437,7 +437,7 @@ blowfish_setkey(BlowfishContext *ctx,
uint32 str[2];
int i;
Assert(keybytes > 0 && keybytes <= (448/8));
Assert(keybytes > 0 && keybytes <= (448 / 8));
for (i = 0; i < 18; i++)
{
@ -492,9 +492,8 @@ blowfish_setkey(BlowfishContext *ctx,
}
void
blowfish_setiv(BlowfishContext *ctx, const uint8 *iv)
blowfish_setiv(BlowfishContext * ctx, const uint8 *iv)
{
ctx->iv0 = GET_32BIT_MSB_FIRST(iv);
ctx->iv1 = GET_32BIT_MSB_FIRST(iv + 4);
}

View File

@ -1,4 +1,4 @@
/* $PostgreSQL: pgsql/contrib/pgcrypto/blf.h,v 1.6 2007/03/28 22:48:58 neilc Exp $ */
/* $PostgreSQL: pgsql/contrib/pgcrypto/blf.h,v 1.7 2007/11/15 21:14:31 momjian Exp $ */
/*
* PuTTY is copyright 1997-2007 Simon Tatham.
*
@ -35,14 +35,12 @@ typedef struct
S3[256],
P[18];
uint32 iv0,
iv1; /* for CBC mode */
} BlowfishContext;
void blowfish_setkey(BlowfishContext *ctx, const uint8 *key, short keybytes);
void blowfish_setiv(BlowfishContext *ctx, const uint8 *iv);
void blowfish_encrypt_cbc(uint8 *blk, int len, BlowfishContext *ctx);
void blowfish_decrypt_cbc(uint8 *blk, int len, BlowfishContext *ctx);
void blowfish_encrypt_ecb(uint8 *blk, int len, BlowfishContext *ctx);
void blowfish_decrypt_ecb(uint8 *blk, int len, BlowfishContext *ctx);
iv1; /* for CBC mode */
} BlowfishContext;
void blowfish_setkey(BlowfishContext * ctx, const uint8 *key, short keybytes);
void blowfish_setiv(BlowfishContext * ctx, const uint8 *iv);
void blowfish_encrypt_cbc(uint8 *blk, int len, BlowfishContext * ctx);
void blowfish_decrypt_cbc(uint8 *blk, int len, BlowfishContext * ctx);
void blowfish_encrypt_ecb(uint8 *blk, int len, BlowfishContext * ctx);
void blowfish_decrypt_ecb(uint8 *blk, int len, BlowfishContext * ctx);

View File

@ -1,5 +1,5 @@
/*
* $PostgreSQL: pgsql/contrib/pgcrypto/crypt-blowfish.c,v 1.12 2007/04/06 05:36:50 tgl Exp $
* $PostgreSQL: pgsql/contrib/pgcrypto/crypt-blowfish.c,v 1.13 2007/11/15 21:14:31 momjian Exp $
*
* This code comes from John the Ripper password cracker, with reentrant
* and crypt(3) interfaces added, but optimizations specific to password
@ -436,7 +436,7 @@ BF_encode(char *dst, const BF_word * src, int size)
}
static void
BF_swap(BF_word *x, int count)
BF_swap(BF_word * x, int count)
{
/* Swap on little-endian hardware, else do nothing */
#ifndef WORDS_BIGENDIAN

View File

@ -26,7 +26,7 @@
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
/* $PostgreSQL: pgsql/contrib/pgcrypto/imath.h,v 1.5 2006/10/04 00:29:46 momjian Exp $ */
/* $PostgreSQL: pgsql/contrib/pgcrypto/imath.h,v 1.6 2007/11/15 21:14:31 momjian Exp $ */
#ifndef IMATH_H_
#define IMATH_H_
@ -115,11 +115,12 @@ mp_result mp_int_mul(mp_int a, mp_int b, mp_int c); /* c = a * b */
mp_result mp_int_mul_value(mp_int a, int value, mp_int c);
mp_result mp_int_mul_pow2(mp_int a, int p2, mp_int c);
mp_result mp_int_sqr(mp_int a, mp_int c); /* c = a * a */
mp_result
mp_int_div(mp_int a, mp_int b, /* q = a / b */
mp_int_div(mp_int a, mp_int b, /* q = a / b */
mp_int q, mp_int r); /* r = a % b */
mp_result
mp_int_div_value(mp_int a, int value, /* q = a / value */
mp_int_div_value(mp_int a, int value, /* q = a / value */
mp_int q, int *r); /* r = a % value */
mp_result
mp_int_div_pow2(mp_int a, int p2, /* q = a / 2^p2 */

View File

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $PostgreSQL: pgsql/contrib/pgcrypto/internal.c,v 1.26 2007/03/28 22:48:58 neilc Exp $
* $PostgreSQL: pgsql/contrib/pgcrypto/internal.c,v 1.27 2007/11/15 21:14:31 momjian Exp $
*/
#include "postgres.h"
@ -251,7 +251,7 @@ struct int_ctx
uint8 iv[INT_MAX_IV];
union
{
BlowfishContext bf;
BlowfishContext bf;
rijndael_ctx rj;
} ctx;
unsigned keylen;
@ -426,7 +426,7 @@ bf_block_size(PX_Cipher * c)
static unsigned
bf_key_size(PX_Cipher * c)
{
return 448/8;
return 448 / 8;
}
static unsigned

View File

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $PostgreSQL: pgsql/contrib/pgcrypto/openssl.c,v 1.31 2007/09/29 02:18:15 tgl Exp $
* $PostgreSQL: pgsql/contrib/pgcrypto/openssl.c,v 1.32 2007/11/15 21:14:31 momjian Exp $
*/
#include "postgres.h"
@ -98,10 +98,13 @@ static void
AES_cbc_encrypt(const uint8 *src, uint8 *dst, int len, AES_KEY *ctx, uint8 *iv, int enc)
{
memcpy(dst, src, len);
if (enc) {
if (enc)
{
aes_cbc_encrypt(ctx, iv, dst, len);
memcpy(iv, dst + len - 16, 16);
} else {
}
else
{
aes_cbc_decrypt(ctx, iv, dst, len);
memcpy(iv, src + len - 16, 16);
}
@ -394,26 +397,27 @@ static int
bf_check_supported_key_len(void)
{
static const uint8 key[56] = {
0xf0,0xe1,0xd2,0xc3,0xb4,0xa5,0x96,0x87,0x78,0x69,
0x5a,0x4b,0x3c,0x2d,0x1e,0x0f,0x00,0x11,0x22,0x33,
0x44,0x55,0x66,0x77,0x04,0x68,0x91,0x04,0xc2,0xfd,
0x3b,0x2f,0x58,0x40,0x23,0x64,0x1a,0xba,0x61,0x76,
0x1f,0x1f,0x1f,0x1f,0x0e,0x0e,0x0e,0x0e,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff
0xf0, 0xe1, 0xd2, 0xc3, 0xb4, 0xa5, 0x96, 0x87, 0x78, 0x69,
0x5a, 0x4b, 0x3c, 0x2d, 0x1e, 0x0f, 0x00, 0x11, 0x22, 0x33,
0x44, 0x55, 0x66, 0x77, 0x04, 0x68, 0x91, 0x04, 0xc2, 0xfd,
0x3b, 0x2f, 0x58, 0x40, 0x23, 0x64, 0x1a, 0xba, 0x61, 0x76,
0x1f, 0x1f, 0x1f, 0x1f, 0x0e, 0x0e, 0x0e, 0x0e, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff
};
static const uint8 data[8] = {0xfe,0xdc,0xba,0x98,0x76,0x54,0x32,0x10};
static const uint8 res[8] = {0xc0,0x45,0x04,0x01,0x2e,0x4e,0x1f,0x53};
static const uint8 data[8] = {0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10};
static const uint8 res[8] = {0xc0, 0x45, 0x04, 0x01, 0x2e, 0x4e, 0x1f, 0x53};
static uint8 out[8];
BF_KEY bf_key;
BF_KEY bf_key;
/* encrypt with 448bits key and verify output */
BF_set_key(&bf_key, 56, key);
BF_ecb_encrypt(data, out, &bf_key, BF_ENCRYPT);
if (memcmp(out, res, 8) != 0)
return 0; /* Output does not match -> strong cipher is not supported */
if (memcmp(out, res, 8) != 0)
return 0; /* Output does not match -> strong cipher is
* not supported */
return 1;
}
@ -421,18 +425,19 @@ static int
bf_init(PX_Cipher * c, const uint8 *key, unsigned klen, const uint8 *iv)
{
ossldata *od = c->ptr;
static int bf_is_strong = -1;
static int bf_is_strong = -1;
/*
* Test if key len is supported. BF_set_key silently cut large keys and it could be
* be a problem when user transfer crypted data from one server to another.
* Test if key len is supported. BF_set_key silently cut large keys and it
* could be be a problem when user transfer crypted data from one server
* to another.
*/
if( bf_is_strong == -1)
if (bf_is_strong == -1)
bf_is_strong = bf_check_supported_key_len();
if( !bf_is_strong && klen>16 )
return PXE_KEY_TOO_BIG;
if (!bf_is_strong && klen > 16)
return PXE_KEY_TOO_BIG;
/* Key len is supported. We can use it. */
BF_set_key(&od->u.bf.key, klen, key);
@ -750,13 +755,14 @@ ossl_aes_init(PX_Cipher * c, const uint8 *key, unsigned klen, const uint8 *iv)
static int
ossl_aes_key_init(ossldata * od, int type)
{
int err;
int err;
/*
* Strong key support could be missing on some openssl installations.
* We must check return value from set key function.
*/
* Strong key support could be missing on some openssl installations. We
* must check return value from set key function.
*/
if (type == AES_ENCRYPT)
err = AES_set_encrypt_key(od->key, od->klen * 8, &od->u.aes_key);
err = AES_set_encrypt_key(od->key, od->klen * 8, &od->u.aes_key);
else
err = AES_set_decrypt_key(od->key, od->klen * 8, &od->u.aes_key);
@ -776,7 +782,7 @@ ossl_aes_ecb_encrypt(PX_Cipher * c, const uint8 *data, unsigned dlen,
unsigned bs = gen_ossl_block_size(c);
ossldata *od = c->ptr;
const uint8 *end = data + dlen - bs;
int err;
int err;
if (!od->init)
if ((err = ossl_aes_key_init(od, AES_ENCRYPT)) != 0)
@ -794,7 +800,7 @@ ossl_aes_ecb_decrypt(PX_Cipher * c, const uint8 *data, unsigned dlen,
unsigned bs = gen_ossl_block_size(c);
ossldata *od = c->ptr;
const uint8 *end = data + dlen - bs;
int err;
int err;
if (!od->init)
if ((err = ossl_aes_key_init(od, AES_DECRYPT)) != 0)
@ -810,12 +816,12 @@ ossl_aes_cbc_encrypt(PX_Cipher * c, const uint8 *data, unsigned dlen,
uint8 *res)
{
ossldata *od = c->ptr;
int err;
int err;
if (!od->init)
if ((err = ossl_aes_key_init(od, AES_ENCRYPT)) != 0)
return err;
AES_cbc_encrypt(data, res, dlen, &od->u.aes_key, od->iv, AES_ENCRYPT);
return 0;
}
@ -825,7 +831,7 @@ ossl_aes_cbc_decrypt(PX_Cipher * c, const uint8 *data, unsigned dlen,
uint8 *res)
{
ossldata *od = c->ptr;
int err;
int err;
if (!od->init)
if ((err = ossl_aes_key_init(od, AES_DECRYPT)) != 0)

View File

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $PostgreSQL: pgsql/contrib/pgcrypto/pgp-compress.c,v 1.6 2007/01/14 20:55:14 alvherre Exp $
* $PostgreSQL: pgsql/contrib/pgcrypto/pgp-compress.c,v 1.7 2007/11/15 21:14:31 momjian Exp $
*/
#include "postgres.h"
@ -312,7 +312,6 @@ pgp_decompress_filter(PullFilter ** res, PGP_Context * ctx, PullFilter * src)
{
return pullf_create(res, &decompress_filter, ctx, src);
}
#else /* !HAVE_ZLIB */
int

View File

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $PostgreSQL: pgsql/contrib/pgcrypto/px.c,v 1.16 2007/08/23 16:15:51 tgl Exp $
* $PostgreSQL: pgsql/contrib/pgcrypto/px.c,v 1.17 2007/11/15 21:14:31 momjian Exp $
*/
#include "postgres.h"
@ -286,7 +286,7 @@ combo_decrypt(PX_Combo * cx, const uint8 *data, unsigned dlen,
/* with padding, empty ciphertext is not allowed */
if (cx->padding)
return PXE_DECRYPT_FAILED;
/* without padding, report empty result */
*rlen = 0;
return 0;

View File

@ -33,7 +33,7 @@
*
* $From: sha2.c,v 1.1 2001/11/08 00:01:51 adg Exp adg $
*
* $PostgreSQL: pgsql/contrib/pgcrypto/sha2.c,v 1.9 2007/04/06 05:36:50 tgl Exp $
* $PostgreSQL: pgsql/contrib/pgcrypto/sha2.c,v 1.10 2007/11/15 21:14:31 momjian Exp $
*/
#include "postgres.h"
@ -78,7 +78,7 @@
(x) = ((tmp & 0xffff0000ffff0000ULL) >> 16) | \
((tmp & 0x0000ffff0000ffffULL) << 16); \
}
#endif /* not bigendian */
#endif /* not bigendian */
/*
* Macro for incrementally adding the unsigned 64-bit integer n to the