diff options
| author | Bruce Momjian | 2009-06-11 14:49:15 +0000 |
|---|---|---|
| committer | Bruce Momjian | 2009-06-11 14:49:15 +0000 |
| commit | d7471402794266078953f1bd113dab4913d631a1 (patch) | |
| tree | 618e392a84eaf837e00bf78f8694097b78fec227 /contrib/pgcrypto | |
| parent | 4e86efb4e51b66ef57b3fe6f28576de23a1bf1c6 (diff) | |
8.4 pgindent run, with new combined Linux/FreeBSD/MinGW typedef list
provided by Andrew.
Diffstat (limited to 'contrib/pgcrypto')
36 files changed, 556 insertions, 555 deletions
diff --git a/contrib/pgcrypto/blf.c b/contrib/pgcrypto/blf.c index 7138ffa9033..e03c542c0d4 100644 --- a/contrib/pgcrypto/blf.c +++ b/contrib/pgcrypto/blf.c @@ -1,7 +1,7 @@ /* * Butchered version of sshblowf.c from putty-0.59. * - * $PostgreSQL: pgsql/contrib/pgcrypto/blf.c,v 1.9 2007/11/15 21:14:31 momjian Exp $ + * $PostgreSQL: pgsql/contrib/pgcrypto/blf.c,v 1.10 2009/06/11 14:48:52 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; @@ -492,7 +492,7 @@ 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); diff --git a/contrib/pgcrypto/blf.h b/contrib/pgcrypto/blf.h index 6e280d8754f..507d7f90553 100644 --- a/contrib/pgcrypto/blf.h +++ b/contrib/pgcrypto/blf.h @@ -1,4 +1,4 @@ -/* $PostgreSQL: pgsql/contrib/pgcrypto/blf.h,v 1.7 2007/11/15 21:14:31 momjian Exp $ */ +/* $PostgreSQL: pgsql/contrib/pgcrypto/blf.h,v 1.8 2009/06/11 14:48:52 momjian Exp $ */ /* * PuTTY is copyright 1997-2007 Simon Tatham. * @@ -36,11 +36,11 @@ typedef struct P[18]; uint32 iv0, iv1; /* for CBC mode */ -} BlowfishContext; +} 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); +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); diff --git a/contrib/pgcrypto/crypt-blowfish.c b/contrib/pgcrypto/crypt-blowfish.c index 84b4d758af1..9c1d2d47062 100644 --- a/contrib/pgcrypto/crypt-blowfish.c +++ b/contrib/pgcrypto/crypt-blowfish.c @@ -1,5 +1,5 @@ /* - * $PostgreSQL: pgsql/contrib/pgcrypto/crypt-blowfish.c,v 1.13 2007/11/15 21:14:31 momjian Exp $ + * $PostgreSQL: pgsql/contrib/pgcrypto/crypt-blowfish.c,v 1.14 2009/06/11 14:48:52 momjian Exp $ * * This code comes from John the Ripper password cracker, with reentrant * and crypt(3) interfaces added, but optimizations specific to password @@ -59,7 +59,7 @@ typedef struct { BF_word S[4][0x100]; BF_key P; -} BF_ctx; +} BF_ctx; /* * Magic IV for 64 Blowfish encryptions that we do at the end. @@ -367,7 +367,7 @@ do { \ } while (0) static int -BF_decode(BF_word * dst, const char *src, int size) +BF_decode(BF_word *dst, const char *src, int size) { unsigned char *dptr = (unsigned char *) dst; unsigned char *end = dptr + size; @@ -399,7 +399,7 @@ BF_decode(BF_word * dst, const char *src, int size) } static void -BF_encode(char *dst, const BF_word * src, int size) +BF_encode(char *dst, const BF_word *src, int size) { unsigned char *sptr = (unsigned char *) src; unsigned char *end = sptr + size; @@ -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 @@ -518,7 +518,7 @@ BF_swap(BF_word * x, int count) #if BF_ASM -extern void _BF_body_r(BF_ctx * ctx); +extern void _BF_body_r(BF_ctx *ctx); #define BF_body() \ _BF_body_r(&data.ctx); diff --git a/contrib/pgcrypto/crypt-gensalt.c b/contrib/pgcrypto/crypt-gensalt.c index c3ec01b9002..b2ec3da8280 100644 --- a/contrib/pgcrypto/crypt-gensalt.c +++ b/contrib/pgcrypto/crypt-gensalt.c @@ -2,7 +2,7 @@ * 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.10 2006/10/04 00:29:46 momjian Exp $ + * $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 @@ -122,7 +122,7 @@ static unsigned char BF_itoa64[64 + 1] = "./ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; static void -BF_encode(char *dst, const BF_word * src, int size) +BF_encode(char *dst, const BF_word *src, int size) { unsigned char *sptr = (unsigned char *) src; unsigned char *end = sptr + size; diff --git a/contrib/pgcrypto/fortuna.c b/contrib/pgcrypto/fortuna.c index 5a2596fe786..4e97946ab3c 100644 --- a/contrib/pgcrypto/fortuna.c +++ b/contrib/pgcrypto/fortuna.c @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $PostgreSQL: pgsql/contrib/pgcrypto/fortuna.c,v 1.8 2006/10/04 00:29:46 momjian Exp $ + * $PostgreSQL: pgsql/contrib/pgcrypto/fortuna.c,v 1.9 2009/06/11 14:48:52 momjian Exp $ */ #include "postgres.h" @@ -176,7 +176,7 @@ md_result(MD_CTX * ctx, uint8 *dst) * initialize state */ static void -init_state(FState * st) +init_state(FState *st) { int i; @@ -190,7 +190,7 @@ init_state(FState * st) * It just needs to change without repeating. */ static void -inc_counter(FState * st) +inc_counter(FState *st) { uint32 *val = (uint32 *) st->counter; @@ -207,7 +207,7 @@ inc_counter(FState * st) * This is called 'cipher in counter mode'. */ static void -encrypt_counter(FState * st, uint8 *dst) +encrypt_counter(FState *st, uint8 *dst) { ciph_encrypt(&st->ciph, st->counter, dst); inc_counter(st); @@ -219,7 +219,7 @@ encrypt_counter(FState * st, uint8 *dst) * microseconds. */ static int -enough_time_passed(FState * st) +enough_time_passed(FState *st) { int ok; struct timeval tv; @@ -252,7 +252,7 @@ enough_time_passed(FState * st) * generate new key from all the pools */ static void -reseed(FState * st) +reseed(FState *st) { unsigned k; unsigned n; @@ -298,7 +298,7 @@ reseed(FState * st) * Pick a random pool. This uses key bytes as random source. */ static unsigned -get_rand_pool(FState * st) +get_rand_pool(FState *st) { unsigned rnd; @@ -318,7 +318,7 @@ get_rand_pool(FState * st) * update pools */ static void -add_entropy(FState * st, const uint8 *data, unsigned len) +add_entropy(FState *st, const uint8 *data, unsigned len) { unsigned pos; uint8 hash[BLOCK]; @@ -349,7 +349,7 @@ add_entropy(FState * st, const uint8 *data, unsigned len) * Just take 2 next blocks as new key */ static void -rekey(FState * st) +rekey(FState *st) { encrypt_counter(st, st->key); encrypt_counter(st, st->key + CIPH_BLOCK); @@ -363,7 +363,7 @@ rekey(FState * st) * entropy over all of the components. */ static void -startup_tricks(FState * st) +startup_tricks(FState *st) { int i; uint8 buf[BLOCK]; @@ -388,7 +388,7 @@ startup_tricks(FState * st) } static void -extract_data(FState * st, unsigned count, uint8 *dst) +extract_data(FState *st, unsigned count, uint8 *dst) { unsigned n; unsigned block_nr = 0; diff --git a/contrib/pgcrypto/imath.c b/contrib/pgcrypto/imath.c index 63b294af24d..35dc652d43c 100644 --- a/contrib/pgcrypto/imath.c +++ b/contrib/pgcrypto/imath.c @@ -27,7 +27,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/* $PostgreSQL: pgsql/contrib/pgcrypto/imath.c,v 1.7 2007/07/15 22:43:40 tgl Exp $ */ +/* $PostgreSQL: pgsql/contrib/pgcrypto/imath.c,v 1.8 2009/06/11 14:48:52 momjian Exp $ */ #include "postgres.h" #include "px.h" @@ -195,7 +195,7 @@ static void s_clamp(mp_int z); static void s_fake(mp_int z, int value, mp_digit vbuf[]); /* Compare two runs of digits of given length, returns <0, 0, >0 */ -static int s_cdig(mp_digit * da, mp_digit * db, mp_size len); +static int s_cdig(mp_digit *da, mp_digit *db, mp_size len); /* Pack the unsigned digits of v into array t */ static int s_vpack(int v, mp_digit t[]); @@ -208,26 +208,26 @@ static int s_vcmp(mp_int a, int v); /* Unsigned magnitude addition; assumes dc is big enough. Carry out is returned (no memory allocated). */ -static mp_digit s_uadd(mp_digit * da, mp_digit * db, mp_digit * dc, +static mp_digit s_uadd(mp_digit *da, mp_digit *db, mp_digit *dc, mp_size size_a, mp_size size_b); /* Unsigned magnitude subtraction. Assumes dc is big enough. */ -static void s_usub(mp_digit * da, mp_digit * db, mp_digit * dc, +static void s_usub(mp_digit *da, mp_digit *db, mp_digit *dc, mp_size size_a, mp_size size_b); /* Unsigned recursive multiplication. Assumes dc is big enough. */ -static int s_kmul(mp_digit * da, mp_digit * db, mp_digit * dc, +static int s_kmul(mp_digit *da, mp_digit *db, mp_digit *dc, mp_size size_a, mp_size size_b); /* Unsigned magnitude multiplication. Assumes dc is big enough. */ -static void s_umul(mp_digit * da, mp_digit * db, mp_digit * dc, +static void s_umul(mp_digit *da, mp_digit *db, mp_digit *dc, mp_size size_a, mp_size size_b); /* Unsigned recursive squaring. Assumes dc is big enough. */ -static int s_ksqr(mp_digit * da, mp_digit * dc, mp_size size_a); +static int s_ksqr(mp_digit *da, mp_digit *dc, mp_size size_a); /* Unsigned magnitude squaring. Assumes dc is big enough. */ -static void s_usqr(mp_digit * da, mp_digit * dc, mp_size size_a); +static void s_usqr(mp_digit *da, mp_digit *dc, mp_size size_a); /* Single digit addition. Assumes a is big enough. */ static void s_dadd(mp_int a, mp_digit b); @@ -236,7 +236,7 @@ static void s_dadd(mp_int a, mp_digit b); static void s_dmul(mp_int a, mp_digit b); /* Single digit multiplication on buffers; assumes dc is big enough. */ -static void s_dbmul(mp_digit * da, mp_digit b, mp_digit * dc, +static void s_dbmul(mp_digit *da, mp_digit b, mp_digit *dc, mp_size size_a); /* Single digit division. Replaces a with the quotient, @@ -310,7 +310,7 @@ static mp_result s_tobin(mp_int z, unsigned char *buf, int *limpos, int pad); #if 0 /* Dump a representation of the mp_int to standard output */ void s_print(char *tag, mp_int z); -void s_print_buf(char *tag, mp_digit * buf, mp_size num); +void s_print_buf(char *tag, mp_digit *buf, mp_size num); #endif /* {{{ get_default_precision() */ @@ -2294,7 +2294,7 @@ s_alloc(mp_size num) /* {{{ s_realloc(old, num) */ static mp_digit * -s_realloc(mp_digit * old, mp_size num) +s_realloc(mp_digit *old, mp_size num) { mp_digit *new = px_realloc(old, num * sizeof(mp_digit)); @@ -2375,7 +2375,7 @@ s_fake(mp_int z, int value, mp_digit vbuf[]) /* {{{ s_cdig(da, db, len) */ static int -s_cdig(mp_digit * da, mp_digit * db, mp_size len) +s_cdig(mp_digit *da, mp_digit *db, mp_size len) { mp_digit *dat = da + len - 1, *dbt = db + len - 1; @@ -2460,7 +2460,7 @@ s_vcmp(mp_int a, int v) /* {{{ s_uadd(da, db, dc, size_a, size_b) */ static mp_digit -s_uadd(mp_digit * da, mp_digit * db, mp_digit * dc, +s_uadd(mp_digit *da, mp_digit *db, mp_digit *dc, mp_size size_a, mp_size size_b) { mp_size pos; @@ -2476,7 +2476,7 @@ s_uadd(mp_digit * da, mp_digit * db, mp_digit * dc, /* Add corresponding digits until the shorter number runs out */ for (pos = 0; pos < size_b; ++pos, ++da, ++db, ++dc) { - w = w + (mp_word) * da + (mp_word) * db; + w = w + (mp_word) *da + (mp_word) *db; *dc = LOWER_HALF(w); w = UPPER_HALF(w); } @@ -2499,7 +2499,7 @@ s_uadd(mp_digit * da, mp_digit * db, mp_digit * dc, /* {{{ s_usub(da, db, dc, size_a, size_b) */ static void -s_usub(mp_digit * da, mp_digit * db, mp_digit * dc, +s_usub(mp_digit *da, mp_digit *db, mp_digit *dc, mp_size size_a, mp_size size_b) { mp_size pos; @@ -2512,7 +2512,7 @@ s_usub(mp_digit * da, mp_digit * db, mp_digit * dc, for (pos = 0; pos < size_b; ++pos, ++da, ++db, ++dc) { w = ((mp_word) MP_DIGIT_MAX + 1 + /* MP_RADIX */ - (mp_word) * da) - w - (mp_word) * db; + (mp_word) *da) - w - (mp_word) *db; *dc = LOWER_HALF(w); w = (UPPER_HALF(w) == 0); @@ -2522,7 +2522,7 @@ s_usub(mp_digit * da, mp_digit * db, mp_digit * dc, for ( /* */ ; pos < size_a; ++pos, ++da, ++dc) { w = ((mp_word) MP_DIGIT_MAX + 1 + /* MP_RADIX */ - (mp_word) * da) - w; + (mp_word) *da) - w; *dc = LOWER_HALF(w); w = (UPPER_HALF(w) == 0); @@ -2537,7 +2537,7 @@ s_usub(mp_digit * da, mp_digit * db, mp_digit * dc, /* {{{ s_kmul(da, db, dc, size_a, size_b) */ static int -s_kmul(mp_digit * da, mp_digit * db, mp_digit * dc, +s_kmul(mp_digit *da, mp_digit *db, mp_digit *dc, mp_size size_a, mp_size size_b) { mp_size bot_size; @@ -2638,7 +2638,7 @@ s_kmul(mp_digit * da, mp_digit * db, mp_digit * dc, /* {{{ s_umul(da, db, dc, size_a, size_b) */ static void -s_umul(mp_digit * da, mp_digit * db, mp_digit * dc, +s_umul(mp_digit *da, mp_digit *db, mp_digit *dc, mp_size size_a, mp_size size_b) { mp_size a, @@ -2656,7 +2656,7 @@ s_umul(mp_digit * da, mp_digit * db, mp_digit * dc, w = 0; for (b = 0; b < size_b; ++b, ++dbt, ++dct) { - w = (mp_word) * da * (mp_word) * dbt + w + (mp_word) * dct; + w = (mp_word) *da * (mp_word) *dbt + w + (mp_word) *dct; *dct = LOWER_HALF(w); w = UPPER_HALF(w); @@ -2671,7 +2671,7 @@ s_umul(mp_digit * da, mp_digit * db, mp_digit * dc, /* {{{ s_ksqr(da, dc, size_a) */ static int -s_ksqr(mp_digit * da, mp_digit * dc, mp_size size_a) +s_ksqr(mp_digit *da, mp_digit *dc, mp_size size_a) { if (multiply_threshold && size_a > multiply_threshold) { @@ -2736,7 +2736,7 @@ s_ksqr(mp_digit * da, mp_digit * dc, mp_size size_a) /* {{{ s_usqr(da, dc, size_a) */ static void -s_usqr(mp_digit * da, mp_digit * dc, mp_size size_a) +s_usqr(mp_digit *da, mp_digit *dc, mp_size size_a) { mp_size i, j; @@ -2751,7 +2751,7 @@ s_usqr(mp_digit * da, mp_digit * dc, mp_size size_a) continue; /* Take care of the first digit, no rollover */ - w = (mp_word) * dat * (mp_word) * dat + (mp_word) * dct; + w = (mp_word) *dat * (mp_word) *dat + (mp_word) *dct; *dct = LOWER_HALF(w); w = UPPER_HALF(w); ++dat; @@ -2759,8 +2759,8 @@ s_usqr(mp_digit * da, mp_digit * dc, mp_size size_a) for (j = i + 1; j < size_a; ++j, ++dat, ++dct) { - mp_word t = (mp_word) * da * (mp_word) * dat; - mp_word u = w + (mp_word) * dct, + mp_word t = (mp_word) *da * (mp_word) *dat; + mp_word u = w + (mp_word) *dct, ov = 0; /* Check if doubling t will overflow a word */ @@ -2808,13 +2808,13 @@ s_dadd(mp_int a, mp_digit b) mp_digit *da = MP_DIGITS(a); mp_size ua = MP_USED(a); - w = (mp_word) * da + b; + w = (mp_word) *da + b; *da++ = LOWER_HALF(w); w = UPPER_HALF(w); for (ua -= 1; ua > 0; --ua, ++da) { - w = (mp_word) * da + w; + w = (mp_word) *da + w; *da = LOWER_HALF(w); w = UPPER_HALF(w); @@ -2840,7 +2840,7 @@ s_dmul(mp_int a, mp_digit b) while (ua > 0) { - w = (mp_word) * da * b + w; + w = (mp_word) *da * b + w; *da++ = LOWER_HALF(w); w = UPPER_HALF(w); --ua; @@ -2858,13 +2858,13 @@ s_dmul(mp_int a, mp_digit b) /* {{{ s_dbmul(da, b, dc, size_a) */ static void -s_dbmul(mp_digit * da, mp_digit b, mp_digit * dc, mp_size size_a) +s_dbmul(mp_digit *da, mp_digit b, mp_digit *dc, mp_size size_a) { mp_word w = 0; while (size_a > 0) { - w = (mp_word) * da++ * (mp_word) b + w; + w = (mp_word) *da++ * (mp_word) b + w; *dc++ = LOWER_HALF(w); w = UPPER_HALF(w); @@ -3085,13 +3085,13 @@ s_qsub(mp_int z, mp_size p2) for (pos = 0, zp = MP_DIGITS(z); pos < tdig; ++pos, ++zp) { - w = ((mp_word) MP_DIGIT_MAX + 1) - w - (mp_word) * zp; + w = ((mp_word) MP_DIGIT_MAX + 1) - w - (mp_word) *zp; *zp = LOWER_HALF(w); w = UPPER_HALF(w) ? 0 : 1; } - w = ((mp_word) MP_DIGIT_MAX + 1 + hi) - w - (mp_word) * zp; + w = ((mp_word) MP_DIGIT_MAX + 1 + hi) - w - (mp_word) *zp; *zp = LOWER_HALF(w); assert(UPPER_HALF(w) != 0); /* no borrow out should be possible */ @@ -3663,7 +3663,7 @@ s_print(char *tag, mp_int z) } void -s_print_buf(char *tag, mp_digit * buf, mp_size num) +s_print_buf(char *tag, mp_digit *buf, mp_size num) { int i; diff --git a/contrib/pgcrypto/imath.h b/contrib/pgcrypto/imath.h index 5bc335e5820..09d0e3e818b 100644 --- a/contrib/pgcrypto/imath.h +++ b/contrib/pgcrypto/imath.h @@ -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.6 2007/11/15 21:14:31 momjian Exp $ */ +/* $PostgreSQL: pgsql/contrib/pgcrypto/imath.h,v 1.7 2009/06/11 14:48:52 momjian Exp $ */ #ifndef IMATH_H_ #define IMATH_H_ @@ -60,7 +60,8 @@ typedef struct mpz mp_size alloc; mp_size used; mp_sign sign; -} mpz_t, *mp_int; +} mpz_t , + *mp_int; #define MP_DIGITS(Z) ((Z)->digits) #define MP_ALLOC(Z) ((Z)->alloc) @@ -117,10 +118,10 @@ 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 */ @@ -210,7 +211,7 @@ const char *mp_error_string(mp_result res); #if 0 void s_print(char *tag, mp_int z); -void s_print_buf(char *tag, mp_digit * buf, mp_size num); +void s_print_buf(char *tag, mp_digit *buf, mp_size num); #endif #endif /* end IMATH_H_ */ diff --git a/contrib/pgcrypto/internal-sha2.c b/contrib/pgcrypto/internal-sha2.c index d5530c39ed9..1e36a369e01 100644 --- a/contrib/pgcrypto/internal-sha2.c +++ b/contrib/pgcrypto/internal-sha2.c @@ -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-sha2.c,v 1.2 2006/10/04 00:29:46 momjian Exp $ + * $PostgreSQL: pgsql/contrib/pgcrypto/internal-sha2.c,v 1.3 2009/06/11 14:48:52 momjian Exp $ */ #include "postgres.h" @@ -36,27 +36,27 @@ #include "px.h" #include "sha2.h" -void init_sha224(PX_MD * h); -void init_sha256(PX_MD * h); -void init_sha384(PX_MD * h); -void init_sha512(PX_MD * h); +void init_sha224(PX_MD *h); +void init_sha256(PX_MD *h); +void init_sha384(PX_MD *h); +void init_sha512(PX_MD *h); /* SHA224 */ static unsigned -int_sha224_len(PX_MD * h) +int_sha224_len(PX_MD *h) { return SHA224_DIGEST_LENGTH; } static unsigned -int_sha224_block_len(PX_MD * h) +int_sha224_block_len(PX_MD *h) { return SHA224_BLOCK_LENGTH; } static void -int_sha224_update(PX_MD * h, const uint8 *data, unsigned dlen) +int_sha224_update(PX_MD *h, const uint8 *data, unsigned dlen) { SHA224_CTX *ctx = (SHA224_CTX *) h->p.ptr; @@ -64,7 +64,7 @@ int_sha224_update(PX_MD * h, const uint8 *data, unsigned dlen) } static void -int_sha224_reset(PX_MD * h) +int_sha224_reset(PX_MD *h) { SHA224_CTX *ctx = (SHA224_CTX *) h->p.ptr; @@ -72,7 +72,7 @@ int_sha224_reset(PX_MD * h) } static void -int_sha224_finish(PX_MD * h, uint8 *dst) +int_sha224_finish(PX_MD *h, uint8 *dst) { SHA224_CTX *ctx = (SHA224_CTX *) h->p.ptr; @@ -80,7 +80,7 @@ int_sha224_finish(PX_MD * h, uint8 *dst) } static void -int_sha224_free(PX_MD * h) +int_sha224_free(PX_MD *h) { SHA224_CTX *ctx = (SHA224_CTX *) h->p.ptr; @@ -92,19 +92,19 @@ int_sha224_free(PX_MD * h) /* SHA256 */ static unsigned -int_sha256_len(PX_MD * h) +int_sha256_len(PX_MD *h) { return SHA256_DIGEST_LENGTH; } static unsigned -int_sha256_block_len(PX_MD * h) +int_sha256_block_len(PX_MD *h) { return SHA256_BLOCK_LENGTH; } static void -int_sha256_update(PX_MD * h, const uint8 *data, unsigned dlen) +int_sha256_update(PX_MD *h, const uint8 *data, unsigned dlen) { SHA256_CTX *ctx = (SHA256_CTX *) h->p.ptr; @@ -112,7 +112,7 @@ int_sha256_update(PX_MD * h, const uint8 *data, unsigned dlen) } static void -int_sha256_reset(PX_MD * h) +int_sha256_reset(PX_MD *h) { SHA256_CTX *ctx = (SHA256_CTX *) h->p.ptr; @@ -120,7 +120,7 @@ int_sha256_reset(PX_MD * h) } static void -int_sha256_finish(PX_MD * h, uint8 *dst) +int_sha256_finish(PX_MD *h, uint8 *dst) { SHA256_CTX *ctx = (SHA256_CTX *) h->p.ptr; @@ -128,7 +128,7 @@ int_sha256_finish(PX_MD * h, uint8 *dst) } static void -int_sha256_free(PX_MD * h) +int_sha256_free(PX_MD *h) { SHA256_CTX *ctx = (SHA256_CTX *) h->p.ptr; @@ -140,19 +140,19 @@ int_sha256_free(PX_MD * h) /* SHA384 */ static unsigned -int_sha384_len(PX_MD * h) +int_sha384_len(PX_MD *h) { return SHA384_DIGEST_LENGTH; } static unsigned -int_sha384_block_len(PX_MD * h) +int_sha384_block_len(PX_MD *h) { return SHA384_BLOCK_LENGTH; } static void -int_sha384_update(PX_MD * h, const uint8 *data, unsigned dlen) +int_sha384_update(PX_MD *h, const uint8 *data, unsigned dlen) { SHA384_CTX *ctx = (SHA384_CTX *) h->p.ptr; @@ -160,7 +160,7 @@ int_sha384_update(PX_MD * h, const uint8 *data, unsigned dlen) } static void -int_sha384_reset(PX_MD * h) +int_sha384_reset(PX_MD *h) { SHA384_CTX *ctx = (SHA384_CTX *) h->p.ptr; @@ -168,7 +168,7 @@ int_sha384_reset(PX_MD * h) } static void -int_sha384_finish(PX_MD * h, uint8 *dst) +int_sha384_finish(PX_MD *h, uint8 *dst) { SHA384_CTX *ctx = (SHA384_CTX *) h->p.ptr; @@ -176,7 +176,7 @@ int_sha384_finish(PX_MD * h, uint8 *dst) } static void -int_sha384_free(PX_MD * h) +int_sha384_free(PX_MD *h) { SHA384_CTX *ctx = (SHA384_CTX *) h->p.ptr; @@ -188,19 +188,19 @@ int_sha384_free(PX_MD * h) /* SHA512 */ static unsigned -int_sha512_len(PX_MD * h) +int_sha512_len(PX_MD *h) { return SHA512_DIGEST_LENGTH; } static unsigned -int_sha512_block_len(PX_MD * h) +int_sha512_block_len(PX_MD *h) { return SHA512_BLOCK_LENGTH; } static void -int_sha512_update(PX_MD * h, const uint8 *data, unsigned dlen) +int_sha512_update(PX_MD *h, const uint8 *data, unsigned dlen) { SHA512_CTX *ctx = (SHA512_CTX *) h->p.ptr; @@ -208,7 +208,7 @@ int_sha512_update(PX_MD * h, const uint8 *data, unsigned dlen) } static void -int_sha512_reset(PX_MD * h) +int_sha512_reset(PX_MD *h) { SHA512_CTX *ctx = (SHA512_CTX *) h->p.ptr; @@ -216,7 +216,7 @@ int_sha512_reset(PX_MD * h) } static void -int_sha512_finish(PX_MD * h, uint8 *dst) +int_sha512_finish(PX_MD *h, uint8 *dst) { SHA512_CTX *ctx = (SHA512_CTX *) h->p.ptr; @@ -224,7 +224,7 @@ int_sha512_finish(PX_MD * h, uint8 *dst) } static void -int_sha512_free(PX_MD * h) +int_sha512_free(PX_MD *h) { SHA512_CTX *ctx = (SHA512_CTX *) h->p.ptr; @@ -236,7 +236,7 @@ int_sha512_free(PX_MD * h) /* init functions */ void -init_sha224(PX_MD * md) +init_sha224(PX_MD *md) { SHA224_CTX *ctx; @@ -256,7 +256,7 @@ init_sha224(PX_MD * md) } void -init_sha256(PX_MD * md) +init_sha256(PX_MD *md) { SHA256_CTX *ctx; @@ -276,7 +276,7 @@ init_sha256(PX_MD * md) } void -init_sha384(PX_MD * md) +init_sha384(PX_MD *md) { SHA384_CTX *ctx; @@ -296,7 +296,7 @@ init_sha384(PX_MD * md) } void -init_sha512(PX_MD * md) +init_sha512(PX_MD *md) { SHA512_CTX *ctx; diff --git a/contrib/pgcrypto/internal.c b/contrib/pgcrypto/internal.c index 56634aa32a2..84bda624a43 100644 --- a/contrib/pgcrypto/internal.c +++ b/contrib/pgcrypto/internal.c @@ -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.28 2008/02/17 02:09:26 tgl Exp $ + * $PostgreSQL: pgsql/contrib/pgcrypto/internal.c,v 1.29 2009/06/11 14:48:52 momjian Exp $ */ #include "postgres.h" @@ -75,18 +75,18 @@ #define SHA1_BLOCK_SIZE 64 #define MD5_BLOCK_SIZE 64 -static void init_md5(PX_MD * h); -static void init_sha1(PX_MD * h); +static void init_md5(PX_MD *h); +static void init_sha1(PX_MD *h); -void init_sha224(PX_MD * h); -void init_sha256(PX_MD * h); -void init_sha384(PX_MD * h); -void init_sha512(PX_MD * h); +void init_sha224(PX_MD *h); +void init_sha256(PX_MD *h); +void init_sha384(PX_MD *h); +void init_sha512(PX_MD *h); struct int_digest { char *name; - void (*init) (PX_MD * h); + void (*init) (PX_MD *h); }; static const struct int_digest @@ -103,19 +103,19 @@ static const struct int_digest /* MD5 */ static unsigned -int_md5_len(PX_MD * h) +int_md5_len(PX_MD *h) { return MD5_DIGEST_LENGTH; } static unsigned -int_md5_block_len(PX_MD * h) +int_md5_block_len(PX_MD *h) { return MD5_BLOCK_SIZE; } static void -int_md5_update(PX_MD * h, const uint8 *data, unsigned dlen) +int_md5_update(PX_MD *h, const uint8 *data, unsigned dlen) { MD5_CTX *ctx = (MD5_CTX *) h->p.ptr; @@ -123,7 +123,7 @@ int_md5_update(PX_MD * h, const uint8 *data, unsigned dlen) } static void -int_md5_reset(PX_MD * h) +int_md5_reset(PX_MD *h) { MD5_CTX *ctx = (MD5_CTX *) h->p.ptr; @@ -131,7 +131,7 @@ int_md5_reset(PX_MD * h) } static void -int_md5_finish(PX_MD * h, uint8 *dst) +int_md5_finish(PX_MD *h, uint8 *dst) { MD5_CTX *ctx = (MD5_CTX *) h->p.ptr; @@ -139,7 +139,7 @@ int_md5_finish(PX_MD * h, uint8 *dst) } static void -int_md5_free(PX_MD * h) +int_md5_free(PX_MD *h) { MD5_CTX *ctx = (MD5_CTX *) h->p.ptr; @@ -151,19 +151,19 @@ int_md5_free(PX_MD * h) /* SHA1 */ static unsigned -int_sha1_len(PX_MD * h) +int_sha1_len(PX_MD *h) { return SHA1_DIGEST_LENGTH; } static unsigned -int_sha1_block_len(PX_MD * h) +int_sha1_block_len(PX_MD *h) { return SHA1_BLOCK_SIZE; } static void -int_sha1_update(PX_MD * h, const uint8 *data, unsigned dlen) +int_sha1_update(PX_MD *h, const uint8 *data, unsigned dlen) { SHA1_CTX *ctx = (SHA1_CTX *) h->p.ptr; @@ -171,7 +171,7 @@ int_sha1_update(PX_MD * h, const uint8 *data, unsigned dlen) } static void -int_sha1_reset(PX_MD * h) +int_sha1_reset(PX_MD *h) { SHA1_CTX *ctx = (SHA1_CTX *) h->p.ptr; @@ -179,7 +179,7 @@ int_sha1_reset(PX_MD * h) } static void -int_sha1_finish(PX_MD * h, uint8 *dst) +int_sha1_finish(PX_MD *h, uint8 *dst) { SHA1_CTX *ctx = (SHA1_CTX *) h->p.ptr; @@ -187,7 +187,7 @@ int_sha1_finish(PX_MD * h, uint8 *dst) } static void -int_sha1_free(PX_MD * h) +int_sha1_free(PX_MD *h) { SHA1_CTX *ctx = (SHA1_CTX *) h->p.ptr; @@ -199,7 +199,7 @@ int_sha1_free(PX_MD * h) /* init functions */ static void -init_md5(PX_MD * md) +init_md5(PX_MD *md) { MD5_CTX *ctx; @@ -219,7 +219,7 @@ init_md5(PX_MD * md) } static void -init_sha1(PX_MD * md) +init_sha1(PX_MD *md) { SHA1_CTX *ctx; @@ -260,7 +260,7 @@ struct int_ctx }; static void -intctx_free(PX_Cipher * c) +intctx_free(PX_Cipher *c) { struct int_ctx *cx = (struct int_ctx *) c->ptr; @@ -280,25 +280,25 @@ intctx_free(PX_Cipher * c) #define MODE_CBC 1 static unsigned -rj_block_size(PX_Cipher * c) +rj_block_size(PX_Cipher *c) { return 128 / 8; } static unsigned -rj_key_size(PX_Cipher * c) +rj_key_size(PX_Cipher *c) { return 256 / 8; } static unsigned -rj_iv_size(PX_Cipher * c) +rj_iv_size(PX_Cipher *c) { return 128 / 8; } static int -rj_init(PX_Cipher * c, const uint8 *key, unsigned klen, const uint8 *iv) +rj_init(PX_Cipher *c, const uint8 *key, unsigned klen, const uint8 *iv) { struct int_ctx *cx = (struct int_ctx *) c->ptr; @@ -327,7 +327,7 @@ rj_real_init(struct int_ctx * cx, int dir) } static int -rj_encrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, uint8 *res) +rj_encrypt(PX_Cipher *c, const uint8 *data, unsigned dlen, uint8 *res) { struct int_ctx *cx = (struct int_ctx *) c->ptr; @@ -357,7 +357,7 @@ rj_encrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, uint8 *res) } static int -rj_decrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, uint8 *res) +rj_decrypt(PX_Cipher *c, const uint8 *data, unsigned dlen, uint8 *res) { struct int_ctx *cx = (struct int_ctx *) c->ptr; @@ -418,25 +418,25 @@ rj_load(int mode) */ static unsigned -bf_block_size(PX_Cipher * c) +bf_block_size(PX_Cipher *c) { return 8; } static unsigned -bf_key_size(PX_Cipher * c) +bf_key_size(PX_Cipher *c) { return 448 / 8; } static unsigned -bf_iv_size(PX_Cipher * c) +bf_iv_size(PX_Cipher *c) { return 8; } static int -bf_init(PX_Cipher * c, const uint8 *key, unsigned klen, const uint8 *iv) +bf_init(PX_Cipher *c, const uint8 *key, unsigned klen, const uint8 *iv) { struct int_ctx *cx = (struct int_ctx *) c->ptr; @@ -448,7 +448,7 @@ bf_init(PX_Cipher * c, const uint8 *key, unsigned klen, const uint8 *iv) } static int -bf_encrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, uint8 *res) +bf_encrypt(PX_Cipher *c, const uint8 *data, unsigned dlen, uint8 *res) { struct int_ctx *cx = (struct int_ctx *) c->ptr; BlowfishContext *bfctx = &cx->ctx.bf; @@ -473,7 +473,7 @@ bf_encrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, uint8 *res) } static int -bf_decrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, uint8 *res) +bf_decrypt(PX_Cipher *c, const uint8 *data, unsigned dlen, uint8 *res) { struct int_ctx *cx = (struct int_ctx *) c->ptr; BlowfishContext *bfctx = &cx->ctx.bf; @@ -577,7 +577,7 @@ static const PX_Alias int_aliases[] = { /* PUBLIC FUNCTIONS */ int -px_find_digest(const char *name, PX_MD ** res) +px_find_digest(const char *name, PX_MD **res) { const struct int_digest *p; PX_MD *h; @@ -596,7 +596,7 @@ px_find_digest(const char *name, PX_MD ** res) } int -px_find_cipher(const char *name, PX_Cipher ** res) +px_find_cipher(const char *name, PX_Cipher **res) { int i; PX_Cipher *c = NULL; diff --git a/contrib/pgcrypto/mbuf.c b/contrib/pgcrypto/mbuf.c index 920e10f6ca6..d3eee2ee4f8 100644 --- a/contrib/pgcrypto/mbuf.c +++ b/contrib/pgcrypto/mbuf.c @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $PostgreSQL: pgsql/contrib/pgcrypto/mbuf.c,v 1.4 2007/07/15 23:57:13 tgl Exp $ + * $PostgreSQL: pgsql/contrib/pgcrypto/mbuf.c,v 1.5 2009/06/11 14:48:52 momjian Exp $ */ #include "postgres.h" @@ -47,25 +47,25 @@ struct MBuf }; int -mbuf_avail(MBuf * mbuf) +mbuf_avail(MBuf *mbuf) { return mbuf->data_end - mbuf->read_pos; } int -mbuf_size(MBuf * mbuf) +mbuf_size(MBuf *mbuf) { return mbuf->data_end - mbuf->data; } int -mbuf_tell(MBuf * mbuf) +mbuf_tell(MBuf *mbuf) { return mbuf->read_pos - mbuf->data; } int -mbuf_free(MBuf * mbuf) +mbuf_free(MBuf *mbuf) { if (mbuf->own_data) { @@ -77,7 +77,7 @@ mbuf_free(MBuf * mbuf) } static void -prepare_room(MBuf * mbuf, int block_len) +prepare_room(MBuf *mbuf, int block_len) { uint8 *newbuf; unsigned newlen; @@ -99,7 +99,7 @@ prepare_room(MBuf * mbuf, int block_len) } int -mbuf_append(MBuf * dst, const uint8 *buf, int len) +mbuf_append(MBuf *dst, const uint8 *buf, int len) { if (dst->no_write) { @@ -154,7 +154,7 @@ mbuf_create_from_data(const uint8 *data, int len) int -mbuf_grab(MBuf * mbuf, int len, uint8 **data_p) +mbuf_grab(MBuf *mbuf, int len, uint8 **data_p) { if (len > mbuf_avail(mbuf)) len = mbuf_avail(mbuf); @@ -167,14 +167,14 @@ mbuf_grab(MBuf * mbuf, int len, uint8 **data_p) } int -mbuf_rewind(MBuf * mbuf) +mbuf_rewind(MBuf *mbuf) { mbuf->read_pos = mbuf->data; return 0; } int -mbuf_steal_data(MBuf * mbuf, uint8 **data_p) +mbuf_steal_data(MBuf *mbuf, uint8 **data_p) { int len = mbuf_size(mbuf); @@ -203,7 +203,7 @@ struct PullFilter }; int -pullf_create(PullFilter ** pf_p, const PullFilterOps * op, void *init_arg, PullFilter * src) +pullf_create(PullFilter **pf_p, const PullFilterOps *op, void *init_arg, PullFilter *src) { PullFilter *pf; void *priv; @@ -242,7 +242,7 @@ pullf_create(PullFilter ** pf_p, const PullFilterOps * op, void *init_arg, PullF } void -pullf_free(PullFilter * pf) +pullf_free(PullFilter *pf) { if (pf->op->free) pf->op->free(pf->priv); @@ -259,7 +259,7 @@ pullf_free(PullFilter * pf) /* may return less data than asked, 0 means eof */ int -pullf_read(PullFilter * pf, int len, uint8 **data_p) +pullf_read(PullFilter *pf, int len, uint8 **data_p) { int res; @@ -276,7 +276,7 @@ pullf_read(PullFilter * pf, int len, uint8 **data_p) } int -pullf_read_max(PullFilter * pf, int len, uint8 **data_p, uint8 *tmpbuf) +pullf_read_max(PullFilter *pf, int len, uint8 **data_p, uint8 *tmpbuf) { int res, total; @@ -313,7 +313,7 @@ pullf_read_max(PullFilter * pf, int len, uint8 **data_p, uint8 *tmpbuf) * caller wants exatly len bytes and dont bother with references */ int -pullf_read_fixed(PullFilter * src, int len, uint8 *dst) +pullf_read_fixed(PullFilter *src, int len, uint8 *dst) { int res; uint8 *p; @@ -335,7 +335,7 @@ pullf_read_fixed(PullFilter * src, int len, uint8 *dst) * read from MBuf */ static int -pull_from_mbuf(void *arg, PullFilter * src, int len, +pull_from_mbuf(void *arg, PullFilter *src, int len, uint8 **data_p, uint8 *buf, int buflen) { MBuf *mbuf = arg; @@ -348,7 +348,7 @@ static const struct PullFilterOps mbuf_reader = { }; int -pullf_create_mbuf_reader(PullFilter ** mp_p, MBuf * src) +pullf_create_mbuf_reader(PullFilter **mp_p, MBuf *src) { return pullf_create(mp_p, &mbuf_reader, src, NULL); } @@ -369,7 +369,7 @@ struct PushFilter }; int -pushf_create(PushFilter ** mp_p, const PushFilterOps * op, void *init_arg, PushFilter * next) +pushf_create(PushFilter **mp_p, const PushFilterOps *op, void *init_arg, PushFilter *next) { PushFilter *mp; void *priv; @@ -408,7 +408,7 @@ pushf_create(PushFilter ** mp_p, const PushFilterOps * op, void *init_arg, PushF } void -pushf_free(PushFilter * mp) +pushf_free(PushFilter *mp) { if (mp->op->free) mp->op->free(mp->priv); @@ -424,7 +424,7 @@ pushf_free(PushFilter * mp) } void -pushf_free_all(PushFilter * mp) +pushf_free_all(PushFilter *mp) { PushFilter *tmp; @@ -437,7 +437,7 @@ pushf_free_all(PushFilter * mp) } static int -wrap_process(PushFilter * mp, const uint8 *data, int len) +wrap_process(PushFilter *mp, const uint8 *data, int len) { int res; @@ -452,7 +452,7 @@ wrap_process(PushFilter * mp, const uint8 *data, int len) /* consumes all data, returns len on success */ int -pushf_write(PushFilter * mp, const uint8 *data, int len) +pushf_write(PushFilter *mp, const uint8 *data, int len) { int need, res; @@ -512,7 +512,7 @@ pushf_write(PushFilter * mp, const uint8 *data, int len) } int -pushf_flush(PushFilter * mp) +pushf_flush(PushFilter *mp) { int res; @@ -542,7 +542,7 @@ pushf_flush(PushFilter * mp) * write to MBuf */ static int -push_into_mbuf(PushFilter * next, void *arg, const uint8 *data, int len) +push_into_mbuf(PushFilter *next, void *arg, const uint8 *data, int len) { int res = 0; MBuf *mbuf = arg; @@ -557,7 +557,7 @@ static const struct PushFilterOps mbuf_filter = { }; int -pushf_create_mbuf_writer(PushFilter ** res, MBuf * dst) +pushf_create_mbuf_writer(PushFilter **res, MBuf *dst) { return pushf_create(res, &mbuf_filter, dst, NULL); } diff --git a/contrib/pgcrypto/mbuf.h b/contrib/pgcrypto/mbuf.h index 91ef821ed4a..aa2b5596eeb 100644 --- a/contrib/pgcrypto/mbuf.h +++ b/contrib/pgcrypto/mbuf.h @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $PostgreSQL: pgsql/contrib/pgcrypto/mbuf.h,v 1.2 2005/10/15 02:49:06 momjian Exp $ + * $PostgreSQL: pgsql/contrib/pgcrypto/mbuf.h,v 1.3 2009/06/11 14:48:52 momjian Exp $ */ #ifndef __PX_MBUF_H @@ -44,15 +44,15 @@ struct PushFilterOps * should return needed buffer size, 0- no buffering, <0 on error if NULL, * no buffering, and priv=init_arg */ - int (*init) (PushFilter * next, void *init_arg, void **priv_p); + int (*init) (PushFilter *next, void *init_arg, void **priv_p); /* * send data to next. should consume all? if null, it will be simply * copied (in-place) returns 0 on error */ - int (*push) (PushFilter * next, void *priv, + int (*push) (PushFilter *next, void *priv, const uint8 *src, int len); - int (*flush) (PushFilter * next, void *priv); + int (*flush) (PushFilter *next, void *priv); void (*free) (void *priv); }; @@ -62,13 +62,13 @@ struct PullFilterOps * should return needed buffer size, 0- no buffering, <0 on error if NULL, * no buffering, and priv=init_arg */ - int (*init) (void **priv_p, void *init_arg, PullFilter * src); + int (*init) (void **priv_p, void *init_arg, PullFilter *src); /* * request data from src, put result ptr to data_p can use ptr from src or * use buf as work area if NULL in-place copy */ - int (*pull) (void *priv, PullFilter * src, int len, + int (*pull) (void *priv, PullFilter *src, int len, uint8 **data_p, uint8 *buf, int buflen); void (*free) (void *priv); }; @@ -78,39 +78,39 @@ struct PullFilterOps */ MBuf *mbuf_create(int len); MBuf *mbuf_create_from_data(const uint8 *data, int len); -int mbuf_tell(MBuf * mbuf); -int mbuf_avail(MBuf * mbuf); -int mbuf_size(MBuf * mbuf); -int mbuf_grab(MBuf * mbuf, int len, uint8 **data_p); -int mbuf_steal_data(MBuf * mbuf, uint8 **data_p); -int mbuf_append(MBuf * dst, const uint8 *buf, int cnt); -int mbuf_rewind(MBuf * mbuf); -int mbuf_free(MBuf * mbuf); +int mbuf_tell(MBuf *mbuf); +int mbuf_avail(MBuf *mbuf); +int mbuf_size(MBuf *mbuf); +int mbuf_grab(MBuf *mbuf, int len, uint8 **data_p); +int mbuf_steal_data(MBuf *mbuf, uint8 **data_p); +int mbuf_append(MBuf *dst, const uint8 *buf, int cnt); +int mbuf_rewind(MBuf *mbuf); +int mbuf_free(MBuf *mbuf); /* * Push filter */ -int pushf_create(PushFilter ** res, const PushFilterOps * ops, void *init_arg, - PushFilter * next); -int pushf_write(PushFilter * mp, const uint8 *data, int len); -void pushf_free_all(PushFilter * mp); -void pushf_free(PushFilter * mp); -int pushf_flush(PushFilter * mp); +int pushf_create(PushFilter **res, const PushFilterOps *ops, void *init_arg, + PushFilter *next); +int pushf_write(PushFilter *mp, const uint8 *data, int len); +void pushf_free_all(PushFilter *mp); +void pushf_free(PushFilter *mp); +int pushf_flush(PushFilter *mp); -int pushf_create_mbuf_writer(PushFilter ** mp_p, MBuf * mbuf); +int pushf_create_mbuf_writer(PushFilter **mp_p, MBuf *mbuf); /* * Pull filter */ -int pullf_create(PullFilter ** res, const PullFilterOps * ops, - void *init_arg, PullFilter * src); -int pullf_read(PullFilter * mp, int len, uint8 **data_p); -int pullf_read_max(PullFilter * mp, int len, +int pullf_create(PullFilter **res, const PullFilterOps *ops, + void *init_arg, PullFilter *src); +int pullf_read(PullFilter *mp, int len, uint8 **data_p); +int pullf_read_max(PullFilter *mp, int len, uint8 **data_p, uint8 *tmpbuf); -void pullf_free(PullFilter * mp); -int pullf_read_fixed(PullFilter * src, int len, uint8 *dst); +void pullf_free(PullFilter *mp); +int pullf_read_fixed(PullFilter *src, int len, uint8 *dst); -int pullf_create_mbuf_reader(PullFilter ** pf_p, MBuf * mbuf); +int pullf_create_mbuf_reader(PullFilter **pf_p, MBuf *mbuf); #define GETBYTE(pf, dst) \ do { \ diff --git a/contrib/pgcrypto/md5.c b/contrib/pgcrypto/md5.c index 851c5c888b2..8083d1f2806 100644 --- a/contrib/pgcrypto/md5.c +++ b/contrib/pgcrypto/md5.c @@ -28,7 +28,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $PostgreSQL: pgsql/contrib/pgcrypto/md5.c,v 1.14 2007/04/06 05:36:50 tgl Exp $ + * $PostgreSQL: pgsql/contrib/pgcrypto/md5.c,v 1.15 2009/06/11 14:48:52 momjian Exp $ */ #include "postgres.h" @@ -136,7 +136,7 @@ static const uint8 md5_paddat[MD5_BUFLEN] = { static void md5_calc(uint8 *, md5_ctxt *); void -md5_init(md5_ctxt * ctxt) +md5_init(md5_ctxt *ctxt) { ctxt->md5_n = 0; ctxt->md5_i = 0; @@ -148,7 +148,7 @@ md5_init(md5_ctxt * ctxt) } void -md5_loop(md5_ctxt * ctxt, const uint8 *input, unsigned len) +md5_loop(md5_ctxt *ctxt, const uint8 *input, unsigned len) { unsigned int gap, i; @@ -175,7 +175,7 @@ md5_loop(md5_ctxt * ctxt, const uint8 *input, unsigned len) } void -md5_pad(md5_ctxt * ctxt) +md5_pad(md5_ctxt *ctxt) { unsigned int gap; @@ -213,7 +213,7 @@ md5_pad(md5_ctxt * ctxt) } void -md5_result(uint8 *digest, md5_ctxt * ctxt) +md5_result(uint8 *digest, md5_ctxt *ctxt) { /* 4 byte words */ #ifndef WORDS_BIGENDIAN @@ -243,7 +243,7 @@ static uint32 X[16]; #endif static void -md5_calc(uint8 *b64, md5_ctxt * ctxt) +md5_calc(uint8 *b64, md5_ctxt *ctxt) { uint32 A = ctxt->md5_sta; uint32 B = ctxt->md5_stb; diff --git a/contrib/pgcrypto/md5.h b/contrib/pgcrypto/md5.h index 933dcaa9b97..eb7c620b48e 100644 --- a/contrib/pgcrypto/md5.h +++ b/contrib/pgcrypto/md5.h @@ -1,4 +1,4 @@ -/* $PostgreSQL: pgsql/contrib/pgcrypto/md5.h,v 1.9 2005/10/15 02:49:06 momjian Exp $ */ +/* $PostgreSQL: pgsql/contrib/pgcrypto/md5.h,v 1.10 2009/06/11 14:48:52 momjian Exp $ */ /* $KAME: md5.h,v 1.3 2000/02/22 14:01:18 itojun Exp $ */ /* @@ -59,7 +59,7 @@ typedef struct unsigned int md5_i; uint8 md5_buf[MD5_BUFLEN]; -} md5_ctxt; +} md5_ctxt; extern void md5_init(md5_ctxt *); extern void md5_loop(md5_ctxt *, const uint8 *, unsigned int); diff --git a/contrib/pgcrypto/openssl.c b/contrib/pgcrypto/openssl.c index 0f46580005d..bb0b4eefd32 100644 --- a/contrib/pgcrypto/openssl.c +++ b/contrib/pgcrypto/openssl.c @@ -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.32 2007/11/15 21:14:31 momjian Exp $ + * $PostgreSQL: pgsql/contrib/pgcrypto/openssl.c,v 1.33 2009/06/11 14:48:52 momjian Exp $ */ #include "postgres.h" @@ -169,10 +169,10 @@ EVP_DigestFinal_ex(EVP_MD_CTX *ctx, unsigned char *res, unsigned int *len) #include "sha2.c" #include "internal-sha2.c" -typedef void (*init_f) (PX_MD * md); +typedef void (*init_f) (PX_MD *md); static int -compat_find_digest(const char *name, PX_MD ** res) +compat_find_digest(const char *name, PX_MD **res) { init_f init = NULL; @@ -203,10 +203,10 @@ typedef struct OSSLDigest { const EVP_MD *algo; EVP_MD_CTX ctx; -} OSSLDigest; +} OSSLDigest; static unsigned -digest_result_size(PX_MD * h) +digest_result_size(PX_MD *h) { OSSLDigest *digest = (OSSLDigest *) h->p.ptr; @@ -214,7 +214,7 @@ digest_result_size(PX_MD * h) } static unsigned -digest_block_size(PX_MD * h) +digest_block_size(PX_MD *h) { OSSLDigest *digest = (OSSLDigest *) h->p.ptr; @@ -222,7 +222,7 @@ digest_block_size(PX_MD * h) } static void -digest_reset(PX_MD * h) +digest_reset(PX_MD *h) { OSSLDigest *digest = (OSSLDigest *) h->p.ptr; @@ -230,7 +230,7 @@ digest_reset(PX_MD * h) } static void -digest_update(PX_MD * h, const uint8 *data, unsigned dlen) +digest_update(PX_MD *h, const uint8 *data, unsigned dlen) { OSSLDigest *digest = (OSSLDigest *) h->p.ptr; @@ -238,7 +238,7 @@ digest_update(PX_MD * h, const uint8 *data, unsigned dlen) } static void -digest_finish(PX_MD * h, uint8 *dst) +digest_finish(PX_MD *h, uint8 *dst) { OSSLDigest *digest = (OSSLDigest *) h->p.ptr; @@ -246,7 +246,7 @@ digest_finish(PX_MD * h, uint8 *dst) } static void -digest_free(PX_MD * h) +digest_free(PX_MD *h) { OSSLDigest *digest = (OSSLDigest *) h->p.ptr; @@ -261,7 +261,7 @@ static int px_openssl_initialized = 0; /* PUBLIC functions */ int -px_find_digest(const char *name, PX_MD ** res) +px_find_digest(const char *name, PX_MD **res) { const EVP_MD *md; PX_MD *h; @@ -310,9 +310,9 @@ px_find_digest(const char *name, PX_MD ** res) struct ossl_cipher { - int (*init) (PX_Cipher * c, const uint8 *key, unsigned klen, const uint8 *iv); - int (*encrypt) (PX_Cipher * c, const uint8 *data, unsigned dlen, uint8 *res); - int (*decrypt) (PX_Cipher * c, const uint8 *data, unsigned dlen, uint8 *res); + int (*init) (PX_Cipher *c, const uint8 *key, unsigned klen, const uint8 *iv); + int (*encrypt) (PX_Cipher *c, const uint8 *data, unsigned dlen, uint8 *res); + int (*decrypt) (PX_Cipher *c, const uint8 *data, unsigned dlen, uint8 *res); int block_size; int max_key_size; @@ -346,12 +346,12 @@ typedef struct unsigned klen; unsigned init; const struct ossl_cipher *ciph; -} ossldata; +} ossldata; /* generic */ static unsigned -gen_ossl_block_size(PX_Cipher * c) +gen_ossl_block_size(PX_Cipher *c) { ossldata *od = (ossldata *) c->ptr; @@ -359,7 +359,7 @@ gen_ossl_block_size(PX_Cipher * c) } static unsigned -gen_ossl_key_size(PX_Cipher * c) +gen_ossl_key_size(PX_Cipher *c) { ossldata *od = (ossldata *) c->ptr; @@ -367,7 +367,7 @@ gen_ossl_key_size(PX_Cipher * c) } static unsigned -gen_ossl_iv_size(PX_Cipher * c) +gen_ossl_iv_size(PX_Cipher *c) { unsigned ivlen; ossldata *od = (ossldata *) c->ptr; @@ -377,7 +377,7 @@ gen_ossl_iv_size(PX_Cipher * c) } static void -gen_ossl_free(PX_Cipher * c) +gen_ossl_free(PX_Cipher *c) { ossldata *od = (ossldata *) c->ptr; @@ -422,7 +422,7 @@ bf_check_supported_key_len(void) } static int -bf_init(PX_Cipher * c, const uint8 *key, unsigned klen, const uint8 *iv) +bf_init(PX_Cipher *c, const uint8 *key, unsigned klen, const uint8 *iv) { ossldata *od = c->ptr; static int bf_is_strong = -1; @@ -450,7 +450,7 @@ bf_init(PX_Cipher * c, const uint8 *key, unsigned klen, const uint8 *iv) } static int -bf_ecb_encrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, uint8 *res) +bf_ecb_encrypt(PX_Cipher *c, const uint8 *data, unsigned dlen, uint8 *res) { unsigned bs = gen_ossl_block_size(c); unsigned i; @@ -462,7 +462,7 @@ bf_ecb_encrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, uint8 *res) } static int -bf_ecb_decrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, uint8 *res) +bf_ecb_decrypt(PX_Cipher *c, const uint8 *data, unsigned dlen, uint8 *res) { unsigned bs = gen_ossl_block_size(c), i; @@ -474,7 +474,7 @@ bf_ecb_decrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, uint8 *res) } static int -bf_cbc_encrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, uint8 *res) +bf_cbc_encrypt(PX_Cipher *c, const uint8 *data, unsigned dlen, uint8 *res) { ossldata *od = c->ptr; @@ -483,7 +483,7 @@ bf_cbc_encrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, uint8 *res) } static int -bf_cbc_decrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, uint8 *res) +bf_cbc_decrypt(PX_Cipher *c, const uint8 *data, unsigned dlen, uint8 *res) { ossldata *od = c->ptr; @@ -492,7 +492,7 @@ bf_cbc_decrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, uint8 *res) } static int -bf_cfb64_encrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, uint8 *res) +bf_cfb64_encrypt(PX_Cipher *c, const uint8 *data, unsigned dlen, uint8 *res) { ossldata *od = c->ptr; @@ -502,7 +502,7 @@ bf_cfb64_encrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, uint8 *res) } static int -bf_cfb64_decrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, uint8 *res) +bf_cfb64_decrypt(PX_Cipher *c, const uint8 *data, unsigned dlen, uint8 *res) { ossldata *od = c->ptr; @@ -514,7 +514,7 @@ bf_cfb64_decrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, uint8 *res) /* DES */ static int -ossl_des_init(PX_Cipher * c, const uint8 *key, unsigned klen, const uint8 *iv) +ossl_des_init(PX_Cipher *c, const uint8 *key, unsigned klen, const uint8 *iv) { ossldata *od = c->ptr; DES_cblock xkey; @@ -532,7 +532,7 @@ ossl_des_init(PX_Cipher * c, const uint8 *key, unsigned klen, const uint8 *iv) } static int -ossl_des_ecb_encrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, +ossl_des_ecb_encrypt(PX_Cipher *c, const uint8 *data, unsigned dlen, uint8 *res) { unsigned bs = gen_ossl_block_size(c); @@ -547,7 +547,7 @@ ossl_des_ecb_encrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, } static int -ossl_des_ecb_decrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, +ossl_des_ecb_decrypt(PX_Cipher *c, const uint8 *data, unsigned dlen, uint8 *res) { unsigned bs = gen_ossl_block_size(c); @@ -562,7 +562,7 @@ ossl_des_ecb_decrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, } static int -ossl_des_cbc_encrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, +ossl_des_cbc_encrypt(PX_Cipher *c, const uint8 *data, unsigned dlen, uint8 *res) { ossldata *od = c->ptr; @@ -573,7 +573,7 @@ ossl_des_cbc_encrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, } static int -ossl_des_cbc_decrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, +ossl_des_cbc_decrypt(PX_Cipher *c, const uint8 *data, unsigned dlen, uint8 *res) { ossldata *od = c->ptr; @@ -586,7 +586,7 @@ ossl_des_cbc_decrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, /* DES3 */ static int -ossl_des3_init(PX_Cipher * c, const uint8 *key, unsigned klen, const uint8 *iv) +ossl_des3_init(PX_Cipher *c, const uint8 *key, unsigned klen, const uint8 *iv) { ossldata *od = c->ptr; DES_cblock xkey1, @@ -617,7 +617,7 @@ ossl_des3_init(PX_Cipher * c, const uint8 *key, unsigned klen, const uint8 *iv) } static int -ossl_des3_ecb_encrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, +ossl_des3_ecb_encrypt(PX_Cipher *c, const uint8 *data, unsigned dlen, uint8 *res) { unsigned bs = gen_ossl_block_size(c); @@ -631,7 +631,7 @@ ossl_des3_ecb_encrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, } static int -ossl_des3_ecb_decrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, +ossl_des3_ecb_decrypt(PX_Cipher *c, const uint8 *data, unsigned dlen, uint8 *res) { unsigned bs = gen_ossl_block_size(c); @@ -645,7 +645,7 @@ ossl_des3_ecb_decrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, } static int -ossl_des3_cbc_encrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, +ossl_des3_cbc_encrypt(PX_Cipher *c, const uint8 *data, unsigned dlen, uint8 *res) { ossldata *od = c->ptr; @@ -657,7 +657,7 @@ ossl_des3_cbc_encrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, } static int -ossl_des3_cbc_decrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, +ossl_des3_cbc_decrypt(PX_Cipher *c, const uint8 *data, unsigned dlen, uint8 *res) { ossldata *od = c->ptr; @@ -671,7 +671,7 @@ ossl_des3_cbc_decrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, /* CAST5 */ static int -ossl_cast_init(PX_Cipher * c, const uint8 *key, unsigned klen, const uint8 *iv) +ossl_cast_init(PX_Cipher *c, const uint8 *key, unsigned klen, const uint8 *iv) { ossldata *od = c->ptr; unsigned bs = gen_ossl_block_size(c); @@ -685,7 +685,7 @@ ossl_cast_init(PX_Cipher * c, const uint8 *key, unsigned klen, const uint8 *iv) } static int -ossl_cast_ecb_encrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, uint8 *res) +ossl_cast_ecb_encrypt(PX_Cipher *c, const uint8 *data, unsigned dlen, uint8 *res) { unsigned bs = gen_ossl_block_size(c); ossldata *od = c->ptr; @@ -697,7 +697,7 @@ ossl_cast_ecb_encrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, uint8 *re } static int -ossl_cast_ecb_decrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, uint8 *res) +ossl_cast_ecb_decrypt(PX_Cipher *c, const uint8 *data, unsigned dlen, uint8 *res) { unsigned bs = gen_ossl_block_size(c); ossldata *od = c->ptr; @@ -709,7 +709,7 @@ ossl_cast_ecb_decrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, uint8 *re } static int -ossl_cast_cbc_encrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, uint8 *res) +ossl_cast_cbc_encrypt(PX_Cipher *c, const uint8 *data, unsigned dlen, uint8 *res) { ossldata *od = c->ptr; @@ -718,7 +718,7 @@ ossl_cast_cbc_encrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, uint8 *re } static int -ossl_cast_cbc_decrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, uint8 *res) +ossl_cast_cbc_decrypt(PX_Cipher *c, const uint8 *data, unsigned dlen, uint8 *res) { ossldata *od = c->ptr; @@ -729,7 +729,7 @@ ossl_cast_cbc_decrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, uint8 *re /* AES */ static int -ossl_aes_init(PX_Cipher * c, const uint8 *key, unsigned klen, const uint8 *iv) +ossl_aes_init(PX_Cipher *c, const uint8 *key, unsigned klen, const uint8 *iv) { ossldata *od = c->ptr; unsigned bs = gen_ossl_block_size(c); @@ -753,7 +753,7 @@ ossl_aes_init(PX_Cipher * c, const uint8 *key, unsigned klen, const uint8 *iv) } static int -ossl_aes_key_init(ossldata * od, int type) +ossl_aes_key_init(ossldata *od, int type) { int err; @@ -776,7 +776,7 @@ ossl_aes_key_init(ossldata * od, int type) } static int -ossl_aes_ecb_encrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, +ossl_aes_ecb_encrypt(PX_Cipher *c, const uint8 *data, unsigned dlen, uint8 *res) { unsigned bs = gen_ossl_block_size(c); @@ -794,7 +794,7 @@ ossl_aes_ecb_encrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, } static int -ossl_aes_ecb_decrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, +ossl_aes_ecb_decrypt(PX_Cipher *c, const uint8 *data, unsigned dlen, uint8 *res) { unsigned bs = gen_ossl_block_size(c); @@ -812,7 +812,7 @@ ossl_aes_ecb_decrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, } static int -ossl_aes_cbc_encrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, +ossl_aes_cbc_encrypt(PX_Cipher *c, const uint8 *data, unsigned dlen, uint8 *res) { ossldata *od = c->ptr; @@ -827,7 +827,7 @@ ossl_aes_cbc_encrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, } static int -ossl_aes_cbc_decrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, +ossl_aes_cbc_decrypt(PX_Cipher *c, const uint8 *data, unsigned dlen, uint8 *res) { ossldata *od = c->ptr; @@ -945,7 +945,7 @@ static const struct ossl_cipher_lookup ossl_cipher_types[] = { /* PUBLIC functions */ int -px_find_cipher(const char *name, PX_Cipher ** res) +px_find_cipher(const char *name, PX_Cipher **res) { const struct ossl_cipher_lookup *i; PX_Cipher *c = NULL; diff --git a/contrib/pgcrypto/pgp-cfb.c b/contrib/pgcrypto/pgp-cfb.c index 811bb7c2c33..bd05ccc94e4 100644 --- a/contrib/pgcrypto/pgp-cfb.c +++ b/contrib/pgcrypto/pgp-cfb.c @@ -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-cfb.c,v 1.3 2005/10/15 02:49:06 momjian Exp $ + * $PostgreSQL: pgsql/contrib/pgcrypto/pgp-cfb.c,v 1.4 2009/06/11 14:48:52 momjian Exp $ */ #include "postgres.h" @@ -35,7 +35,7 @@ #include "px.h" #include "pgp.h" -typedef int (*mix_data_t) (PGP_CFB * ctx, const uint8 *data, int len, uint8 *dst); +typedef int (*mix_data_t) (PGP_CFB *ctx, const uint8 *data, int len, uint8 *dst); struct PGP_CFB { @@ -50,7 +50,7 @@ struct PGP_CFB }; int -pgp_cfb_create(PGP_CFB ** ctx_p, int algo, const uint8 *key, int key_len, +pgp_cfb_create(PGP_CFB **ctx_p, int algo, const uint8 *key, int key_len, int resync, uint8 *iv) { int res; @@ -82,7 +82,7 @@ pgp_cfb_create(PGP_CFB ** ctx_p, int algo, const uint8 *key, int key_len, } void -pgp_cfb_free(PGP_CFB * ctx) +pgp_cfb_free(PGP_CFB *ctx) { px_cipher_free(ctx->ciph); memset(ctx, 0, sizeof(*ctx)); @@ -93,7 +93,7 @@ pgp_cfb_free(PGP_CFB * ctx) * Data processing for normal CFB. (PGP_PKT_SYMENCRYPTED_DATA_MDC) */ static int -mix_encrypt_normal(PGP_CFB * ctx, const uint8 *data, int len, uint8 *dst) +mix_encrypt_normal(PGP_CFB *ctx, const uint8 *data, int len, uint8 *dst) { int i; @@ -104,7 +104,7 @@ mix_encrypt_normal(PGP_CFB * ctx, const uint8 *data, int len, uint8 *dst) } static int -mix_decrypt_normal(PGP_CFB * ctx, const uint8 *data, int len, uint8 *dst) +mix_decrypt_normal(PGP_CFB *ctx, const uint8 *data, int len, uint8 *dst) { int i; @@ -124,7 +124,7 @@ mix_decrypt_normal(PGP_CFB * ctx, const uint8 *data, int len, uint8 *dst) * thus its all concentrated here. */ static int -mix_encrypt_resync(PGP_CFB * ctx, const uint8 *data, int len, uint8 *dst) +mix_encrypt_resync(PGP_CFB *ctx, const uint8 *data, int len, uint8 *dst) { int i, n; @@ -156,7 +156,7 @@ mix_encrypt_resync(PGP_CFB * ctx, const uint8 *data, int len, uint8 *dst) } static int -mix_decrypt_resync(PGP_CFB * ctx, const uint8 *data, int len, uint8 *dst) +mix_decrypt_resync(PGP_CFB *ctx, const uint8 *data, int len, uint8 *dst) { int i, n; @@ -196,7 +196,7 @@ mix_decrypt_resync(PGP_CFB * ctx, const uint8 *data, int len, uint8 *dst) * common code for both encrypt and decrypt. */ static int -cfb_process(PGP_CFB * ctx, const uint8 *data, int len, uint8 *dst, +cfb_process(PGP_CFB *ctx, const uint8 *data, int len, uint8 *dst, mix_data_t mix_data) { int n; @@ -249,7 +249,7 @@ cfb_process(PGP_CFB * ctx, const uint8 *data, int len, uint8 *dst, */ int -pgp_cfb_encrypt(PGP_CFB * ctx, const uint8 *data, int len, uint8 *dst) +pgp_cfb_encrypt(PGP_CFB *ctx, const uint8 *data, int len, uint8 *dst) { mix_data_t mix = ctx->resync ? mix_encrypt_resync : mix_encrypt_normal; @@ -257,7 +257,7 @@ pgp_cfb_encrypt(PGP_CFB * ctx, const uint8 *data, int len, uint8 *dst) } int -pgp_cfb_decrypt(PGP_CFB * ctx, const uint8 *data, int len, uint8 *dst) +pgp_cfb_decrypt(PGP_CFB *ctx, const uint8 *data, int len, uint8 *dst) { mix_data_t mix = ctx->resync ? mix_decrypt_resync : mix_decrypt_normal; diff --git a/contrib/pgcrypto/pgp-compress.c b/contrib/pgcrypto/pgp-compress.c index 9d2f61ed8ed..41f58552476 100644 --- a/contrib/pgcrypto/pgp-compress.c +++ b/contrib/pgcrypto/pgp-compress.c @@ -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.7 2007/11/15 21:14:31 momjian Exp $ + * $PostgreSQL: pgsql/contrib/pgcrypto/pgp-compress.c,v 1.8 2009/06/11 14:48:52 momjian Exp $ */ #include "postgres.h" @@ -69,7 +69,7 @@ z_free(void *priv, void *addr) } static int -compress_init(PushFilter * next, void *init_arg, void **priv_p) +compress_init(PushFilter *next, void *init_arg, void **priv_p) { int res; struct ZipStat *st; @@ -107,7 +107,7 @@ compress_init(PushFilter * next, void *init_arg, void **priv_p) /* cant handle zero-len incoming data, but shouldnt */ static int -compress_process(PushFilter * next, void *priv, const uint8 *data, int len) +compress_process(PushFilter *next, void *priv, const uint8 *data, int len) { int res, n_out; @@ -140,7 +140,7 @@ compress_process(PushFilter * next, void *priv, const uint8 *data, int len) } static int -compress_flush(PushFilter * next, void *priv) +compress_flush(PushFilter *next, void *priv) { int res, zres, @@ -185,7 +185,7 @@ static const PushFilterOps }; int -pgp_compress_filter(PushFilter ** res, PGP_Context * ctx, PushFilter * dst) +pgp_compress_filter(PushFilter **res, PGP_Context *ctx, PushFilter *dst) { return pushf_create(res, &compress_filter, ctx, dst); } @@ -204,7 +204,7 @@ struct DecomprData }; static int -decompress_init(void **priv_p, void *arg, PullFilter * src) +decompress_init(void **priv_p, void *arg, PullFilter *src) { PGP_Context *ctx = arg; struct DecomprData *dec; @@ -237,7 +237,7 @@ decompress_init(void **priv_p, void *arg, PullFilter * src) } static int -decompress_read(void *priv, PullFilter * src, int len, +decompress_read(void *priv, PullFilter *src, int len, uint8 **data_p, uint8 *buf, int buflen) { int res; @@ -308,20 +308,20 @@ static const PullFilterOps }; int -pgp_decompress_filter(PullFilter ** res, PGP_Context * ctx, PullFilter * src) +pgp_decompress_filter(PullFilter **res, PGP_Context *ctx, PullFilter *src) { return pullf_create(res, &decompress_filter, ctx, src); } #else /* !HAVE_ZLIB */ int -pgp_compress_filter(PushFilter ** res, PGP_Context * ctx, PushFilter * dst) +pgp_compress_filter(PushFilter **res, PGP_Context *ctx, PushFilter *dst) { return PXE_PGP_UNSUPPORTED_COMPR; } int -pgp_decompress_filter(PullFilter ** res, PGP_Context * ctx, PullFilter * src) +pgp_decompress_filter(PullFilter **res, PGP_Context *ctx, PullFilter *src) { return PXE_PGP_UNSUPPORTED_COMPR; } diff --git a/contrib/pgcrypto/pgp-decrypt.c b/contrib/pgcrypto/pgp-decrypt.c index 77973a5c314..9df5c717f2b 100644 --- a/contrib/pgcrypto/pgp-decrypt.c +++ b/contrib/pgcrypto/pgp-decrypt.c @@ -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-decrypt.c,v 1.7 2005/11/22 18:17:04 momjian Exp $ + * $PostgreSQL: pgsql/contrib/pgcrypto/pgp-decrypt.c,v 1.8 2009/06/11 14:48:52 momjian Exp $ */ #include "postgres.h" @@ -49,7 +49,7 @@ #define MAX_CHUNK (16*1024*1024) static int -parse_new_len(PullFilter * src, int *len_p) +parse_new_len(PullFilter *src, int *len_p) { uint8 b; int len; @@ -92,7 +92,7 @@ parse_new_len(PullFilter * src, int *len_p) } static int -parse_old_len(PullFilter * src, int *len_p, int lentype) +parse_old_len(PullFilter *src, int *len_p, int lentype) { uint8 b; int len; @@ -126,7 +126,7 @@ parse_old_len(PullFilter * src, int *len_p, int lentype) /* returns pkttype or 0 on eof */ int -pgp_parse_pkt_hdr(PullFilter * src, uint8 *tag, int *len_p, int allow_ctx) +pgp_parse_pkt_hdr(PullFilter *src, uint8 *tag, int *len_p, int allow_ctx) { int lentype; int res; @@ -172,7 +172,7 @@ struct PktData }; static int -pktreader_pull(void *priv, PullFilter * src, int len, +pktreader_pull(void *priv, PullFilter *src, int len, uint8 **data_p, uint8 *buf, int buflen) { int res; @@ -220,8 +220,8 @@ static struct PullFilterOps pktreader_filter = { /* needs helper function to pass several parameters */ int -pgp_create_pkt_reader(PullFilter ** pf_p, PullFilter * src, int len, - int pkttype, PGP_Context * ctx) +pgp_create_pkt_reader(PullFilter **pf_p, PullFilter *src, int len, + int pkttype, PGP_Context *ctx) { int res; struct PktData *pkt = px_alloc(sizeof(*pkt)); @@ -239,7 +239,7 @@ pgp_create_pkt_reader(PullFilter ** pf_p, PullFilter * src, int len, */ static int -prefix_init(void **priv_p, void *arg, PullFilter * src) +prefix_init(void **priv_p, void *arg, PullFilter *src) { PGP_Context *ctx = arg; int len; @@ -294,7 +294,7 @@ static struct PullFilterOps prefix_filter = { */ static int -decrypt_init(void **priv_p, void *arg, PullFilter * src) +decrypt_init(void **priv_p, void *arg, PullFilter *src) { PGP_CFB *cfb = arg; @@ -305,7 +305,7 @@ decrypt_init(void **priv_p, void *arg, PullFilter * src) } static int -decrypt_read(void *priv, PullFilter * src, int len, +decrypt_read(void *priv, PullFilter *src, int len, uint8 **data_p, uint8 *buf, int buflen) { PGP_CFB *cfb = priv; @@ -331,7 +331,7 @@ struct PullFilterOps pgp_decrypt_filter = { */ static int -mdc_init(void **priv_p, void *arg, PullFilter * src) +mdc_init(void **priv_p, void *arg, PullFilter *src) { PGP_Context *ctx = arg; @@ -351,7 +351,7 @@ mdc_free(void *priv) } static int -mdc_finish(PGP_Context * ctx, PullFilter * src, +mdc_finish(PGP_Context *ctx, PullFilter *src, int len, uint8 **data_p) { int res; @@ -407,7 +407,7 @@ mdc_finish(PGP_Context * ctx, PullFilter * src, } static int -mdc_read(void *priv, PullFilter * src, int len, +mdc_read(void *priv, PullFilter *src, int len, uint8 **data_p, uint8 *buf, int buflen) { int res; @@ -460,7 +460,7 @@ struct MDCBufData }; static int -mdcbuf_init(void **priv_p, void *arg, PullFilter * src) +mdcbuf_init(void **priv_p, void *arg, PullFilter *src) { PGP_Context *ctx = arg; struct MDCBufData *st; @@ -520,7 +520,7 @@ mdcbuf_load_mdc(struct MDCBufData * st, uint8 *src, int len) } static int -mdcbuf_refill(struct MDCBufData * st, PullFilter * src) +mdcbuf_refill(struct MDCBufData * st, PullFilter *src) { uint8 *data; int res; @@ -564,7 +564,7 @@ mdcbuf_refill(struct MDCBufData * st, PullFilter * src) } static int -mdcbuf_read(void *priv, PullFilter * src, int len, +mdcbuf_read(void *priv, PullFilter *src, int len, uint8 **data_p, uint8 *buf, int buflen) { struct MDCBufData *st = priv; @@ -606,7 +606,7 @@ static struct PullFilterOps mdcbuf_filter = { * Decrypt separate session key */ static int -decrypt_key(PGP_Context * ctx, const uint8 *src, int len) +decrypt_key(PGP_Context *ctx, const uint8 *src, int len) { int res; uint8 algo; @@ -639,7 +639,7 @@ decrypt_key(PGP_Context * ctx, const uint8 *src, int len) * Handle key packet */ static int -parse_symenc_sesskey(PGP_Context * ctx, PullFilter * src) +parse_symenc_sesskey(PGP_Context *ctx, PullFilter *src) { uint8 *p; int res; @@ -708,7 +708,7 @@ parse_symenc_sesskey(PGP_Context * ctx, PullFilter * src) } static int -copy_crlf(MBuf * dst, uint8 *data, int len, int *got_cr) +copy_crlf(MBuf *dst, uint8 *data, int len, int *got_cr) { uint8 *data_end = data + len; uint8 tmpbuf[1024]; @@ -757,7 +757,7 @@ copy_crlf(MBuf * dst, uint8 *data, int len, int *got_cr) } static int -parse_literal_data(PGP_Context * ctx, MBuf * dst, PullFilter * pkt) +parse_literal_data(PGP_Context *ctx, MBuf *dst, PullFilter *pkt) { int type; int name_len; @@ -824,11 +824,11 @@ parse_literal_data(PGP_Context * ctx, MBuf * dst, PullFilter * pkt) } /* process_data_packets and parse_compressed_data call each other */ -static int process_data_packets(PGP_Context * ctx, MBuf * dst, - PullFilter * src, int allow_compr, int need_mdc); +static int process_data_packets(PGP_Context *ctx, MBuf *dst, + PullFilter *src, int allow_compr, int need_mdc); static int -parse_compressed_data(PGP_Context * ctx, MBuf * dst, PullFilter * pkt) +parse_compressed_data(PGP_Context *ctx, MBuf *dst, PullFilter *pkt) { int res; uint8 type; @@ -868,7 +868,7 @@ parse_compressed_data(PGP_Context * ctx, MBuf * dst, PullFilter * pkt) } static int -process_data_packets(PGP_Context * ctx, MBuf * dst, PullFilter * src, +process_data_packets(PGP_Context *ctx, MBuf *dst, PullFilter *src, int allow_compr, int need_mdc) { uint8 tag; @@ -975,7 +975,7 @@ process_data_packets(PGP_Context * ctx, MBuf * dst, PullFilter * src, } static int -parse_symenc_data(PGP_Context * ctx, PullFilter * pkt, MBuf * dst) +parse_symenc_data(PGP_Context *ctx, PullFilter *pkt, MBuf *dst) { int res; PGP_CFB *cfb = NULL; @@ -1009,7 +1009,7 @@ out: } static int -parse_symenc_mdc_data(PGP_Context * ctx, PullFilter * pkt, MBuf * dst) +parse_symenc_mdc_data(PGP_Context *ctx, PullFilter *pkt, MBuf *dst) { int res; PGP_CFB *cfb = NULL; @@ -1061,7 +1061,7 @@ out: * skip over packet contents */ int -pgp_skip_packet(PullFilter * pkt) +pgp_skip_packet(PullFilter *pkt) { int res = 1; uint8 *tmp; @@ -1075,7 +1075,7 @@ pgp_skip_packet(PullFilter * pkt) * expect to be at packet end, any data is error */ int -pgp_expect_packet_end(PullFilter * pkt) +pgp_expect_packet_end(PullFilter *pkt) { int res = 1; uint8 *tmp; @@ -1093,7 +1093,7 @@ pgp_expect_packet_end(PullFilter * pkt) } int -pgp_decrypt(PGP_Context * ctx, MBuf * msrc, MBuf * mdst) +pgp_decrypt(PGP_Context *ctx, MBuf *msrc, MBuf *mdst) { int res; PullFilter *src = NULL; diff --git a/contrib/pgcrypto/pgp-encrypt.c b/contrib/pgcrypto/pgp-encrypt.c index e2c928154bb..48f2f01f629 100644 --- a/contrib/pgcrypto/pgp-encrypt.c +++ b/contrib/pgcrypto/pgp-encrypt.c @@ -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-encrypt.c,v 1.3 2005/10/15 02:49:06 momjian Exp $ + * $PostgreSQL: pgsql/contrib/pgcrypto/pgp-encrypt.c,v 1.4 2009/06/11 14:48:52 momjian Exp $ */ #include "postgres.h" @@ -66,7 +66,7 @@ render_newlen(uint8 *h, int len) } static int -write_tag_only(PushFilter * dst, int tag) +write_tag_only(PushFilter *dst, int tag) { uint8 hdr = 0xC0 | tag; @@ -74,7 +74,7 @@ write_tag_only(PushFilter * dst, int tag) } static int -write_normal_header(PushFilter * dst, int tag, int len) +write_normal_header(PushFilter *dst, int tag, int len) { uint8 hdr[8]; uint8 *h = hdr; @@ -90,7 +90,7 @@ write_normal_header(PushFilter * dst, int tag, int len) */ static int -mdc_init(PushFilter * dst, void *init_arg, void **priv_p) +mdc_init(PushFilter *dst, void *init_arg, void **priv_p) { int res; PX_MD *md; @@ -104,7 +104,7 @@ mdc_init(PushFilter * dst, void *init_arg, void **priv_p) } static int -mdc_write(PushFilter * dst, void *priv, const uint8 *data, int len) +mdc_write(PushFilter *dst, void *priv, const uint8 *data, int len) { PX_MD *md = priv; @@ -113,7 +113,7 @@ mdc_write(PushFilter * dst, void *priv, const uint8 *data, int len) } static int -mdc_flush(PushFilter * dst, void *priv) +mdc_flush(PushFilter *dst, void *priv) { int res; uint8 pkt[2 + MDC_DIGEST_LEN]; @@ -156,7 +156,7 @@ struct EncStat }; static int -encrypt_init(PushFilter * next, void *init_arg, void **priv_p) +encrypt_init(PushFilter *next, void *init_arg, void **priv_p) { struct EncStat *st; PGP_Context *ctx = init_arg; @@ -188,7 +188,7 @@ encrypt_init(PushFilter * next, void *init_arg, void **priv_p) } static int -encrypt_process(PushFilter * next, void *priv, const uint8 *data, int len) +encrypt_process(PushFilter *next, void *priv, const uint8 *data, int len) { int res; struct EncStat *st = priv; @@ -236,7 +236,7 @@ struct PktStreamStat }; static int -pkt_stream_init(PushFilter * next, void *init_arg, void **priv_p) +pkt_stream_init(PushFilter *next, void *init_arg, void **priv_p) { struct PktStreamStat *st; @@ -249,7 +249,7 @@ pkt_stream_init(PushFilter * next, void *init_arg, void **priv_p) } static int -pkt_stream_process(PushFilter * next, void *priv, const uint8 *data, int len) +pkt_stream_process(PushFilter *next, void *priv, const uint8 *data, int len) { int res; uint8 hdr[8]; @@ -275,7 +275,7 @@ pkt_stream_process(PushFilter * next, void *priv, const uint8 *data, int len) } static int -pkt_stream_flush(PushFilter * next, void *priv) +pkt_stream_flush(PushFilter *next, void *priv) { int res; uint8 hdr[8]; @@ -308,7 +308,7 @@ static const PushFilterOps pkt_stream_filter = { }; int -pgp_create_pkt_writer(PushFilter * dst, int tag, PushFilter ** res_p) +pgp_create_pkt_writer(PushFilter *dst, int tag, PushFilter **res_p) { int res; @@ -324,7 +324,7 @@ pgp_create_pkt_writer(PushFilter * dst, int tag, PushFilter ** res_p) */ static int -crlf_process(PushFilter * dst, void *priv, const uint8 *data, int len) +crlf_process(PushFilter *dst, void *priv, const uint8 *data, int len) { const uint8 *data_end = data + len; const uint8 *p2, @@ -371,7 +371,7 @@ static const PushFilterOps crlf_filter = { * Initialize literal data packet */ static int -init_litdata_packet(PushFilter ** pf_res, PGP_Context * ctx, PushFilter * dst) +init_litdata_packet(PushFilter **pf_res, PGP_Context *ctx, PushFilter *dst) { int res; int hdrlen; @@ -426,7 +426,7 @@ init_litdata_packet(PushFilter ** pf_res, PGP_Context * ctx, PushFilter * dst) * Initialize compression filter */ static int -init_compress(PushFilter ** pf_res, PGP_Context * ctx, PushFilter * dst) +init_compress(PushFilter **pf_res, PGP_Context *ctx, PushFilter *dst) { int res; uint8 type = ctx->compress_algo; @@ -454,7 +454,7 @@ init_compress(PushFilter ** pf_res, PGP_Context * ctx, PushFilter * dst) * Initialize encdata packet */ static int -init_encdata_packet(PushFilter ** pf_res, PGP_Context * ctx, PushFilter * dst) +init_encdata_packet(PushFilter **pf_res, PGP_Context *ctx, PushFilter *dst) { int res; int tag; @@ -475,7 +475,7 @@ init_encdata_packet(PushFilter ** pf_res, PGP_Context * ctx, PushFilter * dst) * write prefix */ static int -write_prefix(PGP_Context * ctx, PushFilter * dst) +write_prefix(PGP_Context *ctx, PushFilter *dst) { uint8 prefix[PGP_MAX_BLOCK + 2]; int res, @@ -499,7 +499,7 @@ write_prefix(PGP_Context * ctx, PushFilter * dst) */ static int -symencrypt_sesskey(PGP_Context * ctx, uint8 *dst) +symencrypt_sesskey(PGP_Context *ctx, uint8 *dst) { int res; PGP_CFB *cfb; @@ -519,7 +519,7 @@ symencrypt_sesskey(PGP_Context * ctx, uint8 *dst) /* 5.3: Symmetric-Key Encrypted Session-Key */ static int -write_symenc_sesskey(PGP_Context * ctx, PushFilter * dst) +write_symenc_sesskey(PGP_Context *ctx, PushFilter *dst) { uint8 pkt[256]; int pktlen; @@ -560,7 +560,7 @@ write_symenc_sesskey(PGP_Context * ctx, PushFilter * dst) * key setup */ static int -init_s2k_key(PGP_Context * ctx) +init_s2k_key(PGP_Context *ctx) { int res; @@ -576,7 +576,7 @@ init_s2k_key(PGP_Context * ctx) } static int -init_sess_key(PGP_Context * ctx) +init_sess_key(PGP_Context *ctx) { int res; @@ -600,7 +600,7 @@ init_sess_key(PGP_Context * ctx) * combine */ int -pgp_encrypt(PGP_Context * ctx, MBuf * src, MBuf * dst) +pgp_encrypt(PGP_Context *ctx, MBuf *src, MBuf *dst) { int res; int len; diff --git a/contrib/pgcrypto/pgp-info.c b/contrib/pgcrypto/pgp-info.c index 9f887ec6d90..a51a553236f 100644 --- a/contrib/pgcrypto/pgp-info.c +++ b/contrib/pgcrypto/pgp-info.c @@ -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-info.c,v 1.4 2005/10/15 02:49:06 momjian Exp $ + * $PostgreSQL: pgsql/contrib/pgcrypto/pgp-info.c,v 1.5 2009/06/11 14:48:52 momjian Exp $ */ #include "postgres.h" @@ -35,7 +35,7 @@ #include "pgp.h" static int -read_pubkey_keyid(PullFilter * pkt, uint8 *keyid_buf) +read_pubkey_keyid(PullFilter *pkt, uint8 *keyid_buf) { int res; PGP_PubKey *pk = NULL; @@ -68,7 +68,7 @@ err: } static int -read_pubenc_keyid(PullFilter * pkt, uint8 *keyid_buf) +read_pubenc_keyid(PullFilter *pkt, uint8 *keyid_buf) { uint8 ver; int res; @@ -109,7 +109,7 @@ static const uint8 any_key[] = * dst should have room for 17 bytes */ int -pgp_get_keyid(MBuf * pgp_data, char *dst) +pgp_get_keyid(MBuf *pgp_data, char *dst) { int res; PullFilter *src; diff --git a/contrib/pgcrypto/pgp-mpi-internal.c b/contrib/pgcrypto/pgp-mpi-internal.c index d2b5d0c8de7..283946b17d2 100644 --- a/contrib/pgcrypto/pgp-mpi-internal.c +++ b/contrib/pgcrypto/pgp-mpi-internal.c @@ -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-mpi-internal.c,v 1.7 2006/10/04 00:29:46 momjian Exp $ + * $PostgreSQL: pgsql/contrib/pgcrypto/pgp-mpi-internal.c,v 1.8 2009/06/11 14:48:52 momjian Exp $ */ #include "postgres.h" @@ -46,7 +46,7 @@ mp_new() } static void -mp_clear_free(mpz_t * a) +mp_clear_free(mpz_t *a) { if (!a) return; @@ -56,7 +56,7 @@ mp_clear_free(mpz_t * a) static int -mp_px_rand(uint32 bits, mpz_t * res) +mp_px_rand(uint32 bits, mpz_t *res) { int err; unsigned bytes = (bits + 7) / 8; @@ -88,7 +88,7 @@ mp_px_rand(uint32 bits, mpz_t * res) } static void -mp_modmul(mpz_t * a, mpz_t * b, mpz_t * p, mpz_t * res) +mp_modmul(mpz_t *a, mpz_t *b, mpz_t *p, mpz_t *res) { mpz_t *tmp = mp_new(); @@ -98,7 +98,7 @@ mp_modmul(mpz_t * a, mpz_t * b, mpz_t * p, mpz_t * res) } static mpz_t * -mpi_to_bn(PGP_MPI * n) +mpi_to_bn(PGP_MPI *n) { mpz_t *bn = mp_new(); @@ -117,7 +117,7 @@ mpi_to_bn(PGP_MPI * n) } static PGP_MPI * -bn_to_mpi(mpz_t * bn) +bn_to_mpi(mpz_t *bn) { int res; PGP_MPI *n; @@ -164,8 +164,8 @@ decide_k_bits(int p_bits) } int -pgp_elgamal_encrypt(PGP_PubKey * pk, PGP_MPI * _m, - PGP_MPI ** c1_p, PGP_MPI ** c2_p) +pgp_elgamal_encrypt(PGP_PubKey *pk, PGP_MPI *_m, + PGP_MPI **c1_p, PGP_MPI **c2_p) { int res = PXE_PGP_MATH_FAILED; int k_bits; @@ -214,8 +214,8 @@ err: } int -pgp_elgamal_decrypt(PGP_PubKey * pk, PGP_MPI * _c1, PGP_MPI * _c2, - PGP_MPI ** msg_p) +pgp_elgamal_decrypt(PGP_PubKey *pk, PGP_MPI *_c1, PGP_MPI *_c2, + PGP_MPI **msg_p) { int res = PXE_PGP_MATH_FAILED; mpz_t *c1 = mpi_to_bn(_c1); @@ -252,7 +252,7 @@ err: } int -pgp_rsa_encrypt(PGP_PubKey * pk, PGP_MPI * _m, PGP_MPI ** c_p) +pgp_rsa_encrypt(PGP_PubKey *pk, PGP_MPI *_m, PGP_MPI **c_p) { int res = PXE_PGP_MATH_FAILED; mpz_t *m = mpi_to_bn(_m); @@ -280,7 +280,7 @@ err: } int -pgp_rsa_decrypt(PGP_PubKey * pk, PGP_MPI * _c, PGP_MPI ** m_p) +pgp_rsa_decrypt(PGP_PubKey *pk, PGP_MPI *_c, PGP_MPI **m_p) { int res = PXE_PGP_MATH_FAILED; mpz_t *c = mpi_to_bn(_c); diff --git a/contrib/pgcrypto/pgp-mpi-openssl.c b/contrib/pgcrypto/pgp-mpi-openssl.c index 0e692e35d25..f2b25de0900 100644 --- a/contrib/pgcrypto/pgp-mpi-openssl.c +++ b/contrib/pgcrypto/pgp-mpi-openssl.c @@ -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-mpi-openssl.c,v 1.4 2005/10/15 02:49:06 momjian Exp $ + * $PostgreSQL: pgsql/contrib/pgcrypto/pgp-mpi-openssl.c,v 1.5 2009/06/11 14:48:52 momjian Exp $ */ #include "postgres.h" @@ -37,7 +37,7 @@ #include "pgp.h" static BIGNUM * -mpi_to_bn(PGP_MPI * n) +mpi_to_bn(PGP_MPI *n) { BIGNUM *bn = BN_bin2bn(n->data, n->bytes, NULL); @@ -99,8 +99,8 @@ decide_k_bits(int p_bits) } int -pgp_elgamal_encrypt(PGP_PubKey * pk, PGP_MPI * _m, - PGP_MPI ** c1_p, PGP_MPI ** c2_p) +pgp_elgamal_encrypt(PGP_PubKey *pk, PGP_MPI *_m, + PGP_MPI **c1_p, PGP_MPI **c2_p) { int res = PXE_PGP_MATH_FAILED; int k_bits; @@ -162,8 +162,8 @@ err: } int -pgp_elgamal_decrypt(PGP_PubKey * pk, PGP_MPI * _c1, PGP_MPI * _c2, - PGP_MPI ** msg_p) +pgp_elgamal_decrypt(PGP_PubKey *pk, PGP_MPI *_c1, PGP_MPI *_c2, + PGP_MPI **msg_p) { int res = PXE_PGP_MATH_FAILED; BIGNUM *c1 = mpi_to_bn(_c1); @@ -213,7 +213,7 @@ err: } int -pgp_rsa_encrypt(PGP_PubKey * pk, PGP_MPI * _m, PGP_MPI ** c_p) +pgp_rsa_encrypt(PGP_PubKey *pk, PGP_MPI *_m, PGP_MPI **c_p) { int res = PXE_PGP_MATH_FAILED; BIGNUM *m = mpi_to_bn(_m); @@ -249,7 +249,7 @@ err: } int -pgp_rsa_decrypt(PGP_PubKey * pk, PGP_MPI * _c, PGP_MPI ** m_p) +pgp_rsa_decrypt(PGP_PubKey *pk, PGP_MPI *_c, PGP_MPI **m_p) { int res = PXE_PGP_MATH_FAILED; BIGNUM *c = mpi_to_bn(_c); diff --git a/contrib/pgcrypto/pgp-mpi.c b/contrib/pgcrypto/pgp-mpi.c index da0edb1361c..3f2ec0f5c76 100644 --- a/contrib/pgcrypto/pgp-mpi.c +++ b/contrib/pgcrypto/pgp-mpi.c @@ -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-mpi.c,v 1.4 2005/10/15 02:49:06 momjian Exp $ + * $PostgreSQL: pgsql/contrib/pgcrypto/pgp-mpi.c,v 1.5 2009/06/11 14:48:52 momjian Exp $ */ #include "postgres.h" @@ -35,7 +35,7 @@ #include "pgp.h" int -pgp_mpi_alloc(int bits, PGP_MPI ** mpi) +pgp_mpi_alloc(int bits, PGP_MPI **mpi) { PGP_MPI *n; int len = (bits + 7) / 8; @@ -54,7 +54,7 @@ pgp_mpi_alloc(int bits, PGP_MPI ** mpi) } int -pgp_mpi_create(uint8 *data, int bits, PGP_MPI ** mpi) +pgp_mpi_create(uint8 *data, int bits, PGP_MPI **mpi) { int res; PGP_MPI *n; @@ -68,7 +68,7 @@ pgp_mpi_create(uint8 *data, int bits, PGP_MPI ** mpi) } int -pgp_mpi_free(PGP_MPI * mpi) +pgp_mpi_free(PGP_MPI *mpi) { if (mpi == NULL) return 0; @@ -78,7 +78,7 @@ pgp_mpi_free(PGP_MPI * mpi) } int -pgp_mpi_read(PullFilter * src, PGP_MPI ** mpi) +pgp_mpi_read(PullFilter *src, PGP_MPI **mpi) { int res; uint8 hdr[2]; @@ -103,7 +103,7 @@ pgp_mpi_read(PullFilter * src, PGP_MPI ** mpi) } int -pgp_mpi_write(PushFilter * dst, PGP_MPI * n) +pgp_mpi_write(PushFilter *dst, PGP_MPI *n) { int res; uint8 buf[2]; @@ -117,7 +117,7 @@ pgp_mpi_write(PushFilter * dst, PGP_MPI * n) } int -pgp_mpi_hash(PX_MD * md, PGP_MPI * n) +pgp_mpi_hash(PX_MD *md, PGP_MPI *n) { uint8 buf[2]; @@ -130,7 +130,7 @@ pgp_mpi_hash(PX_MD * md, PGP_MPI * n) } unsigned -pgp_mpi_cksum(unsigned cksum, PGP_MPI * n) +pgp_mpi_cksum(unsigned cksum, PGP_MPI *n) { int i; diff --git a/contrib/pgcrypto/pgp-pgsql.c b/contrib/pgcrypto/pgp-pgsql.c index 5ffa5ad0a9a..530a3d38d80 100644 --- a/contrib/pgcrypto/pgp-pgsql.c +++ b/contrib/pgcrypto/pgp-pgsql.c @@ -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-pgsql.c,v 1.10 2008/05/04 16:42:41 tgl Exp $ + * $PostgreSQL: pgsql/contrib/pgcrypto/pgp-pgsql.c,v 1.11 2009/06/11 14:48:52 momjian Exp $ */ #include "postgres.h" @@ -79,7 +79,7 @@ PG_FUNCTION_INFO_V1(pg_dearmor); * Mix a block of data into RNG. */ static void -add_block_entropy(PX_MD * md, text *data) +add_block_entropy(PX_MD *md, text *data) { uint8 sha1[20]; @@ -215,7 +215,7 @@ fill_expect(struct debug_expect * ex, int text_mode) } while (0) static void -check_expect(PGP_Context * ctx, struct debug_expect * ex) +check_expect(PGP_Context *ctx, struct debug_expect * ex) { EX_CHECK(cipher_algo); EX_CHECK(s2k_mode); @@ -235,7 +235,7 @@ show_debug(const char *msg) } static int -set_arg(PGP_Context * ctx, char *key, char *val, +set_arg(PGP_Context *ctx, char *key, char *val, struct debug_expect * ex) { int res = 0; @@ -362,7 +362,7 @@ downcase_convert(const uint8 *s, int len) } static int -parse_args(PGP_Context * ctx, uint8 *args, int arg_len, +parse_args(PGP_Context *ctx, uint8 *args, int arg_len, struct debug_expect * ex) { char *str = downcase_convert(args, arg_len); @@ -407,7 +407,7 @@ create_mbuf_from_vardata(text *data) } static void -init_work(PGP_Context ** ctx_p, int is_text, +init_work(PGP_Context **ctx_p, int is_text, text *args, struct debug_expect * ex) { int err = pgp_init(ctx_p); diff --git a/contrib/pgcrypto/pgp-pubdec.c b/contrib/pgcrypto/pgp-pubdec.c index 600a1e25317..cb32708feea 100644 --- a/contrib/pgcrypto/pgp-pubdec.c +++ b/contrib/pgcrypto/pgp-pubdec.c @@ -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-pubdec.c,v 1.5 2005/10/15 02:49:06 momjian Exp $ + * $PostgreSQL: pgsql/contrib/pgcrypto/pgp-pubdec.c,v 1.6 2009/06/11 14:48:52 momjian Exp $ */ #include "postgres.h" @@ -95,7 +95,7 @@ control_cksum(uint8 *msg, int msglen) } static int -decrypt_elgamal(PGP_PubKey * pk, PullFilter * pkt, PGP_MPI ** m_p) +decrypt_elgamal(PGP_PubKey *pk, PullFilter *pkt, PGP_MPI **m_p) { int res; PGP_MPI *c1 = NULL; @@ -122,7 +122,7 @@ out: } static int -decrypt_rsa(PGP_PubKey * pk, PullFilter * pkt, PGP_MPI ** m_p) +decrypt_rsa(PGP_PubKey *pk, PullFilter *pkt, PGP_MPI **m_p) { int res; PGP_MPI *c; @@ -148,7 +148,7 @@ static const uint8 any_key[] = {0, 0, 0, 0, 0, 0, 0, 0}; int -pgp_parse_pubenc_sesskey(PGP_Context * ctx, PullFilter * pkt) +pgp_parse_pubenc_sesskey(PGP_Context *ctx, PullFilter *pkt) { int ver; int algo; diff --git a/contrib/pgcrypto/pgp-pubenc.c b/contrib/pgcrypto/pgp-pubenc.c index de729476f59..0e9ebb42858 100644 --- a/contrib/pgcrypto/pgp-pubenc.c +++ b/contrib/pgcrypto/pgp-pubenc.c @@ -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-pubenc.c,v 1.4 2005/10/15 02:49:06 momjian Exp $ + * $PostgreSQL: pgsql/contrib/pgcrypto/pgp-pubenc.c,v 1.5 2009/06/11 14:48:52 momjian Exp $ */ #include "postgres.h" @@ -86,7 +86,7 @@ pad_eme_pkcs1_v15(uint8 *data, int data_len, int res_len, uint8 **res_p) } static int -create_secmsg(PGP_Context * ctx, PGP_MPI ** msg_p, int full_bytes) +create_secmsg(PGP_Context *ctx, PGP_MPI **msg_p, int full_bytes) { uint8 *secmsg; int res, @@ -136,7 +136,7 @@ create_secmsg(PGP_Context * ctx, PGP_MPI ** msg_p, int full_bytes) } static int -encrypt_and_write_elgamal(PGP_Context * ctx, PGP_PubKey * pk, PushFilter * pkt) +encrypt_and_write_elgamal(PGP_Context *ctx, PGP_PubKey *pk, PushFilter *pkt) { int res; PGP_MPI *m = NULL, @@ -167,7 +167,7 @@ err: } static int -encrypt_and_write_rsa(PGP_Context * ctx, PGP_PubKey * pk, PushFilter * pkt) +encrypt_and_write_rsa(PGP_Context *ctx, PGP_PubKey *pk, PushFilter *pkt) { int res; PGP_MPI *m = NULL, @@ -193,7 +193,7 @@ err: } int -pgp_write_pubenc_sesskey(PGP_Context * ctx, PushFilter * dst) +pgp_write_pubenc_sesskey(PGP_Context *ctx, PushFilter *dst) { int res; PGP_PubKey *pk = ctx->pub_key; diff --git a/contrib/pgcrypto/pgp-pubkey.c b/contrib/pgcrypto/pgp-pubkey.c index 3904561806e..62b6e1ab0e8 100644 --- a/contrib/pgcrypto/pgp-pubkey.c +++ b/contrib/pgcrypto/pgp-pubkey.c @@ -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-pubkey.c,v 1.4 2005/10/15 02:49:06 momjian Exp $ + * $PostgreSQL: pgsql/contrib/pgcrypto/pgp-pubkey.c,v 1.5 2009/06/11 14:48:52 momjian Exp $ */ #include "postgres.h" @@ -35,7 +35,7 @@ #include "pgp.h" int -pgp_key_alloc(PGP_PubKey ** pk_p) +pgp_key_alloc(PGP_PubKey **pk_p) { PGP_PubKey *pk; @@ -46,7 +46,7 @@ pgp_key_alloc(PGP_PubKey ** pk_p) } void -pgp_key_free(PGP_PubKey * pk) +pgp_key_free(PGP_PubKey *pk) { if (pk == NULL) return; @@ -82,7 +82,7 @@ pgp_key_free(PGP_PubKey * pk) } static int -calc_key_id(PGP_PubKey * pk) +calc_key_id(PGP_PubKey *pk) { int res; PX_MD *md; @@ -156,7 +156,7 @@ calc_key_id(PGP_PubKey * pk) } int -_pgp_read_public_key(PullFilter * pkt, PGP_PubKey ** pk_p) +_pgp_read_public_key(PullFilter *pkt, PGP_PubKey **pk_p) { int res; PGP_PubKey *pk; @@ -251,7 +251,7 @@ out: #define HIDE_SHA1 254 static int -check_key_sha1(PullFilter * src, PGP_PubKey * pk) +check_key_sha1(PullFilter *src, PGP_PubKey *pk) { int res; uint8 got_sha1[20]; @@ -297,7 +297,7 @@ err: } static int -check_key_cksum(PullFilter * src, PGP_PubKey * pk) +check_key_cksum(PullFilter *src, PGP_PubKey *pk) { int res; unsigned got_cksum, @@ -335,7 +335,7 @@ check_key_cksum(PullFilter * src, PGP_PubKey * pk) } static int -process_secret_key(PullFilter * pkt, PGP_PubKey ** pk_p, +process_secret_key(PullFilter *pkt, PGP_PubKey **pk_p, const uint8 *key, int key_len) { int res; @@ -456,7 +456,7 @@ process_secret_key(PullFilter * pkt, PGP_PubKey ** pk_p, } static int -internal_read_key(PullFilter * src, PGP_PubKey ** pk_p, +internal_read_key(PullFilter *src, PGP_PubKey **pk_p, const uint8 *psw, int psw_len, int pubtype) { PullFilter *pkt = NULL; @@ -563,7 +563,7 @@ internal_read_key(PullFilter * src, PGP_PubKey ** pk_p, } int -pgp_set_pubkey(PGP_Context * ctx, MBuf * keypkt, +pgp_set_pubkey(PGP_Context *ctx, MBuf *keypkt, const uint8 *key, int key_len, int pubtype) { int res; diff --git a/contrib/pgcrypto/pgp-s2k.c b/contrib/pgcrypto/pgp-s2k.c index 84def87db60..326b1bbf317 100644 --- a/contrib/pgcrypto/pgp-s2k.c +++ b/contrib/pgcrypto/pgp-s2k.c @@ -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-s2k.c,v 1.4 2005/10/15 02:49:06 momjian Exp $ + * $PostgreSQL: pgsql/contrib/pgcrypto/pgp-s2k.c,v 1.5 2009/06/11 14:48:52 momjian Exp $ */ #include "postgres.h" @@ -36,7 +36,7 @@ #include "pgp.h" static int -calc_s2k_simple(PGP_S2K * s2k, PX_MD * md, const uint8 *key, +calc_s2k_simple(PGP_S2K *s2k, PX_MD *md, const uint8 *key, unsigned key_len) { unsigned md_bs, @@ -81,7 +81,7 @@ calc_s2k_simple(PGP_S2K * s2k, PX_MD * md, const uint8 *key, } static int -calc_s2k_salted(PGP_S2K * s2k, PX_MD * md, const uint8 *key, unsigned key_len) +calc_s2k_salted(PGP_S2K *s2k, PX_MD *md, const uint8 *key, unsigned key_len) { unsigned md_bs, md_rlen; @@ -126,7 +126,7 @@ calc_s2k_salted(PGP_S2K * s2k, PX_MD * md, const uint8 *key, unsigned key_len) } static int -calc_s2k_iter_salted(PGP_S2K * s2k, PX_MD * md, const uint8 *key, +calc_s2k_iter_salted(PGP_S2K *s2k, PX_MD *md, const uint8 *key, unsigned key_len) { unsigned md_bs, @@ -213,7 +213,7 @@ decide_count(unsigned rand_byte) } int -pgp_s2k_fill(PGP_S2K * s2k, int mode, int digest_algo) +pgp_s2k_fill(PGP_S2K *s2k, int mode, int digest_algo) { int res = 0; uint8 tmp; @@ -244,7 +244,7 @@ pgp_s2k_fill(PGP_S2K * s2k, int mode, int digest_algo) } int -pgp_s2k_read(PullFilter * src, PGP_S2K * s2k) +pgp_s2k_read(PullFilter *src, PGP_S2K *s2k) { int res = 0; @@ -270,7 +270,7 @@ pgp_s2k_read(PullFilter * src, PGP_S2K * s2k) } int -pgp_s2k_process(PGP_S2K * s2k, int cipher, const uint8 *key, int key_len) +pgp_s2k_process(PGP_S2K *s2k, int cipher, const uint8 *key, int key_len) { int res; PX_MD *md; diff --git a/contrib/pgcrypto/pgp.c b/contrib/pgcrypto/pgp.c index e9e732e4bee..ce6f199a9e9 100644 --- a/contrib/pgcrypto/pgp.c +++ b/contrib/pgcrypto/pgp.c @@ -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.c,v 1.3 2005/10/15 02:49:06 momjian Exp $ + * $PostgreSQL: pgsql/contrib/pgcrypto/pgp.c,v 1.4 2009/06/11 14:48:52 momjian Exp $ */ #include "postgres.h" @@ -165,7 +165,7 @@ pgp_get_cipher_block_size(int code) } int -pgp_load_cipher(int code, PX_Cipher ** res) +pgp_load_cipher(int code, PX_Cipher **res) { int err; const struct cipher_info *i = get_cipher_info(code); @@ -181,7 +181,7 @@ pgp_load_cipher(int code, PX_Cipher ** res) } int -pgp_load_digest(int code, PX_MD ** res) +pgp_load_digest(int code, PX_MD **res) { int err; const char *name = pgp_get_digest_name(code); @@ -197,7 +197,7 @@ pgp_load_digest(int code, PX_MD ** res) } int -pgp_init(PGP_Context ** ctx_p) +pgp_init(PGP_Context **ctx_p) { PGP_Context *ctx; @@ -221,7 +221,7 @@ pgp_init(PGP_Context ** ctx_p) } int -pgp_free(PGP_Context * ctx) +pgp_free(PGP_Context *ctx) { if (ctx->pub_key) pgp_key_free(ctx->pub_key); @@ -231,28 +231,28 @@ pgp_free(PGP_Context * ctx) } int -pgp_disable_mdc(PGP_Context * ctx, int disable) +pgp_disable_mdc(PGP_Context *ctx, int disable) { ctx->disable_mdc = disable ? 1 : 0; return 0; } int -pgp_set_sess_key(PGP_Context * ctx, int use) +pgp_set_sess_key(PGP_Context *ctx, int use) { ctx->use_sess_key = use ? 1 : 0; return 0; } int -pgp_set_convert_crlf(PGP_Context * ctx, int doit) +pgp_set_convert_crlf(PGP_Context *ctx, int doit) { ctx->convert_crlf = doit ? 1 : 0; return 0; } int -pgp_set_s2k_mode(PGP_Context * ctx, int mode) +pgp_set_s2k_mode(PGP_Context *ctx, int mode) { int err = PXE_OK; @@ -271,7 +271,7 @@ pgp_set_s2k_mode(PGP_Context * ctx, int mode) } int -pgp_set_compress_algo(PGP_Context * ctx, int algo) +pgp_set_compress_algo(PGP_Context *ctx, int algo) { switch (algo) { @@ -286,7 +286,7 @@ pgp_set_compress_algo(PGP_Context * ctx, int algo) } int -pgp_set_compress_level(PGP_Context * ctx, int level) +pgp_set_compress_level(PGP_Context *ctx, int level) { if (level >= 0 && level <= 9) { @@ -297,14 +297,14 @@ pgp_set_compress_level(PGP_Context * ctx, int level) } int -pgp_set_text_mode(PGP_Context * ctx, int mode) +pgp_set_text_mode(PGP_Context *ctx, int mode) { ctx->text_mode = mode; return 0; } int -pgp_set_cipher_algo(PGP_Context * ctx, const char *name) +pgp_set_cipher_algo(PGP_Context *ctx, const char *name) { int code = pgp_get_cipher_code(name); @@ -315,7 +315,7 @@ pgp_set_cipher_algo(PGP_Context * ctx, const char *name) } int -pgp_set_s2k_cipher_algo(PGP_Context * ctx, const char *name) +pgp_set_s2k_cipher_algo(PGP_Context *ctx, const char *name) { int code = pgp_get_cipher_code(name); @@ -326,7 +326,7 @@ pgp_set_s2k_cipher_algo(PGP_Context * ctx, const char *name) } int -pgp_set_s2k_digest_algo(PGP_Context * ctx, const char *name) +pgp_set_s2k_digest_algo(PGP_Context *ctx, const char *name) { int code = pgp_get_digest_code(name); @@ -337,20 +337,20 @@ pgp_set_s2k_digest_algo(PGP_Context * ctx, const char *name) } int -pgp_get_unicode_mode(PGP_Context * ctx) +pgp_get_unicode_mode(PGP_Context *ctx) { return ctx->unicode_mode; } int -pgp_set_unicode_mode(PGP_Context * ctx, int mode) +pgp_set_unicode_mode(PGP_Context *ctx, int mode) { ctx->unicode_mode = mode ? 1 : 0; return 0; } int -pgp_set_symkey(PGP_Context * ctx, const uint8 *key, int len) +pgp_set_symkey(PGP_Context *ctx, const uint8 *key, int len) { if (key == NULL || len < 1) return PXE_ARGUMENT_ERROR; diff --git a/contrib/pgcrypto/pgp.h b/contrib/pgcrypto/pgp.h index 223a8a073f8..7860d830c41 100644 --- a/contrib/pgcrypto/pgp.h +++ b/contrib/pgcrypto/pgp.h @@ -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.h,v 1.5 2009/03/25 15:03:13 tgl Exp $ + * $PostgreSQL: pgsql/contrib/pgcrypto/pgp.h,v 1.6 2009/06/11 14:48:52 momjian Exp $ */ enum PGP_S2K_TYPE @@ -224,91 +224,91 @@ struct PGP_PubKey int can_encrypt; }; -int pgp_init(PGP_Context ** ctx); -int pgp_encrypt(PGP_Context * ctx, MBuf * src, MBuf * dst); -int pgp_decrypt(PGP_Context * ctx, MBuf * src, MBuf * dst); -int pgp_free(PGP_Context * ctx); +int pgp_init(PGP_Context **ctx); +int pgp_encrypt(PGP_Context *ctx, MBuf *src, MBuf *dst); +int pgp_decrypt(PGP_Context *ctx, MBuf *src, MBuf *dst); +int pgp_free(PGP_Context *ctx); int pgp_get_digest_code(const char *name); int pgp_get_cipher_code(const char *name); const char *pgp_get_digest_name(int code); const char *pgp_get_cipher_name(int code); -int pgp_set_cipher_algo(PGP_Context * ctx, const char *name); -int pgp_set_s2k_mode(PGP_Context * ctx, int type); -int pgp_set_s2k_cipher_algo(PGP_Context * ctx, const char *name); -int pgp_set_s2k_digest_algo(PGP_Context * ctx, const char *name); -int pgp_set_convert_crlf(PGP_Context * ctx, int doit); -int pgp_disable_mdc(PGP_Context * ctx, int disable); -int pgp_set_sess_key(PGP_Context * ctx, int use); -int pgp_set_compress_algo(PGP_Context * ctx, int algo); -int pgp_set_compress_level(PGP_Context * ctx, int level); -int pgp_set_text_mode(PGP_Context * ctx, int mode); -int pgp_set_unicode_mode(PGP_Context * ctx, int mode); -int pgp_get_unicode_mode(PGP_Context * ctx); - -int pgp_set_symkey(PGP_Context * ctx, const uint8 *key, int klen); -int pgp_set_pubkey(PGP_Context * ctx, MBuf * keypkt, +int pgp_set_cipher_algo(PGP_Context *ctx, const char *name); +int pgp_set_s2k_mode(PGP_Context *ctx, int type); +int pgp_set_s2k_cipher_algo(PGP_Context *ctx, const char *name); +int pgp_set_s2k_digest_algo(PGP_Context *ctx, const char *name); +int pgp_set_convert_crlf(PGP_Context *ctx, int doit); +int pgp_disable_mdc(PGP_Context *ctx, int disable); +int pgp_set_sess_key(PGP_Context *ctx, int use); +int pgp_set_compress_algo(PGP_Context *ctx, int algo); +int pgp_set_compress_level(PGP_Context *ctx, int level); +int pgp_set_text_mode(PGP_Context *ctx, int mode); +int pgp_set_unicode_mode(PGP_Context *ctx, int mode); +int pgp_get_unicode_mode(PGP_Context *ctx); + +int pgp_set_symkey(PGP_Context *ctx, const uint8 *key, int klen); +int pgp_set_pubkey(PGP_Context *ctx, MBuf *keypkt, const uint8 *key, int klen, int pubtype); -int pgp_get_keyid(MBuf * pgp_data, char *dst); +int pgp_get_keyid(MBuf *pgp_data, char *dst); /* internal functions */ -int pgp_load_digest(int c, PX_MD ** res); -int pgp_load_cipher(int c, PX_Cipher ** res); +int pgp_load_digest(int c, PX_MD **res); +int pgp_load_cipher(int c, PX_Cipher **res); int pgp_get_cipher_key_size(int c); int pgp_get_cipher_block_size(int c); -int pgp_s2k_fill(PGP_S2K * s2k, int mode, int digest_algo); -int pgp_s2k_read(PullFilter * src, PGP_S2K * s2k); -int pgp_s2k_process(PGP_S2K * s2k, int cipher, const uint8 *key, int klen); +int pgp_s2k_fill(PGP_S2K *s2k, int mode, int digest_algo); +int pgp_s2k_read(PullFilter *src, PGP_S2K *s2k); +int pgp_s2k_process(PGP_S2K *s2k, int cipher, const uint8 *key, int klen); typedef struct PGP_CFB PGP_CFB; int -pgp_cfb_create(PGP_CFB ** ctx_p, int algo, +pgp_cfb_create(PGP_CFB **ctx_p, int algo, const uint8 *key, int key_len, int recync, uint8 *iv); -void pgp_cfb_free(PGP_CFB * ctx); -int pgp_cfb_encrypt(PGP_CFB * ctx, const uint8 *data, int len, uint8 *dst); -int pgp_cfb_decrypt(PGP_CFB * ctx, const uint8 *data, int len, uint8 *dst); +void pgp_cfb_free(PGP_CFB *ctx); +int pgp_cfb_encrypt(PGP_CFB *ctx, const uint8 *data, int len, uint8 *dst); +int pgp_cfb_decrypt(PGP_CFB *ctx, const uint8 *data, int len, uint8 *dst); int pgp_armor_encode(const uint8 *src, unsigned len, uint8 *dst); int pgp_armor_decode(const uint8 *src, unsigned len, uint8 *dst); unsigned pgp_armor_enc_len(unsigned len); unsigned pgp_armor_dec_len(unsigned len); -int pgp_compress_filter(PushFilter ** res, PGP_Context * ctx, PushFilter * dst); -int pgp_decompress_filter(PullFilter ** res, PGP_Context * ctx, PullFilter * src); +int pgp_compress_filter(PushFilter **res, PGP_Context *ctx, PushFilter *dst); +int pgp_decompress_filter(PullFilter **res, PGP_Context *ctx, PullFilter *src); -int pgp_key_alloc(PGP_PubKey ** pk_p); -void pgp_key_free(PGP_PubKey * pk); -int _pgp_read_public_key(PullFilter * pkt, PGP_PubKey ** pk_p); +int pgp_key_alloc(PGP_PubKey **pk_p); +void pgp_key_free(PGP_PubKey *pk); +int _pgp_read_public_key(PullFilter *pkt, PGP_PubKey **pk_p); -int pgp_parse_pubenc_sesskey(PGP_Context * ctx, PullFilter * pkt); -int pgp_create_pkt_reader(PullFilter ** pf_p, PullFilter * src, int len, - int pkttype, PGP_Context * ctx); -int pgp_parse_pkt_hdr(PullFilter * src, uint8 *tag, int *len_p, +int pgp_parse_pubenc_sesskey(PGP_Context *ctx, PullFilter *pkt); +int pgp_create_pkt_reader(PullFilter **pf_p, PullFilter *src, int len, + int pkttype, PGP_Context *ctx); +int pgp_parse_pkt_hdr(PullFilter *src, uint8 *tag, int *len_p, int allow_ctx); -int pgp_skip_packet(PullFilter * pkt); -int pgp_expect_packet_end(PullFilter * pkt); - -int pgp_write_pubenc_sesskey(PGP_Context * ctx, PushFilter * dst); -int pgp_create_pkt_writer(PushFilter * dst, int tag, PushFilter ** res_p); - -int pgp_mpi_alloc(int bits, PGP_MPI ** mpi); -int pgp_mpi_create(uint8 *data, int bits, PGP_MPI ** mpi); -int pgp_mpi_free(PGP_MPI * mpi); -int pgp_mpi_read(PullFilter * src, PGP_MPI ** mpi); -int pgp_mpi_write(PushFilter * dst, PGP_MPI * n); -int pgp_mpi_hash(PX_MD * md, PGP_MPI * n); -unsigned pgp_mpi_cksum(unsigned cksum, PGP_MPI * n); - -int pgp_elgamal_encrypt(PGP_PubKey * pk, PGP_MPI * m, - PGP_MPI ** c1, PGP_MPI ** c2); -int pgp_elgamal_decrypt(PGP_PubKey * pk, PGP_MPI * c1, PGP_MPI * c2, - PGP_MPI ** m); -int pgp_rsa_encrypt(PGP_PubKey * pk, PGP_MPI * m, PGP_MPI ** c); -int pgp_rsa_decrypt(PGP_PubKey * pk, PGP_MPI * c, PGP_MPI ** m); +int pgp_skip_packet(PullFilter *pkt); +int pgp_expect_packet_end(PullFilter *pkt); + +int pgp_write_pubenc_sesskey(PGP_Context *ctx, PushFilter *dst); +int pgp_create_pkt_writer(PushFilter *dst, int tag, PushFilter **res_p); + +int pgp_mpi_alloc(int bits, PGP_MPI **mpi); +int pgp_mpi_create(uint8 *data, int bits, PGP_MPI **mpi); +int pgp_mpi_free(PGP_MPI *mpi); +int pgp_mpi_read(PullFilter *src, PGP_MPI **mpi); +int pgp_mpi_write(PushFilter *dst, PGP_MPI *n); +int pgp_mpi_hash(PX_MD *md, PGP_MPI *n); +unsigned pgp_mpi_cksum(unsigned cksum, PGP_MPI *n); + +int pgp_elgamal_encrypt(PGP_PubKey *pk, PGP_MPI *m, + PGP_MPI **c1, PGP_MPI **c2); +int pgp_elgamal_decrypt(PGP_PubKey *pk, PGP_MPI *c1, PGP_MPI *c2, + PGP_MPI **m); +int pgp_rsa_encrypt(PGP_PubKey *pk, PGP_MPI *m, PGP_MPI **c); +int pgp_rsa_decrypt(PGP_PubKey *pk, PGP_MPI *c, PGP_MPI **m); extern struct PullFilterOps pgp_decrypt_filter; diff --git a/contrib/pgcrypto/px-hmac.c b/contrib/pgcrypto/px-hmac.c index fa4233903c3..3b2016190e7 100644 --- a/contrib/pgcrypto/px-hmac.c +++ b/contrib/pgcrypto/px-hmac.c @@ -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-hmac.c,v 1.7 2005/07/11 15:07:59 tgl Exp $ + * $PostgreSQL: pgsql/contrib/pgcrypto/px-hmac.c,v 1.8 2009/06/11 14:48:52 momjian Exp $ */ #include "postgres.h" @@ -37,19 +37,19 @@ #define HMAC_OPAD 0x5C static unsigned -hmac_result_size(PX_HMAC * h) +hmac_result_size(PX_HMAC *h) { return px_md_result_size(h->md); } static unsigned -hmac_block_size(PX_HMAC * h) +hmac_block_size(PX_HMAC *h) { return px_md_block_size(h->md); } static void -hmac_init(PX_HMAC * h, const uint8 *key, unsigned klen) +hmac_init(PX_HMAC *h, const uint8 *key, unsigned klen) { unsigned bs, hlen, @@ -84,7 +84,7 @@ hmac_init(PX_HMAC * h, const uint8 *key, unsigned klen) } static void -hmac_reset(PX_HMAC * h) +hmac_reset(PX_HMAC *h) { PX_MD *md = h->md; unsigned bs = px_md_block_size(md); @@ -94,13 +94,13 @@ hmac_reset(PX_HMAC * h) } static void -hmac_update(PX_HMAC * h, const uint8 *data, unsigned dlen) +hmac_update(PX_HMAC *h, const uint8 *data, unsigned dlen) { px_md_update(h->md, data, dlen); } static void -hmac_finish(PX_HMAC * h, uint8 *dst) +hmac_finish(PX_HMAC *h, uint8 *dst) { PX_MD *md = h->md; unsigned bs, @@ -124,7 +124,7 @@ hmac_finish(PX_HMAC * h, uint8 *dst) } static void -hmac_free(PX_HMAC * h) +hmac_free(PX_HMAC *h) { unsigned bs; @@ -142,7 +142,7 @@ hmac_free(PX_HMAC * h) /* PUBLIC FUNCTIONS */ int -px_find_hmac(const char *name, PX_HMAC ** res) +px_find_hmac(const char *name, PX_HMAC **res) { int err; PX_MD *md; diff --git a/contrib/pgcrypto/px.c b/contrib/pgcrypto/px.c index d1b22d7ec7f..f2db06a898b 100644 --- a/contrib/pgcrypto/px.c +++ b/contrib/pgcrypto/px.c @@ -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.17 2007/11/15 21:14:31 momjian Exp $ + * $PostgreSQL: pgsql/contrib/pgcrypto/px.c,v 1.18 2009/06/11 14:48:52 momjian Exp $ */ #include "postgres.h" @@ -106,7 +106,7 @@ px_strerror(int err) const char * -px_resolve_alias(const PX_Alias * list, const char *name) +px_resolve_alias(const PX_Alias *list, const char *name) { while (list->name) { @@ -146,19 +146,19 @@ px_debug(const char *fmt,...) */ static unsigned -combo_encrypt_len(PX_Combo * cx, unsigned dlen) +combo_encrypt_len(PX_Combo *cx, unsigned dlen) { return dlen + 512; } static unsigned -combo_decrypt_len(PX_Combo * cx, unsigned dlen) +combo_decrypt_len(PX_Combo *cx, unsigned dlen) { return dlen; } static int -combo_init(PX_Combo * cx, const uint8 *key, unsigned klen, +combo_init(PX_Combo *cx, const uint8 *key, unsigned klen, const uint8 *iv, unsigned ivlen) { int err; @@ -199,7 +199,7 @@ combo_init(PX_Combo * cx, const uint8 *key, unsigned klen, } static int -combo_encrypt(PX_Combo * cx, const uint8 *data, unsigned dlen, +combo_encrypt(PX_Combo *cx, const uint8 *data, unsigned dlen, uint8 *res, unsigned *rlen) { int err = 0; @@ -270,7 +270,7 @@ out: } static int -combo_decrypt(PX_Combo * cx, const uint8 *data, unsigned dlen, +combo_decrypt(PX_Combo *cx, const uint8 *data, unsigned dlen, uint8 *res, unsigned *rlen) { unsigned bs, @@ -327,7 +327,7 @@ block_error: } static void -combo_free(PX_Combo * cx) +combo_free(PX_Combo *cx) { if (cx->cipher) px_cipher_free(cx->cipher); @@ -380,7 +380,7 @@ parse_cipher_name(char *full, char **cipher, char **pad) /* provider */ int -px_find_combo(const char *name, PX_Combo ** res) +px_find_combo(const char *name, PX_Combo **res) { int err; char *buf, diff --git a/contrib/pgcrypto/px.h b/contrib/pgcrypto/px.h index 257d6015bc3..c916e9361c9 100644 --- a/contrib/pgcrypto/px.h +++ b/contrib/pgcrypto/px.h @@ -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.h,v 1.18 2007/08/23 16:15:51 tgl Exp $ + * $PostgreSQL: pgsql/contrib/pgcrypto/px.h,v 1.19 2009/06/11 14:48:52 momjian Exp $ */ #ifndef __PX_H @@ -116,12 +116,12 @@ typedef struct px_combo PX_Combo; struct px_digest { - unsigned (*result_size) (PX_MD * h); - unsigned (*block_size) (PX_MD * h); - void (*reset) (PX_MD * h); - void (*update) (PX_MD * h, const uint8 *data, unsigned dlen); - void (*finish) (PX_MD * h, uint8 *dst); - void (*free) (PX_MD * h); + unsigned (*result_size) (PX_MD *h); + unsigned (*block_size) (PX_MD *h); + void (*reset) (PX_MD *h); + void (*update) (PX_MD *h, const uint8 *data, unsigned dlen); + void (*finish) (PX_MD *h, uint8 *dst); + void (*free) (PX_MD *h); /* private */ union { @@ -138,13 +138,13 @@ struct px_alias struct px_hmac { - unsigned (*result_size) (PX_HMAC * h); - unsigned (*block_size) (PX_HMAC * h); - void (*reset) (PX_HMAC * h); - void (*update) (PX_HMAC * h, const uint8 *data, unsigned dlen); - void (*finish) (PX_HMAC * h, uint8 *dst); - void (*free) (PX_HMAC * h); - void (*init) (PX_HMAC * h, const uint8 *key, unsigned klen); + unsigned (*result_size) (PX_HMAC *h); + unsigned (*block_size) (PX_HMAC *h); + void (*reset) (PX_HMAC *h); + void (*update) (PX_HMAC *h, const uint8 *data, unsigned dlen); + void (*finish) (PX_HMAC *h, uint8 *dst); + void (*free) (PX_HMAC *h); + void (*init) (PX_HMAC *h, const uint8 *key, unsigned klen); PX_MD *md; /* private */ @@ -157,14 +157,14 @@ struct px_hmac struct px_cipher { - unsigned (*block_size) (PX_Cipher * c); - unsigned (*key_size) (PX_Cipher * c); /* max key len */ - unsigned (*iv_size) (PX_Cipher * c); - - int (*init) (PX_Cipher * c, const uint8 *key, unsigned klen, const uint8 *iv); - int (*encrypt) (PX_Cipher * c, const uint8 *data, unsigned dlen, uint8 *res); - int (*decrypt) (PX_Cipher * c, const uint8 *data, unsigned dlen, uint8 *res); - void (*free) (PX_Cipher * c); + unsigned (*block_size) (PX_Cipher *c); + unsigned (*key_size) (PX_Cipher *c); /* max key len */ + unsigned (*iv_size) (PX_Cipher *c); + + int (*init) (PX_Cipher *c, const uint8 *key, unsigned klen, const uint8 *iv); + int (*encrypt) (PX_Cipher *c, const uint8 *data, unsigned dlen, uint8 *res); + int (*decrypt) (PX_Cipher *c, const uint8 *data, unsigned dlen, uint8 *res); + void (*free) (PX_Cipher *c); /* private */ void *ptr; int pstat; /* mcrypt uses it */ @@ -172,24 +172,24 @@ struct px_cipher struct px_combo { - int (*init) (PX_Combo * cx, const uint8 *key, unsigned klen, + int (*init) (PX_Combo *cx, const uint8 *key, unsigned klen, const uint8 *iv, unsigned ivlen); - int (*encrypt) (PX_Combo * cx, const uint8 *data, unsigned dlen, + int (*encrypt) (PX_Combo *cx, const uint8 *data, unsigned dlen, uint8 *res, unsigned *rlen); - int (*decrypt) (PX_Combo * cx, const uint8 *data, unsigned dlen, + int (*decrypt) (PX_Combo *cx, const uint8 *data, unsigned dlen, uint8 *res, unsigned *rlen); - unsigned (*encrypt_len) (PX_Combo * cx, unsigned dlen); - unsigned (*decrypt_len) (PX_Combo * cx, unsigned dlen); - void (*free) (PX_Combo * cx); + unsigned (*encrypt_len) (PX_Combo *cx, unsigned dlen); + unsigned (*decrypt_len) (PX_Combo *cx, unsigned dlen); + void (*free) (PX_Combo *cx); PX_Cipher *cipher; unsigned padding; }; -int px_find_digest(const char *name, PX_MD ** res); -int px_find_hmac(const char *name, PX_HMAC ** res); -int px_find_cipher(const char *name, PX_Cipher ** res); -int px_find_combo(const char *name, PX_Combo ** res); +int px_find_digest(const char *name, PX_MD **res); +int px_find_hmac(const char *name, PX_HMAC **res); +int px_find_cipher(const char *name, PX_Cipher **res); +int px_find_combo(const char *name, PX_Combo **res); int px_get_random_bytes(uint8 *dst, unsigned count); int px_get_pseudo_random_bytes(uint8 *dst, unsigned count); @@ -199,7 +199,7 @@ unsigned px_acquire_system_randomness(uint8 *dst); const char *px_strerror(int err); -const char *px_resolve_alias(const PX_Alias * aliases, const char *name); +const char *px_resolve_alias(const PX_Alias *aliases, const char *name); void px_set_debug_handler(void (*handler) (const char *)); diff --git a/contrib/pgcrypto/rijndael.c b/contrib/pgcrypto/rijndael.c index 97f97bd543c..cf9eca91dcb 100644 --- a/contrib/pgcrypto/rijndael.c +++ b/contrib/pgcrypto/rijndael.c @@ -1,6 +1,6 @@ /* $OpenBSD: rijndael.c,v 1.6 2000/12/09 18:51:34 markus Exp $ */ -/* $PostgreSQL: pgsql/contrib/pgcrypto/rijndael.c,v 1.13 2007/04/06 05:36:50 tgl Exp $ */ +/* $PostgreSQL: pgsql/contrib/pgcrypto/rijndael.c,v 1.14 2009/06/11 14:48:52 momjian Exp $ */ /* This is an independent implementation of the encryption algorithm: */ /* */ @@ -302,7 +302,7 @@ do { t = ls_box(rotr(t, 8)) ^ rco_tab[i]; \ } while (0) rijndael_ctx * -rijndael_set_key(rijndael_ctx * ctx, const u4byte * in_key, const u4byte key_len, +rijndael_set_key(rijndael_ctx *ctx, const u4byte *in_key, const u4byte key_len, int encrypt) { u4byte i, @@ -384,7 +384,7 @@ do { \ } while (0) void -rijndael_encrypt(rijndael_ctx * ctx, const u4byte * in_blk, u4byte * out_blk) +rijndael_encrypt(rijndael_ctx *ctx, const u4byte *in_blk, u4byte *out_blk) { u4byte k_len = ctx->k_len; u4byte *e_key = ctx->e_key; @@ -448,7 +448,7 @@ do { \ } while (0) void -rijndael_decrypt(rijndael_ctx * ctx, const u4byte * in_blk, u4byte * out_blk) +rijndael_decrypt(rijndael_ctx *ctx, const u4byte *in_blk, u4byte *out_blk) { u4byte b0[4], b1[4], @@ -501,7 +501,7 @@ rijndael_decrypt(rijndael_ctx * ctx, const u4byte * in_blk, u4byte * out_blk) */ void -aes_set_key(rijndael_ctx * ctx, const uint8 *key, unsigned keybits, int enc) +aes_set_key(rijndael_ctx *ctx, const uint8 *key, unsigned keybits, int enc) { uint32 *k; @@ -510,7 +510,7 @@ aes_set_key(rijndael_ctx * ctx, const uint8 *key, unsigned keybits, int enc) } void -aes_ecb_encrypt(rijndael_ctx * ctx, uint8 *data, unsigned len) +aes_ecb_encrypt(rijndael_ctx *ctx, uint8 *data, unsigned len) { unsigned bs = 16; uint32 *d; @@ -526,7 +526,7 @@ aes_ecb_encrypt(rijndael_ctx * ctx, uint8 *data, unsigned len) } void -aes_ecb_decrypt(rijndael_ctx * ctx, uint8 *data, unsigned len) +aes_ecb_decrypt(rijndael_ctx *ctx, uint8 *data, unsigned len) { unsigned bs = 16; uint32 *d; @@ -542,7 +542,7 @@ aes_ecb_decrypt(rijndael_ctx * ctx, uint8 *data, unsigned len) } void -aes_cbc_encrypt(rijndael_ctx * ctx, uint8 *iva, uint8 *data, unsigned len) +aes_cbc_encrypt(rijndael_ctx *ctx, uint8 *iva, uint8 *data, unsigned len) { uint32 *iv = (uint32 *) iva; uint32 *d = (uint32 *) data; @@ -564,7 +564,7 @@ aes_cbc_encrypt(rijndael_ctx * ctx, uint8 *iva, uint8 *data, unsigned len) } void -aes_cbc_decrypt(rijndael_ctx * ctx, uint8 *iva, uint8 *data, unsigned len) +aes_cbc_decrypt(rijndael_ctx *ctx, uint8 *iva, uint8 *data, unsigned len) { uint32 *d = (uint32 *) data; unsigned bs = 16; diff --git a/contrib/pgcrypto/rijndael.h b/contrib/pgcrypto/rijndael.h index e5e862323f8..e4c42291708 100644 --- a/contrib/pgcrypto/rijndael.h +++ b/contrib/pgcrypto/rijndael.h @@ -1,5 +1,5 @@ /* - * $PostgreSQL: pgsql/contrib/pgcrypto/rijndael.h,v 1.6 2008/05/17 01:28:21 adunstan Exp $ + * $PostgreSQL: pgsql/contrib/pgcrypto/rijndael.h,v 1.7 2009/06/11 14:48:52 momjian Exp $ * * $OpenBSD: rijndael.h,v 1.3 2001/05/09 23:01:32 markus Exp $ */ @@ -36,7 +36,7 @@ typedef struct _rijndael_ctx int decrypt; u4byte e_key[64]; u4byte d_key[64]; -} rijndael_ctx; +} rijndael_ctx; /* 2. Standard interface for AES cryptographic routines */ @@ -51,10 +51,10 @@ void rijndael_decrypt(rijndael_ctx *, const u4byte *, u4byte *); /* conventional interface */ -void aes_set_key(rijndael_ctx * ctx, const uint8 *key, unsigned keybits, int enc); -void aes_ecb_encrypt(rijndael_ctx * ctx, uint8 *data, unsigned len); -void aes_ecb_decrypt(rijndael_ctx * ctx, uint8 *data, unsigned len); -void aes_cbc_encrypt(rijndael_ctx * ctx, uint8 *iva, uint8 *data, unsigned len); -void aes_cbc_decrypt(rijndael_ctx * ctx, uint8 *iva, uint8 *data, unsigned len); +void aes_set_key(rijndael_ctx *ctx, const uint8 *key, unsigned keybits, int enc); +void aes_ecb_encrypt(rijndael_ctx *ctx, uint8 *data, unsigned len); +void aes_ecb_decrypt(rijndael_ctx *ctx, uint8 *data, unsigned len); +void aes_cbc_encrypt(rijndael_ctx *ctx, uint8 *iva, uint8 *data, unsigned len); +void aes_cbc_decrypt(rijndael_ctx *ctx, uint8 *iva, uint8 *data, unsigned len); #endif /* _RIJNDAEL_H_ */ diff --git a/contrib/pgcrypto/sha2.c b/contrib/pgcrypto/sha2.c index c2e9da965b9..9cd58a08ab4 100644 --- a/contrib/pgcrypto/sha2.c +++ b/contrib/pgcrypto/sha2.c @@ -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.10 2007/11/15 21:14:31 momjian Exp $ + * $PostgreSQL: pgsql/contrib/pgcrypto/sha2.c,v 1.11 2009/06/11 14:48:52 momjian Exp $ */ #include "postgres.h" @@ -250,7 +250,7 @@ static const uint64 sha512_initial_hash_value[8] = { /*** SHA-256: *********************************************************/ void -SHA256_Init(SHA256_CTX * context) +SHA256_Init(SHA256_CTX *context) { if (context == NULL) return; @@ -286,7 +286,7 @@ SHA256_Init(SHA256_CTX * context) } while(0) static void -SHA256_Transform(SHA256_CTX * context, const uint8 *data) +SHA256_Transform(SHA256_CTX *context, const uint8 *data) { uint32 a, b, @@ -357,7 +357,7 @@ SHA256_Transform(SHA256_CTX * context, const uint8 *data) #else /* SHA2_UNROLL_TRANSFORM */ static void -SHA256_Transform(SHA256_CTX * context, const uint8 *data) +SHA256_Transform(SHA256_CTX *context, const uint8 *data) { uint32 a, b, @@ -447,7 +447,7 @@ SHA256_Transform(SHA256_CTX * context, const uint8 *data) #endif /* SHA2_UNROLL_TRANSFORM */ void -SHA256_Update(SHA256_CTX * context, const uint8 *data, size_t len) +SHA256_Update(SHA256_CTX *context, const uint8 *data, size_t len) { size_t freespace, usedspace; @@ -500,7 +500,7 @@ SHA256_Update(SHA256_CTX * context, const uint8 *data, size_t len) } static void -SHA256_Last(SHA256_CTX * context) +SHA256_Last(SHA256_CTX *context) { unsigned int usedspace; @@ -548,7 +548,7 @@ SHA256_Last(SHA256_CTX * context) } void -SHA256_Final(uint8 digest[], SHA256_CTX * context) +SHA256_Final(uint8 digest[], SHA256_CTX *context) { /* If no digest buffer is passed, we don't bother doing this: */ if (digest != NULL) @@ -576,7 +576,7 @@ SHA256_Final(uint8 digest[], SHA256_CTX * context) /*** SHA-512: *********************************************************/ void -SHA512_Init(SHA512_CTX * context) +SHA512_Init(SHA512_CTX *context) { if (context == NULL) return; @@ -615,7 +615,7 @@ SHA512_Init(SHA512_CTX * context) } while(0) static void -SHA512_Transform(SHA512_CTX * context, const uint8 *data) +SHA512_Transform(SHA512_CTX *context, const uint8 *data) { uint64 a, b, @@ -683,7 +683,7 @@ SHA512_Transform(SHA512_CTX * context, const uint8 *data) #else /* SHA2_UNROLL_TRANSFORM */ static void -SHA512_Transform(SHA512_CTX * context, const uint8 *data) +SHA512_Transform(SHA512_CTX *context, const uint8 *data) { uint64 a, b, @@ -773,7 +773,7 @@ SHA512_Transform(SHA512_CTX * context, const uint8 *data) #endif /* SHA2_UNROLL_TRANSFORM */ void -SHA512_Update(SHA512_CTX * context, const uint8 *data, size_t len) +SHA512_Update(SHA512_CTX *context, const uint8 *data, size_t len) { size_t freespace, usedspace; @@ -826,7 +826,7 @@ SHA512_Update(SHA512_CTX * context, const uint8 *data, size_t len) } static void -SHA512_Last(SHA512_CTX * context) +SHA512_Last(SHA512_CTX *context) { unsigned int usedspace; @@ -876,7 +876,7 @@ SHA512_Last(SHA512_CTX * context) } void -SHA512_Final(uint8 digest[], SHA512_CTX * context) +SHA512_Final(uint8 digest[], SHA512_CTX *context) { /* If no digest buffer is passed, we don't bother doing this: */ if (digest != NULL) @@ -905,7 +905,7 @@ SHA512_Final(uint8 digest[], SHA512_CTX * context) /*** SHA-384: *********************************************************/ void -SHA384_Init(SHA384_CTX * context) +SHA384_Init(SHA384_CTX *context) { if (context == NULL) return; @@ -915,13 +915,13 @@ SHA384_Init(SHA384_CTX * context) } void -SHA384_Update(SHA384_CTX * context, const uint8 *data, size_t len) +SHA384_Update(SHA384_CTX *context, const uint8 *data, size_t len) { SHA512_Update((SHA512_CTX *) context, data, len); } void -SHA384_Final(uint8 digest[], SHA384_CTX * context) +SHA384_Final(uint8 digest[], SHA384_CTX *context) { /* If no digest buffer is passed, we don't bother doing this: */ if (digest != NULL) @@ -949,7 +949,7 @@ SHA384_Final(uint8 digest[], SHA384_CTX * context) /*** SHA-224: *********************************************************/ void -SHA224_Init(SHA224_CTX * context) +SHA224_Init(SHA224_CTX *context) { if (context == NULL) return; @@ -959,13 +959,13 @@ SHA224_Init(SHA224_CTX * context) } void -SHA224_Update(SHA224_CTX * context, const uint8 *data, size_t len) +SHA224_Update(SHA224_CTX *context, const uint8 *data, size_t len) { SHA256_Update((SHA256_CTX *) context, data, len); } void -SHA224_Final(uint8 digest[], SHA224_CTX * context) +SHA224_Final(uint8 digest[], SHA224_CTX *context) { /* If no digest buffer is passed, we don't bother doing this: */ if (digest != NULL) diff --git a/contrib/pgcrypto/sha2.h b/contrib/pgcrypto/sha2.h index f6fde39c5b4..8d593c60e5f 100644 --- a/contrib/pgcrypto/sha2.h +++ b/contrib/pgcrypto/sha2.h @@ -1,4 +1,4 @@ -/* $PostgreSQL: pgsql/contrib/pgcrypto/sha2.h,v 1.4 2006/07/13 04:15:25 neilc Exp $ */ +/* $PostgreSQL: pgsql/contrib/pgcrypto/sha2.h,v 1.5 2009/06/11 14:48:52 momjian Exp $ */ /* $OpenBSD: sha2.h,v 1.2 2004/04/28 23:11:57 millert Exp $ */ /* @@ -70,13 +70,13 @@ typedef struct _SHA256_CTX uint32 state[8]; uint64 bitcount; uint8 buffer[SHA256_BLOCK_LENGTH]; -} SHA256_CTX; +} SHA256_CTX; typedef struct _SHA512_CTX { uint64 state[8]; uint64 bitcount[2]; uint8 buffer[SHA512_BLOCK_LENGTH]; -} SHA512_CTX; +} SHA512_CTX; typedef SHA256_CTX SHA224_CTX; typedef SHA512_CTX SHA384_CTX; |
