summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiels Möller <nisse@lysator.liu.se>2013-04-26 10:28:57 +0200
committerNiels Möller <nisse@lysator.liu.se>2013-04-26 10:28:57 +0200
commitb8bfc32ff2fe1084614332bdda4d3b7805f62da0 (patch)
tree89051484ba8b04a534128414f971115e42de7132
parentfc05e5448e27c5436186b5c51a81772d440bf134 (diff)
downloadnettle-b8bfc32ff2fe1084614332bdda4d3b7805f62da0.tar.gz
Use size_t rather than unsigned for all hash-related functions.
-rw-r--r--examples/nettle-openssl.c10
-rw-r--r--gcm-aes.c4
-rw-r--r--gcm.c6
-rw-r--r--gcm.h8
-rw-r--r--gosthash94.c4
-rw-r--r--gosthash94.h4
-rw-r--r--hmac-md5.c6
-rw-r--r--hmac-ripemd160.c6
-rw-r--r--hmac-sha1.c6
-rw-r--r--hmac-sha224.c4
-rw-r--r--hmac-sha256.c6
-rw-r--r--hmac-sha384.c4
-rw-r--r--hmac-sha512.c6
-rw-r--r--hmac.c6
-rw-r--r--hmac.h44
-rw-r--r--md2.c4
-rw-r--r--md2.h4
-rw-r--r--md4.c4
-rw-r--r--md4.h4
-rw-r--r--md5.c4
-rw-r--r--md5.h4
-rw-r--r--nettle-internal.h6
-rw-r--r--nettle-types.h4
-rw-r--r--ripemd160.c4
-rw-r--r--ripemd160.h4
-rw-r--r--sha1.c4
-rw-r--r--sha1.h4
-rw-r--r--sha2.h12
-rw-r--r--sha256.c8
-rw-r--r--sha3-224.c4
-rw-r--r--sha3-256.c4
-rw-r--r--sha3-384.c4
-rw-r--r--sha3-512.c4
-rw-r--r--sha3.c2
-rw-r--r--sha3.h18
-rw-r--r--sha512.c8
-rw-r--r--umac.h24
-rw-r--r--umac128.c6
-rw-r--r--umac32.c6
-rw-r--r--umac64.c6
-rw-r--r--umac96.c6
41 files changed, 143 insertions, 143 deletions
diff --git a/examples/nettle-openssl.c b/examples/nettle-openssl.c
index 5805b662..8ef0c025 100644
--- a/examples/nettle-openssl.c
+++ b/examples/nettle-openssl.c
@@ -308,8 +308,8 @@ openssl_md5_init(void *ctx)
static nettle_hash_update_func openssl_md5_update;
static void
openssl_md5_update(void *ctx,
- unsigned length,
- const uint8_t *src)
+ size_t length,
+ const uint8_t *src)
{
MD5_Update(ctx, src, length);
}
@@ -317,7 +317,7 @@ openssl_md5_update(void *ctx,
static nettle_hash_digest_func openssl_md5_digest;
static void
openssl_md5_digest(void *ctx,
- unsigned length, uint8_t *dst)
+ size_t length, uint8_t *dst)
{
assert(length == SHA_DIGEST_LENGTH);
MD5_Final(dst, ctx);
@@ -344,7 +344,7 @@ openssl_sha1_init(void *ctx)
static nettle_hash_update_func openssl_sha1_update;
static void
openssl_sha1_update(void *ctx,
- unsigned length,
+ size_t length,
const uint8_t *src)
{
SHA1_Update(ctx, src, length);
@@ -353,7 +353,7 @@ openssl_sha1_update(void *ctx,
static nettle_hash_digest_func openssl_sha1_digest;
static void
openssl_sha1_digest(void *ctx,
- unsigned length, uint8_t *dst)
+ size_t length, uint8_t *dst)
{
assert(length == SHA_DIGEST_LENGTH);
SHA1_Final(dst, ctx);
diff --git a/gcm-aes.c b/gcm-aes.c
index 194a0d82..7873fbb1 100644
--- a/gcm-aes.c
+++ b/gcm-aes.c
@@ -43,7 +43,7 @@ gcm_aes_set_iv(struct gcm_aes_ctx *ctx,
}
void
-gcm_aes_update(struct gcm_aes_ctx *ctx, unsigned length, const uint8_t *data)
+gcm_aes_update(struct gcm_aes_ctx *ctx, size_t length, const uint8_t *data)
{
GCM_UPDATE(ctx, length, data);
}
@@ -64,7 +64,7 @@ gcm_aes_decrypt(struct gcm_aes_ctx *ctx,
void
gcm_aes_digest(struct gcm_aes_ctx *ctx,
- unsigned length, uint8_t *digest)
+ size_t length, uint8_t *digest)
{
GCM_DIGEST(ctx, aes_encrypt, length, digest);
diff --git a/gcm.c b/gcm.c
index de5321e7..6893d515 100644
--- a/gcm.c
+++ b/gcm.c
@@ -349,7 +349,7 @@ gcm_set_key(struct gcm_key *key,
static void
gcm_hash(const struct gcm_key *key, union gcm_block *x,
- unsigned length, const uint8_t *data)
+ size_t length, const uint8_t *data)
{
for (; length >= GCM_BLOCK_SIZE;
length -= GCM_BLOCK_SIZE, data += GCM_BLOCK_SIZE)
@@ -412,7 +412,7 @@ gcm_set_iv(struct gcm_ctx *ctx, const struct gcm_key *key,
void
gcm_update(struct gcm_ctx *ctx, const struct gcm_key *key,
- unsigned length, const uint8_t *data)
+ size_t length, const uint8_t *data)
{
assert(ctx->auth_size % GCM_BLOCK_SIZE == 0);
assert(ctx->data_size == 0);
@@ -488,7 +488,7 @@ gcm_decrypt(struct gcm_ctx *ctx, const struct gcm_key *key,
void
gcm_digest(struct gcm_ctx *ctx, const struct gcm_key *key,
void *cipher, nettle_crypt_func *f,
- unsigned length, uint8_t *digest)
+ size_t length, uint8_t *digest)
{
uint8_t buffer[GCM_BLOCK_SIZE];
diff --git a/gcm.h b/gcm.h
index b42c9957..f50c7363 100644
--- a/gcm.h
+++ b/gcm.h
@@ -98,7 +98,7 @@ gcm_set_iv(struct gcm_ctx *ctx, const struct gcm_key *key,
void
gcm_update(struct gcm_ctx *ctx, const struct gcm_key *key,
- unsigned length, const uint8_t *data);
+ size_t length, const uint8_t *data);
void
gcm_encrypt(struct gcm_ctx *ctx, const struct gcm_key *key,
@@ -113,7 +113,7 @@ gcm_decrypt(struct gcm_ctx *ctx, const struct gcm_key *key,
void
gcm_digest(struct gcm_ctx *ctx, const struct gcm_key *key,
void *cipher, nettle_crypt_func *f,
- unsigned length, uint8_t *digest);
+ size_t length, uint8_t *digest);
/* Convenience macrology (not sure how useful it is) */
@@ -166,7 +166,7 @@ gcm_aes_set_iv(struct gcm_aes_ctx *ctx,
void
gcm_aes_update(struct gcm_aes_ctx *ctx,
- unsigned length, const uint8_t *data);
+ size_t length, const uint8_t *data);
void
gcm_aes_encrypt(struct gcm_aes_ctx *ctx,
@@ -177,7 +177,7 @@ gcm_aes_decrypt(struct gcm_aes_ctx *ctx,
size_t length, uint8_t *dst, const uint8_t *src);
void
-gcm_aes_digest(struct gcm_aes_ctx *ctx, unsigned length, uint8_t *digest);
+gcm_aes_digest(struct gcm_aes_ctx *ctx, size_t length, uint8_t *digest);
#ifdef __cplusplus
}
diff --git a/gosthash94.c b/gosthash94.c
index ba0171b4..a671b4fe 100644
--- a/gosthash94.c
+++ b/gosthash94.c
@@ -525,7 +525,7 @@ gost_compute_sum_and_hash (struct gosthash94_ctx *ctx, const uint8_t *block)
*/
void
gosthash94_update (struct gosthash94_ctx *ctx,
- unsigned length, const uint8_t *msg)
+ size_t length, const uint8_t *msg)
{
unsigned index = (unsigned) ctx->length & 31;
ctx->length += length;
@@ -564,7 +564,7 @@ gosthash94_update (struct gosthash94_ctx *ctx,
*/
void
gosthash94_digest (struct gosthash94_ctx *ctx,
- unsigned length, uint8_t *result)
+ size_t length, uint8_t *result)
{
unsigned index = ctx->length & 31;
uint32_t msg32[8];
diff --git a/gosthash94.h b/gosthash94.h
index ff76b238..f1d91800 100644
--- a/gosthash94.h
+++ b/gosthash94.h
@@ -77,9 +77,9 @@ struct gosthash94_ctx
void gosthash94_init(struct gosthash94_ctx *ctx);
void gosthash94_update(struct gosthash94_ctx *ctx,
- unsigned length, const uint8_t *msg);
+ size_t length, const uint8_t *msg);
void gosthash94_digest(struct gosthash94_ctx *ctx,
- unsigned length, uint8_t *result);
+ size_t length, uint8_t *result);
#ifdef __cplusplus
}
diff --git a/hmac-md5.c b/hmac-md5.c
index 62b61307..94bd44d9 100644
--- a/hmac-md5.c
+++ b/hmac-md5.c
@@ -31,21 +31,21 @@
void
hmac_md5_set_key(struct hmac_md5_ctx *ctx,
- unsigned key_length, const uint8_t *key)
+ size_t key_length, const uint8_t *key)
{
HMAC_SET_KEY(ctx, &nettle_md5, key_length, key);
}
void
hmac_md5_update(struct hmac_md5_ctx *ctx,
- unsigned length, const uint8_t *data)
+ size_t length, const uint8_t *data)
{
md5_update(&ctx->state, length, data);
}
void
hmac_md5_digest(struct hmac_md5_ctx *ctx,
- unsigned length, uint8_t *digest)
+ size_t length, uint8_t *digest)
{
HMAC_DIGEST(ctx, &nettle_md5, length, digest);
}
diff --git a/hmac-ripemd160.c b/hmac-ripemd160.c
index 7ba0064b..126fd93d 100644
--- a/hmac-ripemd160.c
+++ b/hmac-ripemd160.c
@@ -31,21 +31,21 @@
void
hmac_ripemd160_set_key(struct hmac_ripemd160_ctx *ctx,
- unsigned key_length, const uint8_t *key)
+ size_t key_length, const uint8_t *key)
{
HMAC_SET_KEY(ctx, &nettle_ripemd160, key_length, key);
}
void
hmac_ripemd160_update(struct hmac_ripemd160_ctx *ctx,
- unsigned length, const uint8_t *data)
+ size_t length, const uint8_t *data)
{
ripemd160_update(&ctx->state, length, data);
}
void
hmac_ripemd160_digest(struct hmac_ripemd160_ctx *ctx,
- unsigned length, uint8_t *digest)
+ size_t length, uint8_t *digest)
{
HMAC_DIGEST(ctx, &nettle_ripemd160, length, digest);
}
diff --git a/hmac-sha1.c b/hmac-sha1.c
index 54637d36..1c763377 100644
--- a/hmac-sha1.c
+++ b/hmac-sha1.c
@@ -31,21 +31,21 @@
void
hmac_sha1_set_key(struct hmac_sha1_ctx *ctx,
- unsigned key_length, const uint8_t *key)
+ size_t key_length, const uint8_t *key)
{
HMAC_SET_KEY(ctx, &nettle_sha1, key_length, key);
}
void
hmac_sha1_update(struct hmac_sha1_ctx *ctx,
- unsigned length, const uint8_t *data)
+ size_t length, const uint8_t *data)
{
sha1_update(&ctx->state, length, data);
}
void
hmac_sha1_digest(struct hmac_sha1_ctx *ctx,
- unsigned length, uint8_t *digest)
+ size_t length, uint8_t *digest)
{
HMAC_DIGEST(ctx, &nettle_sha1, length, digest);
}
diff --git a/hmac-sha224.c b/hmac-sha224.c
index 79898ccb..8a8992df 100644
--- a/hmac-sha224.c
+++ b/hmac-sha224.c
@@ -31,14 +31,14 @@
void
hmac_sha224_set_key(struct hmac_sha224_ctx *ctx,
- unsigned key_length, const uint8_t *key)
+ size_t key_length, const uint8_t *key)
{
HMAC_SET_KEY(ctx, &nettle_sha224, key_length, key);
}
void
hmac_sha224_digest(struct hmac_sha224_ctx *ctx,
- unsigned length, uint8_t *digest)
+ size_t length, uint8_t *digest)
{
HMAC_DIGEST(ctx, &nettle_sha224, length, digest);
}
diff --git a/hmac-sha256.c b/hmac-sha256.c
index 6a592660..09c59189 100644
--- a/hmac-sha256.c
+++ b/hmac-sha256.c
@@ -31,21 +31,21 @@
void
hmac_sha256_set_key(struct hmac_sha256_ctx *ctx,
- unsigned key_length, const uint8_t *key)
+ size_t key_length, const uint8_t *key)
{
HMAC_SET_KEY(ctx, &nettle_sha256, key_length, key);
}
void
hmac_sha256_update(struct hmac_sha256_ctx *ctx,
- unsigned length, const uint8_t *data)
+ size_t length, const uint8_t *data)
{
sha256_update(&ctx->state, length, data);
}
void
hmac_sha256_digest(struct hmac_sha256_ctx *ctx,
- unsigned length, uint8_t *digest)
+ size_t length, uint8_t *digest)
{
HMAC_DIGEST(ctx, &nettle_sha256, length, digest);
}
diff --git a/hmac-sha384.c b/hmac-sha384.c
index 46d0e42d..ba3c2553 100644
--- a/hmac-sha384.c
+++ b/hmac-sha384.c
@@ -31,14 +31,14 @@
void
hmac_sha384_set_key(struct hmac_sha512_ctx *ctx,
- unsigned key_length, const uint8_t *key)
+ size_t key_length, const uint8_t *key)
{
HMAC_SET_KEY(ctx, &nettle_sha384, key_length, key);
}
void
hmac_sha384_digest(struct hmac_sha512_ctx *ctx,
- unsigned length, uint8_t *digest)
+ size_t length, uint8_t *digest)
{
HMAC_DIGEST(ctx, &nettle_sha384, length, digest);
}
diff --git a/hmac-sha512.c b/hmac-sha512.c
index 14b40ceb..ff6a029e 100644
--- a/hmac-sha512.c
+++ b/hmac-sha512.c
@@ -31,21 +31,21 @@
void
hmac_sha512_set_key(struct hmac_sha512_ctx *ctx,
- unsigned key_length, const uint8_t *key)
+ size_t key_length, const uint8_t *key)
{
HMAC_SET_KEY(ctx, &nettle_sha512, key_length, key);
}
void
hmac_sha512_update(struct hmac_sha512_ctx *ctx,
- unsigned length, const uint8_t *data)
+ size_t length, const uint8_t *data)
{
sha512_update(&ctx->state, length, data);
}
void
hmac_sha512_digest(struct hmac_sha512_ctx *ctx,
- unsigned length, uint8_t *digest)
+ size_t length, uint8_t *digest)
{
HMAC_DIGEST(ctx, &nettle_sha512, length, digest);
}
diff --git a/hmac.c b/hmac.c
index 8c363b13..571a742f 100644
--- a/hmac.c
+++ b/hmac.c
@@ -43,7 +43,7 @@
void
hmac_set_key(void *outer, void *inner, void *state,
const struct nettle_hash *hash,
- unsigned key_length, const uint8_t *key)
+ size_t key_length, const uint8_t *key)
{
TMP_DECL(pad, uint8_t, NETTLE_MAX_HASH_BLOCK_SIZE);
TMP_ALLOC(pad, hash->block_size);
@@ -85,7 +85,7 @@ hmac_set_key(void *outer, void *inner, void *state,
void
hmac_update(void *state,
const struct nettle_hash *hash,
- unsigned length, const uint8_t *data)
+ size_t length, const uint8_t *data)
{
hash->update(state, length, data);
}
@@ -93,7 +93,7 @@ hmac_update(void *state,
void
hmac_digest(const void *outer, const void *inner, void *state,
const struct nettle_hash *hash,
- unsigned length, uint8_t *dst)
+ size_t length, uint8_t *dst)
{
TMP_DECL(digest, uint8_t, NETTLE_MAX_HASH_DIGEST_SIZE);
TMP_ALLOC(digest, hash->digest_size);
diff --git a/hmac.h b/hmac.h
index c6cb0e06..562bdd77 100644
--- a/hmac.h
+++ b/hmac.h
@@ -64,19 +64,19 @@ extern "C" {
void
hmac_set_key(void *outer, void *inner, void *state,
const struct nettle_hash *hash,
- unsigned length, const uint8_t *key);
+ size_t length, const uint8_t *key);
/* This function is not strictly needed, it's s just the same as the
* hash update function. */
void
hmac_update(void *state,
const struct nettle_hash *hash,
- unsigned length, const uint8_t *data);
+ size_t length, const uint8_t *data);
void
hmac_digest(const void *outer, const void *inner, void *state,
const struct nettle_hash *hash,
- unsigned length, uint8_t *digest);
+ size_t length, uint8_t *digest);
#define HMAC_CTX(type) \
@@ -97,15 +97,15 @@ struct hmac_md5_ctx HMAC_CTX(struct md5_ctx);
void
hmac_md5_set_key(struct hmac_md5_ctx *ctx,
- unsigned key_length, const uint8_t *key);
+ size_t key_length, const uint8_t *key);
void
hmac_md5_update(struct hmac_md5_ctx *ctx,
- unsigned length, const uint8_t *data);
+ size_t length, const uint8_t *data);
void
hmac_md5_digest(struct hmac_md5_ctx *ctx,
- unsigned length, uint8_t *digest);
+ size_t length, uint8_t *digest);
/* hmac-ripemd160 */
@@ -113,15 +113,15 @@ struct hmac_ripemd160_ctx HMAC_CTX(struct ripemd160_ctx);
void
hmac_ripemd160_set_key(struct hmac_ripemd160_ctx *ctx,
- unsigned key_length, const uint8_t *key);
+ size_t key_length, const uint8_t *key);
void
hmac_ripemd160_update(struct hmac_ripemd160_ctx *ctx,
- unsigned length, const uint8_t *data);
+ size_t length, const uint8_t *data);
void
hmac_ripemd160_digest(struct hmac_ripemd160_ctx *ctx,
- unsigned length, uint8_t *digest);
+ size_t length, uint8_t *digest);
/* hmac-sha1 */
@@ -129,71 +129,71 @@ struct hmac_sha1_ctx HMAC_CTX(struct sha1_ctx);
void
hmac_sha1_set_key(struct hmac_sha1_ctx *ctx,
- unsigned key_length, const uint8_t *key);
+ size_t key_length, const uint8_t *key);
void
hmac_sha1_update(struct hmac_sha1_ctx *ctx,
- unsigned length, const uint8_t *data);
+ size_t length, const uint8_t *data);
void
hmac_sha1_digest(struct hmac_sha1_ctx *ctx,
- unsigned length, uint8_t *digest);
+ size_t length, uint8_t *digest);
/* hmac-sha256 */
struct hmac_sha256_ctx HMAC_CTX(struct sha256_ctx);
void
hmac_sha256_set_key(struct hmac_sha256_ctx *ctx,
- unsigned key_length, const uint8_t *key);
+ size_t key_length, const uint8_t *key);
void
hmac_sha256_update(struct hmac_sha256_ctx *ctx,
- unsigned length, const uint8_t *data);
+ size_t length, const uint8_t *data);
void
hmac_sha256_digest(struct hmac_sha256_ctx *ctx,
- unsigned length, uint8_t *digest);
+ size_t length, uint8_t *digest);
/* hmac-sha224 */
#define hmac_sha224_ctx hmac_sha256_ctx
void
hmac_sha224_set_key(struct hmac_sha224_ctx *ctx,
- unsigned key_length, const uint8_t *key);
+ size_t key_length, const uint8_t *key);
#define hmac_sha224_update nettle_hmac_sha256_update
void
hmac_sha224_digest(struct hmac_sha224_ctx *ctx,
- unsigned length, uint8_t *digest);
+ size_t length, uint8_t *digest);
/* hmac-sha512 */
struct hmac_sha512_ctx HMAC_CTX(struct sha512_ctx);
void
hmac_sha512_set_key(struct hmac_sha512_ctx *ctx,
- unsigned key_length, const uint8_t *key);
+ size_t key_length, const uint8_t *key);
void
hmac_sha512_update(struct hmac_sha512_ctx *ctx,
- unsigned length, const uint8_t *data);
+ size_t length, const uint8_t *data);
void
hmac_sha512_digest(struct hmac_sha512_ctx *ctx,
- unsigned length, uint8_t *digest);
+ size_t length, uint8_t *digest);
/* hmac-sha384 */
#define hmac_sha384_ctx hmac_sha512_ctx
void
hmac_sha384_set_key(struct hmac_sha512_ctx *ctx,
- unsigned key_length, const uint8_t *key);
+ size_t key_length, const uint8_t *key);
#define hmac_sha384_update nettle_hmac_sha512_update
void
hmac_sha384_digest(struct hmac_sha512_ctx *ctx,
- unsigned length, uint8_t *digest);
+ size_t length, uint8_t *digest);
#ifdef __cplusplus
}
diff --git a/md2.c b/md2.c
index a39f733b..72543de7 100644
--- a/md2.c
+++ b/md2.c
@@ -106,7 +106,7 @@ md2_init(struct md2_ctx *ctx)
void
md2_update(struct md2_ctx *ctx,
- unsigned length,
+ size_t length,
const uint8_t *data)
{
MD_UPDATE(ctx, length, data, md2_transform, (void)0);
@@ -114,7 +114,7 @@ md2_update(struct md2_ctx *ctx,
void
md2_digest(struct md2_ctx *ctx,
- unsigned length,
+ size_t length,
uint8_t *digest)
{
unsigned left;
diff --git a/md2.h b/md2.h
index 08070205..9bf47e55 100644
--- a/md2.h
+++ b/md2.h
@@ -53,12 +53,12 @@ md2_init(struct md2_ctx *ctx);
void
md2_update(struct md2_ctx *ctx,
- unsigned length,
+ size_t length,
const uint8_t *data);
void
md2_digest(struct md2_ctx *ctx,
- unsigned length,
+ size_t length,
uint8_t *digest);
diff --git a/md4.c b/md4.c
index ad093cab..80d50f6b 100644
--- a/md4.c
+++ b/md4.c
@@ -67,7 +67,7 @@ md4_init(struct md4_ctx *ctx)
void
md4_update(struct md4_ctx *ctx,
- unsigned length,
+ size_t length,
const uint8_t *data)
{
MD_UPDATE(ctx, length, data, md4_compress, MD_INCR(ctx));
@@ -75,7 +75,7 @@ md4_update(struct md4_ctx *ctx,
void
md4_digest(struct md4_ctx *ctx,
- unsigned length,
+ size_t length,
uint8_t *digest)
{
uint32_t data[MD4_DATA_LENGTH];
diff --git a/md4.h b/md4.h
index 1edc8443..5b805c22 100644
--- a/md4.h
+++ b/md4.h
@@ -57,12 +57,12 @@ md4_init(struct md4_ctx *ctx);
void
md4_update(struct md4_ctx *ctx,
- unsigned length,
+ size_t length,
const uint8_t *data);
void
md4_digest(struct md4_ctx *ctx,
- unsigned length,
+ size_t length,
uint8_t *digest);
diff --git a/md5.c b/md5.c
index 484753ce..32c3583e 100644
--- a/md5.c
+++ b/md5.c
@@ -57,7 +57,7 @@ md5_init(struct md5_ctx *ctx)
void
md5_update(struct md5_ctx *ctx,
- unsigned length,
+ size_t length,
const uint8_t *data)
{
MD_UPDATE(ctx, length, data, COMPRESS, MD_INCR(ctx));
@@ -65,7 +65,7 @@ md5_update(struct md5_ctx *ctx,
void
md5_digest(struct md5_ctx *ctx,
- unsigned length,
+ size_t length,
uint8_t *digest)
{
uint32_t high, low;
diff --git a/md5.h b/md5.h
index 31ad40e9..2899cdfc 100644
--- a/md5.h
+++ b/md5.h
@@ -56,12 +56,12 @@ md5_init(struct md5_ctx *ctx);
void
md5_update(struct md5_ctx *ctx,
- unsigned length,
+ size_t length,
const uint8_t *data);
void
md5_digest(struct md5_ctx *ctx,
- unsigned length,
+ size_t length,
uint8_t *digest);
/* Internal compression function. STATE points to 4 uint32_t words,
diff --git a/nettle-internal.h b/nettle-internal.h
index 71452d45..e094064f 100644
--- a/nettle-internal.h
+++ b/nettle-internal.h
@@ -83,12 +83,12 @@ struct nettle_aead
{
const char *name;
- unsigned context_size;
+ size_t context_size;
/* Block size of the input, and the size of the output digest */
- unsigned block_size;
+ size_t block_size;
/* Suggested key size; other sizes are sometimes possible. */
- unsigned key_size;
+ size_t key_size;
nettle_set_key_func *set_key;
nettle_set_key_func *set_iv;
diff --git a/nettle-types.h b/nettle-types.h
index 5f7738e7..df68cc2b 100644
--- a/nettle-types.h
+++ b/nettle-types.h
@@ -60,10 +60,10 @@ typedef void nettle_crypt_func(void *ctx,
/* Hash algorithms */
typedef void nettle_hash_init_func(void *ctx);
typedef void nettle_hash_update_func(void *ctx,
- unsigned length,
+ size_t length,
const uint8_t *src);
typedef void nettle_hash_digest_func(void *ctx,
- unsigned length, uint8_t *dst);
+ size_t length, uint8_t *dst);
/* ASCII armor codecs. NOTE: Experimental and subject to change. */
diff --git a/ripemd160.c b/ripemd160.c
index 9011b9ee..92a6414f 100644
--- a/ripemd160.c
+++ b/ripemd160.c
@@ -165,13 +165,13 @@ ripemd160_init(struct ripemd160_ctx *ctx)
* of DATA with length LENGTH.
*/
void
-ripemd160_update(struct ripemd160_ctx *ctx, unsigned length, const uint8_t *data)
+ripemd160_update(struct ripemd160_ctx *ctx, size_t length, const uint8_t *data)
{
MD_UPDATE(ctx, length, data, COMPRESS, MD_INCR(ctx));
}
void
-ripemd160_digest(struct ripemd160_ctx *ctx, unsigned length, uint8_t *digest)
+ripemd160_digest(struct ripemd160_ctx *ctx, size_t length, uint8_t *digest)
{
uint32_t high, low;
diff --git a/ripemd160.h b/ripemd160.h
index c3746966..eca98736 100644
--- a/ripemd160.h
+++ b/ripemd160.h
@@ -58,12 +58,12 @@ ripemd160_init(struct ripemd160_ctx *ctx);
void
ripemd160_update(struct ripemd160_ctx *ctx,
- unsigned length,
+ size_t length,
const uint8_t *data);
void
ripemd160_digest(struct ripemd160_ctx *ctx,
- unsigned length,
+ size_t length,
uint8_t *digest);
/* Internal compression function. STATE points to 5 uint32_t words,
diff --git a/sha1.c b/sha1.c
index dc52be22..b7ab9412 100644
--- a/sha1.c
+++ b/sha1.c
@@ -76,14 +76,14 @@ sha1_init(struct sha1_ctx *ctx)
void
sha1_update(struct sha1_ctx *ctx,
- unsigned length, const uint8_t *data)
+ size_t length, const uint8_t *data)
{
MD_UPDATE (ctx, length, data, COMPRESS, MD_INCR(ctx));
}
void
sha1_digest(struct sha1_ctx *ctx,
- unsigned length,
+ size_t length,
uint8_t *digest)
{
uint32_t high, low;
diff --git a/sha1.h b/sha1.h
index 5c90e542..9452f0aa 100644
--- a/sha1.h
+++ b/sha1.h
@@ -58,12 +58,12 @@ sha1_init(struct sha1_ctx *ctx);
void
sha1_update(struct sha1_ctx *ctx,
- unsigned length,
+ size_t length,
const uint8_t *data);
void
sha1_digest(struct sha1_ctx *ctx,
- unsigned length,
+ size_t length,
uint8_t *digest);
/* Internal compression function. STATE points to 5 uint32_t words,
diff --git a/sha2.h b/sha2.h
index 738261e2..3a0b449a 100644
--- a/sha2.h
+++ b/sha2.h
@@ -65,12 +65,12 @@ sha256_init(struct sha256_ctx *ctx);
void
sha256_update(struct sha256_ctx *ctx,
- unsigned length,
+ size_t length,
const uint8_t *data);
void
sha256_digest(struct sha256_ctx *ctx,
- unsigned length,
+ size_t length,
uint8_t *digest);
/* Internal compression function. STATE points to 8 uint32_t words,
@@ -93,7 +93,7 @@ sha224_init(struct sha256_ctx *ctx);
void
sha224_digest(struct sha256_ctx *ctx,
- unsigned length,
+ size_t length,
uint8_t *digest);
@@ -118,12 +118,12 @@ sha512_init(struct sha512_ctx *ctx);
void
sha512_update(struct sha512_ctx *ctx,
- unsigned length,
+ size_t length,
const uint8_t *data);
void
sha512_digest(struct sha512_ctx *ctx,
- unsigned length,
+ size_t length,
uint8_t *digest);
/* Internal compression function. STATE points to 8 uint64_t words,
@@ -146,7 +146,7 @@ sha384_init(struct sha512_ctx *ctx);
void
sha384_digest(struct sha512_ctx *ctx,
- unsigned length,
+ size_t length,
uint8_t *digest);
#ifdef __cplusplus
diff --git a/sha256.c b/sha256.c
index 47995979..5b77f9ce 100644
--- a/sha256.c
+++ b/sha256.c
@@ -87,14 +87,14 @@ sha256_init(struct sha256_ctx *ctx)
void
sha256_update(struct sha256_ctx *ctx,
- unsigned length, const uint8_t *data)
+ size_t length, const uint8_t *data)
{
MD_UPDATE (ctx, length, data, COMPRESS, MD_INCR(ctx));
}
static void
sha256_write_digest(struct sha256_ctx *ctx,
- unsigned length,
+ size_t length,
uint8_t *digest)
{
uint32_t high, low;
@@ -119,7 +119,7 @@ sha256_write_digest(struct sha256_ctx *ctx,
void
sha256_digest(struct sha256_ctx *ctx,
- unsigned length,
+ size_t length,
uint8_t *digest)
{
sha256_write_digest(ctx, length, digest);
@@ -149,7 +149,7 @@ sha224_init(struct sha256_ctx *ctx)
void
sha224_digest(struct sha256_ctx *ctx,
- unsigned length,
+ size_t length,
uint8_t *digest)
{
sha256_write_digest(ctx, length, digest);
diff --git a/sha3-224.c b/sha3-224.c
index 81a4fbdf..2b9b2189 100644
--- a/sha3-224.c
+++ b/sha3-224.c
@@ -42,7 +42,7 @@ sha3_224_init (struct sha3_224_ctx *ctx)
void
sha3_224_update (struct sha3_224_ctx *ctx,
- unsigned length,
+ size_t length,
const uint8_t *data)
{
ctx->index = _sha3_update (&ctx->state, SHA3_224_DATA_SIZE, ctx->block,
@@ -51,7 +51,7 @@ sha3_224_update (struct sha3_224_ctx *ctx,
void
sha3_224_digest(struct sha3_224_ctx *ctx,
- unsigned length,
+ size_t length,
uint8_t *digest)
{
_sha3_pad (&ctx->state, SHA3_224_DATA_SIZE, ctx->block, ctx->index);
diff --git a/sha3-256.c b/sha3-256.c
index e5294818..64e3c0c2 100644
--- a/sha3-256.c
+++ b/sha3-256.c
@@ -42,7 +42,7 @@ sha3_256_init (struct sha3_256_ctx *ctx)
void
sha3_256_update (struct sha3_256_ctx *ctx,
- unsigned length,
+ size_t length,
const uint8_t *data)
{
ctx->index = _sha3_update (&ctx->state, SHA3_256_DATA_SIZE, ctx->block,
@@ -51,7 +51,7 @@ sha3_256_update (struct sha3_256_ctx *ctx,
void
sha3_256_digest(struct sha3_256_ctx *ctx,
- unsigned length,
+ size_t length,
uint8_t *digest)
{
_sha3_pad (&ctx->state, SHA3_256_DATA_SIZE, ctx->block, ctx->index);
diff --git a/sha3-384.c b/sha3-384.c
index 5a919807..1f2229c8 100644
--- a/sha3-384.c
+++ b/sha3-384.c
@@ -42,7 +42,7 @@ sha3_384_init (struct sha3_384_ctx *ctx)
void
sha3_384_update (struct sha3_384_ctx *ctx,
- unsigned length,
+ size_t length,
const uint8_t *data)
{
ctx->index = _sha3_update (&ctx->state, SHA3_384_DATA_SIZE, ctx->block,
@@ -51,7 +51,7 @@ sha3_384_update (struct sha3_384_ctx *ctx,
void
sha3_384_digest(struct sha3_384_ctx *ctx,
- unsigned length,
+ size_t length,
uint8_t *digest)
{
_sha3_pad (&ctx->state, SHA3_384_DATA_SIZE, ctx->block, ctx->index);
diff --git a/sha3-512.c b/sha3-512.c
index 53d3f3b6..c0ee2b29 100644
--- a/sha3-512.c
+++ b/sha3-512.c
@@ -42,7 +42,7 @@ sha3_512_init (struct sha3_512_ctx *ctx)
void
sha3_512_update (struct sha3_512_ctx *ctx,
- unsigned length,
+ size_t length,
const uint8_t *data)
{
ctx->index = _sha3_update (&ctx->state, SHA3_512_DATA_SIZE, ctx->block,
@@ -51,7 +51,7 @@ sha3_512_update (struct sha3_512_ctx *ctx,
void
sha3_512_digest(struct sha3_512_ctx *ctx,
- unsigned length,
+ size_t length,
uint8_t *digest)
{
_sha3_pad (&ctx->state, SHA3_512_DATA_SIZE, ctx->block, ctx->index);
diff --git a/sha3.c b/sha3.c
index c8381159..6f694c27 100644
--- a/sha3.c
+++ b/sha3.c
@@ -56,7 +56,7 @@ unsigned
_sha3_update (struct sha3_state *state,
unsigned block_size, uint8_t *block,
unsigned pos,
- unsigned length, const uint8_t *data)
+ size_t length, const uint8_t *data)
{
if (pos > 0)
{
diff --git a/sha3.h b/sha3.h
index c6830b27..c81e46e9 100644
--- a/sha3.h
+++ b/sha3.h
@@ -67,7 +67,7 @@ unsigned
_sha3_update (struct sha3_state *state,
unsigned block_size, uint8_t *block,
unsigned pos,
- unsigned length, const uint8_t *data);
+ size_t length, const uint8_t *data);
void
_sha3_pad (struct sha3_state *state,
unsigned block_size, uint8_t *block, unsigned pos);
@@ -101,12 +101,12 @@ sha3_224_init (struct sha3_224_ctx *ctx);
void
sha3_224_update (struct sha3_224_ctx *ctx,
- unsigned length,
+ size_t length,
const uint8_t *data);
void
sha3_224_digest(struct sha3_224_ctx *ctx,
- unsigned length,
+ size_t length,
uint8_t *digest);
struct sha3_256_ctx
@@ -121,12 +121,12 @@ sha3_256_init (struct sha3_256_ctx *ctx);
void
sha3_256_update (struct sha3_256_ctx *ctx,
- unsigned length,
+ size_t length,
const uint8_t *data);
void
sha3_256_digest(struct sha3_256_ctx *ctx,
- unsigned length,
+ size_t length,
uint8_t *digest);
struct sha3_384_ctx
@@ -141,12 +141,12 @@ sha3_384_init (struct sha3_384_ctx *ctx);
void
sha3_384_update (struct sha3_384_ctx *ctx,
- unsigned length,
+ size_t length,
const uint8_t *data);
void
sha3_384_digest(struct sha3_384_ctx *ctx,
- unsigned length,
+ size_t length,
uint8_t *digest);
struct sha3_512_ctx
@@ -161,12 +161,12 @@ sha3_512_init (struct sha3_512_ctx *ctx);
void
sha3_512_update (struct sha3_512_ctx *ctx,
- unsigned length,
+ size_t length,
const uint8_t *data);
void
sha3_512_digest(struct sha3_512_ctx *ctx,
- unsigned length,
+ size_t length,
uint8_t *digest);
#ifdef __cplusplus
diff --git a/sha512.c b/sha512.c
index bf5de2fc..65297f33 100644
--- a/sha512.c
+++ b/sha512.c
@@ -137,14 +137,14 @@ sha512_init(struct sha512_ctx *ctx)
void
sha512_update(struct sha512_ctx *ctx,
- unsigned length, const uint8_t *data)
+ size_t length, const uint8_t *data)
{
MD_UPDATE (ctx, length, data, COMPRESS, MD_INCR(ctx));
}
static void
sha512_write_digest(struct sha512_ctx *ctx,
- unsigned length,
+ size_t length,
uint8_t *digest)
{
uint64_t high, low;
@@ -188,7 +188,7 @@ sha512_write_digest(struct sha512_ctx *ctx,
void
sha512_digest(struct sha512_ctx *ctx,
- unsigned length,
+ size_t length,
uint8_t *digest)
{
assert(length <= SHA512_DIGEST_SIZE);
@@ -229,7 +229,7 @@ sha384_init(struct sha512_ctx *ctx)
void
sha384_digest(struct sha512_ctx *ctx,
- unsigned length,
+ size_t length,
uint8_t *digest)
{
assert(length <= SHA384_DIGEST_SIZE);
diff --git a/umac.h b/umac.h
index 4fbd8e12..b6cec8aa 100644
--- a/umac.h
+++ b/umac.h
@@ -140,43 +140,43 @@ umac128_set_key (struct umac128_ctx *ctx, const uint8_t *key);
/* Optional, if not used, messages get incrementing nonces starting from zero. */
void
umac32_set_nonce (struct umac32_ctx *ctx,
- unsigned nonce_length, const uint8_t *nonce);
+ size_t nonce_length, const uint8_t *nonce);
void
umac64_set_nonce (struct umac64_ctx *ctx,
- unsigned nonce_length, const uint8_t *nonce);
+ size_t nonce_length, const uint8_t *nonce);
void
umac96_set_nonce (struct umac96_ctx *ctx,
- unsigned nonce_length, const uint8_t *nonce);
+ size_t nonce_length, const uint8_t *nonce);
void
umac128_set_nonce (struct umac128_ctx *ctx,
- unsigned nonce_length, const uint8_t *nonce);
+ size_t nonce_length, const uint8_t *nonce);
void
umac32_update (struct umac32_ctx *ctx,
- unsigned length, const uint8_t *data);
+ size_t length, const uint8_t *data);
void
umac64_update (struct umac64_ctx *ctx,
- unsigned length, const uint8_t *data);
+ size_t length, const uint8_t *data);
void
umac96_update (struct umac96_ctx *ctx,
- unsigned length, const uint8_t *data);
+ size_t length, const uint8_t *data);
void
umac128_update (struct umac128_ctx *ctx,
- unsigned length, const uint8_t *data);
+ size_t length, const uint8_t *data);
/* The _digest functions increment the nonce */
void
umac32_digest (struct umac32_ctx *ctx,
- unsigned length, uint8_t *digest);
+ size_t length, uint8_t *digest);
void
umac64_digest (struct umac64_ctx *ctx,
- unsigned length, uint8_t *digest);
+ size_t length, uint8_t *digest);
void
umac96_digest (struct umac96_ctx *ctx,
- unsigned length, uint8_t *digest);
+ size_t length, uint8_t *digest);
void
umac128_digest (struct umac128_ctx *ctx,
- unsigned length, uint8_t *digest);
+ size_t length, uint8_t *digest);
/* Internal functions */
diff --git a/umac128.c b/umac128.c
index 95c90e5f..3ce0c05e 100644
--- a/umac128.c
+++ b/umac128.c
@@ -48,7 +48,7 @@ umac128_set_key (struct umac128_ctx *ctx, const uint8_t *key)
void
umac128_set_nonce (struct umac128_ctx *ctx,
- unsigned nonce_length, const uint8_t *nonce)
+ size_t nonce_length, const uint8_t *nonce)
{
assert (nonce_length > 0);
assert (nonce_length <= AES_BLOCK_SIZE);
@@ -71,7 +71,7 @@ umac128_set_nonce (struct umac128_ctx *ctx,
void
umac128_update (struct umac128_ctx *ctx,
- unsigned length, const uint8_t *data)
+ size_t length, const uint8_t *data)
{
MD_UPDATE (ctx, length, data, UMAC128_BLOCK, (void)0);
}
@@ -79,7 +79,7 @@ umac128_update (struct umac128_ctx *ctx,
void
umac128_digest (struct umac128_ctx *ctx,
- unsigned length, uint8_t *digest)
+ size_t length, uint8_t *digest)
{
uint32_t tag[4];
unsigned i;
diff --git a/umac32.c b/umac32.c
index fd8a2819..c266a416 100644
--- a/umac32.c
+++ b/umac32.c
@@ -49,7 +49,7 @@ umac32_set_key (struct umac32_ctx *ctx, const uint8_t *key)
void
umac32_set_nonce (struct umac32_ctx *ctx,
- unsigned nonce_length, const uint8_t *nonce)
+ size_t nonce_length, const uint8_t *nonce)
{
assert (nonce_length > 0);
assert (nonce_length <= AES_BLOCK_SIZE);
@@ -71,7 +71,7 @@ umac32_set_nonce (struct umac32_ctx *ctx,
void
umac32_update (struct umac32_ctx *ctx,
- unsigned length, const uint8_t *data)
+ size_t length, const uint8_t *data)
{
MD_UPDATE (ctx, length, data, UMAC32_BLOCK, (void)0);
}
@@ -79,7 +79,7 @@ umac32_update (struct umac32_ctx *ctx,
void
umac32_digest (struct umac32_ctx *ctx,
- unsigned length, uint8_t *digest)
+ size_t length, uint8_t *digest)
{
uint32_t pad;
diff --git a/umac64.c b/umac64.c
index 3e05779a..133f2783 100644
--- a/umac64.c
+++ b/umac64.c
@@ -49,7 +49,7 @@ umac64_set_key (struct umac64_ctx *ctx, const uint8_t *key)
void
umac64_set_nonce (struct umac64_ctx *ctx,
- unsigned nonce_length, const uint8_t *nonce)
+ size_t nonce_length, const uint8_t *nonce)
{
assert (nonce_length > 0);
assert (nonce_length <= AES_BLOCK_SIZE);
@@ -72,7 +72,7 @@ umac64_set_nonce (struct umac64_ctx *ctx,
void
umac64_update (struct umac64_ctx *ctx,
- unsigned length, const uint8_t *data)
+ size_t length, const uint8_t *data)
{
MD_UPDATE (ctx, length, data, UMAC64_BLOCK, (void)0);
}
@@ -80,7 +80,7 @@ umac64_update (struct umac64_ctx *ctx,
void
umac64_digest (struct umac64_ctx *ctx,
- unsigned length, uint8_t *digest)
+ size_t length, uint8_t *digest)
{
uint32_t tag[2];
uint32_t *pad;
diff --git a/umac96.c b/umac96.c
index 1c1840c9..3c7905a9 100644
--- a/umac96.c
+++ b/umac96.c
@@ -48,7 +48,7 @@ umac96_set_key (struct umac96_ctx *ctx, const uint8_t *key)
void
umac96_set_nonce (struct umac96_ctx *ctx,
- unsigned nonce_length, const uint8_t *nonce)
+ size_t nonce_length, const uint8_t *nonce)
{
assert (nonce_length > 0);
assert (nonce_length <= AES_BLOCK_SIZE);
@@ -70,7 +70,7 @@ umac96_set_nonce (struct umac96_ctx *ctx,
void
umac96_update (struct umac96_ctx *ctx,
- unsigned length, const uint8_t *data)
+ size_t length, const uint8_t *data)
{
MD_UPDATE (ctx, length, data, UMAC96_BLOCK, (void)0);
}
@@ -78,7 +78,7 @@ umac96_update (struct umac96_ctx *ctx,
void
umac96_digest (struct umac96_ctx *ctx,
- unsigned length, uint8_t *digest)
+ size_t length, uint8_t *digest)
{
uint32_t tag[4];
unsigned i;