diff --git a/configure.ac b/configure.ac
index a98585ddb..5b42d3201 100644
--- a/configure.ac
+++ b/configure.ac
@@ -883,6 +883,7 @@ echo " * AES-CCM: $ENABLED_AESCCM"
echo " * Camellia: $ENABLED_CAMELLIA"
echo " * RIPEMD: $ENABLED_RIPEMD"
echo " * SHA-512: $ENABLED_SHA512"
+echo " * BLAKE2: $ENABLED_BLAKE2"
echo " * keygen: $ENABLED_KEYGEN"
echo " * certgen: $ENABLED_CERTGEN"
echo " * HC-128: $ENABLED_HC128"
diff --git a/ctaocrypt/benchmark/benchmark.c b/ctaocrypt/benchmark/benchmark.c
index 05e17f711..108214a0b 100644
--- a/ctaocrypt/benchmark/benchmark.c
+++ b/ctaocrypt/benchmark/benchmark.c
@@ -627,18 +627,22 @@ void bench_blake2(void)
int i;
blake2b_init(S, 32);
- start = current_time();
+ start = current_time(1);
- for(i = 0; i < megs; i++)
+ for(i = 0; i < numBlocks; i++)
blake2b_update(S, plain, sizeof(plain));
blake2b_final(S, digest, 32);
- total = current_time() - start;
- persec = 1 / total * megs;
+ total = current_time(0) - start;
+ persec = 1 / total * numBlocks;
+#ifdef BENCH_EMBEDDED
+ /* since using kB, convert to MB/s */
+ persec = persec / 1024;
+#endif
- printf("BLAKE2 %d megs took %5.3f seconds, %6.2f MB/s\n", megs, total,
- persec);
+ printf("BLAKE2 %d %s took %5.3f seconds, %6.2f MB/s\n", numBlocks,
+ blockType, total, persec);
}
#endif
diff --git a/ctaocrypt/src/blake2b.c b/ctaocrypt/src/blake2b.c
index 36c0d4fa2..d52a946b9 100644
--- a/ctaocrypt/src/blake2b.c
+++ b/ctaocrypt/src/blake2b.c
@@ -10,6 +10,27 @@
You should have received a copy of the CC0 Public Domain Dedication along with
this software. If not, see .
*/
+/* blake2b.c
+ *
+ * Copyright (C) 2006-2013 wolfSSL Inc.
+ *
+ * This file is part of CyaSSL.
+ *
+ * CyaSSL is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * CyaSSL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ */
+
#ifdef HAVE_CONFIG_H
#include
diff --git a/cyassl/ctaocrypt/blake2-impl.h b/cyassl/ctaocrypt/blake2-impl.h
index 83d2dcbb2..2109577ac 100644
--- a/cyassl/ctaocrypt/blake2-impl.h
+++ b/cyassl/ctaocrypt/blake2-impl.h
@@ -10,15 +10,37 @@
You should have received a copy of the CC0 Public Domain Dedication along with
this software. If not, see .
*/
-#pragma once
-#ifndef __BLAKE2_IMPL_H__
-#define __BLAKE2_IMPL_H__
+/* blake2-impl.h
+ *
+ * Copyright (C) 2006-2013 wolfSSL Inc.
+ *
+ * This file is part of CyaSSL.
+ *
+ * CyaSSL is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * CyaSSL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ */
+#pragma once
+#ifndef CTAOCRYPT_BLAKE2_IMPL_H
+#define CTAOCRYPT_BLAKE2_IMPL_H
+
+#include
#include
static inline uint32_t load32( const void *src )
{
-#if defined(NATIVE_LITTLE_ENDIAN)
+#if defined(LITTLE_ENDIAN_ORDER)
return *( uint32_t * )( src );
#else
const uint8_t *p = ( uint8_t * )src;
@@ -32,7 +54,7 @@ static inline uint32_t load32( const void *src )
static inline uint64_t load64( const void *src )
{
-#if defined(NATIVE_LITTLE_ENDIAN)
+#if defined(LITTLE_ENDIAN_ORDER)
return *( uint64_t * )( src );
#else
const uint8_t *p = ( uint8_t * )src;
@@ -50,7 +72,7 @@ static inline uint64_t load64( const void *src )
static inline void store32( void *dst, uint32_t w )
{
-#if defined(NATIVE_LITTLE_ENDIAN)
+#if defined(LITTLE_ENDIAN_ORDER)
*( uint32_t * )( dst ) = w;
#else
uint8_t *p = ( uint8_t * )dst;
@@ -63,7 +85,7 @@ static inline void store32( void *dst, uint32_t w )
static inline void store64( void *dst, uint64_t w )
{
-#if defined(NATIVE_LITTLE_ENDIAN)
+#if defined(LITTLE_ENDIAN_ORDER)
*( uint64_t * )( dst ) = w;
#else
uint8_t *p = ( uint8_t * )dst;
@@ -129,5 +151,5 @@ static inline void secure_zero_memory( void *v, size_t n )
while( n-- ) *p++ = 0;
}
-#endif
+#endif /* CTAOCRYPT_BLAKE2_IMPL_H */
diff --git a/cyassl/ctaocrypt/blake2.h b/cyassl/ctaocrypt/blake2.h
index ea88f234e..8aa05bcc7 100644
--- a/cyassl/ctaocrypt/blake2.h
+++ b/cyassl/ctaocrypt/blake2.h
@@ -10,9 +10,29 @@
You should have received a copy of the CC0 Public Domain Dedication along with
this software. If not, see .
*/
+/* blake2.h
+ *
+ * Copyright (C) 2006-2013 wolfSSL Inc.
+ *
+ * This file is part of CyaSSL.
+ *
+ * CyaSSL is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * CyaSSL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ */
-#ifndef __BLAKE2_H__
-#define __BLAKE2_H__
+#ifndef CTAOCRYPT_BLAKE2_H
+#define CTAOCRYPT_BLAKE2_H
#include
@@ -155,5 +175,5 @@ extern "C" {
}
#endif
-#endif
+#endif /* CTAOCRYPT_BLAKE2_H */