Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Brian Smith
nettle
Commits
b8bfc32f
Commit
b8bfc32f
authored
Apr 26, 2013
by
Niels Möller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use size_t rather than unsigned for all hash-related functions.
parent
fc05e544
Changes
41
Hide whitespace changes
Inline
Side-by-side
Showing
41 changed files
with
143 additions
and
143 deletions
+143
-143
examples/nettle-openssl.c
examples/nettle-openssl.c
+5
-5
gcm-aes.c
gcm-aes.c
+2
-2
gcm.c
gcm.c
+3
-3
gcm.h
gcm.h
+4
-4
gosthash94.c
gosthash94.c
+2
-2
gosthash94.h
gosthash94.h
+2
-2
hmac-md5.c
hmac-md5.c
+3
-3
hmac-ripemd160.c
hmac-ripemd160.c
+3
-3
hmac-sha1.c
hmac-sha1.c
+3
-3
hmac-sha224.c
hmac-sha224.c
+2
-2
hmac-sha256.c
hmac-sha256.c
+3
-3
hmac-sha384.c
hmac-sha384.c
+2
-2
hmac-sha512.c
hmac-sha512.c
+3
-3
hmac.c
hmac.c
+3
-3
hmac.h
hmac.h
+22
-22
md2.c
md2.c
+2
-2
md2.h
md2.h
+2
-2
md4.c
md4.c
+2
-2
md4.h
md4.h
+2
-2
md5.c
md5.c
+2
-2
md5.h
md5.h
+2
-2
nettle-internal.h
nettle-internal.h
+3
-3
nettle-types.h
nettle-types.h
+2
-2
ripemd160.c
ripemd160.c
+2
-2
ripemd160.h
ripemd160.h
+2
-2
sha1.c
sha1.c
+2
-2
sha1.h
sha1.h
+2
-2
sha2.h
sha2.h
+6
-6
sha256.c
sha256.c
+4
-4
sha3-224.c
sha3-224.c
+2
-2
sha3-256.c
sha3-256.c
+2
-2
sha3-384.c
sha3-384.c
+2
-2
sha3-512.c
sha3-512.c
+2
-2
sha3.c
sha3.c
+1
-1
sha3.h
sha3.h
+9
-9
sha512.c
sha512.c
+4
-4
umac.h
umac.h
+12
-12
umac128.c
umac128.c
+3
-3
umac32.c
umac32.c
+3
-3
umac64.c
umac64.c
+3
-3
umac96.c
umac96.c
+3
-3
No files found.
examples/nettle-openssl.c
View file @
b8bfc32f
...
...
@@ -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
);
...
...
gcm-aes.c
View file @
b8bfc32f
...
...
@@ -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
);
...
...
gcm.c
View file @
b8bfc32f
...
...
@@ -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
];
...
...
gcm.h
View file @
b8bfc32f
...
...
@@ -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
}
...
...
gosthash94.c
View file @
b8bfc32f
...
...
@@ -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
];
...
...
gosthash94.h
View file @
b8bfc32f
...
...
@@ -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
}
...
...
hmac-md5.c
View file @
b8bfc32f
...
...
@@ -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
);
}
hmac-ripemd160.c
View file @
b8bfc32f
...
...
@@ -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
);
}
hmac-sha1.c
View file @
b8bfc32f
...
...
@@ -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
);
}
hmac-sha224.c
View file @
b8bfc32f
...
...
@@ -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
);
}
hmac-sha256.c
View file @
b8bfc32f
...
...
@@ -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
);
}
hmac-sha384.c
View file @
b8bfc32f
...
...
@@ -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
);
}
hmac-sha512.c
View file @
b8bfc32f
...
...
@@ -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
);
}
hmac.c
View file @
b8bfc32f
...
...
@@ -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
);
...
...
hmac.h
View file @
b8bfc32f
...
...
@@ -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
}
...
...
md2.c
View file @
b8bfc32f
...
...
@@ -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
;
...
...
md2.h
View file @
b8bfc32f
...
...
@@ -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
);
...
...
md4.c
View file @
b8bfc32f
...
...
@@ -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
];
...
...
md4.h
View file @
b8bfc32f
...
...
@@ -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
);
...
...
md5.c
View file @
b8bfc32f
...
...
@@ -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
;
...
...
md5.h
View file @
b8bfc32f
...
...
@@ -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,
...
...
nettle-internal.h
View file @
b8bfc32f
...
...
@@ -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
;
...
...
nettle-types.h
View file @
b8bfc32f
...
...
@@ -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. */
...
...
ripemd160.c
View file @
b8bfc32f
...
...
@@ -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