From cd27712c4cafafd13c70c8e5f00a398ccd7058c1 Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Tue, 1 Jul 2014 02:16:17 -0700 Subject: [PATCH 1/3] THANKS += @jshahbazi for the Fortran bindings --- THANKS | 1 + 1 file changed, 1 insertion(+) diff --git a/THANKS b/THANKS index 1a9cbdbb..78f2784f 100644 --- a/THANKS +++ b/THANKS @@ -1,6 +1,7 @@ @alethia7 @dnaq @joshjdevl +@jshahbazi @neheb Amit Murthy (@amitmurthy) Bruno Oliveira (@abstractj) From c87d9f38f8eef3bc65e2f00e061d471622979fac Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Tue, 1 Jul 2014 19:27:34 +0000 Subject: [PATCH 2/3] Having dead code in the tree is sad, but keeps the diff with the reference implementation to a minimum. --- .../crypto_generichash/blake2/ref/blake2b-ref.c | 11 ++++++----- .../crypto_generichash/blake2/ref/blake2s-ref.c | 11 ++++++----- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/libsodium/crypto_generichash/blake2/ref/blake2b-ref.c b/src/libsodium/crypto_generichash/blake2/ref/blake2b-ref.c index 1ae6b926..9cc7ede5 100644 --- a/src/libsodium/crypto_generichash/blake2/ref/blake2b-ref.c +++ b/src/libsodium/crypto_generichash/blake2/ref/blake2b-ref.c @@ -48,13 +48,13 @@ static inline int blake2b_set_lastnode( blake2b_state *S ) S->f[1] = ~0ULL; return 0; } - +#if 0 static inline int blake2b_clear_lastnode( blake2b_state *S ) { S->f[1] = 0ULL; return 0; } - +#endif /* Some helper functions, not necessarily useful */ static inline int blake2b_set_lastblock( blake2b_state *S ) { @@ -63,7 +63,7 @@ static inline int blake2b_set_lastblock( blake2b_state *S ) S->f[0] = ~0ULL; return 0; } - +#if 0 static inline int blake2b_clear_lastblock( blake2b_state *S ) { if( S->last_node ) blake2b_clear_lastnode( S ); @@ -71,7 +71,7 @@ static inline int blake2b_clear_lastblock( blake2b_state *S ) S->f[0] = 0ULL; return 0; } - +#endif static inline int blake2b_increment_counter( blake2b_state *S, const uint64_t inc ) { S->t[0] += inc; @@ -82,6 +82,7 @@ static inline int blake2b_increment_counter( blake2b_state *S, const uint64_t in // Parameter-related functions +#if 0 static inline int blake2b_param_set_digest_length( blake2b_param *P, const uint8_t digest_length ) { P->digest_length = digest_length; @@ -123,7 +124,7 @@ static inline int blake2b_param_set_inner_length( blake2b_param *P, const uint8_ P->inner_length = inner_length; return 0; } - +#endif static inline int blake2b_param_set_salt( blake2b_param *P, const uint8_t salt[BLAKE2B_SALTBYTES] ) { memcpy( P->salt, salt, BLAKE2B_SALTBYTES ); diff --git a/src/libsodium/crypto_generichash/blake2/ref/blake2s-ref.c b/src/libsodium/crypto_generichash/blake2/ref/blake2s-ref.c index 3103c31c..0e79aa52 100644 --- a/src/libsodium/crypto_generichash/blake2/ref/blake2s-ref.c +++ b/src/libsodium/crypto_generichash/blake2/ref/blake2s-ref.c @@ -44,13 +44,13 @@ static inline int blake2s_set_lastnode( blake2s_state *S ) S->f[1] = ~0U; return 0; } - +#if 0 static inline int blake2s_clear_lastnode( blake2s_state *S ) { S->f[1] = 0U; return 0; } - +#endif /* Some helper functions, not necessarily useful */ static inline int blake2s_set_lastblock( blake2s_state *S ) { @@ -59,7 +59,7 @@ static inline int blake2s_set_lastblock( blake2s_state *S ) S->f[0] = ~0U; return 0; } - +#if 0 static inline int blake2s_clear_lastblock( blake2s_state *S ) { if( S->last_node ) blake2s_clear_lastnode( S ); @@ -67,7 +67,7 @@ static inline int blake2s_clear_lastblock( blake2s_state *S ) S->f[0] = 0U; return 0; } - +#endif static inline int blake2s_increment_counter( blake2s_state *S, const uint32_t inc ) { S->t[0] += inc; @@ -76,6 +76,7 @@ static inline int blake2s_increment_counter( blake2s_state *S, const uint32_t in } // Parameter-related functions +#if 0 static inline int blake2s_param_set_digest_length( blake2s_param *P, const uint8_t digest_length ) { P->digest_length = digest_length; @@ -117,7 +118,7 @@ static inline int blake2s_param_set_inner_length( blake2s_param *P, const uint8_ P->inner_length = inner_length; return 0; } - +#endif static inline int blake2s_param_set_salt( blake2s_param *P, const uint8_t salt[BLAKE2S_SALTBYTES] ) { memcpy( P->salt, salt, BLAKE2S_SALTBYTES ); From 0e4f4d6205f6ce7db7c2fd04444bf1767437a904 Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Tue, 1 Jul 2014 19:33:59 +0000 Subject: [PATCH 3/3] Use unsigned types for sizes in tests. --- test/default/box_easy.c | 2 +- test/default/secretbox_easy.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/default/box_easy.c b/test/default/box_easy.c index 10319879..d3b899fc 100644 --- a/test/default/box_easy.c +++ b/test/default/box_easy.c @@ -47,7 +47,7 @@ unsigned char c[147 + crypto_box_MACBYTES]; int main(void) { - int i; + size_t i; crypto_box_easy(c, m, 131, nonce, bobpk, alicesk); for (i = 0; i < 131 + crypto_box_MACBYTES; ++i) { diff --git a/test/default/secretbox_easy.c b/test/default/secretbox_easy.c index 48f4e76a..dc3f3bd9 100644 --- a/test/default/secretbox_easy.c +++ b/test/default/secretbox_easy.c @@ -41,7 +41,7 @@ unsigned char mac[crypto_secretbox_MACBYTES]; int main(void) { - int i; + size_t i; crypto_secretbox_easy(c, m, 131, nonce, firstkey); for (i = 0;i < 131 + crypto_secretbox_MACBYTES; ++i) {