[git] GCRYPT - branch, master, updated. libgcrypt-1.5.0-384-gb787657
by Jussi Kivilinna
cvs at cvs.gnupg.org
Mon Nov 18 14:40:14 CET 2013
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "The GNU crypto library".
The branch, master has been updated
via b787657a9d2c1d8e19f9fcb0b21e31cb062630cf (commit)
from ef9f52cbb39e46918c96200b09c21e931eff174f (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit b787657a9d2c1d8e19f9fcb0b21e31cb062630cf
Author: Jussi Kivilinna <jussi.kivilinna at iki.fi>
Date: Fri Nov 15 16:23:00 2013 +0200
cipher: use size_t for internal buffer lengths
* cipher/arcfour.c (do_encrypt_stream, encrypt_stream): Use 'size_t'
for buffer lengths.
* cipher/blowfish.c (_gcry_blowfish_ctr_enc, _gcry_blowfish_cbc_dec)
(_gcry_blowfish_cfb_dec): Ditto.
* cipher/camellia-glue.c (_gcry_camellia_ctr_enc)
(_gcry_camellia_cbc_dec, _gcry_blowfish_cfb_dec): Ditto.
* cipher/cast5.c (_gcry_cast5_ctr_enc, _gcry_cast5_cbc_dec)
(_gcry_cast5_cfb_dec): Ditto.
* cipher/cipher-aeswrap.c (_gcry_cipher_aeswrap_encrypt)
(_gcry_cipher_aeswrap_decrypt): Ditto.
* cipher/cipher-cbc.c (_gcry_cipher_cbc_encrypt)
(_gcry_cipher_cbc_decrypt): Ditto.
* cipher/cipher-ccm.c (_gcry_cipher_ccm_encrypt)
(_gcry_cipher_ccm_decrypt): Ditto.
* cipher/cipher-cfb.c (_gcry_cipher_cfb_encrypt)
(_gcry_cipher_cfb_decrypt): Ditto.
* cipher/cipher-ctr.c (_gcry_cipher_ctr_encrypt): Ditto.
* cipher/cipher-internal.h (gcry_cipher_handle->bulk)
(_gcry_cipher_cbc_encrypt, _gcry_cipher_cbc_decrypt)
(_gcry_cipher_cfb_encrypt, _gcry_cipher_cfb_decrypt)
(_gcry_cipher_ofb_encrypt, _gcry_cipher_ctr_encrypt)
(_gcry_cipher_aeswrap_encrypt, _gcry_cipher_aeswrap_decrypt)
(_gcry_cipher_ccm_encrypt, _gcry_cipher_ccm_decrypt): Ditto.
* cipher/cipher-ofb.c (_gcry_cipher_cbc_encrypt): Ditto.
* cipher/cipher-selftest.h (gcry_cipher_bulk_cbc_dec_t)
(gcry_cipher_bulk_cfb_dec_t, gcry_cipher_bulk_ctr_enc_t): Ditto.
* cipher/cipher.c (cipher_setkey, cipher_setiv, do_ecb_crypt)
(do_ecb_encrypt, do_ecb_decrypt, cipher_encrypt)
(cipher_decrypt): Ditto.
* cipher/rijndael.c (_gcry_aes_ctr_enc, _gcry_aes_cbc_dec)
(_gcry_aes_cfb_dec, _gcry_aes_cbc_enc, _gcry_aes_cfb_enc): Ditto.
* cipher/salsa20.c (salsa20_setiv, salsa20_do_encrypt_stream)
(salsa20_encrypt_stream, salsa20r12_encrypt_stream): Ditto.
* cipher/serpent.c (_gcry_serpent_ctr_enc, _gcry_serpent_cbc_dec)
(_gcry_serpent_cfb_dec): Ditto.
* cipher/twofish.c (_gcry_twofish_ctr_enc, _gcry_twofish_cbc_dec)
(_gcry_twofish_cfb_dec): Ditto.
* src/cipher-proto.h (gcry_cipher_stencrypt_t)
(gcry_cipher_stdecrypt_t, cipher_setiv_fuct_t): Ditto.
* src/cipher.h (_gcry_aes_cfb_enc, _gcry_aes_cfb_dec)
(_gcry_aes_cbc_enc, _gcry_aes_cbc_dec, _gcry_aes_ctr_enc)
(_gcry_blowfish_cfb_dec, _gcry_blowfish_cbc_dec)
(_gcry_blowfish_ctr_enc, _gcry_cast5_cfb_dec, _gcry_cast5_cbc_dec)
(_gcry_cast5_ctr_enc, _gcry_camellia_cfb_dec, _gcry_camellia_cbc_dec)
(_gcry_camellia_ctr_enc, _gcry_serpent_cfb_dec, _gcry_serpent_cbc_dec)
(_gcry_serpent_ctr_enc, _gcry_twofish_cfb_dec, _gcry_twofish_cbc_dec)
(_gcry_twofish_ctr_enc): Ditto.
--
On 64-bit platforms, cipher module internally converts 64-bit size_t values
to 32-bit unsigned integers.
Signed-off-by: Jussi Kivilinna <jussi.kivilinna at iki.fi>
diff --git a/cipher/arcfour.c b/cipher/arcfour.c
index 64f7204..d692c84 100644
--- a/cipher/arcfour.c
+++ b/cipher/arcfour.c
@@ -40,7 +40,7 @@ typedef struct {
static void
do_encrypt_stream( ARCFOUR_context *ctx,
- byte *outbuf, const byte *inbuf, unsigned int length )
+ byte *outbuf, const byte *inbuf, size_t length )
{
#ifndef __i386__
register unsigned int i = ctx->idx_i;
@@ -89,7 +89,7 @@ do_encrypt_stream( ARCFOUR_context *ctx,
static void
encrypt_stream (void *context,
- byte *outbuf, const byte *inbuf, unsigned int length)
+ byte *outbuf, const byte *inbuf, size_t length)
{
ARCFOUR_context *ctx = (ARCFOUR_context *) context;
do_encrypt_stream (ctx, outbuf, inbuf, length );
diff --git a/cipher/blowfish.c b/cipher/blowfish.c
index 4665a1d..ae470d8 100644
--- a/cipher/blowfish.c
+++ b/cipher/blowfish.c
@@ -588,7 +588,7 @@ decrypt_block (void *context, byte *outbuf, const byte *inbuf)
of size BLOWFISH_BLOCKSIZE. */
void
_gcry_blowfish_ctr_enc(void *context, unsigned char *ctr, void *outbuf_arg,
- const void *inbuf_arg, unsigned int nblocks)
+ const void *inbuf_arg, size_t nblocks)
{
BLOWFISH_context *ctx = context;
unsigned char *outbuf = outbuf_arg;
@@ -658,7 +658,7 @@ _gcry_blowfish_ctr_enc(void *context, unsigned char *ctr, void *outbuf_arg,
intended for the bulk encryption feature of cipher.c. */
void
_gcry_blowfish_cbc_dec(void *context, unsigned char *iv, void *outbuf_arg,
- const void *inbuf_arg, unsigned int nblocks)
+ const void *inbuf_arg, size_t nblocks)
{
BLOWFISH_context *ctx = context;
unsigned char *outbuf = outbuf_arg;
@@ -719,7 +719,7 @@ _gcry_blowfish_cbc_dec(void *context, unsigned char *iv, void *outbuf_arg,
intended for the bulk encryption feature of cipher.c. */
void
_gcry_blowfish_cfb_dec(void *context, unsigned char *iv, void *outbuf_arg,
- const void *inbuf_arg, unsigned int nblocks)
+ const void *inbuf_arg, size_t nblocks)
{
BLOWFISH_context *ctx = context;
unsigned char *outbuf = outbuf_arg;
diff --git a/cipher/camellia-glue.c b/cipher/camellia-glue.c
index 24936ce..575bb04 100644
--- a/cipher/camellia-glue.c
+++ b/cipher/camellia-glue.c
@@ -290,7 +290,7 @@ camellia_decrypt(void *c, byte *outbuf, const byte *inbuf)
void
_gcry_camellia_ctr_enc(void *context, unsigned char *ctr,
void *outbuf_arg, const void *inbuf_arg,
- unsigned int nblocks)
+ size_t nblocks)
{
CAMELLIA_context *ctx = context;
unsigned char *outbuf = outbuf_arg;
@@ -382,7 +382,7 @@ _gcry_camellia_ctr_enc(void *context, unsigned char *ctr,
void
_gcry_camellia_cbc_dec(void *context, unsigned char *iv,
void *outbuf_arg, const void *inbuf_arg,
- unsigned int nblocks)
+ size_t nblocks)
{
CAMELLIA_context *ctx = context;
unsigned char *outbuf = outbuf_arg;
@@ -465,7 +465,7 @@ _gcry_camellia_cbc_dec(void *context, unsigned char *iv,
void
_gcry_camellia_cfb_dec(void *context, unsigned char *iv,
void *outbuf_arg, const void *inbuf_arg,
- unsigned int nblocks)
+ size_t nblocks)
{
CAMELLIA_context *ctx = context;
unsigned char *outbuf = outbuf_arg;
diff --git a/cipher/cast5.c b/cipher/cast5.c
index 09c9691..115e1e6 100644
--- a/cipher/cast5.c
+++ b/cipher/cast5.c
@@ -564,7 +564,7 @@ decrypt_block (void *context, byte *outbuf, const byte *inbuf)
of size CAST5_BLOCKSIZE. */
void
_gcry_cast5_ctr_enc(void *context, unsigned char *ctr, void *outbuf_arg,
- const void *inbuf_arg, unsigned int nblocks)
+ const void *inbuf_arg, size_t nblocks)
{
CAST5_context *ctx = context;
unsigned char *outbuf = outbuf_arg;
@@ -635,7 +635,7 @@ _gcry_cast5_ctr_enc(void *context, unsigned char *ctr, void *outbuf_arg,
intended for the bulk encryption feature of cipher.c. */
void
_gcry_cast5_cbc_dec(void *context, unsigned char *iv, void *outbuf_arg,
- const void *inbuf_arg, unsigned int nblocks)
+ const void *inbuf_arg, size_t nblocks)
{
CAST5_context *ctx = context;
unsigned char *outbuf = outbuf_arg;
@@ -695,7 +695,7 @@ _gcry_cast5_cbc_dec(void *context, unsigned char *iv, void *outbuf_arg,
intended for the bulk encryption feature of cipher.c. */
void
_gcry_cast5_cfb_dec(void *context, unsigned char *iv, void *outbuf_arg,
- const void *inbuf_arg, unsigned int nblocks)
+ const void *inbuf_arg, size_t nblocks)
{
CAST5_context *ctx = context;
unsigned char *outbuf = outbuf_arg;
diff --git a/cipher/cipher-aeswrap.c b/cipher/cipher-aeswrap.c
index 03b0ea7..50ac107 100644
--- a/cipher/cipher-aeswrap.c
+++ b/cipher/cipher-aeswrap.c
@@ -35,11 +35,11 @@
blocksize 128. */
gcry_err_code_t
_gcry_cipher_aeswrap_encrypt (gcry_cipher_hd_t c,
- byte *outbuf, unsigned int outbuflen,
- const byte *inbuf, unsigned int inbuflen )
+ byte *outbuf, size_t outbuflen,
+ const byte *inbuf, size_t inbuflen )
{
int j, x;
- unsigned int n, i;
+ size_t n, i;
unsigned char *r, *a, *b;
unsigned char t[8];
unsigned int burn, nburn;
@@ -117,11 +117,11 @@ _gcry_cipher_aeswrap_encrypt (gcry_cipher_hd_t c,
blocksize 128. */
gcry_err_code_t
_gcry_cipher_aeswrap_decrypt (gcry_cipher_hd_t c,
- byte *outbuf, unsigned int outbuflen,
- const byte *inbuf, unsigned int inbuflen)
+ byte *outbuf, size_t outbuflen,
+ const byte *inbuf, size_t inbuflen)
{
int j, x;
- unsigned int n, i;
+ size_t n, i;
unsigned char *r, *a, *b;
unsigned char t[8];
unsigned int burn, nburn;
diff --git a/cipher/cipher-cbc.c b/cipher/cipher-cbc.c
index 4ad2ebd..4b929da 100644
--- a/cipher/cipher-cbc.c
+++ b/cipher/cipher-cbc.c
@@ -34,15 +34,15 @@
gcry_err_code_t
_gcry_cipher_cbc_encrypt (gcry_cipher_hd_t c,
- unsigned char *outbuf, unsigned int outbuflen,
- const unsigned char *inbuf, unsigned int inbuflen)
+ unsigned char *outbuf, size_t outbuflen,
+ const unsigned char *inbuf, size_t inbuflen)
{
- unsigned int n;
+ size_t n;
unsigned char *ivp;
int i;
size_t blocksize = c->spec->blocksize;
gcry_cipher_encrypt_t enc_fn = c->spec->encrypt;
- unsigned nblocks = inbuflen / blocksize;
+ size_t nblocks = inbuflen / blocksize;
unsigned int burn, nburn;
if (outbuflen < ((c->flags & GCRY_CIPHER_CBC_MAC)? blocksize : inbuflen))
@@ -92,7 +92,7 @@ _gcry_cipher_cbc_encrypt (gcry_cipher_hd_t c,
{
/* We have to be careful here, since outbuf might be equal to
inbuf. */
- int restbytes;
+ size_t restbytes;
unsigned char b;
if ((inbuflen % blocksize) == 0)
@@ -124,14 +124,14 @@ _gcry_cipher_cbc_encrypt (gcry_cipher_hd_t c,
gcry_err_code_t
_gcry_cipher_cbc_decrypt (gcry_cipher_hd_t c,
- unsigned char *outbuf, unsigned int outbuflen,
- const unsigned char *inbuf, unsigned int inbuflen)
+ unsigned char *outbuf, size_t outbuflen,
+ const unsigned char *inbuf, size_t inbuflen)
{
- unsigned int n;
+ size_t n;
int i;
size_t blocksize = c->spec->blocksize;
gcry_cipher_decrypt_t dec_fn = c->spec->decrypt;
- unsigned int nblocks = inbuflen / blocksize;
+ size_t nblocks = inbuflen / blocksize;
unsigned int burn, nburn;
if (outbuflen < inbuflen)
@@ -175,7 +175,7 @@ _gcry_cipher_cbc_decrypt (gcry_cipher_hd_t c,
if ((c->flags & GCRY_CIPHER_CBC_CTS) && inbuflen > blocksize)
{
- int restbytes;
+ size_t restbytes;
if ((inbuflen % blocksize) == 0)
restbytes = blocksize;
diff --git a/cipher/cipher-ccm.c b/cipher/cipher-ccm.c
index ebcbf1e..2a1fc74 100644
--- a/cipher/cipher-ccm.c
+++ b/cipher/cipher-ccm.c
@@ -318,8 +318,8 @@ _gcry_cipher_ccm_check_tag (gcry_cipher_hd_t c, const unsigned char *intag,
gcry_err_code_t
_gcry_cipher_ccm_encrypt (gcry_cipher_hd_t c, unsigned char *outbuf,
- unsigned int outbuflen, const unsigned char *inbuf,
- unsigned int inbuflen)
+ size_t outbuflen, const unsigned char *inbuf,
+ size_t inbuflen)
{
unsigned int burn;
@@ -342,8 +342,8 @@ _gcry_cipher_ccm_encrypt (gcry_cipher_hd_t c, unsigned char *outbuf,
gcry_err_code_t
_gcry_cipher_ccm_decrypt (gcry_cipher_hd_t c, unsigned char *outbuf,
- unsigned int outbuflen, const unsigned char *inbuf,
- unsigned int inbuflen)
+ size_t outbuflen, const unsigned char *inbuf,
+ size_t inbuflen)
{
gcry_err_code_t err;
unsigned int burn;
diff --git a/cipher/cipher-cfb.c b/cipher/cipher-cfb.c
index 610d006..8539f54 100644
--- a/cipher/cipher-cfb.c
+++ b/cipher/cipher-cfb.c
@@ -33,8 +33,8 @@
gcry_err_code_t
_gcry_cipher_cfb_encrypt (gcry_cipher_hd_t c,
- unsigned char *outbuf, unsigned int outbuflen,
- const unsigned char *inbuf, unsigned int inbuflen)
+ unsigned char *outbuf, size_t outbuflen,
+ const unsigned char *inbuf, size_t inbuflen)
{
unsigned char *ivp;
gcry_cipher_encrypt_t enc_fn = c->spec->encrypt;
@@ -73,7 +73,7 @@ _gcry_cipher_cfb_encrypt (gcry_cipher_hd_t c,
also allows to use a bulk encryption function if available. */
if (inbuflen >= blocksize_x_2 && c->bulk.cfb_enc)
{
- unsigned int nblocks = inbuflen / blocksize;
+ size_t nblocks = inbuflen / blocksize;
c->bulk.cfb_enc (&c->context.c, c->u_iv.iv, outbuf, inbuf, nblocks);
outbuf += nblocks * blocksize;
inbuf += nblocks * blocksize;
@@ -130,8 +130,8 @@ _gcry_cipher_cfb_encrypt (gcry_cipher_hd_t c,
gcry_err_code_t
_gcry_cipher_cfb_decrypt (gcry_cipher_hd_t c,
- unsigned char *outbuf, unsigned int outbuflen,
- const unsigned char *inbuf, unsigned int inbuflen)
+ unsigned char *outbuf, size_t outbuflen,
+ const unsigned char *inbuf, size_t inbuflen)
{
unsigned char *ivp;
gcry_cipher_encrypt_t enc_fn = c->spec->encrypt;
@@ -170,7 +170,7 @@ _gcry_cipher_cfb_decrypt (gcry_cipher_hd_t c,
also allows to use a bulk encryption function if available. */
if (inbuflen >= blocksize_x_2 && c->bulk.cfb_dec)
{
- unsigned int nblocks = inbuflen / blocksize;
+ size_t nblocks = inbuflen / blocksize;
c->bulk.cfb_dec (&c->context.c, c->u_iv.iv, outbuf, inbuf, nblocks);
outbuf += nblocks * blocksize;
inbuf += nblocks * blocksize;
diff --git a/cipher/cipher-ctr.c b/cipher/cipher-ctr.c
index 37a6a79..1e7133c 100644
--- a/cipher/cipher-ctr.c
+++ b/cipher/cipher-ctr.c
@@ -33,14 +33,14 @@
gcry_err_code_t
_gcry_cipher_ctr_encrypt (gcry_cipher_hd_t c,
- unsigned char *outbuf, unsigned int outbuflen,
- const unsigned char *inbuf, unsigned int inbuflen)
+ unsigned char *outbuf, size_t outbuflen,
+ const unsigned char *inbuf, size_t inbuflen)
{
- unsigned int n;
+ size_t n;
int i;
gcry_cipher_encrypt_t enc_fn = c->spec->encrypt;
unsigned int blocksize = c->spec->blocksize;
- unsigned int nblocks;
+ size_t nblocks;
unsigned int burn, nburn;
if (outbuflen < inbuflen)
diff --git a/cipher/cipher-internal.h b/cipher/cipher-internal.h
index f528c84..db06823 100644
--- a/cipher/cipher-internal.h
+++ b/cipher/cipher-internal.h
@@ -74,19 +74,19 @@ struct gcry_cipher_handle
struct {
void (*cfb_enc)(void *context, unsigned char *iv,
void *outbuf_arg, const void *inbuf_arg,
- unsigned int nblocks);
+ size_t nblocks);
void (*cfb_dec)(void *context, unsigned char *iv,
void *outbuf_arg, const void *inbuf_arg,
- unsigned int nblocks);
+ size_t nblocks);
void (*cbc_enc)(void *context, unsigned char *iv,
void *outbuf_arg, const void *inbuf_arg,
- unsigned int nblocks, int cbc_mac);
+ size_t nblocks, int cbc_mac);
void (*cbc_dec)(void *context, unsigned char *iv,
void *outbuf_arg, const void *inbuf_arg,
- unsigned int nblocks);
+ size_t nblocks);
void (*ctr_enc)(void *context, unsigned char *iv,
void *outbuf_arg, const void *inbuf_arg,
- unsigned int nblocks);
+ size_t nblocks);
} bulk;
@@ -150,57 +150,57 @@ struct gcry_cipher_handle
/*-- cipher-cbc.c --*/
gcry_err_code_t _gcry_cipher_cbc_encrypt
/* */ (gcry_cipher_hd_t c,
- unsigned char *outbuf, unsigned int outbuflen,
- const unsigned char *inbuf, unsigned int inbuflen);
+ unsigned char *outbuf, size_t outbuflen,
+ const unsigned char *inbuf, size_t inbuflen);
gcry_err_code_t _gcry_cipher_cbc_decrypt
/* */ (gcry_cipher_hd_t c,
- unsigned char *outbuf, unsigned int outbuflen,
- const unsigned char *inbuf, unsigned int inbuflen);
+ unsigned char *outbuf, size_t outbuflen,
+ const unsigned char *inbuf, size_t inbuflen);
/*-- cipher-cfb.c --*/
gcry_err_code_t _gcry_cipher_cfb_encrypt
/* */ (gcry_cipher_hd_t c,
- unsigned char *outbuf, unsigned int outbuflen,
- const unsigned char *inbuf, unsigned int inbuflen);
+ unsigned char *outbuf, size_t outbuflen,
+ const unsigned char *inbuf, size_t inbuflen);
gcry_err_code_t _gcry_cipher_cfb_decrypt
/* */ (gcry_cipher_hd_t c,
- unsigned char *outbuf, unsigned int outbuflen,
- const unsigned char *inbuf, unsigned int inbuflen);
+ unsigned char *outbuf, size_t outbuflen,
+ const unsigned char *inbuf, size_t inbuflen);
/*-- cipher-ofb.c --*/
gcry_err_code_t _gcry_cipher_ofb_encrypt
/* */ (gcry_cipher_hd_t c,
- unsigned char *outbuf, unsigned int outbuflen,
- const unsigned char *inbuf, unsigned int inbuflen);
+ unsigned char *outbuf, size_t outbuflen,
+ const unsigned char *inbuf, size_t inbuflen);
/*-- cipher-ctr.c --*/
gcry_err_code_t _gcry_cipher_ctr_encrypt
/* */ (gcry_cipher_hd_t c,
- unsigned char *outbuf, unsigned int outbuflen,
- const unsigned char *inbuf, unsigned int inbuflen);
+ unsigned char *outbuf, size_t outbuflen,
+ const unsigned char *inbuf, size_t inbuflen);
/*-- cipher-aeswrap.c --*/
gcry_err_code_t _gcry_cipher_aeswrap_encrypt
/* */ (gcry_cipher_hd_t c,
- byte *outbuf, unsigned int outbuflen,
- const byte *inbuf, unsigned int inbuflen);
+ byte *outbuf, size_t outbuflen,
+ const byte *inbuf, size_t inbuflen);
gcry_err_code_t _gcry_cipher_aeswrap_decrypt
/* */ (gcry_cipher_hd_t c,
- byte *outbuf, unsigned int outbuflen,
- const byte *inbuf, unsigned int inbuflen);
+ byte *outbuf, size_t outbuflen,
+ const byte *inbuf, size_t inbuflen);
/*-- cipher-ccm.c --*/
gcry_err_code_t _gcry_cipher_ccm_encrypt
/* */ (gcry_cipher_hd_t c,
- unsigned char *outbuf, unsigned int outbuflen,
- const unsigned char *inbuf, unsigned int inbuflen);
+ unsigned char *outbuf, size_t outbuflen,
+ const unsigned char *inbuf, size_t inbuflen);
gcry_err_code_t _gcry_cipher_ccm_decrypt
/* */ (gcry_cipher_hd_t c,
- unsigned char *outbuf, unsigned int outbuflen,
- const unsigned char *inbuf, unsigned int inbuflen);
+ unsigned char *outbuf, size_t outbuflen,
+ const unsigned char *inbuf, size_t inbuflen);
gcry_err_code_t _gcry_cipher_ccm_set_nonce
/* */ (gcry_cipher_hd_t c, const unsigned char *nonce,
size_t noncelen);
diff --git a/cipher/cipher-ofb.c b/cipher/cipher-ofb.c
index c6d84dd..3842774 100644
--- a/cipher/cipher-ofb.c
+++ b/cipher/cipher-ofb.c
@@ -33,8 +33,8 @@
gcry_err_code_t
_gcry_cipher_ofb_encrypt (gcry_cipher_hd_t c,
- unsigned char *outbuf, unsigned int outbuflen,
- const unsigned char *inbuf, unsigned int inbuflen)
+ unsigned char *outbuf, size_t outbuflen,
+ const unsigned char *inbuf, size_t inbuflen)
{
unsigned char *ivp;
gcry_cipher_encrypt_t enc_fn = c->spec->encrypt;
diff --git a/cipher/cipher-selftest.h b/cipher/cipher-selftest.h
index 41d77af..3a0fe98 100644
--- a/cipher/cipher-selftest.h
+++ b/cipher/cipher-selftest.h
@@ -28,17 +28,17 @@
typedef void (*gcry_cipher_bulk_cbc_dec_t)(void *context, unsigned char *iv,
void *outbuf_arg,
const void *inbuf_arg,
- unsigned int nblocks);
+ size_t nblocks);
typedef void (*gcry_cipher_bulk_cfb_dec_t)(void *context, unsigned char *iv,
void *outbuf_arg,
const void *inbuf_arg,
- unsigned int nblocks);
+ size_t nblocks);
typedef void (*gcry_cipher_bulk_ctr_enc_t)(void *context, unsigned char *iv,
void *outbuf_arg,
const void *inbuf_arg,
- unsigned int nblocks);
+ size_t nblocks);
/* Helper function for bulk CBC decryption selftest */
const char *
diff --git a/cipher/cipher.c b/cipher/cipher.c
index 705696c..80aa7a7 100644
--- a/cipher/cipher.c
+++ b/cipher/cipher.c
@@ -555,7 +555,7 @@ gcry_cipher_close (gcry_cipher_hd_t h)
/* Set the key to be used for the encryption context C to KEY with
length KEYLEN. The length should match the required length. */
static gcry_error_t
-cipher_setkey (gcry_cipher_hd_t c, byte *key, unsigned int keylen)
+cipher_setkey (gcry_cipher_hd_t c, byte *key, size_t keylen)
{
gcry_err_code_t ret;
@@ -578,7 +578,7 @@ cipher_setkey (gcry_cipher_hd_t c, byte *key, unsigned int keylen)
/* Set the IV to be used for the encryption context C to IV with
length IVLEN. The length should match the required length. */
static void
-cipher_setiv (gcry_cipher_hd_t c, const byte *iv, unsigned ivlen)
+cipher_setiv (gcry_cipher_hd_t c, const byte *iv, size_t ivlen)
{
/* If the cipher has its own IV handler, we use only this one. This
is currently used for stream ciphers requiring a nonce. */
@@ -594,7 +594,7 @@ cipher_setiv (gcry_cipher_hd_t c, const byte *iv, unsigned ivlen)
if (ivlen != c->spec->blocksize)
{
log_info ("WARNING: cipher_setiv: ivlen=%u blklen=%u\n",
- ivlen, (unsigned int)c->spec->blocksize);
+ (unsigned int)ivlen, (unsigned int)c->spec->blocksize);
fips_signal_error ("IV length does not match blocklength");
}
if (ivlen > c->spec->blocksize)
@@ -628,12 +628,12 @@ cipher_reset (gcry_cipher_hd_t c)
static gcry_err_code_t
do_ecb_crypt (gcry_cipher_hd_t c,
- unsigned char *outbuf, unsigned int outbuflen,
- const unsigned char *inbuf, unsigned int inbuflen,
+ unsigned char *outbuf, size_t outbuflen,
+ const unsigned char *inbuf, size_t inbuflen,
gcry_cipher_encrypt_t crypt_fn)
{
unsigned int blocksize = c->spec->blocksize;
- unsigned int n, nblocks;
+ size_t n, nblocks;
unsigned int burn, nburn;
if (outbuflen < inbuflen)
@@ -660,16 +660,16 @@ do_ecb_crypt (gcry_cipher_hd_t c,
static gcry_err_code_t
do_ecb_encrypt (gcry_cipher_hd_t c,
- unsigned char *outbuf, unsigned int outbuflen,
- const unsigned char *inbuf, unsigned int inbuflen)
+ unsigned char *outbuf, size_t outbuflen,
+ const unsigned char *inbuf, size_t inbuflen)
{
return do_ecb_crypt (c, outbuf, outbuflen, inbuf, inbuflen, c->spec->encrypt);
}
static gcry_err_code_t
do_ecb_decrypt (gcry_cipher_hd_t c,
- unsigned char *outbuf, unsigned int outbuflen,
- const unsigned char *inbuf, unsigned int inbuflen)
+ unsigned char *outbuf, size_t outbuflen,
+ const unsigned char *inbuf, size_t inbuflen)
{
return do_ecb_crypt (c, outbuf, outbuflen, inbuf, inbuflen, c->spec->decrypt);
}
@@ -681,8 +681,8 @@ do_ecb_decrypt (gcry_cipher_hd_t c,
* Depending on the mode some constraints apply to INBUFLEN.
*/
static gcry_err_code_t
-cipher_encrypt (gcry_cipher_hd_t c, byte *outbuf, unsigned int outbuflen,
- const byte *inbuf, unsigned int inbuflen)
+cipher_encrypt (gcry_cipher_hd_t c, byte *outbuf, size_t outbuflen,
+ const byte *inbuf, size_t inbuflen)
{
gcry_err_code_t rc;
@@ -781,8 +781,8 @@ gcry_cipher_encrypt (gcry_cipher_hd_t h, void *out, size_t outsize,
* Depending on the mode some some contraints apply to INBUFLEN.
*/
static gcry_err_code_t
-cipher_decrypt (gcry_cipher_hd_t c, byte *outbuf, unsigned int outbuflen,
- const byte *inbuf, unsigned int inbuflen)
+cipher_decrypt (gcry_cipher_hd_t c, byte *outbuf, size_t outbuflen,
+ const byte *inbuf, size_t inbuflen)
{
gcry_err_code_t rc;
diff --git a/cipher/rijndael.c b/cipher/rijndael.c
index 47b2559..257a162 100644
--- a/cipher/rijndael.c
+++ b/cipher/rijndael.c
@@ -1672,7 +1672,7 @@ rijndael_encrypt (void *context, byte *b, const byte *a)
void
_gcry_aes_cfb_enc (void *context, unsigned char *iv,
void *outbuf_arg, const void *inbuf_arg,
- unsigned int nblocks)
+ size_t nblocks)
{
RIJNDAEL_context *ctx = context;
unsigned char *outbuf = outbuf_arg;
@@ -1736,7 +1736,7 @@ _gcry_aes_cfb_enc (void *context, unsigned char *iv,
void
_gcry_aes_cbc_enc (void *context, unsigned char *iv,
void *outbuf_arg, const void *inbuf_arg,
- unsigned int nblocks, int cbc_mac)
+ size_t nblocks, int cbc_mac)
{
RIJNDAEL_context *ctx = context;
unsigned char *outbuf = outbuf_arg;
@@ -1834,7 +1834,7 @@ _gcry_aes_cbc_enc (void *context, unsigned char *iv,
void
_gcry_aes_ctr_enc (void *context, unsigned char *ctr,
void *outbuf_arg, const void *inbuf_arg,
- unsigned int nblocks)
+ size_t nblocks)
{
RIJNDAEL_context *ctx = context;
unsigned char *outbuf = outbuf_arg;
@@ -2095,7 +2095,7 @@ rijndael_decrypt (void *context, byte *b, const byte *a)
void
_gcry_aes_cfb_dec (void *context, unsigned char *iv,
void *outbuf_arg, const void *inbuf_arg,
- unsigned int nblocks)
+ size_t nblocks)
{
RIJNDAEL_context *ctx = context;
unsigned char *outbuf = outbuf_arg;
@@ -2200,7 +2200,7 @@ _gcry_aes_cfb_dec (void *context, unsigned char *iv,
void
_gcry_aes_cbc_dec (void *context, unsigned char *iv,
void *outbuf_arg, const void *inbuf_arg,
- unsigned int nblocks)
+ size_t nblocks)
{
RIJNDAEL_context *ctx = context;
unsigned char *outbuf = outbuf_arg;
diff --git a/cipher/salsa20.c b/cipher/salsa20.c
index f708b18..72b28b0 100644
--- a/cipher/salsa20.c
+++ b/cipher/salsa20.c
@@ -112,7 +112,7 @@ typedef struct SALSA20_context_s
#define LE_READ_UINT32(p) buf_get_le32(p)
-static void salsa20_setiv (void *context, const byte *iv, unsigned int ivlen);
+static void salsa20_setiv (void *context, const byte *iv, size_t ivlen);
static const char *selftest (void);
@@ -360,13 +360,13 @@ salsa20_setkey (void *context, const byte *key, unsigned int keylen)
static void
-salsa20_setiv (void *context, const byte *iv, unsigned int ivlen)
+salsa20_setiv (void *context, const byte *iv, size_t ivlen)
{
SALSA20_context_t *ctx = (SALSA20_context_t *)context;
byte tmp[SALSA20_IV_SIZE];
if (iv && ivlen != SALSA20_IV_SIZE)
- log_info ("WARNING: salsa20_setiv: bad ivlen=%u\n", ivlen);
+ log_info ("WARNING: salsa20_setiv: bad ivlen=%u\n", (u32)ivlen);
if (!iv || ivlen != SALSA20_IV_SIZE)
memset (tmp, 0, sizeof(tmp));
@@ -387,14 +387,14 @@ salsa20_setiv (void *context, const byte *iv, unsigned int ivlen)
static void
salsa20_do_encrypt_stream (SALSA20_context_t *ctx,
byte *outbuf, const byte *inbuf,
- unsigned int length, unsigned rounds)
+ size_t length, unsigned rounds)
{
unsigned int nburn, burn = 0;
if (ctx->unused)
{
unsigned char *p = (void*)ctx->pad;
- unsigned int n;
+ size_t n;
gcry_assert (ctx->unused < SALSA20_BLOCK_SIZE);
@@ -414,7 +414,7 @@ salsa20_do_encrypt_stream (SALSA20_context_t *ctx,
#ifdef USE_AMD64
if (length >= SALSA20_BLOCK_SIZE)
{
- unsigned int nblocks = length / SALSA20_BLOCK_SIZE;
+ size_t nblocks = length / SALSA20_BLOCK_SIZE;
burn = _gcry_salsa20_amd64_encrypt_blocks(ctx->input, inbuf, outbuf,
nblocks, rounds);
length -= SALSA20_BLOCK_SIZE * nblocks;
@@ -461,7 +461,7 @@ salsa20_do_encrypt_stream (SALSA20_context_t *ctx,
static void
salsa20_encrypt_stream (void *context,
- byte *outbuf, const byte *inbuf, unsigned int length)
+ byte *outbuf, const byte *inbuf, size_t length)
{
SALSA20_context_t *ctx = (SALSA20_context_t *)context;
@@ -472,7 +472,7 @@ salsa20_encrypt_stream (void *context,
static void
salsa20r12_encrypt_stream (void *context,
- byte *outbuf, const byte *inbuf, unsigned int length)
+ byte *outbuf, const byte *inbuf, size_t length)
{
SALSA20_context_t *ctx = (SALSA20_context_t *)context;
diff --git a/cipher/serpent.c b/cipher/serpent.c
index 915cc95..8e647d4 100644
--- a/cipher/serpent.c
+++ b/cipher/serpent.c
@@ -827,7 +827,7 @@ serpent_decrypt (void *ctx, byte *buffer_out, const byte *buffer_in)
void
_gcry_serpent_ctr_enc(void *context, unsigned char *ctr,
void *outbuf_arg, const void *inbuf_arg,
- unsigned int nblocks)
+ size_t nblocks)
{
serpent_context_t *ctx = context;
unsigned char *outbuf = outbuf_arg;
@@ -944,8 +944,8 @@ _gcry_serpent_ctr_enc(void *context, unsigned char *ctr,
intended for the bulk encryption feature of cipher.c. */
void
_gcry_serpent_cbc_dec(void *context, unsigned char *iv,
- void *outbuf_arg, const void *inbuf_arg,
- unsigned int nblocks)
+ void *outbuf_arg, const void *inbuf_arg,
+ size_t nblocks)
{
serpent_context_t *ctx = context;
unsigned char *outbuf = outbuf_arg;
@@ -1053,7 +1053,7 @@ _gcry_serpent_cbc_dec(void *context, unsigned char *iv,
void
_gcry_serpent_cfb_dec(void *context, unsigned char *iv,
void *outbuf_arg, const void *inbuf_arg,
- unsigned int nblocks)
+ size_t nblocks)
{
serpent_context_t *ctx = context;
unsigned char *outbuf = outbuf_arg;
diff --git a/cipher/twofish.c b/cipher/twofish.c
index 04081db..ecd76e3 100644
--- a/cipher/twofish.c
+++ b/cipher/twofish.c
@@ -966,7 +966,7 @@ twofish_decrypt (void *context, byte *out, const byte *in)
of size TWOFISH_BLOCKSIZE. */
void
_gcry_twofish_ctr_enc(void *context, unsigned char *ctr, void *outbuf_arg,
- const void *inbuf_arg, unsigned int nblocks)
+ const void *inbuf_arg, size_t nblocks)
{
TWOFISH_context *ctx = context;
unsigned char *outbuf = outbuf_arg;
@@ -1025,7 +1025,7 @@ _gcry_twofish_ctr_enc(void *context, unsigned char *ctr, void *outbuf_arg,
intended for the bulk encryption feature of cipher.c. */
void
_gcry_twofish_cbc_dec(void *context, unsigned char *iv, void *outbuf_arg,
- const void *inbuf_arg, unsigned int nblocks)
+ const void *inbuf_arg, size_t nblocks)
{
TWOFISH_context *ctx = context;
unsigned char *outbuf = outbuf_arg;
@@ -1075,7 +1075,7 @@ _gcry_twofish_cbc_dec(void *context, unsigned char *iv, void *outbuf_arg,
intended for the bulk encryption feature of cipher.c. */
void
_gcry_twofish_cfb_dec(void *context, unsigned char *iv, void *outbuf_arg,
- const void *inbuf_arg, unsigned int nblocks)
+ const void *inbuf_arg, size_t nblocks)
{
TWOFISH_context *ctx = context;
unsigned char *outbuf = outbuf_arg;
diff --git a/src/cipher-proto.h b/src/cipher-proto.h
index c7ce906..c82012c 100644
--- a/src/cipher-proto.h
+++ b/src/cipher-proto.h
@@ -153,21 +153,20 @@ typedef unsigned int (*gcry_cipher_decrypt_t) (void *c,
typedef void (*gcry_cipher_stencrypt_t) (void *c,
unsigned char *outbuf,
const unsigned char *inbuf,
- unsigned int n);
+ size_t n);
/* Type for the cipher_stdecrypt function. */
typedef void (*gcry_cipher_stdecrypt_t) (void *c,
unsigned char *outbuf,
const unsigned char *inbuf,
- unsigned int n);
+ size_t n);
/* The type used to convey additional information to a cipher. */
typedef gpg_err_code_t (*cipher_set_extra_info_t)
(void *c, int what, const void *buffer, size_t buflen);
/* The type used to set an IV directly in the algorithm module. */
-typedef void (*cipher_setiv_func_t)(void *c,
- const byte *iv, unsigned int ivlen);
+typedef void (*cipher_setiv_func_t)(void *c, const byte *iv, size_t ivlen);
/* A structure to map OIDs to encryption modes. */
typedef struct gcry_cipher_oid_spec
diff --git a/src/cipher.h b/src/cipher.h
index d939ade..38d2a97 100644
--- a/src/cipher.h
+++ b/src/cipher.h
@@ -97,78 +97,78 @@ void _gcry_sha1_hash_buffers (void *outbuf,
/*-- rijndael.c --*/
void _gcry_aes_cfb_enc (void *context, unsigned char *iv,
void *outbuf, const void *inbuf,
- unsigned int nblocks);
+ size_t nblocks);
void _gcry_aes_cfb_dec (void *context, unsigned char *iv,
void *outbuf_arg, const void *inbuf_arg,
- unsigned int nblocks);
+ size_t nblocks);
void _gcry_aes_cbc_enc (void *context, unsigned char *iv,
void *outbuf_arg, const void *inbuf_arg,
- unsigned int nblocks, int cbc_mac);
+ size_t nblocks, int cbc_mac);
void _gcry_aes_cbc_dec (void *context, unsigned char *iv,
void *outbuf_arg, const void *inbuf_arg,
- unsigned int nblocks);
+ size_t nblocks);
void _gcry_aes_ctr_enc (void *context, unsigned char *ctr,
void *outbuf_arg, const void *inbuf_arg,
- unsigned int nblocks);
+ size_t nblocks);
/*-- blowfish.c --*/
void _gcry_blowfish_cfb_dec (void *context, unsigned char *iv,
void *outbuf_arg, const void *inbuf_arg,
- unsigned int nblocks);
+ size_t nblocks);
void _gcry_blowfish_cbc_dec (void *context, unsigned char *iv,
void *outbuf_arg, const void *inbuf_arg,
- unsigned int nblocks);
+ size_t nblocks);
void _gcry_blowfish_ctr_enc (void *context, unsigned char *ctr,
void *outbuf_arg, const void *inbuf_arg,
- unsigned int nblocks);
+ size_t nblocks);
/*-- cast5.c --*/
void _gcry_cast5_cfb_dec (void *context, unsigned char *iv,
void *outbuf_arg, const void *inbuf_arg,
- unsigned int nblocks);
+ size_t nblocks);
void _gcry_cast5_cbc_dec (void *context, unsigned char *iv,
void *outbuf_arg, const void *inbuf_arg,
- unsigned int nblocks);
+ size_t nblocks);
void _gcry_cast5_ctr_enc (void *context, unsigned char *ctr,
void *outbuf_arg, const void *inbuf_arg,
- unsigned int nblocks);
+ size_t nblocks);
/*-- camellia-glue.c --*/
void _gcry_camellia_ctr_enc (void *context, unsigned char *ctr,
void *outbuf_arg, const void *inbuf_arg,
- unsigned int nblocks);
+ size_t nblocks);
void _gcry_camellia_cbc_dec (void *context, unsigned char *iv,
void *outbuf_arg, const void *inbuf_arg,
- unsigned int nblocks);
+ size_t nblocks);
void _gcry_camellia_cfb_dec (void *context, unsigned char *iv,
void *outbuf_arg, const void *inbuf_arg,
- unsigned int nblocks);
+ size_t nblocks);
/*-- serpent.c --*/
void _gcry_serpent_ctr_enc (void *context, unsigned char *ctr,
void *outbuf_arg, const void *inbuf_arg,
- unsigned int nblocks);
+ size_t nblocks);
void _gcry_serpent_cbc_dec (void *context, unsigned char *iv,
void *outbuf_arg, const void *inbuf_arg,
- unsigned int nblocks);
+ size_t nblocks);
void _gcry_serpent_cfb_dec (void *context, unsigned char *iv,
void *outbuf_arg, const void *inbuf_arg,
- unsigned int nblocks);
+ size_t nblocks);
/*-- twofish.c --*/
void _gcry_twofish_ctr_enc (void *context, unsigned char *ctr,
void *outbuf_arg, const void *inbuf_arg,
- unsigned int nblocks);
+ size_t nblocks);
void _gcry_twofish_cbc_dec (void *context, unsigned char *iv,
void *outbuf_arg, const void *inbuf_arg,
- unsigned int nblocks);
+ size_t nblocks);
void _gcry_twofish_cfb_dec (void *context, unsigned char *iv,
void *outbuf_arg, const void *inbuf_arg,
- unsigned int nblocks);
+ size_t nblocks);
/*-- dsa.c --*/
void _gcry_register_pk_dsa_progress (gcry_handler_progress_t cbc, void *cb_data);
-----------------------------------------------------------------------
Summary of changes:
cipher/arcfour.c | 4 ++--
cipher/blowfish.c | 6 +++---
cipher/camellia-glue.c | 6 +++---
cipher/cast5.c | 6 +++---
cipher/cipher-aeswrap.c | 12 +++++------
cipher/cipher-cbc.c | 20 +++++++++----------
cipher/cipher-ccm.c | 8 ++++----
cipher/cipher-cfb.c | 12 +++++------
cipher/cipher-ctr.c | 8 ++++----
cipher/cipher-internal.h | 50 +++++++++++++++++++++++-----------------------
cipher/cipher-ofb.c | 4 ++--
cipher/cipher-selftest.h | 6 +++---
cipher/cipher.c | 28 +++++++++++++-------------
cipher/rijndael.c | 10 +++++-----
cipher/salsa20.c | 16 +++++++--------
cipher/serpent.c | 8 ++++----
cipher/twofish.c | 6 +++---
src/cipher-proto.h | 7 +++----
src/cipher.h | 40 ++++++++++++++++++-------------------
19 files changed, 128 insertions(+), 129 deletions(-)
hooks/post-receive
--
The GNU crypto library
http://git.gnupg.org
_______________________________________________
Gnupg-commits mailing list
Gnupg-commits at gnupg.org
http://lists.gnupg.org/mailman/listinfo/gnupg-commits
More information about the Gcrypt-devel
mailing list