add license, bring up to date

This commit is contained in:
toddouska 2013-02-22 15:52:20 -08:00
parent 48303918c2
commit e947c86e67
5 changed files with 85 additions and 17 deletions

View File

@ -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"

View File

@ -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

View File

@ -10,6 +10,27 @@
You should have received a copy of the CC0 Public Domain Dedication along with
this software. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
*/
/* 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 <config.h>

View File

@ -10,15 +10,37 @@
You should have received a copy of the CC0 Public Domain Dedication along with
this software. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
*/
#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 <cyassl/ctaocrypt/types.h>
#include <stdint.h>
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 */

View File

@ -10,9 +10,29 @@
You should have received a copy of the CC0 Public Domain Dedication along with
this software. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
*/
/* 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 <cyassl/ctaocrypt/types.h>
@ -155,5 +175,5 @@ extern "C" {
}
#endif
#endif
#endif /* CTAOCRYPT_BLAKE2_H */