diff --git a/examples/nettle-openssl.c b/examples/nettle-openssl.c index 5805b66201826e9efc4a7cb3ef7ec0df1f8572f6..8ef0c025be1d0ce1b1dcd259b5e4e2840440f8d5 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 194a0d823e105106ac968ca9fe8f47773975d9e9..7873fbb1b6070095069f03363a75db7e426098ee 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 de5321e7210f944fd226f289aa9c48f5bc6ac87d..6893d515e5be0c62fc8e195b137d0a144b9f5523 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 b42c995781141d0fe11edf658068d3bd3346a13f..f50c7363edafeba192c7169dcaa2835beb060f87 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 ba0171b446d6a52e1dc2baa94d48553360855ccd..a671b4fee6a5e3a7848c6d7eb584a1e82e05f1d0 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 ff76b2386ca0b554fa6ce79298701333816a149c..f1d91800c26b391255bd0b398c82974c886bf842 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 62b61307cee8cd7af48d8d5018955daa81e1c2ee..94bd44d97144e6fa1c3d96eaaca3cbd0d2340097 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 7ba0064b743ab83899cf2fa78250d72f5eba6258..126fd93d3b0605c3898d9fb71bf4e7a62f49fbfd 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 54637d3667f9d430727c0fe1aeb692c548065488..1c7633778a54d45b7f696fb0a6b8876df94389e1 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 79898ccbdb0fee37737a2a5a1228f0bb2b5cb8e1..8a8992df747a0c00b2098d635b5bab0d5d14f9e5 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 6a59266071600f4db9620d71374045a1cf346b1a..09c5918978da56b843dfc0f5eaa3e6fc85cf9a6f 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 46d0e42d6e9d71e00380740c7a39a55946f97334..ba3c25536a6ff44ed9be626fdcb1e20726977b2a 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 14b40cebc9556391941bd08806c8e558fb09f3d7..ff6a029e923489b29227570799293e6d46ac2a9b 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 8c363b1365dea6659f59e49190f52ed9f194d619..571a742f338b45999948aa7eb99d6d73b8163d92 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 c6cb0e06170f5ac8ca3342e099a0ff0e0ff11022..562bdd776d32f2507b17abd14e0f2077dcc4a774 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 a39f733b440553a231e21ee0decc1ad76f0bdafd..72543de7edd71cb742a7d7c67fe99db26c5c4486 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 080702059dc5178ec1f48282a420b61f2b9f4718..9bf47e55edce0695fb07402c2750cebb34c49777 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 ad093cab41d8cad42a34d403c8dea99e06fac416..80d50f6b40258a0d58e91217c3cf5e4af7ca7e20 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 1edc8443e3e6dd12b7d1986cd6f432002bc22122..5b805c2207c160bf7c750dca0cda7a46d49fef2e 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 484753ce96578cfd818738d2fdad0004d78d34c6..32c3583e6f2d3a30ff5718baf52e56747d76aaff 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 31ad40e91644cad132f3e5e99f784365b0ffb609..2899cdfce6dbfcbf31b6906dfa6bc7ac7d044719 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 71452d45d72aa5b01bbb91bb74ecad9c82e77aba..e094064f6f32c6daf7f33324b288d96f1b0cf6e3 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 5f7738e7ea20feaf583af1283689234bf4755bf4..df68cc2bfaa528450f192ceb049834aa73a1a9b3 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 9011b9eeb68f14e70c402b46ce21ed08555bb7dc..92a6414f1d55436d5b93866fb97aba26fda27b2f 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 c37469669277acaecdfaac38d612e00dee2b83fb..eca987361c9a0bfe597b294d3bbf079e4152f7bf 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 dc52be22fd3800283e861fce6aacc2bb0f2acf7e..b7ab94124f942075fb7633c15cd1f830999e21c4 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 5c90e542e4e42ac22f890ee42c1f101209679c9d..9452f0aa8ac77b9f0579c8f48f3135a7b34b9a40 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 738261e2e5e3dd11de36f85a4e192916bf591972..3a0b449aac7d70f0b4b5c1032820dfbecd8b4c07 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 47995979b780a3b73e6b3abbc630d346e8ea07f0..5b77f9ce77973047cbadcf2d39cb0770112d2c21 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 81a4fbdf9f929b907c05e447de370d392e1d1a2f..2b9b2189e8f0ca047ebdca2fd869ba9cf7fdfbb9 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 e5294818fca0980e611cfa932a7e8204b1da605d..64e3c0c242336dd9521cefb5afa4b2d5eb0d403d 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 5a919807b8d071f825b849e6c58376fd7da7b896..1f2229c888a01d20cfe2d1e67db394035f89d0ee 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 53d3f3b6ca359d59eff25bf50e995ab880826123..c0ee2b29d2fb5fc3c00b675872009c1d95e10f72 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 c8381159fba9788d621ca055d9db2532c264f0bd..6f694c27c9d51eb8365c73f64a2f6a4350693724 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 c6830b2738aaed3f3152e85e1efdd35a93a46adc..c81e46e9adede77df86c303e5d4048ae18dd9c7e 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 bf5de2fc4ccab7bb22e87c72bc857b334c724717..65297f33bc68c0375932ec843277d754d0374f89 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 4fbd8e12a7ca481ceb2df5d432cd460fa88a966f..b6cec8aa656f7997c1511311c12d7981c7c1428e 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 95c90e5f3efe6781ce3e1a5e3f9a2e1bf6bf1fad..3ce0c05ed8fd6d58cb7375e11416e2fbddacf147 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 fd8a28193f85bdab3e526542065ff06ce7383834..c266a4166dc6ac43aec9e1effed723f5cfa9d358 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 3e05779ac3c51026854701eaafa4885a944092f3..133f2783588ba84e3aa8deb16c7ea017522bf707 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 1c1840c98fac44741544497a9c0a77e7c0679511..3c7905a9a4df9c52e95fac5e81632f43ac119f71 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;