Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/BLAKE2/BLAKE2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Neves <sneves@dei.uc.pt>2016-10-12 00:12:43 +0300
committerSamuel Neves <sneves@dei.uc.pt>2016-10-12 00:12:43 +0300
commitde31f550f3aef856472a7e70a6481136553d5097 (patch)
tree1dda3b2cdf4fe41703b2f62c862d4435bb173185
parentcb19577245324bbcda774adaec9c5307e2d9280a (diff)
replace some c99isms
-rw-r--r--ref/blake2.h4
-rw-r--r--ref/blake2sp-ref.c4
-rw-r--r--ref/blake2xb-ref.c13
-rw-r--r--ref/blake2xs-ref.c10
-rw-r--r--sse/blake2xb.c20
-rw-r--r--sse/blake2xs.c18
6 files changed, 36 insertions, 33 deletions
diff --git a/ref/blake2.h b/ref/blake2.h
index 35339b5..02e1537 100644
--- a/ref/blake2.h
+++ b/ref/blake2.h
@@ -123,13 +123,13 @@ extern "C" {
typedef struct blake2b_param__ blake2b_param;
- typedef struct blake2xs_state__
+ typedef struct blake2xs_state__
{
blake2s_state S[1];
blake2s_param P[1];
} blake2xs_state;
- typedef struct blake2xb_state__
+ typedef struct blake2xb_state__
{
blake2b_state S[1];
blake2b_param P[1];
diff --git a/ref/blake2sp-ref.c b/ref/blake2sp-ref.c
index 3e6be19..e9e9259 100644
--- a/ref/blake2sp-ref.c
+++ b/ref/blake2sp-ref.c
@@ -51,8 +51,8 @@ static int blake2sp_init_root( blake2s_state *S, size_t outlen, size_t keylen )
P->fanout = PARALLELISM_DEGREE;
P->depth = 2;
store32( &P->leaf_length, 0 );
- store32( &P->node_offset, 0ULL );
- store16( &P->xof_length, 0ULL );
+ store32( &P->node_offset, 0 );
+ store16( &P->xof_length, 0 );
P->node_depth = 1;
P->inner_length = BLAKE2S_OUTBYTES;
memset( P->salt, 0, sizeof( P->salt ) );
diff --git a/ref/blake2xb-ref.c b/ref/blake2xb-ref.c
index b84a138..9fc8860 100644
--- a/ref/blake2xb-ref.c
+++ b/ref/blake2xb-ref.c
@@ -164,11 +164,11 @@ int blake2xb(void *out, size_t outlen, const void *in, size_t inlen, const void
#if defined(BLAKE2XB_SELFTEST)
#include <string.h>
#include "blake2-kat.h"
-int main( int argc, char **argv )
+int main( void )
{
uint8_t key[BLAKE2B_KEYBYTES];
uint8_t buf[BLAKE2_KAT_LENGTH];
- size_t i, step;
+ size_t i, step, outlen;
for( i = 0; i < BLAKE2B_KEYBYTES; ++i ) {
key[i] = ( uint8_t )i;
@@ -182,11 +182,12 @@ int main( int argc, char **argv )
/* (Test of input lengths mostly covered by blake2s tests) */
/* Test simple API */
- for( size_t outlen = 1; outlen <= BLAKE2_KAT_LENGTH; ++outlen )
+ for( outlen = 1; outlen <= BLAKE2_KAT_LENGTH; ++outlen )
{
uint8_t hash[BLAKE2_KAT_LENGTH] = {0};
- blake2xb( hash, outlen, buf, BLAKE2_KAT_LENGTH, key, BLAKE2B_KEYBYTES );
-
+ if( blake2xb( hash, outlen, buf, BLAKE2_KAT_LENGTH, key, BLAKE2B_KEYBYTES ) < 0 ) {
+ goto fail;
+ }
if( 0 != memcmp( hash, blake2xb_keyed_kat[outlen-1], outlen ) )
{
@@ -196,7 +197,7 @@ int main( int argc, char **argv )
/* Test streaming API */
for(step = 1; step < BLAKE2B_BLOCKBYTES; ++step) {
- for (size_t outlen = 1; outlen <= BLAKE2_KAT_LENGTH; ++outlen) {
+ for (outlen = 1; outlen <= BLAKE2_KAT_LENGTH; ++outlen) {
uint8_t hash[BLAKE2_KAT_LENGTH];
blake2xb_state S;
uint8_t * p = buf;
diff --git a/ref/blake2xs-ref.c b/ref/blake2xs-ref.c
index 133f240..bcb56ed 100644
--- a/ref/blake2xs-ref.c
+++ b/ref/blake2xs-ref.c
@@ -166,7 +166,7 @@ int main( void )
{
uint8_t key[BLAKE2S_KEYBYTES];
uint8_t buf[BLAKE2_KAT_LENGTH];
- size_t i, step;
+ size_t i, step, outlen;
for( i = 0; i < BLAKE2S_KEYBYTES; ++i ) {
key[i] = ( uint8_t )i;
@@ -180,10 +180,12 @@ int main( void )
/* (Test of input lengths mostly covered by blake2s tests) */
/* Test simple API */
- for( size_t outlen = 1; outlen <= BLAKE2_KAT_LENGTH; ++outlen )
+ for( outlen = 1; outlen <= BLAKE2_KAT_LENGTH; ++outlen )
{
uint8_t hash[BLAKE2_KAT_LENGTH] = {0};
- blake2xs( hash, outlen, buf, BLAKE2_KAT_LENGTH, key, BLAKE2S_KEYBYTES );
+ if( blake2xs( hash, outlen, buf, BLAKE2_KAT_LENGTH, key, BLAKE2S_KEYBYTES ) < 0 ) {
+ goto fail;
+ }
if( 0 != memcmp( hash, blake2xs_keyed_kat[outlen-1], outlen ) )
{
@@ -193,7 +195,7 @@ int main( void )
/* Test streaming API */
for(step = 1; step < BLAKE2S_BLOCKBYTES; ++step) {
- for (size_t outlen = 1; outlen <= BLAKE2_KAT_LENGTH; ++outlen) {
+ for (outlen = 1; outlen <= BLAKE2_KAT_LENGTH; ++outlen) {
uint8_t hash[BLAKE2_KAT_LENGTH];
blake2xs_state S;
uint8_t * p = buf;
diff --git a/sse/blake2xb.c b/sse/blake2xb.c
index b84a138..a888bd1 100644
--- a/sse/blake2xb.c
+++ b/sse/blake2xb.c
@@ -1,17 +1,17 @@
/*
BLAKE2 reference source code package - reference C implementations
-
- Copyright 2016, JP Aumasson <jeanphilippe.aumasson@gmail.com>.
- Copyright 2016, Samuel Neves <sneves@dei.uc.pt>.
-
+
+ Copyright 2016, JP Aumasson <jeanphilippe.aumasson@gmail.com>.
+ Copyright 2016, Samuel Neves <sneves@dei.uc.pt>.
+
You may use this under the terms of the CC0, the OpenSSL Licence, or
the Apache Public License 2.0, at your option. The terms of these
licenses can be found at:
-
+
- CC0 1.0 Universal : http://creativecommons.org/publicdomain/zero/1.0
- OpenSSL license : https://www.openssl.org/source/license.html
- Apache 2.0 : http://www.apache.org/licenses/LICENSE-2.0
-
+
More information about the BLAKE2 hash function can be found at
https://blake2.net.
*/
@@ -164,11 +164,11 @@ int blake2xb(void *out, size_t outlen, const void *in, size_t inlen, const void
#if defined(BLAKE2XB_SELFTEST)
#include <string.h>
#include "blake2-kat.h"
-int main( int argc, char **argv )
+int main( void )
{
uint8_t key[BLAKE2B_KEYBYTES];
uint8_t buf[BLAKE2_KAT_LENGTH];
- size_t i, step;
+ size_t i, step, outlen;
for( i = 0; i < BLAKE2B_KEYBYTES; ++i ) {
key[i] = ( uint8_t )i;
@@ -182,7 +182,7 @@ int main( int argc, char **argv )
/* (Test of input lengths mostly covered by blake2s tests) */
/* Test simple API */
- for( size_t outlen = 1; outlen <= BLAKE2_KAT_LENGTH; ++outlen )
+ for( outlen = 1; outlen <= BLAKE2_KAT_LENGTH; ++outlen )
{
uint8_t hash[BLAKE2_KAT_LENGTH] = {0};
blake2xb( hash, outlen, buf, BLAKE2_KAT_LENGTH, key, BLAKE2B_KEYBYTES );
@@ -196,7 +196,7 @@ int main( int argc, char **argv )
/* Test streaming API */
for(step = 1; step < BLAKE2B_BLOCKBYTES; ++step) {
- for (size_t outlen = 1; outlen <= BLAKE2_KAT_LENGTH; ++outlen) {
+ for (outlen = 1; outlen <= BLAKE2_KAT_LENGTH; ++outlen) {
uint8_t hash[BLAKE2_KAT_LENGTH];
blake2xb_state S;
uint8_t * p = buf;
diff --git a/sse/blake2xs.c b/sse/blake2xs.c
index 133f240..e69594f 100644
--- a/sse/blake2xs.c
+++ b/sse/blake2xs.c
@@ -1,17 +1,17 @@
/*
BLAKE2 reference source code package - reference C implementations
-
- Copyright 2016, JP Aumasson <jeanphilippe.aumasson@gmail.com>.
- Copyright 2016, Samuel Neves <sneves@dei.uc.pt>.
-
+
+ Copyright 2016, JP Aumasson <jeanphilippe.aumasson@gmail.com>.
+ Copyright 2016, Samuel Neves <sneves@dei.uc.pt>.
+
You may use this under the terms of the CC0, the OpenSSL Licence, or
the Apache Public License 2.0, at your option. The terms of these
licenses can be found at:
-
+
- CC0 1.0 Universal : http://creativecommons.org/publicdomain/zero/1.0
- OpenSSL license : https://www.openssl.org/source/license.html
- Apache 2.0 : http://www.apache.org/licenses/LICENSE-2.0
-
+
More information about the BLAKE2 hash function can be found at
https://blake2.net.
*/
@@ -166,7 +166,7 @@ int main( void )
{
uint8_t key[BLAKE2S_KEYBYTES];
uint8_t buf[BLAKE2_KAT_LENGTH];
- size_t i, step;
+ size_t i, step, outlen;
for( i = 0; i < BLAKE2S_KEYBYTES; ++i ) {
key[i] = ( uint8_t )i;
@@ -180,7 +180,7 @@ int main( void )
/* (Test of input lengths mostly covered by blake2s tests) */
/* Test simple API */
- for( size_t outlen = 1; outlen <= BLAKE2_KAT_LENGTH; ++outlen )
+ for( outlen = 1; outlen <= BLAKE2_KAT_LENGTH; ++outlen )
{
uint8_t hash[BLAKE2_KAT_LENGTH] = {0};
blake2xs( hash, outlen, buf, BLAKE2_KAT_LENGTH, key, BLAKE2S_KEYBYTES );
@@ -193,7 +193,7 @@ int main( void )
/* Test streaming API */
for(step = 1; step < BLAKE2S_BLOCKBYTES; ++step) {
- for (size_t outlen = 1; outlen <= BLAKE2_KAT_LENGTH; ++outlen) {
+ for (outlen = 1; outlen <= BLAKE2_KAT_LENGTH; ++outlen) {
uint8_t hash[BLAKE2_KAT_LENGTH];
blake2xs_state S;
uint8_t * p = buf;