mirror of
https://github.com/postgres/postgres.git
synced 2025-05-12 00:01:58 -04:00
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
This commit is contained in:
parent
01e0dae689
commit
540155b777
@ -26,7 +26,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* 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)
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
@ -137,7 +137,7 @@ int_sha1_block_len(PX_MD * h)
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
@ -225,7 +225,7 @@ struct int_ctx
|
||||
blf_ctx bf;
|
||||
rijndael_ctx rj;
|
||||
} ctx;
|
||||
uint keylen;
|
||||
unsigned keylen;
|
||||
int is_init;
|
||||
int mode;
|
||||
};
|
||||
@ -269,7 +269,7 @@ rj_iv_size(PX_Cipher * c)
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
@ -298,7 +298,7 @@ rj_real_init(struct int_ctx * cx, int dir)
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
@ -328,7 +328,7 @@ rj_encrypt(PX_Cipher * c, const uint8 *data, uint dlen, uint8 *res)
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
@ -407,7 +407,7 @@ bf_iv_size(PX_Cipher * c)
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
@ -419,7 +419,7 @@ bf_init(PX_Cipher * c, const uint8 *key, uint klen, const uint8 *iv)
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
@ -443,7 +443,7 @@ bf_encrypt(PX_Cipher * c, const uint8 *data, uint dlen, uint8 *res)
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
|
@ -26,7 +26,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* 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>
|
||||
@ -75,7 +75,7 @@ digest_reset(PX_MD * h)
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
@ -86,7 +86,7 @@ static void
|
||||
digest_finish(PX_MD * h, uint8 *dst)
|
||||
{
|
||||
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);
|
||||
uint8 *buf = mhash_end(mh);
|
||||
|
||||
@ -136,7 +136,7 @@ cipher_iv_size(PX_Cipher * c)
|
||||
}
|
||||
|
||||
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;
|
||||
MCRYPT ctx = (MCRYPT) c->ptr;
|
||||
@ -150,7 +150,7 @@ cipher_init(PX_Cipher * c, const uint8 *key, uint klen, const uint8 *iv)
|
||||
}
|
||||
|
||||
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;
|
||||
MCRYPT ctx = (MCRYPT) c->ptr;
|
||||
@ -164,7 +164,7 @@ cipher_encrypt(PX_Cipher * c, const uint8 *data, uint dlen, uint8 *res)
|
||||
}
|
||||
|
||||
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;
|
||||
MCRYPT ctx = (MCRYPT) c->ptr;
|
||||
|
@ -26,7 +26,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* 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>
|
||||
@ -60,7 +60,7 @@ digest_reset(PX_MD * h)
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
@ -108,8 +108,8 @@ typedef struct
|
||||
const EVP_CIPHER *evp_ciph;
|
||||
uint8 key[EVP_MAX_KEY_LENGTH];
|
||||
uint8 iv[EVP_MAX_IV_LENGTH];
|
||||
uint klen;
|
||||
uint init;
|
||||
unsigned klen;
|
||||
unsigned init;
|
||||
} ossldata;
|
||||
|
||||
/* generic EVP */
|
||||
@ -133,7 +133,7 @@ gen_evp_key_size(PX_Cipher * c)
|
||||
static uint
|
||||
gen_evp_iv_size(PX_Cipher * c)
|
||||
{
|
||||
uint ivlen;
|
||||
unsigned ivlen;
|
||||
ossldata *od = (ossldata *) c->ptr;
|
||||
|
||||
ivlen = EVP_CIPHER_iv_length(od->evp_ciph);
|
||||
@ -153,10 +153,10 @@ gen_evp_free(PX_Cipher * c)
|
||||
/* fun */
|
||||
|
||||
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;
|
||||
uint bs = gen_evp_block_size(c);
|
||||
unsigned bs = gen_evp_block_size(c);
|
||||
|
||||
if (iv)
|
||||
memcpy(od->iv, iv, bs);
|
||||
@ -179,7 +179,7 @@ _gen_init(PX_Cipher * c, int enc)
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
@ -190,7 +190,7 @@ gen_evp_encrypt(PX_Cipher * c, const uint8 *data, uint dlen, uint8 *res)
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
@ -203,7 +203,7 @@ gen_evp_decrypt(PX_Cipher * c, const uint8 *data, uint dlen, uint8 *res)
|
||||
/* Blowfish */
|
||||
|
||||
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;
|
||||
|
||||
@ -217,9 +217,9 @@ bf_init(PX_Cipher * c, const uint8 *key, uint klen, const uint8 *iv)
|
||||
}
|
||||
|
||||
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;
|
||||
ossldata *od = c->ptr;
|
||||
|
||||
@ -229,9 +229,9 @@ bf_ecb_encrypt(PX_Cipher * c, const uint8 *data, uint dlen, uint8 *res)
|
||||
}
|
||||
|
||||
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;
|
||||
ossldata *od = c->ptr;
|
||||
|
||||
@ -241,7 +241,7 @@ bf_ecb_decrypt(PX_Cipher * c, const uint8 *data, uint dlen, uint8 *res)
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
@ -250,7 +250,7 @@ bf_cbc_encrypt(PX_Cipher * c, const uint8 *data, uint dlen, uint8 *res)
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
@ -259,7 +259,7 @@ bf_cbc_decrypt(PX_Cipher * c, const uint8 *data, uint dlen, uint8 *res)
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
@ -269,7 +269,7 @@ bf_cfb64_encrypt(PX_Cipher * c, const uint8 *data, uint dlen, uint8 *res)
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
@ -279,7 +279,7 @@ bf_cfb64_decrypt(PX_Cipher * c, const uint8 *data, uint dlen, uint8 *res)
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
@ -288,7 +288,7 @@ bf_ofb64_encrypt(PX_Cipher * c, const uint8 *data, uint dlen, uint8 *res)
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
@ -371,7 +371,7 @@ static PX_Cipher gen_evp_handler = {
|
||||
static int px_openssl_initialized = 0;
|
||||
|
||||
/* 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_free(void *p) { px_free(p); }
|
||||
*/
|
||||
@ -416,7 +416,7 @@ px_find_digest(const char *name, PX_MD ** res)
|
||||
int
|
||||
px_find_cipher(const char *name, PX_Cipher ** res)
|
||||
{
|
||||
uint i;
|
||||
unsigned i;
|
||||
PX_Cipher *c = NULL,
|
||||
*csrc;
|
||||
ossldata *od;
|
||||
|
@ -26,7 +26,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* 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>
|
||||
@ -51,7 +51,7 @@ pg_digest(PG_FUNCTION_ARGS)
|
||||
{
|
||||
bytea *arg;
|
||||
text *name;
|
||||
uint len,
|
||||
unsigned len,
|
||||
hlen;
|
||||
PX_MD *md;
|
||||
bytea *res;
|
||||
@ -117,7 +117,7 @@ pg_hmac(PG_FUNCTION_ARGS)
|
||||
bytea *arg;
|
||||
bytea *key;
|
||||
text *name;
|
||||
uint len,
|
||||
unsigned len,
|
||||
hlen,
|
||||
klen;
|
||||
PX_HMAC *h;
|
||||
@ -187,7 +187,7 @@ Datum
|
||||
pg_gen_salt(PG_FUNCTION_ARGS)
|
||||
{
|
||||
text *arg0;
|
||||
uint len;
|
||||
unsigned len;
|
||||
text *res;
|
||||
char buf[PX_MAX_SALT_LEN + 1];
|
||||
|
||||
@ -221,7 +221,7 @@ pg_gen_salt_rounds(PG_FUNCTION_ARGS)
|
||||
{
|
||||
text *arg0;
|
||||
int rounds;
|
||||
uint len;
|
||||
unsigned len;
|
||||
text *res;
|
||||
char buf[PX_MAX_SALT_LEN + 1];
|
||||
|
||||
@ -256,7 +256,7 @@ pg_crypt(PG_FUNCTION_ARGS)
|
||||
{
|
||||
text *arg0;
|
||||
text *arg1;
|
||||
uint len0,
|
||||
unsigned len0,
|
||||
len1,
|
||||
clen;
|
||||
char *buf0,
|
||||
@ -319,7 +319,7 @@ pg_encrypt(PG_FUNCTION_ARGS)
|
||||
*res;
|
||||
text *type;
|
||||
PX_Combo *c;
|
||||
uint dlen,
|
||||
unsigned dlen,
|
||||
klen,
|
||||
rlen;
|
||||
|
||||
@ -368,7 +368,7 @@ pg_decrypt(PG_FUNCTION_ARGS)
|
||||
*res;
|
||||
text *type;
|
||||
PX_Combo *c;
|
||||
uint dlen,
|
||||
unsigned dlen,
|
||||
klen,
|
||||
rlen;
|
||||
|
||||
@ -417,7 +417,7 @@ pg_encrypt_iv(PG_FUNCTION_ARGS)
|
||||
*res;
|
||||
text *type;
|
||||
PX_Combo *c;
|
||||
uint dlen,
|
||||
unsigned dlen,
|
||||
klen,
|
||||
ivlen,
|
||||
rlen;
|
||||
@ -471,7 +471,7 @@ pg_decrypt_iv(PG_FUNCTION_ARGS)
|
||||
*res;
|
||||
text *type;
|
||||
PX_Combo *c;
|
||||
uint dlen,
|
||||
unsigned dlen,
|
||||
klen,
|
||||
rlen,
|
||||
ivlen;
|
||||
@ -542,8 +542,8 @@ find_provider(text *name,
|
||||
void *res;
|
||||
char buf[PX_MAX_NAMELEN + 1],
|
||||
*p;
|
||||
uint len;
|
||||
uint i;
|
||||
unsigned len;
|
||||
unsigned i;
|
||||
int err;
|
||||
|
||||
len = VARSIZE(name) - VARHDRSZ;
|
||||
|
@ -26,7 +26,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* 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)
|
||||
}
|
||||
|
||||
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,
|
||||
i;
|
||||
uint8 *keybuf;
|
||||
@ -88,14 +88,14 @@ static void
|
||||
hmac_reset(PX_HMAC * h)
|
||||
{
|
||||
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_update(md, h->p.ipad, bs);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
@ -104,7 +104,7 @@ static void
|
||||
hmac_finish(PX_HMAC * h, uint8 *dst)
|
||||
{
|
||||
PX_MD *md = h->md;
|
||||
uint bs,
|
||||
unsigned bs,
|
||||
hlen;
|
||||
uint8 *buf;
|
||||
|
||||
@ -127,7 +127,7 @@ hmac_finish(PX_HMAC * h, uint8 *dst)
|
||||
static void
|
||||
hmac_free(PX_HMAC * h)
|
||||
{
|
||||
uint bs;
|
||||
unsigned bs;
|
||||
|
||||
bs = px_md_block_size(h->md);
|
||||
px_md_free(h->md);
|
||||
@ -148,7 +148,7 @@ px_find_hmac(const char *name, PX_HMAC ** res)
|
||||
int err;
|
||||
PX_MD *md;
|
||||
PX_HMAC *h;
|
||||
uint bs;
|
||||
unsigned bs;
|
||||
|
||||
err = px_find_digest(name, &md);
|
||||
if (err)
|
||||
|
@ -26,7 +26,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* 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>
|
||||
@ -51,23 +51,23 @@ px_resolve_alias(const PX_Alias * list, const char *name)
|
||||
*/
|
||||
|
||||
static uint
|
||||
combo_encrypt_len(PX_Combo * cx, uint dlen)
|
||||
combo_encrypt_len(PX_Combo * cx, unsigned dlen)
|
||||
{
|
||||
return dlen + 512;
|
||||
}
|
||||
|
||||
static uint
|
||||
combo_decrypt_len(PX_Combo * cx, uint dlen)
|
||||
combo_decrypt_len(PX_Combo * cx, unsigned dlen)
|
||||
{
|
||||
return dlen;
|
||||
}
|
||||
|
||||
static int
|
||||
combo_init(PX_Combo * cx, const uint8 *key, uint klen,
|
||||
const uint8 *iv, uint ivlen)
|
||||
combo_init(PX_Combo * cx, const uint8 *key, unsigned klen,
|
||||
const uint8 *iv, unsigned ivlen)
|
||||
{
|
||||
int err;
|
||||
uint bs,
|
||||
unsigned bs,
|
||||
ks,
|
||||
ivs;
|
||||
PX_Cipher *c = cx->cipher;
|
||||
@ -104,12 +104,12 @@ combo_init(PX_Combo * cx, const uint8 *key, uint klen,
|
||||
}
|
||||
|
||||
static int
|
||||
combo_encrypt(PX_Combo * cx, const uint8 *data, uint dlen,
|
||||
uint8 *res, uint *rlen)
|
||||
combo_encrypt(PX_Combo * cx, const uint8 *data, unsigned dlen,
|
||||
uint8 *res, unsigned *rlen)
|
||||
{
|
||||
int err = 0;
|
||||
uint8 *bbuf;
|
||||
uint bs,
|
||||
unsigned bs,
|
||||
maxlen,
|
||||
bpos,
|
||||
i,
|
||||
@ -175,13 +175,13 @@ out:
|
||||
}
|
||||
|
||||
static int
|
||||
combo_decrypt(PX_Combo * cx, const uint8 *data, uint dlen,
|
||||
uint8 *res, uint *rlen)
|
||||
combo_decrypt(PX_Combo * cx, const uint8 *data, unsigned dlen,
|
||||
uint8 *res, unsigned *rlen)
|
||||
{
|
||||
uint bs,
|
||||
unsigned bs,
|
||||
i,
|
||||
pad;
|
||||
uint pad_ok;
|
||||
unsigned pad_ok;
|
||||
|
||||
PX_Cipher *c = cx->cipher;
|
||||
|
||||
|
@ -26,7 +26,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* 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
|
||||
@ -64,16 +64,16 @@ typedef struct px_combo PX_Combo;
|
||||
|
||||
struct px_digest
|
||||
{
|
||||
uint (*result_size) (PX_MD * h);
|
||||
uint (*block_size) (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, uint dlen);
|
||||
void (*update) (PX_MD * h, const uint8 *data, unsigned dlen);
|
||||
void (*finish) (PX_MD * h, uint8 *dst);
|
||||
void (*free) (PX_MD * h);
|
||||
/* private */
|
||||
union
|
||||
{
|
||||
uint code;
|
||||
unsigned code;
|
||||
const void *ptr;
|
||||
} p;
|
||||
};
|
||||
@ -86,13 +86,13 @@ struct px_alias
|
||||
|
||||
struct px_hmac
|
||||
{
|
||||
uint (*result_size) (PX_HMAC * h);
|
||||
uint (*block_size) (PX_HMAC * h);
|
||||
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, uint dlen);
|
||||
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, uint klen);
|
||||
void (*init) (PX_HMAC * h, const uint8 *key, unsigned klen);
|
||||
|
||||
PX_MD *md;
|
||||
/* private */
|
||||
@ -105,13 +105,13 @@ struct px_hmac
|
||||
|
||||
struct px_cipher
|
||||
{
|
||||
uint (*block_size) (PX_Cipher * c);
|
||||
uint (*key_size) (PX_Cipher * c); /* max key len */
|
||||
uint (*iv_size) (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, uint klen, const uint8 *iv);
|
||||
int (*encrypt) (PX_Cipher * c, const uint8 *data, uint dlen, uint8 *res);
|
||||
int (*decrypt) (PX_Cipher * c, const uint8 *data, uint 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);
|
||||
void (*free) (PX_Cipher * c);
|
||||
/* private */
|
||||
void *ptr;
|
||||
@ -120,18 +120,18 @@ struct px_cipher
|
||||
|
||||
struct px_combo
|
||||
{
|
||||
int (*init) (PX_Combo * cx, const uint8 *key, uint klen,
|
||||
const uint8 *iv, uint ivlen);
|
||||
int (*encrypt) (PX_Combo * cx, const uint8 *data, uint dlen,
|
||||
uint8 *res, uint *rlen);
|
||||
int (*decrypt) (PX_Combo * cx, const uint8 *data, uint dlen,
|
||||
uint8 *res, uint *rlen);
|
||||
uint (*encrypt_len) (PX_Combo * cx, uint dlen);
|
||||
uint (*decrypt_len) (PX_Combo * cx, uint dlen);
|
||||
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,
|
||||
uint8 *res, unsigned *rlen);
|
||||
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);
|
||||
|
||||
PX_Cipher *cipher;
|
||||
uint padding;
|
||||
unsigned padding;
|
||||
};
|
||||
|
||||
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)
|
||||
*/
|
||||
|
||||
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;
|
||||
|
||||
|
@ -48,7 +48,7 @@ void rijndael_decrypt(rijndael_ctx *, const u4byte *, u4byte *);
|
||||
|
||||
/* 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_decrypt(rijndael_ctx * ctx, uint8 *data, unsigned len);
|
||||
void aes_cbc_encrypt(rijndael_ctx * ctx, uint8 *iva, uint8 *data, unsigned len);
|
||||
|
Loading…
x
Reference in New Issue
Block a user