Commit 540155b7 authored by Bruce Momjian's avatar Bruce Momjian

pgcrypto uses non-standard type uint, which causes compile

failures on FreeBSD.  This patch replaces uint -> unsigned.

This was reported by Daniel Holtzman against 0.4pre3 standalone
package, but it needs fixing in contrib/pgcrypto too.

Marko Kreen
parent 01e0dae6
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* $Id: internal.c,v 1.8 2001/11/05 17:46:23 momjian Exp $ * $Id: internal.c,v 1.9 2001/11/20 15:50:53 momjian Exp $
*/ */
...@@ -90,7 +90,7 @@ int_md5_block_len(PX_MD * h) ...@@ -90,7 +90,7 @@ int_md5_block_len(PX_MD * h)
} }
static void static void
int_md5_update(PX_MD * h, const uint8 *data, uint dlen) int_md5_update(PX_MD * h, const uint8 *data, unsigned dlen)
{ {
MD5_CTX *ctx = (MD5_CTX *) h->p.ptr; MD5_CTX *ctx = (MD5_CTX *) h->p.ptr;
...@@ -137,7 +137,7 @@ int_sha1_block_len(PX_MD * h) ...@@ -137,7 +137,7 @@ int_sha1_block_len(PX_MD * h)
} }
static void static void
int_sha1_update(PX_MD * h, const uint8 *data, uint dlen) int_sha1_update(PX_MD * h, const uint8 *data, unsigned dlen)
{ {
SHA1_CTX *ctx = (SHA1_CTX *) h->p.ptr; SHA1_CTX *ctx = (SHA1_CTX *) h->p.ptr;
...@@ -225,7 +225,7 @@ struct int_ctx ...@@ -225,7 +225,7 @@ struct int_ctx
blf_ctx bf; blf_ctx bf;
rijndael_ctx rj; rijndael_ctx rj;
} ctx; } ctx;
uint keylen; unsigned keylen;
int is_init; int is_init;
int mode; int mode;
}; };
...@@ -269,7 +269,7 @@ rj_iv_size(PX_Cipher * c) ...@@ -269,7 +269,7 @@ rj_iv_size(PX_Cipher * c)
} }
static int static int
rj_init(PX_Cipher * c, const uint8 *key, uint 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; struct int_ctx *cx = (struct int_ctx *) c->ptr;
...@@ -298,7 +298,7 @@ rj_real_init(struct int_ctx * cx, int dir) ...@@ -298,7 +298,7 @@ rj_real_init(struct int_ctx * cx, int dir)
} }
static int static int
rj_encrypt(PX_Cipher * c, const uint8 *data, uint dlen, uint8 *res) rj_encrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, uint8 *res)
{ {
struct int_ctx *cx = (struct int_ctx *) c->ptr; struct int_ctx *cx = (struct int_ctx *) c->ptr;
...@@ -328,7 +328,7 @@ rj_encrypt(PX_Cipher * c, const uint8 *data, uint dlen, uint8 *res) ...@@ -328,7 +328,7 @@ rj_encrypt(PX_Cipher * c, const uint8 *data, uint dlen, uint8 *res)
} }
static int static int
rj_decrypt(PX_Cipher * c, const uint8 *data, uint dlen, uint8 *res) rj_decrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, uint8 *res)
{ {
struct int_ctx *cx = (struct int_ctx *) c->ptr; struct int_ctx *cx = (struct int_ctx *) c->ptr;
...@@ -407,7 +407,7 @@ bf_iv_size(PX_Cipher * c) ...@@ -407,7 +407,7 @@ bf_iv_size(PX_Cipher * c)
} }
static int static int
bf_init(PX_Cipher * c, const uint8 *key, uint 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; struct int_ctx *cx = (struct int_ctx *) c->ptr;
...@@ -419,7 +419,7 @@ bf_init(PX_Cipher * c, const uint8 *key, uint klen, const uint8 *iv) ...@@ -419,7 +419,7 @@ bf_init(PX_Cipher * c, const uint8 *key, uint klen, const uint8 *iv)
} }
static int static int
bf_encrypt(PX_Cipher * c, const uint8 *data, uint dlen, uint8 *res) bf_encrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, uint8 *res)
{ {
struct int_ctx *cx = (struct int_ctx *) c->ptr; struct int_ctx *cx = (struct int_ctx *) c->ptr;
...@@ -443,7 +443,7 @@ bf_encrypt(PX_Cipher * c, const uint8 *data, uint dlen, uint8 *res) ...@@ -443,7 +443,7 @@ bf_encrypt(PX_Cipher * c, const uint8 *data, uint dlen, uint8 *res)
} }
static int static int
bf_decrypt(PX_Cipher * c, const uint8 *data, uint dlen, uint8 *res) bf_decrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, uint8 *res)
{ {
struct int_ctx *cx = (struct int_ctx *) c->ptr; struct int_ctx *cx = (struct int_ctx *) c->ptr;
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* $Id: mhash.c,v 1.5 2001/10/25 05:49:19 momjian Exp $ * $Id: mhash.c,v 1.6 2001/11/20 15:50:53 momjian Exp $
*/ */
#include <postgres.h> #include <postgres.h>
...@@ -75,7 +75,7 @@ digest_reset(PX_MD * h) ...@@ -75,7 +75,7 @@ digest_reset(PX_MD * h)
} }
static void static void
digest_update(PX_MD * h, const uint8 *data, uint dlen) digest_update(PX_MD * h, const uint8 *data, unsigned dlen)
{ {
MHASH mh = (MHASH) h->p.ptr; MHASH mh = (MHASH) h->p.ptr;
...@@ -86,7 +86,7 @@ static void ...@@ -86,7 +86,7 @@ static void
digest_finish(PX_MD * h, uint8 *dst) digest_finish(PX_MD * h, uint8 *dst)
{ {
MHASH mh = (MHASH) h->p.ptr; MHASH mh = (MHASH) h->p.ptr;
uint hlen = digest_result_size(h); unsigned hlen = digest_result_size(h);
hashid id = mhash_get_mhash_algo(mh); hashid id = mhash_get_mhash_algo(mh);
uint8 *buf = mhash_end(mh); uint8 *buf = mhash_end(mh);
...@@ -136,7 +136,7 @@ cipher_iv_size(PX_Cipher * c) ...@@ -136,7 +136,7 @@ cipher_iv_size(PX_Cipher * c)
} }
static int static int
cipher_init(PX_Cipher * c, const uint8 *key, uint klen, const uint8 *iv) cipher_init(PX_Cipher * c, const uint8 *key, unsigned klen, const uint8 *iv)
{ {
int err; int err;
MCRYPT ctx = (MCRYPT) c->ptr; MCRYPT ctx = (MCRYPT) c->ptr;
...@@ -150,7 +150,7 @@ cipher_init(PX_Cipher * c, const uint8 *key, uint klen, const uint8 *iv) ...@@ -150,7 +150,7 @@ cipher_init(PX_Cipher * c, const uint8 *key, uint klen, const uint8 *iv)
} }
static int static int
cipher_encrypt(PX_Cipher * c, const uint8 *data, uint dlen, uint8 *res) cipher_encrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, uint8 *res)
{ {
int err; int err;
MCRYPT ctx = (MCRYPT) c->ptr; MCRYPT ctx = (MCRYPT) c->ptr;
...@@ -164,7 +164,7 @@ cipher_encrypt(PX_Cipher * c, const uint8 *data, uint dlen, uint8 *res) ...@@ -164,7 +164,7 @@ cipher_encrypt(PX_Cipher * c, const uint8 *data, uint dlen, uint8 *res)
} }
static int static int
cipher_decrypt(PX_Cipher * c, const uint8 *data, uint dlen, uint8 *res) cipher_decrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, uint8 *res)
{ {
int err; int err;
MCRYPT ctx = (MCRYPT) c->ptr; MCRYPT ctx = (MCRYPT) c->ptr;
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* $Id: openssl.c,v 1.8 2001/11/05 17:46:23 momjian Exp $ * $Id: openssl.c,v 1.9 2001/11/20 15:50:53 momjian Exp $
*/ */
#include <postgres.h> #include <postgres.h>
...@@ -60,7 +60,7 @@ digest_reset(PX_MD * h) ...@@ -60,7 +60,7 @@ digest_reset(PX_MD * h)
} }
static void static void
digest_update(PX_MD * h, const uint8 *data, uint dlen) digest_update(PX_MD * h, const uint8 *data, unsigned dlen)
{ {
EVP_MD_CTX *ctx = (EVP_MD_CTX *) h->p.ptr; EVP_MD_CTX *ctx = (EVP_MD_CTX *) h->p.ptr;
...@@ -108,8 +108,8 @@ typedef struct ...@@ -108,8 +108,8 @@ typedef struct
const EVP_CIPHER *evp_ciph; const EVP_CIPHER *evp_ciph;
uint8 key[EVP_MAX_KEY_LENGTH]; uint8 key[EVP_MAX_KEY_LENGTH];
uint8 iv[EVP_MAX_IV_LENGTH]; uint8 iv[EVP_MAX_IV_LENGTH];
uint klen; unsigned klen;
uint init; unsigned init;
} ossldata; } ossldata;
/* generic EVP */ /* generic EVP */
...@@ -133,7 +133,7 @@ gen_evp_key_size(PX_Cipher * c) ...@@ -133,7 +133,7 @@ gen_evp_key_size(PX_Cipher * c)
static uint static uint
gen_evp_iv_size(PX_Cipher * c) gen_evp_iv_size(PX_Cipher * c)
{ {
uint ivlen; unsigned ivlen;
ossldata *od = (ossldata *) c->ptr; ossldata *od = (ossldata *) c->ptr;
ivlen = EVP_CIPHER_iv_length(od->evp_ciph); ivlen = EVP_CIPHER_iv_length(od->evp_ciph);
...@@ -153,10 +153,10 @@ gen_evp_free(PX_Cipher * c) ...@@ -153,10 +153,10 @@ gen_evp_free(PX_Cipher * c)
/* fun */ /* fun */
static int static int
gen_evp_init(PX_Cipher * c, const uint8 *key, uint klen, const uint8 *iv) gen_evp_init(PX_Cipher * c, const uint8 *key, unsigned klen, const uint8 *iv)
{ {
ossldata *od = (ossldata *) c->ptr; ossldata *od = (ossldata *) c->ptr;
uint bs = gen_evp_block_size(c); unsigned bs = gen_evp_block_size(c);
if (iv) if (iv)
memcpy(od->iv, iv, bs); memcpy(od->iv, iv, bs);
...@@ -179,7 +179,7 @@ _gen_init(PX_Cipher * c, int enc) ...@@ -179,7 +179,7 @@ _gen_init(PX_Cipher * c, int enc)
} }
static int static int
gen_evp_encrypt(PX_Cipher * c, const uint8 *data, uint dlen, uint8 *res) gen_evp_encrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, uint8 *res)
{ {
ossldata *od = c->ptr; ossldata *od = c->ptr;
...@@ -190,7 +190,7 @@ gen_evp_encrypt(PX_Cipher * c, const uint8 *data, uint dlen, uint8 *res) ...@@ -190,7 +190,7 @@ gen_evp_encrypt(PX_Cipher * c, const uint8 *data, uint dlen, uint8 *res)
} }
static int static int
gen_evp_decrypt(PX_Cipher * c, const uint8 *data, uint dlen, uint8 *res) gen_evp_decrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, uint8 *res)
{ {
ossldata *od = c->ptr; ossldata *od = c->ptr;
...@@ -203,7 +203,7 @@ gen_evp_decrypt(PX_Cipher * c, const uint8 *data, uint dlen, uint8 *res) ...@@ -203,7 +203,7 @@ gen_evp_decrypt(PX_Cipher * c, const uint8 *data, uint dlen, uint8 *res)
/* Blowfish */ /* Blowfish */
static int static int
bf_init(PX_Cipher * c, const uint8 *key, uint klen, const uint8 *iv) bf_init(PX_Cipher * c, const uint8 *key, unsigned klen, const uint8 *iv)
{ {
ossldata *od = c->ptr; ossldata *od = c->ptr;
...@@ -217,9 +217,9 @@ bf_init(PX_Cipher * c, const uint8 *key, uint klen, const uint8 *iv) ...@@ -217,9 +217,9 @@ bf_init(PX_Cipher * c, const uint8 *key, uint klen, const uint8 *iv)
} }
static int static int
bf_ecb_encrypt(PX_Cipher * c, const uint8 *data, uint dlen, uint8 *res) bf_ecb_encrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, uint8 *res)
{ {
uint bs = gen_evp_block_size(c), unsigned bs = gen_evp_block_size(c),
i; i;
ossldata *od = c->ptr; ossldata *od = c->ptr;
...@@ -229,9 +229,9 @@ bf_ecb_encrypt(PX_Cipher * c, const uint8 *data, uint dlen, uint8 *res) ...@@ -229,9 +229,9 @@ bf_ecb_encrypt(PX_Cipher * c, const uint8 *data, uint dlen, uint8 *res)
} }
static int static int
bf_ecb_decrypt(PX_Cipher * c, const uint8 *data, uint dlen, uint8 *res) bf_ecb_decrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, uint8 *res)
{ {
uint bs = gen_evp_block_size(c), unsigned bs = gen_evp_block_size(c),
i; i;
ossldata *od = c->ptr; ossldata *od = c->ptr;
...@@ -241,7 +241,7 @@ bf_ecb_decrypt(PX_Cipher * c, const uint8 *data, uint dlen, uint8 *res) ...@@ -241,7 +241,7 @@ bf_ecb_decrypt(PX_Cipher * c, const uint8 *data, uint dlen, uint8 *res)
} }
static int static int
bf_cbc_encrypt(PX_Cipher * c, const uint8 *data, uint dlen, uint8 *res) bf_cbc_encrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, uint8 *res)
{ {
ossldata *od = c->ptr; ossldata *od = c->ptr;
...@@ -250,7 +250,7 @@ bf_cbc_encrypt(PX_Cipher * c, const uint8 *data, uint dlen, uint8 *res) ...@@ -250,7 +250,7 @@ bf_cbc_encrypt(PX_Cipher * c, const uint8 *data, uint dlen, uint8 *res)
} }
static int static int
bf_cbc_decrypt(PX_Cipher * c, const uint8 *data, uint dlen, uint8 *res) bf_cbc_decrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, uint8 *res)
{ {
ossldata *od = c->ptr; ossldata *od = c->ptr;
...@@ -259,7 +259,7 @@ bf_cbc_decrypt(PX_Cipher * c, const uint8 *data, uint dlen, uint8 *res) ...@@ -259,7 +259,7 @@ bf_cbc_decrypt(PX_Cipher * c, const uint8 *data, uint dlen, uint8 *res)
} }
static int static int
bf_cfb64_encrypt(PX_Cipher * c, const uint8 *data, uint dlen, uint8 *res) bf_cfb64_encrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, uint8 *res)
{ {
ossldata *od = c->ptr; ossldata *od = c->ptr;
...@@ -269,7 +269,7 @@ bf_cfb64_encrypt(PX_Cipher * c, const uint8 *data, uint dlen, uint8 *res) ...@@ -269,7 +269,7 @@ bf_cfb64_encrypt(PX_Cipher * c, const uint8 *data, uint dlen, uint8 *res)
} }
static int static int
bf_cfb64_decrypt(PX_Cipher * c, const uint8 *data, uint dlen, uint8 *res) bf_cfb64_decrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, uint8 *res)
{ {
ossldata *od = c->ptr; ossldata *od = c->ptr;
...@@ -279,7 +279,7 @@ bf_cfb64_decrypt(PX_Cipher * c, const uint8 *data, uint dlen, uint8 *res) ...@@ -279,7 +279,7 @@ bf_cfb64_decrypt(PX_Cipher * c, const uint8 *data, uint dlen, uint8 *res)
} }
static int static int
bf_ofb64_encrypt(PX_Cipher * c, const uint8 *data, uint dlen, uint8 *res) bf_ofb64_encrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, uint8 *res)
{ {
ossldata *od = c->ptr; ossldata *od = c->ptr;
...@@ -288,7 +288,7 @@ bf_ofb64_encrypt(PX_Cipher * c, const uint8 *data, uint dlen, uint8 *res) ...@@ -288,7 +288,7 @@ bf_ofb64_encrypt(PX_Cipher * c, const uint8 *data, uint dlen, uint8 *res)
} }
static int static int
bf_ofb64_decrypt(PX_Cipher * c, const uint8 *data, uint dlen, uint8 *res) bf_ofb64_decrypt(PX_Cipher * c, const uint8 *data, unsigned dlen, uint8 *res)
{ {
ossldata *od = c->ptr; ossldata *od = c->ptr;
...@@ -371,7 +371,7 @@ static PX_Cipher gen_evp_handler = { ...@@ -371,7 +371,7 @@ static PX_Cipher gen_evp_handler = {
static int px_openssl_initialized = 0; static int px_openssl_initialized = 0;
/* ATM not needed /* ATM not needed
static void *o_alloc(uint s) { return px_alloc(s); } static void *o_alloc(unsigned s) { return px_alloc(s); }
static void *o_realloc(void *p) { return px_realloc(p); } static void *o_realloc(void *p) { return px_realloc(p); }
static void o_free(void *p) { px_free(p); } static void o_free(void *p) { px_free(p); }
*/ */
...@@ -416,7 +416,7 @@ px_find_digest(const char *name, PX_MD ** res) ...@@ -416,7 +416,7 @@ px_find_digest(const char *name, PX_MD ** res)
int int
px_find_cipher(const char *name, PX_Cipher ** res) px_find_cipher(const char *name, PX_Cipher ** res)
{ {
uint i; unsigned i;
PX_Cipher *c = NULL, PX_Cipher *c = NULL,
*csrc; *csrc;
ossldata *od; ossldata *od;
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* $Id: pgcrypto.c,v 1.10 2001/10/25 05:49:19 momjian Exp $ * $Id: pgcrypto.c,v 1.11 2001/11/20 15:50:53 momjian Exp $
*/ */
#include <postgres.h> #include <postgres.h>
...@@ -51,7 +51,7 @@ pg_digest(PG_FUNCTION_ARGS) ...@@ -51,7 +51,7 @@ pg_digest(PG_FUNCTION_ARGS)
{ {
bytea *arg; bytea *arg;
text *name; text *name;
uint len, unsigned len,
hlen; hlen;
PX_MD *md; PX_MD *md;
bytea *res; bytea *res;
...@@ -117,7 +117,7 @@ pg_hmac(PG_FUNCTION_ARGS) ...@@ -117,7 +117,7 @@ pg_hmac(PG_FUNCTION_ARGS)
bytea *arg; bytea *arg;
bytea *key; bytea *key;
text *name; text *name;
uint len, unsigned len,
hlen, hlen,
klen; klen;
PX_HMAC *h; PX_HMAC *h;
...@@ -187,7 +187,7 @@ Datum ...@@ -187,7 +187,7 @@ Datum
pg_gen_salt(PG_FUNCTION_ARGS) pg_gen_salt(PG_FUNCTION_ARGS)
{ {
text *arg0; text *arg0;
uint len; unsigned len;
text *res; text *res;
char buf[PX_MAX_SALT_LEN + 1]; char buf[PX_MAX_SALT_LEN + 1];
...@@ -221,7 +221,7 @@ pg_gen_salt_rounds(PG_FUNCTION_ARGS) ...@@ -221,7 +221,7 @@ pg_gen_salt_rounds(PG_FUNCTION_ARGS)
{ {
text *arg0; text *arg0;
int rounds; int rounds;
uint len; unsigned len;
text *res; text *res;
char buf[PX_MAX_SALT_LEN + 1]; char buf[PX_MAX_SALT_LEN + 1];
...@@ -256,7 +256,7 @@ pg_crypt(PG_FUNCTION_ARGS) ...@@ -256,7 +256,7 @@ pg_crypt(PG_FUNCTION_ARGS)
{ {
text *arg0; text *arg0;
text *arg1; text *arg1;
uint len0, unsigned len0,
len1, len1,
clen; clen;
char *buf0, char *buf0,
...@@ -319,7 +319,7 @@ pg_encrypt(PG_FUNCTION_ARGS) ...@@ -319,7 +319,7 @@ pg_encrypt(PG_FUNCTION_ARGS)
*res; *res;
text *type; text *type;
PX_Combo *c; PX_Combo *c;
uint dlen, unsigned dlen,
klen, klen,
rlen; rlen;
...@@ -368,7 +368,7 @@ pg_decrypt(PG_FUNCTION_ARGS) ...@@ -368,7 +368,7 @@ pg_decrypt(PG_FUNCTION_ARGS)
*res; *res;
text *type; text *type;
PX_Combo *c; PX_Combo *c;
uint dlen, unsigned dlen,
klen, klen,
rlen; rlen;
...@@ -417,7 +417,7 @@ pg_encrypt_iv(PG_FUNCTION_ARGS) ...@@ -417,7 +417,7 @@ pg_encrypt_iv(PG_FUNCTION_ARGS)
*res; *res;
text *type; text *type;
PX_Combo *c; PX_Combo *c;
uint dlen, unsigned dlen,
klen, klen,
ivlen, ivlen,
rlen; rlen;
...@@ -471,7 +471,7 @@ pg_decrypt_iv(PG_FUNCTION_ARGS) ...@@ -471,7 +471,7 @@ pg_decrypt_iv(PG_FUNCTION_ARGS)
*res; *res;
text *type; text *type;
PX_Combo *c; PX_Combo *c;
uint dlen, unsigned dlen,
klen, klen,
rlen, rlen,
ivlen; ivlen;
...@@ -542,8 +542,8 @@ find_provider(text *name, ...@@ -542,8 +542,8 @@ find_provider(text *name,
void *res; void *res;
char buf[PX_MAX_NAMELEN + 1], char buf[PX_MAX_NAMELEN + 1],
*p; *p;
uint len; unsigned len;
uint i; unsigned i;
int err; int err;
len = VARSIZE(name) - VARHDRSZ; len = VARSIZE(name) - VARHDRSZ;
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* $Id: px-hmac.c,v 1.2 2001/10/25 05:49:20 momjian Exp $ * $Id: px-hmac.c,v 1.3 2001/11/20 15:50:53 momjian Exp $
*/ */
...@@ -50,9 +50,9 @@ hmac_block_size(PX_HMAC * h) ...@@ -50,9 +50,9 @@ hmac_block_size(PX_HMAC * h)
} }
static void static void
hmac_init(PX_HMAC * h, const uint8 *key, uint klen) hmac_init(PX_HMAC * h, const uint8 *key, unsigned klen)
{ {
uint bs, unsigned bs,
hlen, hlen,
i; i;
uint8 *keybuf; uint8 *keybuf;
...@@ -88,14 +88,14 @@ static void ...@@ -88,14 +88,14 @@ static void
hmac_reset(PX_HMAC * h) hmac_reset(PX_HMAC * h)
{ {
PX_MD *md = h->md; PX_MD *md = h->md;
uint bs = px_md_block_size(md); unsigned bs = px_md_block_size(md);
px_md_reset(md); px_md_reset(md);
px_md_update(md, h->p.ipad, bs); px_md_update(md, h->p.ipad, bs);
} }
static void static void
hmac_update(PX_HMAC * h, const uint8 *data, uint dlen) hmac_update(PX_HMAC * h, const uint8 *data, unsigned dlen)
{ {
px_md_update(h->md, data, dlen); px_md_update(h->md, data, dlen);
} }
...@@ -104,7 +104,7 @@ static void ...@@ -104,7 +104,7 @@ static void
hmac_finish(PX_HMAC * h, uint8 *dst) hmac_finish(PX_HMAC * h, uint8 *dst)
{ {
PX_MD *md = h->md; PX_MD *md = h->md;
uint bs, unsigned bs,
hlen; hlen;
uint8 *buf; uint8 *buf;
...@@ -127,7 +127,7 @@ hmac_finish(PX_HMAC * h, uint8 *dst) ...@@ -127,7 +127,7 @@ hmac_finish(PX_HMAC * h, uint8 *dst)
static void static void
hmac_free(PX_HMAC * h) hmac_free(PX_HMAC * h)
{ {
uint bs; unsigned bs;
bs = px_md_block_size(h->md); bs = px_md_block_size(h->md);
px_md_free(h->md); px_md_free(h->md);
...@@ -148,7 +148,7 @@ px_find_hmac(const char *name, PX_HMAC ** res) ...@@ -148,7 +148,7 @@ px_find_hmac(const char *name, PX_HMAC ** res)
int err; int err;
PX_MD *md; PX_MD *md;
PX_HMAC *h; PX_HMAC *h;
uint bs; unsigned bs;
err = px_find_digest(name, &md); err = px_find_digest(name, &md);
if (err) if (err)
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* $Id: px.c,v 1.4 2001/11/08 15:56:58 momjian Exp $ * $Id: px.c,v 1.5 2001/11/20 15:50:53 momjian Exp $
*/ */
#include <postgres.h> #include <postgres.h>
...@@ -51,23 +51,23 @@ px_resolve_alias(const PX_Alias * list, const char *name) ...@@ -51,23 +51,23 @@ px_resolve_alias(const PX_Alias * list, const char *name)
*/ */
static uint static uint
combo_encrypt_len(PX_Combo * cx, uint dlen) combo_encrypt_len(PX_Combo * cx, unsigned dlen)
{ {
return dlen + 512; return dlen + 512;
} }
static uint static uint
combo_decrypt_len(PX_Combo * cx, uint dlen) combo_decrypt_len(PX_Combo * cx, unsigned dlen)
{ {
return dlen; return dlen;
} }
static int static int
combo_init(PX_Combo * cx, const uint8 *key, uint klen, combo_init(PX_Combo * cx, const uint8 *key, unsigned klen,
const uint8 *iv, uint ivlen) const uint8 *iv, unsigned ivlen)
{ {
int err; int err;
uint bs, unsigned bs,
ks, ks,
ivs; ivs;
PX_Cipher *c = cx->cipher; PX_Cipher *c = cx->cipher;
...@@ -104,12 +104,12 @@ combo_init(PX_Combo * cx, const uint8 *key, uint klen, ...@@ -104,12 +104,12 @@ combo_init(PX_Combo * cx, const uint8 *key, uint klen,
} }
static int static int
combo_encrypt(PX_Combo * cx, const uint8 *data, uint dlen, combo_encrypt(PX_Combo * cx, const uint8 *data, unsigned dlen,
uint8 *res, uint *rlen) uint8 *res, unsigned *rlen)
{ {
int err = 0; int err = 0;
uint8 *bbuf; uint8 *bbuf;
uint bs, unsigned bs,
maxlen, maxlen,
bpos, bpos,
i, i,
...@@ -175,13 +175,13 @@ out: ...@@ -175,13 +175,13 @@ out:
} }
static int static int
combo_decrypt(PX_Combo * cx, const uint8 *data, uint dlen, combo_decrypt(PX_Combo * cx, const uint8 *data, unsigned dlen,
uint8 *res, uint *rlen) uint8 *res, unsigned *rlen)
{ {
uint bs, unsigned bs,
i, i,
pad; pad;
uint pad_ok; unsigned pad_ok;
PX_Cipher *c = cx->cipher; PX_Cipher *c = cx->cipher;
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* $Id: px.h,v 1.4 2001/11/05 17:46:23 momjian Exp $ * $Id: px.h,v 1.5 2001/11/20 15:50:53 momjian Exp $
*/ */
#ifndef __PX_H #ifndef __PX_H
...@@ -64,16 +64,16 @@ typedef struct px_combo PX_Combo; ...@@ -64,16 +64,16 @@ typedef struct px_combo PX_Combo;
struct px_digest struct px_digest
{ {
uint (*result_size) (PX_MD * h); unsigned (*result_size) (PX_MD * h);
uint (*block_size) (PX_MD * h); unsigned (*block_size) (PX_MD * h);
void (*reset) (PX_MD * h); void (*reset) (PX_MD * h);
void (*update) (PX_MD * h, const uint8 *data, uint dlen); void (*update) (PX_MD * h, const uint8 *data, unsigned dlen);
void (*finish) (PX_MD * h, uint8 *dst); void (*finish) (PX_MD * h, uint8 *dst);
void (*free) (PX_MD * h); void (*free) (PX_MD * h);
/* private */ /* private */
union union
{ {
uint code; unsigned code;
const void *ptr; const void *ptr;
} p; } p;
}; };
...@@ -86,13 +86,13 @@ struct px_alias ...@@ -86,13 +86,13 @@ struct px_alias
struct px_hmac struct px_hmac
{ {
uint (*result_size) (PX_HMAC * h); unsigned (*result_size) (PX_HMAC * h);
uint (*block_size) (PX_HMAC * h); unsigned (*block_size) (PX_HMAC * h);
void (*reset) (PX_HMAC * h); void (*reset) (PX_HMAC * h);
void (*update) (PX_HMAC * h, const uint8 *data, uint dlen); void (*update) (PX_HMAC * h, const uint8 *data, unsigned dlen);
void (*finish) (PX_HMAC * h, uint8 *dst); void (*finish) (PX_HMAC * h, uint8 *dst);
void (*free) (PX_HMAC * h); void (*free) (PX_HMAC * h);
void (*init) (PX_HMAC * h, const uint8 *key, uint klen); void (*init) (PX_HMAC * h, const uint8 *key, unsigned klen);
PX_MD *md; PX_MD *md;
/* private */ /* private */
...@@ -105,13 +105,13 @@ struct px_hmac ...@@ -105,13 +105,13 @@ struct px_hmac
struct px_cipher struct px_cipher
{ {
uint (*block_size) (PX_Cipher * c); unsigned (*block_size) (PX_Cipher * c);
uint (*key_size) (PX_Cipher * c); /* max key len */ unsigned (*key_size) (PX_Cipher * c); /* max key len */
uint (*iv_size) (PX_Cipher * c); unsigned (*iv_size) (PX_Cipher * c);
int (*init) (PX_Cipher * c, const uint8 *key, uint klen, const uint8 *iv); int (*init) (PX_Cipher * c, const uint8 *key, unsigned klen, const uint8 *iv);
int (*encrypt) (PX_Cipher * c, const uint8 *data, uint dlen, uint8 *res); int (*encrypt) (PX_Cipher * c, const uint8 *data, unsigned dlen, uint8 *res);
int (*decrypt) (PX_Cipher * c, const uint8 *data, uint dlen, uint8 *res); int (*decrypt) (PX_Cipher * c, const uint8 *data, unsigned dlen, uint8 *res);
void (*free) (PX_Cipher * c); void (*free) (PX_Cipher * c);
/* private */ /* private */
void *ptr; void *ptr;
...@@ -120,18 +120,18 @@ struct px_cipher ...@@ -120,18 +120,18 @@ struct px_cipher
struct px_combo struct px_combo
{ {
int (*init) (PX_Combo * cx, const uint8 *key, uint klen, int (*init) (PX_Combo * cx, const uint8 *key, unsigned klen,
const uint8 *iv, uint ivlen); const uint8 *iv, unsigned ivlen);
int (*encrypt) (PX_Combo * cx, const uint8 *data, uint dlen, int (*encrypt) (PX_Combo * cx, const uint8 *data, unsigned dlen,
uint8 *res, uint *rlen); uint8 *res, unsigned *rlen);
int (*decrypt) (PX_Combo * cx, const uint8 *data, uint dlen, int (*decrypt) (PX_Combo * cx, const uint8 *data, unsigned dlen,
uint8 *res, uint *rlen); uint8 *res, unsigned *rlen);
uint (*encrypt_len) (PX_Combo * cx, uint dlen); unsigned (*encrypt_len) (PX_Combo * cx, unsigned dlen);
uint (*decrypt_len) (PX_Combo * cx, uint dlen); unsigned (*decrypt_len) (PX_Combo * cx, unsigned dlen);
void (*free) (PX_Combo * cx); void (*free) (PX_Combo * cx);
PX_Cipher *cipher; PX_Cipher *cipher;
uint padding; unsigned padding;
}; };
int px_find_digest(const char *name, PX_MD ** res); int px_find_digest(const char *name, PX_MD ** res);
......
...@@ -492,7 +492,7 @@ rijndael_decrypt(rijndael_ctx * ctx, const u4byte * in_blk, u4byte * out_blk) ...@@ -492,7 +492,7 @@ rijndael_decrypt(rijndael_ctx * ctx, const u4byte * in_blk, u4byte * out_blk)
*/ */
void void
aes_set_key(rijndael_ctx * ctx, const uint8 *key, uint keybits, int enc) aes_set_key(rijndael_ctx * ctx, const uint8 *key, unsigned keybits, int enc)
{ {
uint32 *k; uint32 *k;
......
...@@ -48,7 +48,7 @@ void rijndael_decrypt(rijndael_ctx *, const u4byte *, u4byte *); ...@@ -48,7 +48,7 @@ void rijndael_decrypt(rijndael_ctx *, const u4byte *, u4byte *);
/* conventional interface */ /* conventional interface */
void aes_set_key(rijndael_ctx * ctx, const uint8 *key, uint keybits, int enc); 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_encrypt(rijndael_ctx * ctx, uint8 *data, unsigned len);
void aes_ecb_decrypt(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_encrypt(rijndael_ctx * ctx, uint8 *iva, uint8 *data, unsigned len);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment