summaryrefslogtreecommitdiff
path: root/contrib/pgcrypto
diff options
context:
space:
mode:
authorTom Lane2017-06-21 19:18:54 +0000
committerTom Lane2017-06-21 19:19:25 +0000
commitc7b8998ebbf310a156aa38022555a24d98fdbfb4 (patch)
treee85979fb1213a731b7b557f8a830df541f26b135 /contrib/pgcrypto
parentf669c09989bda894d6ba01634ccb229f0687c08a (diff)
Phase 2 of pgindent updates.
Change pg_bsd_indent to follow upstream rules for placement of comments to the right of code, and remove pgindent hack that caused comments following #endif to not obey the general rule. Commit e3860ffa4dd0dad0dd9eea4be9cc1412373a8c89 wasn't actually using the published version of pg_bsd_indent, but a hacked-up version that tried to minimize the amount of movement of comments to the right of code. The situation of interest is where such a comment has to be moved to the right of its default placement at column 33 because there's code there. BSD indent has always moved right in units of tab stops in such cases --- but in the previous incarnation, indent was working in 8-space tab stops, while now it knows we use 4-space tabs. So the net result is that in about half the cases, such comments are placed one tab stop left of before. This is better all around: it leaves more room on the line for comment text, and it means that in such cases the comment uniformly starts at the next 4-space tab stop after the code, rather than sometimes one and sometimes two tabs after. Also, ensure that comments following #endif are indented the same as comments following other preprocessor commands such as #else. That inconsistency turns out to have been self-inflicted damage from a poorly-thought-through post-indent "fixup" in pgindent. This patch is much less interesting than the first round of indent changes, but also bulkier, so I thought it best to separate the effects. Discussion: https://postgr.es/m/E1dAmxK-0006EE-1r@gemulon.postgresql.org Discussion: https://postgr.es/m/30527.1495162840@sss.pgh.pa.us
Diffstat (limited to 'contrib/pgcrypto')
-rw-r--r--contrib/pgcrypto/crypt-des.c2
-rw-r--r--contrib/pgcrypto/imath.c20
-rw-r--r--contrib/pgcrypto/imath.h28
-rw-r--r--contrib/pgcrypto/internal.c4
-rw-r--r--contrib/pgcrypto/mbuf.h2
-rw-r--r--contrib/pgcrypto/md5.h2
-rw-r--r--contrib/pgcrypto/pgp.h4
-rw-r--r--contrib/pgcrypto/px-crypt.h2
-rw-r--r--contrib/pgcrypto/px.h4
-rw-r--r--contrib/pgcrypto/rijndael.c4
-rw-r--r--contrib/pgcrypto/rijndael.h2
-rw-r--r--contrib/pgcrypto/sha1.h2
12 files changed, 38 insertions, 38 deletions
diff --git a/contrib/pgcrypto/crypt-des.c b/contrib/pgcrypto/crypt-des.c
index 44a5731dde..60bdbb0c91 100644
--- a/contrib/pgcrypto/crypt-des.c
+++ b/contrib/pgcrypto/crypt-des.c
@@ -734,7 +734,7 @@ px_crypt_des(const char *key, const char *setting)
p = output + strlen(output);
}
else
-#endif /* !DISABLE_XDES */
+#endif /* !DISABLE_XDES */
{
/*
* "old"-style: setting - 2 bytes of salt key - only up to the first 8
diff --git a/contrib/pgcrypto/imath.c b/contrib/pgcrypto/imath.c
index 41021a7ffd..cd528bfd83 100644
--- a/contrib/pgcrypto/imath.c
+++ b/contrib/pgcrypto/imath.c
@@ -1975,7 +1975,7 @@ mp_int_string_len(mp_int z, mp_size radix)
if (radix < MP_MIN_RADIX || radix > MP_MAX_RADIX)
return MP_RANGE;
- len = s_outlen(z, radix) + 1; /* for terminator */
+ len = s_outlen(z, radix) + 1; /* for terminator */
/* Allow for sign marker on negatives */
if (MP_SIGN(z) == MP_NEG)
@@ -2512,7 +2512,7 @@ s_usub(mp_digit *da, mp_digit *db, mp_digit *dc,
/* Subtract corresponding digits and propagate borrow */
for (pos = 0; pos < size_b; ++pos, ++da, ++db, ++dc)
{
- w = ((mp_word) MP_DIGIT_MAX + 1 + /* MP_RADIX */
+ w = ((mp_word) MP_DIGIT_MAX + 1 + /* MP_RADIX */
(mp_word) *da) - w - (mp_word) *db;
*dc = LOWER_HALF(w);
@@ -2522,7 +2522,7 @@ s_usub(mp_digit *da, mp_digit *db, mp_digit *dc,
/* Finish the subtraction for remaining upper digits of da */
for ( /* */ ; pos < size_a; ++pos, ++da, ++dc)
{
- w = ((mp_word) MP_DIGIT_MAX + 1 + /* MP_RADIX */
+ w = ((mp_word) MP_DIGIT_MAX + 1 + /* MP_RADIX */
(mp_word) *da) - w;
*dc = LOWER_HALF(w);
@@ -2594,10 +2594,10 @@ s_kmul(mp_digit *da, mp_digit *db, mp_digit *dc,
* t1 and t2 are initially used as temporaries to compute the inner
* product (a1 + a0)(b1 + b0) = a1b1 + a1b0 + a0b1 + a0b0
*/
- carry = s_uadd(da, a_top, t1, bot_size, at_size); /* t1 = a1 + a0 */
+ carry = s_uadd(da, a_top, t1, bot_size, at_size); /* t1 = a1 + a0 */
t1[bot_size] = carry;
- carry = s_uadd(db, b_top, t2, bot_size, bt_size); /* t2 = b1 + b0 */
+ carry = s_uadd(db, b_top, t2, bot_size, bt_size); /* t2 = b1 + b0 */
t2[bot_size] = carry;
(void) s_kmul(t1, t2, t3, bot_size + 1, bot_size + 1); /* t3 = t1 * t2 */
@@ -2609,7 +2609,7 @@ s_kmul(mp_digit *da, mp_digit *db, mp_digit *dc,
ZERO(t1, buf_size);
ZERO(t2, buf_size);
(void) s_kmul(da, db, t1, bot_size, bot_size); /* t1 = a0 * b0 */
- (void) s_kmul(a_top, b_top, t2, at_size, bt_size); /* t2 = a1 * b1 */
+ (void) s_kmul(a_top, b_top, t2, at_size, bt_size); /* t2 = a1 * b1 */
/* Subtract out t1 and t2 to get the inner product */
s_usub(t3, t1, t3, buf_size + 2, buf_size);
@@ -2692,10 +2692,10 @@ s_ksqr(mp_digit *da, mp_digit *dc, mp_size size_a)
t3 = t2 + buf_size;
ZERO(t1, 4 * buf_size);
- (void) s_ksqr(da, t1, bot_size); /* t1 = a0 ^ 2 */
- (void) s_ksqr(a_top, t2, at_size); /* t2 = a1 ^ 2 */
+ (void) s_ksqr(da, t1, bot_size); /* t1 = a0 ^ 2 */
+ (void) s_ksqr(a_top, t2, at_size); /* t2 = a1 ^ 2 */
- (void) s_kmul(da, a_top, t3, bot_size, at_size); /* t3 = a0 * a1 */
+ (void) s_kmul(da, a_top, t3, bot_size, at_size); /* t3 = a0 * a1 */
/* Quick multiply t3 by 2, shifting left (can't overflow) */
{
@@ -2782,7 +2782,7 @@ s_usqr(mp_digit *da, mp_digit *dc, mp_size size_a)
w = UPPER_HALF(w);
if (ov)
{
- w += MP_DIGIT_MAX; /* MP_RADIX */
+ w += MP_DIGIT_MAX; /* MP_RADIX */
++w;
}
}
diff --git a/contrib/pgcrypto/imath.h b/contrib/pgcrypto/imath.h
index 8ba38d3acb..2d7a5268e5 100644
--- a/contrib/pgcrypto/imath.h
+++ b/contrib/pgcrypto/imath.h
@@ -106,9 +106,9 @@ void mp_int_free(mp_int z);
mp_result mp_int_copy(mp_int a, mp_int c); /* c = a */
void mp_int_swap(mp_int a, mp_int c); /* swap a, c */
-void mp_int_zero(mp_int z); /* z = 0 */
-mp_result mp_int_abs(mp_int a, mp_int c); /* c = |a| */
-mp_result mp_int_neg(mp_int a, mp_int c); /* c = -a */
+void mp_int_zero(mp_int z); /* z = 0 */
+mp_result mp_int_abs(mp_int a, mp_int c); /* c = |a| */
+mp_result mp_int_neg(mp_int a, mp_int c); /* c = -a */
mp_result mp_int_add(mp_int a, mp_int b, mp_int c); /* c = a + b */
mp_result mp_int_add_value(mp_int a, int value, mp_int c);
mp_result mp_int_sub(mp_int a, mp_int b, mp_int c); /* c = a - b */
@@ -116,23 +116,23 @@ mp_result mp_int_sub_value(mp_int a, int value, mp_int c);
mp_result mp_int_mul(mp_int a, mp_int b, mp_int c); /* c = a * b */
mp_result mp_int_mul_value(mp_int a, int value, mp_int c);
mp_result mp_int_mul_pow2(mp_int a, int p2, mp_int c);
-mp_result mp_int_sqr(mp_int a, mp_int c); /* c = a * a */
+mp_result mp_int_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_result 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 q, int *r); /* r = a % value */
+mp_result 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 */
mp_int q, mp_int r); /* r = q % 2^p2 */
mp_result mp_int_mod(mp_int a, mp_int m, mp_int c); /* c = a % m */
#define mp_int_mod_value(A, V, R) mp_int_div_value((A), (V), 0, (R))
-mp_result mp_int_expt(mp_int a, int b, mp_int c); /* c = a^b */
+mp_result mp_int_expt(mp_int a, int b, mp_int c); /* c = a^b */
mp_result mp_int_expt_value(int a, int b, mp_int c); /* c = a^b */
int mp_int_compare(mp_int a, mp_int b); /* a <=> b */
-int mp_int_compare_unsigned(mp_int a, mp_int b); /* |a| <=> |b| */
-int mp_int_compare_zero(mp_int z); /* a <=> 0 */
+int mp_int_compare_unsigned(mp_int a, mp_int b); /* |a| <=> |b| */
+int mp_int_compare_zero(mp_int z); /* a <=> 0 */
int mp_int_compare_value(mp_int z, int value); /* a <=> v */
/* Returns true if v|a, false otherwise (including errors) */
@@ -144,15 +144,15 @@ int mp_int_is_pow2(mp_int z);
mp_result mp_int_exptmod(mp_int a, mp_int b, mp_int m,
mp_int c); /* c = a^b (mod m) */
mp_result mp_int_exptmod_evalue(mp_int a, int value,
- mp_int m, mp_int c); /* c = a^v (mod m) */
+ mp_int m, mp_int c); /* c = a^v (mod m) */
mp_result mp_int_exptmod_bvalue(int value, mp_int b,
- mp_int m, mp_int c); /* c = v^b (mod m) */
+ mp_int m, mp_int c); /* c = v^b (mod m) */
mp_result mp_int_exptmod_known(mp_int a, mp_int b,
mp_int m, mp_int mu,
mp_int c); /* c = a^b (mod m) */
mp_result mp_int_redux_const(mp_int m, mp_int c);
-mp_result mp_int_invmod(mp_int a, mp_int m, mp_int c); /* c = 1/a (mod m) */
+mp_result mp_int_invmod(mp_int a, mp_int m, mp_int c); /* c = 1/a (mod m) */
mp_result mp_int_gcd(mp_int a, mp_int b, mp_int c); /* c = gcd(a, b) */
@@ -207,4 +207,4 @@ void s_print(char *tag, mp_int z);
void s_print_buf(char *tag, mp_digit *buf, mp_size num);
#endif
-#endif /* end IMATH_H_ */
+#endif /* end IMATH_H_ */
diff --git a/contrib/pgcrypto/internal.c b/contrib/pgcrypto/internal.c
index c2687cfdb2..16dfe725ea 100644
--- a/contrib/pgcrypto/internal.c
+++ b/contrib/pgcrypto/internal.c
@@ -42,11 +42,11 @@
/*
* System reseeds should be separated at least this much.
*/
-#define SYSTEM_RESEED_MIN (20*60) /* 20 min */
+#define SYSTEM_RESEED_MIN (20*60) /* 20 min */
/*
* How often to roll dice.
*/
-#define SYSTEM_RESEED_CHECK_TIME (10*60) /* 10 min */
+#define SYSTEM_RESEED_CHECK_TIME (10*60) /* 10 min */
/*
* The chance is x/256 that the reseed happens.
*/
diff --git a/contrib/pgcrypto/mbuf.h b/contrib/pgcrypto/mbuf.h
index d413eb5276..50a989f059 100644
--- a/contrib/pgcrypto/mbuf.h
+++ b/contrib/pgcrypto/mbuf.h
@@ -121,4 +121,4 @@ int pullf_create_mbuf_reader(PullFilter **pf_p, MBuf *mbuf);
(dst) = __b; \
} while (0)
-#endif /* __PX_MBUF_H */
+#endif /* __PX_MBUF_H */
diff --git a/contrib/pgcrypto/md5.h b/contrib/pgcrypto/md5.h
index 07d08c134d..3e6e8da5e7 100644
--- a/contrib/pgcrypto/md5.h
+++ b/contrib/pgcrypto/md5.h
@@ -76,4 +76,4 @@ do { \
md5_result((x), (y)); \
} while (0)
-#endif /* ! _NETINET6_MD5_H_ */
+#endif /* ! _NETINET6_MD5_H_ */
diff --git a/contrib/pgcrypto/pgp.h b/contrib/pgcrypto/pgp.h
index 804a27018a..1b6ea4c9ea 100644
--- a/contrib/pgcrypto/pgp.h
+++ b/contrib/pgcrypto/pgp.h
@@ -155,8 +155,8 @@ struct PGP_Context
*/
int mdc_checked;
int corrupt_prefix; /* prefix failed RFC 4880 "quick check" */
- int unsupported_compr; /* has bzip2 compression */
- int unexpected_binary; /* binary data seen in text_mode */
+ int unsupported_compr; /* has bzip2 compression */
+ int unexpected_binary; /* binary data seen in text_mode */
int in_mdc_pkt;
int use_mdcbuf_filter;
PX_MD *mdc_ctx;
diff --git a/contrib/pgcrypto/px-crypt.h b/contrib/pgcrypto/px-crypt.h
index 24daee743c..4ea72dcbc5 100644
--- a/contrib/pgcrypto/px-crypt.h
+++ b/contrib/pgcrypto/px-crypt.h
@@ -79,4 +79,4 @@ char *px_crypt_des(const char *key, const char *setting);
char *px_crypt_md5(const char *pw, const char *salt,
char *dst, unsigned dstlen);
-#endif /* _PX_CRYPT_H */
+#endif /* _PX_CRYPT_H */
diff --git a/contrib/pgcrypto/px.h b/contrib/pgcrypto/px.h
index e8068317d0..cef9c4b456 100644
--- a/contrib/pgcrypto/px.h
+++ b/contrib/pgcrypto/px.h
@@ -154,7 +154,7 @@ struct px_hmac
struct px_cipher
{
unsigned (*block_size) (PX_Cipher *c);
- unsigned (*key_size) (PX_Cipher *c); /* max key len */
+ 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);
@@ -239,4 +239,4 @@ void px_debug(const char *fmt,...) pg_attribute_printf(1, 2);
(c)->decrypt(c, data, dlen, res, rlen)
#define px_combo_free(c) (c)->free(c)
-#endif /* __PX_H */
+#endif /* __PX_H */
diff --git a/contrib/pgcrypto/rijndael.c b/contrib/pgcrypto/rijndael.c
index 4adbcc1f91..4c074efbc0 100644
--- a/contrib/pgcrypto/rijndael.c
+++ b/contrib/pgcrypto/rijndael.c
@@ -97,7 +97,7 @@ static u4byte il_tab[4][256];
#endif
static u4byte tab_gen = 0;
-#endif /* !PRE_CALC_TABLES */
+#endif /* !PRE_CALC_TABLES */
#define ff_mult(a,b) ((a) && (b) ? pow_tab[(log_tab[a] + log_tab[b]) % 255] : 0)
@@ -250,7 +250,7 @@ gen_tabs(void)
}
tab_gen = 1;
-#endif /* !PRE_CALC_TABLES */
+#endif /* !PRE_CALC_TABLES */
}
diff --git a/contrib/pgcrypto/rijndael.h b/contrib/pgcrypto/rijndael.h
index 108ef68b76..bc9ddfaad3 100644
--- a/contrib/pgcrypto/rijndael.h
+++ b/contrib/pgcrypto/rijndael.h
@@ -56,4 +56,4 @@ 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_ */
+#endif /* _RIJNDAEL_H_ */
diff --git a/contrib/pgcrypto/sha1.h b/contrib/pgcrypto/sha1.h
index 2f61e454ba..4300694a34 100644
--- a/contrib/pgcrypto/sha1.h
+++ b/contrib/pgcrypto/sha1.h
@@ -72,4 +72,4 @@ typedef struct sha1_ctxt SHA1_CTX;
#define SHA1_RESULTLEN (160/8)
-#endif /* _NETINET6_SHA1_H_ */
+#endif /* _NETINET6_SHA1_H_ */