1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-30 11:03:19 +03:00

Suppress signed-vs-unsigned-char warnings in contrib.

This commit is contained in:
Tom Lane
2005-09-24 19:14:05 +00:00
parent 8889685555
commit 8a65b820e2
15 changed files with 124 additions and 105 deletions

View File

@ -651,9 +651,9 @@ px_crypt_des(const char *key, const char *setting)
r0,
r1,
keybuf[2];
uint8 *p,
*q;
static uint8 output[21];
char *p;
uint8 *q;
static char output[21];
if (!des_initialised)
des_init();
@ -669,7 +669,7 @@ px_crypt_des(const char *key, const char *setting)
if ((*q++ = *key << 1))
key++;
}
if (des_setkey((uint8 *) keybuf))
if (des_setkey((char *) keybuf))
return (NULL);
#ifndef DISABLE_XDES
@ -690,7 +690,7 @@ px_crypt_des(const char *key, const char *setting)
/*
* Encrypt the key with itself.
*/
if (des_cipher((uint8 *) keybuf, (uint8 *) keybuf, 0L, 1))
if (des_cipher((char *) keybuf, (char *) keybuf, 0L, 1))
return (NULL);
/*
@ -700,7 +700,7 @@ px_crypt_des(const char *key, const char *setting)
while (q - (uint8 *) keybuf - 8 && *key)
*q++ ^= *key++ << 1;
if (des_setkey((uint8 *) keybuf))
if (des_setkey((char *) keybuf))
return (NULL);
}
strncpy(output, setting, 9);

View File

@ -8,7 +8,7 @@
*
* $FreeBSD: src/lib/libcrypt/crypt-md5.c,v 1.5 1999/12/17 20:21:45 peter Exp $
*
* $PostgreSQL: pgsql/contrib/pgcrypto/crypt-md5.c,v 1.4 2005/07/11 15:07:59 tgl Exp $
* $PostgreSQL: pgsql/contrib/pgcrypto/crypt-md5.c,v 1.5 2005/09/24 19:14:04 tgl Exp $
*/
#include "postgres.h"
@ -63,18 +63,18 @@ px_crypt_md5(const char *pw, const char *salt, char *passwd, unsigned dstlen)
err = px_find_digest("md5", &ctx1);
/* The password first, since that is what is most unknown */
px_md_update(ctx, pw, strlen(pw));
px_md_update(ctx, (uint8 *) pw, strlen(pw));
/* Then our magic string */
px_md_update(ctx, magic, strlen(magic));
px_md_update(ctx, (uint8 *) magic, strlen(magic));
/* Then the raw salt */
px_md_update(ctx, sp, sl);
px_md_update(ctx, (uint8 *) sp, sl);
/* Then just as many characters of the MD5(pw,salt,pw) */
px_md_update(ctx1, pw, strlen(pw));
px_md_update(ctx1, sp, sl);
px_md_update(ctx1, pw, strlen(pw));
px_md_update(ctx1, (uint8 *) pw, strlen(pw));
px_md_update(ctx1, (uint8 *) sp, sl);
px_md_update(ctx1, (uint8 *) pw, strlen(pw));
px_md_finish(ctx1, final);
for (pl = strlen(pw); pl > 0; pl -= MD5_SIZE)
px_md_update(ctx, final, pl > MD5_SIZE ? MD5_SIZE : pl);
@ -87,7 +87,7 @@ px_crypt_md5(const char *pw, const char *salt, char *passwd, unsigned dstlen)
if (i & 1)
px_md_update(ctx, final, 1);
else
px_md_update(ctx, pw, 1);
px_md_update(ctx, (uint8 *) pw, 1);
/* Now make the output string */
strcpy(passwd, magic);
@ -105,20 +105,20 @@ px_crypt_md5(const char *pw, const char *salt, char *passwd, unsigned dstlen)
{
px_md_reset(ctx1);
if (i & 1)
px_md_update(ctx1, pw, strlen(pw));
px_md_update(ctx1, (uint8 *) pw, strlen(pw));
else
px_md_update(ctx1, final, MD5_SIZE);
if (i % 3)
px_md_update(ctx1, sp, sl);
px_md_update(ctx1, (uint8 *) sp, sl);
if (i % 7)
px_md_update(ctx1, pw, strlen(pw));
px_md_update(ctx1, (uint8 *) pw, strlen(pw));
if (i & 1)
px_md_update(ctx1, final, MD5_SIZE);
else
px_md_update(ctx1, pw, strlen(pw));
px_md_update(ctx1, (uint8 *) pw, strlen(pw));
px_md_finish(ctx1, final);
}

View File

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $PostgreSQL: pgsql/contrib/pgcrypto/pgcrypto.c,v 1.18 2005/03/21 05:19:55 neilc Exp $
* $PostgreSQL: pgsql/contrib/pgcrypto/pgcrypto.c,v 1.19 2005/09/24 19:14:04 tgl Exp $
*/
#include "postgres.h"
@ -75,8 +75,8 @@ pg_digest(PG_FUNCTION_ARGS)
arg = PG_GETARG_BYTEA_P(0);
len = VARSIZE(arg) - VARHDRSZ;
px_md_update(md, VARDATA(arg), len);
px_md_finish(md, VARDATA(res));
px_md_update(md, (uint8 *) VARDATA(arg), len);
px_md_finish(md, (uint8 *) VARDATA(res));
px_md_free(md);
PG_FREE_IF_COPY(arg, 0);
@ -144,9 +144,9 @@ pg_hmac(PG_FUNCTION_ARGS)
len = VARSIZE(arg) - VARHDRSZ;
klen = VARSIZE(key) - VARHDRSZ;
px_hmac_init(h, VARDATA(key), klen);
px_hmac_update(h, VARDATA(arg), len);
px_hmac_finish(h, VARDATA(res));
px_hmac_init(h, (uint8 *) VARDATA(key), klen);
px_hmac_update(h, (uint8 *) VARDATA(arg), len);
px_hmac_finish(h, (uint8 *) VARDATA(res));
px_hmac_free(h);
PG_FREE_IF_COPY(arg, 0);
@ -346,9 +346,10 @@ pg_encrypt(PG_FUNCTION_ARGS)
rlen = px_combo_encrypt_len(c, dlen);
res = palloc(VARHDRSZ + rlen);
err = px_combo_init(c, VARDATA(key), klen, NULL, 0);
err = px_combo_init(c, (uint8 *) VARDATA(key), klen, NULL, 0);
if (!err)
err = px_combo_encrypt(c, VARDATA(data), dlen, VARDATA(res), &rlen);
err = px_combo_encrypt(c, (uint8 *) VARDATA(data), dlen,
(uint8 *) VARDATA(res), &rlen);
px_combo_free(c);
PG_FREE_IF_COPY(data, 0);
@ -397,9 +398,10 @@ pg_decrypt(PG_FUNCTION_ARGS)
rlen = px_combo_decrypt_len(c, dlen);
res = palloc(VARHDRSZ + rlen);
err = px_combo_init(c, VARDATA(key), klen, NULL, 0);
err = px_combo_init(c, (uint8 *) VARDATA(key), klen, NULL, 0);
if (!err)
err = px_combo_decrypt(c, VARDATA(data), dlen, VARDATA(res), &rlen);
err = px_combo_decrypt(c, (uint8 *) VARDATA(data), dlen,
(uint8 *) VARDATA(res), &rlen);
px_combo_free(c);
@ -452,9 +454,11 @@ pg_encrypt_iv(PG_FUNCTION_ARGS)
rlen = px_combo_encrypt_len(c, dlen);
res = palloc(VARHDRSZ + rlen);
err = px_combo_init(c, VARDATA(key), klen, VARDATA(iv), ivlen);
err = px_combo_init(c, (uint8 *) VARDATA(key), klen,
(uint8 *) VARDATA(iv), ivlen);
if (!err)
px_combo_encrypt(c, VARDATA(data), dlen, VARDATA(res), &rlen);
px_combo_encrypt(c, (uint8 *) VARDATA(data), dlen,
(uint8 *) VARDATA(res), &rlen);
px_combo_free(c);
@ -508,9 +512,11 @@ pg_decrypt_iv(PG_FUNCTION_ARGS)
rlen = px_combo_decrypt_len(c, dlen);
res = palloc(VARHDRSZ + rlen);
err = px_combo_init(c, VARDATA(key), klen, VARDATA(iv), ivlen);
err = px_combo_init(c, (uint8 *) VARDATA(key), klen,
(uint8 *) VARDATA(iv), ivlen);
if (!err)
px_combo_decrypt(c, VARDATA(data), dlen, VARDATA(res), &rlen);
px_combo_decrypt(c, (uint8 *) VARDATA(data), dlen,
(uint8 *) VARDATA(res), &rlen);
px_combo_free(c);

View File

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $PostgreSQL: pgsql/contrib/pgcrypto/pgp-decrypt.c,v 1.4 2005/07/18 17:09:01 tgl Exp $
* $PostgreSQL: pgsql/contrib/pgcrypto/pgp-decrypt.c,v 1.5 2005/09/24 19:14:04 tgl Exp $
*/
#include "postgres.h"
@ -792,7 +792,7 @@ parse_literal_data(PGP_Context * ctx, MBuf * dst, PullFilter * pkt)
break;
}
if (res >= 0 && got_cr)
res = mbuf_append(dst, "\r", 1);
res = mbuf_append(dst, (const uint8 *) "\r", 1);
return res;
}

View File

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $PostgreSQL: pgsql/contrib/pgcrypto/pgp-pgsql.c,v 1.4 2005/08/13 02:06:20 momjian Exp $
* $PostgreSQL: pgsql/contrib/pgcrypto/pgp-pgsql.c,v 1.5 2005/09/24 19:14:04 tgl Exp $
*/
#include "postgres.h"
@ -94,7 +94,7 @@ static void add_block_entropy(PX_MD *md, text *data)
uint8 sha1[20];
px_md_reset(md);
px_md_update(md, VARDATA(data), VARSIZE(data) - VARHDRSZ);
px_md_update(md, (uint8 *) VARDATA(data), VARSIZE(data) - VARHDRSZ);
px_md_finish(md, sha1);
px_add_entropy(sha1, 20);
@ -151,14 +151,14 @@ static text *convert_charset(text *src, int cset_from, int cset_to)
int src_len = VARSIZE(src) - VARHDRSZ;
int dst_len;
unsigned char *dst;
unsigned char *csrc = VARDATA(src);
unsigned char *csrc = (unsigned char *) VARDATA(src);
text *res;
dst = pg_do_encoding_conversion(csrc, src_len, cset_from, cset_to);
if (dst == csrc)
return src;
dst_len = strlen(dst);
dst_len = strlen((char *) dst);
res = palloc(dst_len + VARHDRSZ);
memcpy(VARDATA(res), dst, dst_len);
VARATT_SIZEP(res) = VARHDRSZ + dst_len;
@ -398,7 +398,8 @@ static int parse_args(PGP_Context *ctx, uint8 *args, int arg_len,
static MBuf *
create_mbuf_from_vardata(text *data)
{
return mbuf_create_from_data(VARDATA(data), VARSIZE(data) - VARHDRSZ);
return mbuf_create_from_data((uint8 *) VARDATA(data),
VARSIZE(data) - VARHDRSZ);
}
static void
@ -410,7 +411,8 @@ init_work(PGP_Context **ctx_p, int is_text,
fill_expect(ex, is_text);
if (err == 0 && args != NULL)
err = parse_args(*ctx_p, VARDATA(args), VARSIZE(args) - VARHDRSZ, ex);
err = parse_args(*ctx_p, (uint8 *) VARDATA(args),
VARSIZE(args) - VARHDRSZ, ex);
if (err)
{
@ -474,7 +476,8 @@ encrypt_internal(int is_pubenc, int is_text,
mbuf_free(kbuf);
}
else
err = pgp_set_symkey(ctx, VARDATA(key), VARSIZE(key) - VARHDRSZ);
err = pgp_set_symkey(ctx, (uint8 *) VARDATA(key),
VARSIZE(key) - VARHDRSZ);
/*
* encrypt
@ -532,7 +535,8 @@ decrypt_internal(int is_pubenc, int need_text, text *data,
init_work(&ctx, need_text, args, &ex);
src = mbuf_create_from_data(VARDATA(data), VARSIZE(data) - VARHDRSZ);
src = mbuf_create_from_data((uint8 *) VARDATA(data),
VARSIZE(data) - VARHDRSZ);
dst = mbuf_create(VARSIZE(data) + 2048);
/*
@ -550,7 +554,7 @@ decrypt_internal(int is_pubenc, int need_text, text *data,
MBuf *kbuf;
if (keypsw)
{
psw = VARDATA(keypsw);
psw = (uint8 *) VARDATA(keypsw);
psw_len = VARSIZE(keypsw) - VARHDRSZ;
}
kbuf = create_mbuf_from_vardata(key);
@ -558,7 +562,8 @@ decrypt_internal(int is_pubenc, int need_text, text *data,
mbuf_free(kbuf);
}
else
err = pgp_set_symkey(ctx, VARDATA(key), VARSIZE(key) - VARHDRSZ);
err = pgp_set_symkey(ctx, (uint8 *) VARDATA(key),
VARSIZE(key) - VARHDRSZ);
/*
* decrypt
@ -846,7 +851,8 @@ pg_armor(PG_FUNCTION_ARGS)
guess_len = pgp_armor_enc_len(data_len);
res = palloc(VARHDRSZ + guess_len);
res_len = pgp_armor_encode(VARDATA(data), data_len, VARDATA(res));
res_len = pgp_armor_encode((uint8 *) VARDATA(data), data_len,
(uint8 *) VARDATA(res));
if (res_len > guess_len)
ereport(ERROR,
(errcode(ERRCODE_EXTERNAL_ROUTINE_INVOCATION_EXCEPTION),
@ -875,7 +881,8 @@ pg_dearmor(PG_FUNCTION_ARGS)
guess_len = pgp_armor_dec_len(data_len);
res = palloc(VARHDRSZ + guess_len);
res_len = pgp_armor_decode(VARDATA(data), data_len, VARDATA(res));
res_len = pgp_armor_decode((uint8 *) VARDATA(data), data_len,
(uint8 *) VARDATA(res));
if (res_len < 0)
ereport(ERROR,
(errcode(ERRCODE_EXTERNAL_ROUTINE_INVOCATION_EXCEPTION),

View File

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $PostgreSQL: pgsql/contrib/pgcrypto/px-crypt.c,v 1.13 2005/08/13 02:06:20 momjian Exp $
* $PostgreSQL: pgsql/contrib/pgcrypto/px-crypt.c,v 1.14 2005/09/24 19:14:04 tgl Exp $
*/
#include "postgres.h"
@ -152,7 +152,7 @@ px_gen_salt(const char *salt_type, char *buf, int rounds)
return PXE_BAD_SALT_ROUNDS;
}
res = px_get_pseudo_random_bytes(rbuf, g->input_len);
res = px_get_pseudo_random_bytes((uint8 *) rbuf, g->input_len);
if (res < 0)
return res;