Updating CLU from cyassl to wolfssl, updating headers
parent
de2b31f1cd
commit
f0601422f4
|
@ -6,22 +6,33 @@ To use this feature, please configure wolfssl with the following line:
|
|||
'''
|
||||
|
||||
The pwdbased is for password based encryption allowing the user
|
||||
to specify a unique password known only to him/her self and the
|
||||
to specify a unique password known only to him/her self and the
|
||||
recipient of the encrypted file.
|
||||
|
||||
The opensslextra provides utility for a hex to binary conversion of
|
||||
The opensslextra provides utility for a hex to binary conversion of
|
||||
hexidecimal values.
|
||||
|
||||
other features that can be included when configuring cyassl for
|
||||
other features that can be included when configuring wolfssl for
|
||||
encryption or decryption are:
|
||||
|
||||
--enable-camellia
|
||||
--enable-des3
|
||||
|
||||
|
||||
--enable-blake2
|
||||
--enable-sha512
|
||||
--enable-fortress
|
||||
|
||||
then run "./configure", "make", and "make install" before using wolfssl CLU
|
||||
|
||||
After wolfssl is properly installed, to install wolfssl CLU:
|
||||
In the clu directory (wolfssl-examples/clu) enter the following commands:
|
||||
./autogen.sh
|
||||
make
|
||||
sudo make install
|
||||
|
||||
Now you should be able to use the wolfssl command line tool. To verify type:
|
||||
wolfssl -h
|
||||
|
||||
If everything worked, you should see the wolfssl help page.
|
||||
|
||||
Thank you and have fun!
|
||||
|
|
|
@ -75,8 +75,8 @@ TAO_REQUIRE_LIBWOLFSSL
|
|||
# Have John or Todd assist in writing have_pwdbased.m4
|
||||
#TAO_REQUIRE_PWDBASED
|
||||
|
||||
# since we have autoconf available, we can use cyassl options header
|
||||
AM_CFLAGS="$AM_CFLAGS -DHAVE_CYASSL_OPTIONS"
|
||||
# since we have autoconf available, we can use wolfssl options header
|
||||
AM_CFLAGS="$AM_CFLAGS -DHAVE_WOLFSSL_OPTIONS"
|
||||
|
||||
# capture user C_EXTRA_FLAGS from ./configure line, CFLAGS may hold -g -O2 even
|
||||
# if user doesn't override, no way to tell
|
||||
|
|
|
@ -1,21 +1,22 @@
|
|||
/* util.h
|
||||
*
|
||||
* Copyright (C) 2006-2014 wolfSSL Inc.
|
||||
* This file is part of CyaSSL.
|
||||
* Copyright (C) 2006-2015 wolfSSL Inc.
|
||||
*
|
||||
* CyaSSL is free software; you can redistribute it and/or modify
|
||||
* This file is part of wolfSSL. (formerly known as CyaSSL)
|
||||
*
|
||||
* wolfSSL 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,
|
||||
* wolfSSL 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,USA
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
|
@ -25,38 +26,38 @@
|
|||
#include <termios.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
/* cyassl includes */
|
||||
#include <cyassl/options.h>
|
||||
#include <cyassl/ctaocrypt/random.h>
|
||||
#include <cyassl/ctaocrypt/pwdbased.h>
|
||||
#include <cyassl/ctaocrypt/aes.h>
|
||||
#include <cyassl/ctaocrypt/des3.h>
|
||||
#include <cyassl/ctaocrypt/error-crypt.h>
|
||||
#include <cyassl/error-ssl.h>
|
||||
/* wolfssl includes */
|
||||
#include <wolfssl/options.h>
|
||||
#include <wolfssl/wolfcrypt/random.h>
|
||||
#include <wolfssl/wolfcrypt/pwdbased.h>
|
||||
#include <wolfssl/wolfcrypt/aes.h>
|
||||
#include <wolfssl/wolfcrypt/des3.h>
|
||||
#include <wolfssl/wolfcrypt/error-crypt.h>
|
||||
#include <wolfssl/error-ssl.h>
|
||||
|
||||
#ifndef NO_MD5
|
||||
#include <cyassl/ctaocrypt/md5.h>
|
||||
#include <wolfssl/wolfcrypt/md5.h>
|
||||
#endif
|
||||
|
||||
#ifndef NO_SHA
|
||||
#include <cyassl/ctaocrypt/sha.h>
|
||||
#include <wolfssl/wolfcrypt/sha.h>
|
||||
#endif
|
||||
|
||||
#ifndef NO_SHA256
|
||||
#include <cyassl/ctaocrypt/sha256.h>
|
||||
#include <wolfssl/wolfcrypt/sha256.h>
|
||||
#endif
|
||||
|
||||
#ifdef CYASSL_SHA512
|
||||
#include <cyassl/ctaocrypt/sha512.h>
|
||||
#ifdef WOLFSSL_SHA512
|
||||
#include <wolfssl/wolfcrypt/sha512.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_BLAKE2
|
||||
#define BLAKE_DIGEST_SIZE 64
|
||||
#include <cyassl/ctaocrypt/blake2.h>
|
||||
#include <wolfssl/wolfcrypt/blake2.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CAMELLIA
|
||||
#include <cyassl/ctaocrypt/camellia.h>
|
||||
#include <wolfssl/wolfcrypt/camellia.h>
|
||||
#endif
|
||||
|
||||
#ifndef UTIL_H_INCLUDED
|
||||
|
|
|
@ -15,14 +15,14 @@ This command allows data to be decrypted using ciphers and keys based on passwor
|
|||
-aes-ctr-[ 128 | 192 | 256 ]
|
||||
uses AES Counter with designated key size.
|
||||
to use the -ctr option you must enable the following flag
|
||||
"#define CYASSL_AES_COUNTER"
|
||||
"#define WOLFSSL_AES_COUNTER"
|
||||
|
||||
-3des-cbc-[ 056 | 112 | 168 ]
|
||||
uses 3DES algorithm with designated key size. requires cyassl be
|
||||
uses 3DES algorithm with designated key size. requires wolfssl be
|
||||
configured with --enable-des3.
|
||||
|
||||
-camellia-cbc-[128|192|256]
|
||||
uses Camellia algorithm with designated key size. requires cyassl be
|
||||
uses Camellia algorithm with designated key size. requires wolfssl be
|
||||
configured with --enable-camellia
|
||||
|
||||
.SH OPTIONS
|
||||
|
|
|
@ -14,7 +14,7 @@ This command allows data to be encrypted using ciphers and keys based on passwor
|
|||
-aes-ctr-[128|192|256]
|
||||
uses AES Counter with designated key size.
|
||||
to use the -ctr option you must use the following:
|
||||
"#define CYASSL_AES_COUNTER"
|
||||
"#define WOLFSSL_AES_COUNTER"
|
||||
|
||||
-3des-cbc-[056|112|168]
|
||||
uses 3DES algorithm with designated key size.
|
||||
|
@ -48,4 +48,4 @@ wolfSSL, Inc. (info@wolfssl.com)
|
|||
.SH COPYRIGHT
|
||||
Copyright 2014 wolfSSL Inc. All rights reserved.
|
||||
.SH REPORTING BUGS
|
||||
Report cyassl bugs to support@wolfssl.com
|
||||
Report wolfssl bugs to support@wolfssl.com
|
||||
|
|
|
@ -1,21 +1,22 @@
|
|||
/* wolfsslBenchSetup.c
|
||||
*
|
||||
* Copyright (C) 2006-2014 wolfSSL Inc.
|
||||
* This file is part of CyaSSL.
|
||||
* Copyright (C) 2006-2015 wolfSSL Inc.
|
||||
*
|
||||
* CyaSSL is free software; you can redistribute it and/or modify
|
||||
* This file is part of wolfSSL. (formerly known as CyaSSL)
|
||||
*
|
||||
* wolfSSL 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,
|
||||
* wolfSSL 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,USA
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "include/wolfssl.h"
|
||||
|
@ -29,7 +30,7 @@ int wolfsslBenchSetup(int argc, char** argv)
|
|||
#ifndef NO_AES
|
||||
"aes-cbc"
|
||||
#endif
|
||||
#ifdef CYASSL_AES_COUNTER
|
||||
#ifdef WOLFSSL_AES_COUNTER
|
||||
, "aes-ctr"
|
||||
#endif
|
||||
#ifndef NO_DES3
|
||||
|
@ -47,10 +48,10 @@ int wolfsslBenchSetup(int argc, char** argv)
|
|||
#ifndef NO_SHA256
|
||||
, "sha256"
|
||||
#endif
|
||||
#ifdef CYASSL_SHA384
|
||||
#ifdef WOLFSSL_SHA384
|
||||
, "sha384"
|
||||
#endif
|
||||
#ifdef CYASSL_SHA512
|
||||
#ifdef WOLFSSL_SHA512
|
||||
, "sha512"
|
||||
#endif
|
||||
#ifdef HAVE_BLAKE2
|
||||
|
|
|
@ -1,21 +1,22 @@
|
|||
/* wolfsslBenchmark.c
|
||||
*
|
||||
* Copyright (C) 2006-2014 wolfSSL Inc.
|
||||
* This file is part of CyaSSL.
|
||||
* Copyright (C) 2006-2015 wolfSSL Inc.
|
||||
*
|
||||
* CyaSSL is free software; you can redistribute it and/or modify
|
||||
* This file is part of wolfSSL. (formerly known as CyaSSL)
|
||||
*
|
||||
* wolfSSL 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,
|
||||
* wolfSSL 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,USA
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "include/wolfssl.h"
|
||||
|
@ -58,7 +59,7 @@ int wolfsslBenchmark(int timer, int* option)
|
|||
|
||||
byte* digest; /* message digest */
|
||||
|
||||
InitRng(&rng);
|
||||
wc_InitRng(&rng);
|
||||
|
||||
signal(SIGALRM, wolfsslStop);
|
||||
i = 0;
|
||||
|
@ -70,17 +71,17 @@ int wolfsslBenchmark(int timer, int* option)
|
|||
key = malloc(AES_BLOCK_SIZE);
|
||||
iv = malloc(AES_BLOCK_SIZE);
|
||||
|
||||
RNG_GenerateBlock(&rng, plain, AES_BLOCK_SIZE);
|
||||
RNG_GenerateBlock(&rng, cipher, AES_BLOCK_SIZE);
|
||||
RNG_GenerateBlock(&rng, key, AES_BLOCK_SIZE);
|
||||
RNG_GenerateBlock(&rng, iv, AES_BLOCK_SIZE);
|
||||
wc_RNG_GenerateBlock(&rng, plain, AES_BLOCK_SIZE);
|
||||
wc_RNG_GenerateBlock(&rng, cipher, AES_BLOCK_SIZE);
|
||||
wc_RNG_GenerateBlock(&rng, key, AES_BLOCK_SIZE);
|
||||
wc_RNG_GenerateBlock(&rng, iv, AES_BLOCK_SIZE);
|
||||
start = wolfsslGetTime();
|
||||
alarm(timer);
|
||||
|
||||
AesSetKey(&aes, key, AES_BLOCK_SIZE, iv, AES_ENCRYPTION);
|
||||
wc_AesSetKey(&aes, key, AES_BLOCK_SIZE, iv, AES_ENCRYPTION);
|
||||
|
||||
while (loop) {
|
||||
AesCbcEncrypt(&aes, cipher, plain, AES_BLOCK_SIZE);
|
||||
wc_AesCbcEncrypt(&aes, cipher, plain, AES_BLOCK_SIZE);
|
||||
blocks++;
|
||||
currTime = wolfsslGetTime();
|
||||
stop = currTime - start;
|
||||
|
@ -103,7 +104,7 @@ int wolfsslBenchmark(int timer, int* option)
|
|||
}
|
||||
i++;
|
||||
#endif
|
||||
#ifdef CYASSL_AES_COUNTER
|
||||
#ifdef WOLFSSL_AES_COUNTER
|
||||
/* aes-ctr test */
|
||||
if (option[i] == 1) {
|
||||
plain = malloc(AES_BLOCK_SIZE);
|
||||
|
@ -111,16 +112,16 @@ int wolfsslBenchmark(int timer, int* option)
|
|||
key = malloc(AES_BLOCK_SIZE);
|
||||
iv = malloc(AES_BLOCK_SIZE);
|
||||
|
||||
RNG_GenerateBlock(&rng, plain, AES_BLOCK_SIZE);
|
||||
RNG_GenerateBlock(&rng, cipher, AES_BLOCK_SIZE);
|
||||
RNG_GenerateBlock(&rng, key, AES_BLOCK_SIZE);
|
||||
RNG_GenerateBlock(&rng, iv, AES_BLOCK_SIZE);
|
||||
wc_RNG_GenerateBlock(&rng, plain, AES_BLOCK_SIZE);
|
||||
wc_RNG_GenerateBlock(&rng, cipher, AES_BLOCK_SIZE);
|
||||
wc_RNG_GenerateBlock(&rng, key, AES_BLOCK_SIZE);
|
||||
wc_RNG_GenerateBlock(&rng, iv, AES_BLOCK_SIZE);
|
||||
start = wolfsslGetTime();
|
||||
alarm(timer);
|
||||
|
||||
AesSetKeyDirect(&aes, key, AES_BLOCK_SIZE, iv, AES_ENCRYPTION);
|
||||
wc_AesSetKeyDirect(&aes, key, AES_BLOCK_SIZE, iv, AES_ENCRYPTION);
|
||||
while (loop) {
|
||||
AesCtrEncrypt(&aes, cipher, plain, AES_BLOCK_SIZE);
|
||||
wc_AesCtrEncrypt(&aes, cipher, plain, AES_BLOCK_SIZE);
|
||||
blocks++;
|
||||
currTime = wolfsslGetTime();
|
||||
stop = currTime - start;
|
||||
|
@ -150,17 +151,17 @@ int wolfsslBenchmark(int timer, int* option)
|
|||
key = malloc(DES3_BLOCK_SIZE);
|
||||
iv = malloc(DES3_BLOCK_SIZE);
|
||||
|
||||
RNG_GenerateBlock(&rng, plain, DES3_BLOCK_SIZE);
|
||||
RNG_GenerateBlock(&rng, cipher, DES3_BLOCK_SIZE);
|
||||
RNG_GenerateBlock(&rng, key, DES3_BLOCK_SIZE);
|
||||
RNG_GenerateBlock(&rng, iv, DES3_BLOCK_SIZE);
|
||||
wc_RNG_GenerateBlock(&rng, plain, DES3_BLOCK_SIZE);
|
||||
wc_RNG_GenerateBlock(&rng, cipher, DES3_BLOCK_SIZE);
|
||||
wc_RNG_GenerateBlock(&rng, key, DES3_BLOCK_SIZE);
|
||||
wc_RNG_GenerateBlock(&rng, iv, DES3_BLOCK_SIZE);
|
||||
|
||||
start = wolfsslGetTime();
|
||||
alarm(timer);
|
||||
|
||||
Des3_SetKey(&des3, key, iv, DES_ENCRYPTION);
|
||||
wc_Des3_SetKey(&des3, key, iv, DES_ENCRYPTION);
|
||||
while (loop) {
|
||||
Des3_CbcEncrypt(&des3, cipher, plain, DES3_BLOCK_SIZE);
|
||||
wc_Des3_CbcEncrypt(&des3, cipher, plain, DES3_BLOCK_SIZE);
|
||||
blocks++;
|
||||
currTime = wolfsslGetTime();
|
||||
stop = currTime - start;
|
||||
|
@ -192,17 +193,17 @@ int wolfsslBenchmark(int timer, int* option)
|
|||
key = malloc(CAMELLIA_BLOCK_SIZE);
|
||||
iv = malloc(CAMELLIA_BLOCK_SIZE);
|
||||
|
||||
RNG_GenerateBlock(&rng, plain, CAMELLIA_BLOCK_SIZE);
|
||||
RNG_GenerateBlock(&rng, cipher, CAMELLIA_BLOCK_SIZE);
|
||||
RNG_GenerateBlock(&rng, key, CAMELLIA_BLOCK_SIZE);
|
||||
RNG_GenerateBlock(&rng, iv, CAMELLIA_BLOCK_SIZE);
|
||||
wc_RNG_GenerateBlock(&rng, plain, CAMELLIA_BLOCK_SIZE);
|
||||
wc_RNG_GenerateBlock(&rng, cipher, CAMELLIA_BLOCK_SIZE);
|
||||
wc_RNG_GenerateBlock(&rng, key, CAMELLIA_BLOCK_SIZE);
|
||||
wc_RNG_GenerateBlock(&rng, iv, CAMELLIA_BLOCK_SIZE);
|
||||
|
||||
start = wolfsslGetTime();
|
||||
alarm(timer);
|
||||
|
||||
CamelliaSetKey(&camellia, key, CAMELLIA_BLOCK_SIZE, iv);
|
||||
wc_CamelliaSetKey(&camellia, key, CAMELLIA_BLOCK_SIZE, iv);
|
||||
while (loop) {
|
||||
CamelliaCbcEncrypt(&camellia, cipher, plain, CAMELLIA_BLOCK_SIZE);
|
||||
wc_CamelliaCbcEncrypt(&camellia, cipher, plain, CAMELLIA_BLOCK_SIZE);
|
||||
blocks++;
|
||||
currTime = wolfsslGetTime();
|
||||
stop = currTime - start;
|
||||
|
@ -231,21 +232,21 @@ int wolfsslBenchmark(int timer, int* option)
|
|||
|
||||
digest = malloc(MD5_DIGEST_SIZE);
|
||||
plain = malloc(MEGABYTE);
|
||||
RNG_GenerateBlock(&rng, plain, MEGABYTE);
|
||||
wc_RNG_GenerateBlock(&rng, plain, MEGABYTE);
|
||||
|
||||
InitMd5(&md5);
|
||||
wc_InitMd5(&md5);
|
||||
start = wolfsslGetTime();
|
||||
alarm(timer);
|
||||
|
||||
while (loop) {
|
||||
Md5Update(&md5, plain, MEGABYTE);
|
||||
wc_Md5Update(&md5, plain, MEGABYTE);
|
||||
blocks++;
|
||||
currTime = wolfsslGetTime();
|
||||
stop = currTime - start;
|
||||
/* if stop >= timer, loop = 0 */
|
||||
loop = (stop >= timer) ? 0 : 1;
|
||||
}
|
||||
Md5Final(&md5, digest);
|
||||
wc_Md5Final(&md5, digest);
|
||||
printf("MD5 ");
|
||||
wolfsslStats(start, MEGABYTE, blocks);
|
||||
XMEMSET(plain, 0, MEGABYTE);
|
||||
|
@ -264,21 +265,21 @@ int wolfsslBenchmark(int timer, int* option)
|
|||
|
||||
digest = malloc(SHA_DIGEST_SIZE);
|
||||
plain = malloc(MEGABYTE);
|
||||
RNG_GenerateBlock(&rng, plain, MEGABYTE);
|
||||
wc_RNG_GenerateBlock(&rng, plain, MEGABYTE);
|
||||
|
||||
InitSha(&sha);
|
||||
wc_InitSha(&sha);
|
||||
start = wolfsslGetTime();
|
||||
alarm(timer);
|
||||
|
||||
while (loop) {
|
||||
ShaUpdate(&sha, plain, MEGABYTE);
|
||||
wc_ShaUpdate(&sha, plain, MEGABYTE);
|
||||
blocks++;
|
||||
currTime = wolfsslGetTime();
|
||||
stop = currTime - start;
|
||||
/* if stop >= timer, loop = 0 */
|
||||
loop = (stop >= timer) ? 0 : 1;
|
||||
}
|
||||
ShaFinal(&sha, digest);
|
||||
wc_ShaFinal(&sha, digest);
|
||||
printf("Sha ");
|
||||
wolfsslStats(start, MEGABYTE, blocks);
|
||||
XMEMSET(plain, 0, MEGABYTE);
|
||||
|
@ -297,21 +298,21 @@ int wolfsslBenchmark(int timer, int* option)
|
|||
|
||||
digest = malloc(SHA256_DIGEST_SIZE);
|
||||
plain = malloc(MEGABYTE);
|
||||
RNG_GenerateBlock(&rng, plain, MEGABYTE);
|
||||
wc_RNG_GenerateBlock(&rng, plain, MEGABYTE);
|
||||
|
||||
InitSha256(&sha256);
|
||||
wc_InitSha256(&sha256);
|
||||
start = wolfsslGetTime();
|
||||
alarm(timer);
|
||||
|
||||
while (loop) {
|
||||
Sha256Update(&sha256, plain, MEGABYTE);
|
||||
wc_Sha256Update(&sha256, plain, MEGABYTE);
|
||||
blocks++;
|
||||
currTime = wolfsslGetTime();
|
||||
stop = currTime - start;
|
||||
/* if stop >= timer, loop = 0 */
|
||||
loop = (stop >= timer) ? 0 : 1;
|
||||
}
|
||||
Sha256Final(&sha256, digest);
|
||||
wc_Sha256Final(&sha256, digest);
|
||||
printf("Sha256 ");
|
||||
wolfsslStats(start, MEGABYTE, blocks);
|
||||
XMEMSET(plain, 0, MEGABYTE);
|
||||
|
@ -324,28 +325,28 @@ int wolfsslBenchmark(int timer, int* option)
|
|||
}
|
||||
i++;
|
||||
#endif
|
||||
#ifdef CYASSL_SHA384
|
||||
#ifdef WOLFSSL_SHA384
|
||||
/* sha384 test */
|
||||
if (option[i] == 1) {
|
||||
Sha384 sha384;
|
||||
|
||||
digest = malloc(SHA384_DIGEST_SIZE);
|
||||
plain = malloc(MEGABYTE);
|
||||
RNG_GenerateBlock(&rng, plain, MEGABYTE);
|
||||
wc_RNG_GenerateBlock(&rng, plain, MEGABYTE);
|
||||
|
||||
InitSha384(&sha384);
|
||||
wc_InitSha384(&sha384);
|
||||
start = wolfsslGetTime();
|
||||
alarm(timer);
|
||||
|
||||
while (loop) {
|
||||
Sha384Update(&sha384, plain, MEGABYTE);
|
||||
wc_Sha384Update(&sha384, plain, MEGABYTE);
|
||||
blocks++;
|
||||
currTime = wolfsslGetTime();
|
||||
stop = currTime - start;
|
||||
/* if stop >= timer, loop = 0 */
|
||||
loop = (stop >= timer) ? 0 : 1;
|
||||
}
|
||||
Sha384Final(&sha384, digest);
|
||||
wc_Sha384Final(&sha384, digest);
|
||||
printf("Sha384 ");
|
||||
wolfsslStats(start, MEGABYTE, blocks);
|
||||
XMEMSET(plain, 0, MEGABYTE);
|
||||
|
@ -357,28 +358,28 @@ int wolfsslBenchmark(int timer, int* option)
|
|||
}
|
||||
i++;
|
||||
#endif
|
||||
#ifdef CYASSL_SHA512
|
||||
#ifdef WOLFSSL_SHA512
|
||||
/* sha512 test */
|
||||
if (option[i] == 1) {
|
||||
Sha512 sha512;
|
||||
|
||||
digest = malloc(SHA512_DIGEST_SIZE);
|
||||
plain = malloc(MEGABYTE);
|
||||
RNG_GenerateBlock(&rng, plain, MEGABYTE);
|
||||
wc_RNG_GenerateBlock(&rng, plain, MEGABYTE);
|
||||
|
||||
InitSha512(&sha512);
|
||||
wc_InitSha512(&sha512);
|
||||
start = wolfsslGetTime();
|
||||
alarm(timer);
|
||||
|
||||
while (loop) {
|
||||
Sha512Update(&sha512, plain, MEGABYTE);
|
||||
wc_Sha512Update(&sha512, plain, MEGABYTE);
|
||||
blocks++;
|
||||
currTime = wolfsslGetTime();
|
||||
stop = currTime - start;
|
||||
/* if stop >= timer, loop = 0 */
|
||||
loop = (stop >= timer) ? 0 : 1;
|
||||
}
|
||||
Sha512Final(&sha512, digest);
|
||||
wc_Sha512Final(&sha512, digest);
|
||||
printf("Sha512 ");
|
||||
wolfsslStats(start, MEGABYTE, blocks);
|
||||
XMEMSET(plain, 0, MEGABYTE);
|
||||
|
@ -397,21 +398,21 @@ int wolfsslBenchmark(int timer, int* option)
|
|||
|
||||
digest = malloc(BLAKE_DIGEST_SIZE);
|
||||
plain = malloc(MEGABYTE);
|
||||
RNG_GenerateBlock(&rng, plain, MEGABYTE);
|
||||
wc_RNG_GenerateBlock(&rng, plain, MEGABYTE);
|
||||
|
||||
InitBlake2b(&b2b, BLAKE_DIGEST_SIZE);
|
||||
wc_InitBlake2b(&b2b, BLAKE_DIGEST_SIZE);
|
||||
start = wolfsslGetTime();
|
||||
alarm(timer);
|
||||
|
||||
while (loop) {
|
||||
Blake2bUpdate(&b2b, plain, MEGABYTE);
|
||||
wc_Blake2bUpdate(&b2b, plain, MEGABYTE);
|
||||
blocks++;
|
||||
currTime = wolfsslGetTime();
|
||||
stop = currTime - start;
|
||||
/* if stop >= timer, loop = 0 */
|
||||
loop = (stop >= timer) ? 0 : 1;
|
||||
}
|
||||
Blake2bFinal(&b2b, digest, BLAKE_DIGEST_SIZE);
|
||||
wc_Blake2bFinal(&b2b, digest, BLAKE_DIGEST_SIZE);
|
||||
printf("Blake2b ");
|
||||
wolfsslStats(start, MEGABYTE, blocks);
|
||||
XMEMSET(plain, 0, MEGABYTE);
|
||||
|
|
|
@ -1,21 +1,22 @@
|
|||
/* wolfsslDecrypt.c
|
||||
*
|
||||
* Copyright (C) 2006-2014 wolfSSL Inc.
|
||||
* This file is part of CyaSSL.
|
||||
* Copyright (C) 2006-2015 wolfSSL Inc.
|
||||
*
|
||||
* CyaSSL is free software; you can redistribute it and/or modify
|
||||
* This file is part of wolfSSL. (formerly known as CyaSSL)
|
||||
*
|
||||
* wolfSSL 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,
|
||||
* wolfSSL 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,USA
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "include/wolfssl.h"
|
||||
|
@ -86,7 +87,7 @@ int wolfsslDecrypt(char* alg, char* mode, byte* pwdKey, byte* key, int size,
|
|||
input = (byte*) malloc(MAX);
|
||||
output = (byte*) malloc(MAX);
|
||||
|
||||
InitRng(&rng);
|
||||
wc_InitRng(&rng);
|
||||
|
||||
/* reads from inFile and writes whatever
|
||||
* is there to the input buffer
|
||||
|
@ -108,7 +109,7 @@ int wolfsslDecrypt(char* alg, char* mode, byte* pwdKey, byte* key, int size,
|
|||
}
|
||||
/* replicates old pwdKey if pwdKeys match */
|
||||
if (keyType == 1) {
|
||||
if (PBKDF2(key, pwdKey, (int) strlen((const char*)pwdKey), salt,
|
||||
if (wc_PBKDF2(key, pwdKey, (int) strlen((const char*)pwdKey), salt,
|
||||
SALT_SIZE, 4096, size, SHA256) != 0) {
|
||||
printf("pwdKey set error.\n");
|
||||
wolfsslFreeBins(input, output, NULL, NULL, NULL);
|
||||
|
@ -150,14 +151,14 @@ int wolfsslDecrypt(char* alg, char* mode, byte* pwdKey, byte* key, int size,
|
|||
#ifndef NO_AES
|
||||
if (strcmp(alg, "aes") == 0) {
|
||||
if (strcmp(mode, "cbc") == 0) {
|
||||
ret = AesSetKey(&aes, key, AES_BLOCK_SIZE, iv, AES_DECRYPTION);
|
||||
ret = wc_AesSetKey(&aes, key, AES_BLOCK_SIZE, iv, AES_DECRYPTION);
|
||||
if (ret != 0) {
|
||||
fclose(inFile);
|
||||
fclose(outFile);
|
||||
wolfsslFreeBins(input, output, NULL, NULL, NULL);
|
||||
return ret;
|
||||
}
|
||||
ret = AesCbcDecrypt(&aes, output, input, tempMax);
|
||||
ret = wc_AesCbcDecrypt(&aes, output, input, tempMax);
|
||||
if (ret != 0) {
|
||||
fclose(inFile);
|
||||
fclose(outFile);
|
||||
|
@ -165,25 +166,25 @@ int wolfsslDecrypt(char* alg, char* mode, byte* pwdKey, byte* key, int size,
|
|||
return DECRYPT_ERROR;
|
||||
}
|
||||
}
|
||||
#ifdef CYASSL_AES_COUNTER
|
||||
#ifdef WOLFSSL_AES_COUNTER
|
||||
else if (strcmp(mode, "ctr") == 0) {
|
||||
/* if mode is ctr */
|
||||
AesSetKeyDirect(&aes, key, AES_BLOCK_SIZE, iv, AES_ENCRYPTION);
|
||||
AesCtrEncrypt(&aes, output, input, tempMax);
|
||||
wc_AesSetKeyDirect(&aes, key, AES_BLOCK_SIZE, iv, AES_ENCRYPTION);
|
||||
wc_AesCtrEncrypt(&aes, output, input, tempMax);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
#ifndef NO_DES3
|
||||
if (strcmp(alg, "3des") == 0) {
|
||||
ret = Des3_SetKey(&des3, key, iv, DES_DECRYPTION);
|
||||
ret = wc_Des3_SetKey(&des3, key, iv, DES_DECRYPTION);
|
||||
if (ret != 0) {
|
||||
fclose(inFile);
|
||||
fclose(outFile);
|
||||
wolfsslFreeBins(input, output, NULL, NULL, NULL);
|
||||
return ret;
|
||||
}
|
||||
ret = Des3_CbcDecrypt(&des3, output, input, tempMax);
|
||||
ret = wc_Des3_CbcDecrypt(&des3, output, input, tempMax);
|
||||
if (ret != 0){
|
||||
fclose(inFile);
|
||||
fclose(outFile);
|
||||
|
@ -194,14 +195,14 @@ int wolfsslDecrypt(char* alg, char* mode, byte* pwdKey, byte* key, int size,
|
|||
#endif
|
||||
#ifdef HAVE_CAMELLIA
|
||||
if (strcmp(alg, "camellia") == 0) {
|
||||
ret = CamelliaSetKey(&camellia, key, block, iv);
|
||||
ret = wc_CamelliaSetKey(&camellia, key, block, iv);
|
||||
if (ret != 0) {
|
||||
fclose(inFile);
|
||||
fclose(outFile);
|
||||
wolfsslFreeBins(input, output, NULL, NULL, NULL);
|
||||
return ret;
|
||||
}
|
||||
CamelliaCbcDecrypt(&camellia, output, input, tempMax);
|
||||
wc_CamelliaCbcDecrypt(&camellia, output, input, tempMax);
|
||||
}
|
||||
#endif
|
||||
if (currLoopFlag == lastLoopFlag) {
|
||||
|
@ -236,8 +237,8 @@ int wolfsslDecrypt(char* alg, char* mode, byte* pwdKey, byte* key, int size,
|
|||
XMEMSET (output, 0, MAX);
|
||||
wolfsslFreeBins(input, output, NULL, NULL, NULL);
|
||||
XMEMSET(key, 0, size);
|
||||
/* Use the cyassl FreeRng to free rng */
|
||||
FreeRng(&rng);
|
||||
/* Use the wolfssl wc_FreeRng to free rng */
|
||||
wc_FreeRng(&rng);
|
||||
fclose(inFile);
|
||||
fclose(outFile);
|
||||
|
||||
|
|
|
@ -1,21 +1,22 @@
|
|||
/* wolfsslEncrypt.c
|
||||
*
|
||||
* Copyright (C) 2006-2014 wolfSSL Inc.
|
||||
* This file is part of CyaSSL.
|
||||
* Copyright (C) 2006-2015 wolfSSL Inc.
|
||||
*
|
||||
* CyaSSL is free software; you can redistribute it and/or modify
|
||||
* This file is part of wolfSSL. (formerly known as CyaSSL)
|
||||
*
|
||||
* wolfSSL 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,
|
||||
* wolfSSL 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,USA
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "include/wolfssl.h"
|
||||
|
@ -93,7 +94,7 @@ int wolfsslEncrypt(char* alg, char* mode, byte* pwdKey, byte* key, int size,
|
|||
length = inputLength;
|
||||
|
||||
/* Start up the random number generator */
|
||||
ret = (int) InitRng(&rng);
|
||||
ret = (int) wc_InitRng(&rng);
|
||||
if (ret != 0) {
|
||||
printf("Random Number Generator failed to start.\n");
|
||||
return ret;
|
||||
|
@ -112,7 +113,7 @@ int wolfsslEncrypt(char* alg, char* mode, byte* pwdKey, byte* key, int size,
|
|||
*/
|
||||
if (ivCheck == 0) {
|
||||
/* IV not set, generate it */
|
||||
ret = RNG_GenerateBlock(&rng, iv, block);
|
||||
ret = wc_RNG_GenerateBlock(&rng, iv, block);
|
||||
|
||||
if (ret != 0) {
|
||||
return ret;
|
||||
|
@ -184,39 +185,39 @@ int wolfsslEncrypt(char* alg, char* mode, byte* pwdKey, byte* key, int size,
|
|||
#ifndef NO_AES
|
||||
if (strcmp(alg, "aes") == 0) {
|
||||
if (strcmp(mode, "cbc") == 0) {
|
||||
ret = AesSetKey(&aes, key, AES_BLOCK_SIZE, iv, AES_ENCRYPTION);
|
||||
ret = wc_AesSetKey(&aes, key, AES_BLOCK_SIZE, iv, AES_ENCRYPTION);
|
||||
if (ret != 0) {
|
||||
printf("AesSetKey failed.\n");
|
||||
printf("wc_AesSetKey failed.\n");
|
||||
wolfsslFreeBins(input, output, NULL, NULL, NULL);
|
||||
return ret;
|
||||
}
|
||||
ret = AesCbcEncrypt(&aes, output, input, tempMax);
|
||||
ret = wc_AesCbcEncrypt(&aes, output, input, tempMax);
|
||||
if (ret != 0) {
|
||||
printf("AesCbcEncrypt failed.\n");
|
||||
printf("wc_AesCbcEncrypt failed.\n");
|
||||
wolfsslFreeBins(input, output, NULL, NULL, NULL);
|
||||
return ENCRYPT_ERROR;
|
||||
}
|
||||
}
|
||||
#ifdef CYASSL_AES_COUNTER
|
||||
#ifdef WOLFSSL_AES_COUNTER
|
||||
else if (strcmp(mode, "ctr") == 0) {
|
||||
/* if mode is ctr */
|
||||
AesSetKeyDirect(&aes, key, AES_BLOCK_SIZE, iv, AES_ENCRYPTION);
|
||||
AesCtrEncrypt(&aes, output, input, tempMax);
|
||||
wc_AesSetKeyDirect(&aes, key, AES_BLOCK_SIZE, iv, AES_ENCRYPTION);
|
||||
wc_AesCtrEncrypt(&aes, output, input, tempMax);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
#ifndef NO_DES3
|
||||
if (strcmp(alg, "3des") == 0) {
|
||||
ret = Des3_SetKey(&des3, key, iv, DES_ENCRYPTION);
|
||||
ret = wc_Des3_SetKey(&des3, key, iv, DES_ENCRYPTION);
|
||||
if (ret != 0) {
|
||||
printf("Des3_SetKey failed.\n");
|
||||
printf("wc_Des3_SetKey failed.\n");
|
||||
wolfsslFreeBins(input, output, NULL, NULL, NULL);
|
||||
return ret;
|
||||
}
|
||||
ret = Des3_CbcEncrypt(&des3, output, input, tempMax);
|
||||
ret = wc_Des3_CbcEncrypt(&des3, output, input, tempMax);
|
||||
if (ret != 0) {
|
||||
printf("Des3_CbcEncrypt failed.\n");
|
||||
printf("wc_Des3_cbcEncrypt failed.\n");
|
||||
wolfsslFreeBins(input, output, NULL, NULL, NULL);
|
||||
return ENCRYPT_ERROR;
|
||||
}
|
||||
|
@ -224,14 +225,14 @@ int wolfsslEncrypt(char* alg, char* mode, byte* pwdKey, byte* key, int size,
|
|||
#endif
|
||||
#ifdef HAVE_CAMELLIA
|
||||
if (strcmp(alg, "camellia") == 0) {
|
||||
ret = CamelliaSetKey(&camellia, key, block, iv);
|
||||
ret = wc_CamelliaSetKey(&camellia, key, block, iv);
|
||||
if (ret != 0) {
|
||||
printf("CamelliaSetKey failed.\n");
|
||||
wolfsslFreeBins(input, output, NULL, NULL, NULL);
|
||||
return ret;
|
||||
}
|
||||
if (strcmp(mode, "cbc") == 0) {
|
||||
CamelliaCbcEncrypt(&camellia, output, input, tempMax);
|
||||
wc_CamelliaCbcEncrypt(&camellia, output, input, tempMax);
|
||||
}
|
||||
else {
|
||||
printf("Incompatible mode while using Camellia.\n");
|
||||
|
@ -287,8 +288,8 @@ int wolfsslEncrypt(char* alg, char* mode, byte* pwdKey, byte* key, int size,
|
|||
XMEMSET(iv, 0 , block);
|
||||
XMEMSET(alg, 0, size);
|
||||
XMEMSET(mode, 0 , block);
|
||||
/* Use the cyassl free for rng */
|
||||
FreeRng(&rng);
|
||||
/* Use the wolfssl free for rng */
|
||||
wc_FreeRng(&rng);
|
||||
wolfsslFreeBins(input, output, NULL, NULL, NULL);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
/* wolfsslFuncs.c
|
||||
*
|
||||
* Copyright (C) 2006-2014 wolfSSL Inc.
|
||||
* This file is part of wolfSSL. (formerly known as CyaSSL)
|
||||
* Copyright (C) 2006-2015 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of wolfSSL. (formerly known as wolfSSL)
|
||||
*
|
||||
* wolfSSL is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -78,10 +79,10 @@ void wolfsslVerboseHelp()
|
|||
#ifndef NO_SHA256
|
||||
,"sha256"
|
||||
#endif
|
||||
#ifdef CYASSL_SHA384
|
||||
#ifdef WOLFSSL_SHA384
|
||||
,"sha384"
|
||||
#endif
|
||||
#ifdef CYASSL_SHA512
|
||||
#ifdef WOLFSSL_SHA512
|
||||
,"sha512"
|
||||
#endif
|
||||
#ifdef HAVE_BLAKE2
|
||||
|
@ -94,7 +95,7 @@ void wolfsslVerboseHelp()
|
|||
#ifndef NO_AES
|
||||
"aes-cbc"
|
||||
#endif
|
||||
#ifdef CYASSL_AES_COUNTER
|
||||
#ifdef WOLFSSL_AES_COUNTER
|
||||
, "aes-ctr"
|
||||
#endif
|
||||
#ifndef NO_DES3
|
||||
|
@ -112,10 +113,10 @@ void wolfsslVerboseHelp()
|
|||
#ifndef NO_SHA256
|
||||
, "sha256"
|
||||
#endif
|
||||
#ifdef CYASSL_SHA384
|
||||
#ifdef WOLFSSL_SHA384
|
||||
, "sha384"
|
||||
#endif
|
||||
#ifdef CYASSL_SHA512
|
||||
#ifdef WOLFSSL_SHA512
|
||||
, "sha512"
|
||||
#endif
|
||||
#ifdef HAVE_BLAKE2
|
||||
|
@ -129,7 +130,7 @@ void wolfsslVerboseHelp()
|
|||
#ifndef NO_AES
|
||||
printf("aes-cbc-128\t\taes-cbc-192\t\taes-cbc-256\n");
|
||||
#endif
|
||||
#ifdef CYASSL_AES_COUNTER
|
||||
#ifdef WOLFSSL_AES_COUNTER
|
||||
printf("aes-ctr-128\t\taes-ctr-192\t\taes-ctr-256\n");
|
||||
#endif
|
||||
#ifndef NO_DES3
|
||||
|
@ -163,7 +164,7 @@ void wolfsslEncryptHelp()
|
|||
#ifndef NO_AES
|
||||
printf("aes-cbc-128\t\taes-cbc-192\t\taes-cbc-256\n");
|
||||
#endif
|
||||
#ifdef CYASSL_AES_COUNTER
|
||||
#ifdef WOLFSSL_AES_COUNTER
|
||||
printf("aes-ctr-128\t\taes-ctr-192\t\taes-ctr-256\n");
|
||||
#endif
|
||||
#ifndef NO_DES3
|
||||
|
@ -191,7 +192,7 @@ void wolfsslDecryptHelp()
|
|||
#ifndef NO_AES
|
||||
printf("aes-cbc-128\t\taes-cbc-192\t\taes-cbc-256\n");
|
||||
#endif
|
||||
#ifdef CYASSL_AES_COUNTER
|
||||
#ifdef WOLFSSL_AES_COUNTER
|
||||
printf("aes-ctr-128\t\taes-ctr-192\t\taes-ctr-256\n");
|
||||
#endif
|
||||
#ifndef NO_DES3
|
||||
|
@ -226,10 +227,10 @@ void wolfsslHashHelp()
|
|||
#ifndef NO_SHA256
|
||||
,"sha256"
|
||||
#endif
|
||||
#ifdef CYASSL_SHA384
|
||||
#ifdef WOLFSSL_SHA384
|
||||
,"sha384"
|
||||
#endif
|
||||
#ifdef CYASSL_SHA512
|
||||
#ifdef WOLFSSL_SHA512
|
||||
,"sha512"
|
||||
#endif
|
||||
#ifdef HAVE_BLAKE2
|
||||
|
@ -259,7 +260,7 @@ void wolfsslBenchHelp()
|
|||
#ifndef NO_AES
|
||||
"aes-cbc"
|
||||
#endif
|
||||
#ifdef CYASSL_AES_COUNTER
|
||||
#ifdef WOLFSSL_AES_COUNTER
|
||||
, "aes-ctr"
|
||||
#endif
|
||||
#ifndef NO_DES3
|
||||
|
@ -277,10 +278,10 @@ void wolfsslBenchHelp()
|
|||
#ifndef NO_SHA256
|
||||
, "sha256"
|
||||
#endif
|
||||
#ifdef CYASSL_SHA384
|
||||
#ifdef WOLFSSL_SHA384
|
||||
, "sha384"
|
||||
#endif
|
||||
#ifdef CYASSL_SHA512
|
||||
#ifdef WOLFSSL_SHA512
|
||||
, "sha512"
|
||||
#endif
|
||||
#ifdef HAVE_BLAKE2
|
||||
|
@ -323,7 +324,7 @@ int wolfsslGetAlgo(char* name, char** alg, char** mode, int* size)
|
|||
#endif
|
||||
};
|
||||
const char* acceptMode[] = {"cbc"
|
||||
#ifdef CYASSL_AES_COUNTER
|
||||
#ifdef WOLFSSL_AES_COUNTER
|
||||
, "ctr"
|
||||
#endif
|
||||
};
|
||||
|
@ -397,7 +398,7 @@ int wolfsslGenKey(RNG* rng, byte* pwdKey, int size, byte* salt, int pad)
|
|||
|
||||
/* randomly generates salt */
|
||||
|
||||
ret = RNG_GenerateBlock(rng, salt, SALT_SIZE-1);
|
||||
ret = wc_RNG_GenerateBlock(rng, salt, SALT_SIZE-1);
|
||||
|
||||
if (ret != 0)
|
||||
return ret;
|
||||
|
@ -409,7 +410,7 @@ int wolfsslGenKey(RNG* rng, byte* pwdKey, int size, byte* salt, int pad)
|
|||
salt[0] = 0;
|
||||
|
||||
/* stretches pwdKey */
|
||||
ret = (int) PBKDF2(pwdKey, pwdKey, (int) strlen((const char*)pwdKey), salt, SALT_SIZE,
|
||||
ret = (int) wc_PBKDF2(pwdKey, pwdKey, (int) strlen((const char*)pwdKey), salt, SALT_SIZE,
|
||||
4096, size, SHA256);
|
||||
if (ret != 0)
|
||||
return ret;
|
||||
|
|
|
@ -1,21 +1,22 @@
|
|||
/* wolfsslHash.c
|
||||
*
|
||||
* Copyright (C) 2006-2014 wolfSSL Inc.
|
||||
* This file is part of CyaSSL.
|
||||
* Copyright (C) 2006-2015 wolfSSL Inc.
|
||||
*
|
||||
* CyaSSL is free software; you can redistribute it and/or modify
|
||||
* This file is part of wolfSSL. (formerly known as CyaSSL)
|
||||
*
|
||||
* wolfSSL 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,
|
||||
* wolfSSL 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,USA
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "include/wolfssl.h"
|
||||
|
@ -78,34 +79,34 @@ int wolfsslHash(char* in, char* out, char* alg, int size)
|
|||
/* hashes using accepted algorithm */
|
||||
#ifndef NO_MD5
|
||||
if (strcmp(alg, "md5") == 0) {
|
||||
ret = Md5Hash(input, length, output);
|
||||
ret = wc_Md5Hash(input, length, output);
|
||||
}
|
||||
#endif
|
||||
#ifndef NO_SHA
|
||||
else if (strcmp(alg, "sha") == 0) {
|
||||
ret = ShaHash(input, length, output);
|
||||
ret = wc_ShaHash(input, length, output);
|
||||
}
|
||||
#endif
|
||||
#ifndef NO_SHA256
|
||||
else if (strcmp(alg, "sha256") == 0) {
|
||||
ret = Sha256Hash(input, length, output);
|
||||
ret = wc_Sha256Hash(input, length, output);
|
||||
}
|
||||
#endif
|
||||
#ifdef CYASSL_SHA384
|
||||
#ifdef WOLFSSL_SHA384
|
||||
else if (strcmp(alg, "sha384") == 0) {
|
||||
ret = Sha384Hash(input, length, output);
|
||||
ret = wc_Sha384Hash(input, length, output);
|
||||
}
|
||||
#endif
|
||||
#ifdef CYASSL_SHA512
|
||||
#ifdef WOLFSSL_SHA512
|
||||
else if (strcmp(alg, "sha512") == 0) {
|
||||
ret = Sha512Hash(input, length, output);
|
||||
ret = wc_Sha512Hash(input, length, output);
|
||||
}
|
||||
#endif
|
||||
#ifdef HAVE_BLAKE2
|
||||
else if (strcmp(alg, "blake2b") == 0) {
|
||||
ret = InitBlake2b(&hash, size);
|
||||
ret = Blake2bUpdate(&hash, input, length);
|
||||
ret = Blake2bFinal(&hash, output, size);
|
||||
ret = wc_InitBlake2b(&hash, size);
|
||||
ret = wc_Blake2bUpdate(&hash, input, length);
|
||||
ret = wc_Blake2bFinal(&hash, output, size);
|
||||
}
|
||||
#endif
|
||||
if (ret == 0) {
|
||||
|
|
|
@ -1,21 +1,22 @@
|
|||
/* wolfsslHashSetup.c
|
||||
*
|
||||
* Copyright (C) 2006-2014 wolfSSL Inc.
|
||||
* This file is part of CyaSSL.
|
||||
* Copyright (C) 2006-2015 wolfSSL Inc.
|
||||
*
|
||||
* CyaSSL is free software; you can redistribute it and/or modify
|
||||
* This file is part of wolfSSL. (formerly known as CyaSSL)
|
||||
*
|
||||
* wolfSSL 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,
|
||||
* wolfSSL 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,USA
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "include/wolfssl.h"
|
||||
|
@ -39,10 +40,10 @@ int wolfsslHashSetup(int argc, char** argv)
|
|||
#ifndef NO_SHA256
|
||||
, "sha256"
|
||||
#endif
|
||||
#ifdef CYASSL_SHA384
|
||||
#ifdef WOLFSSL_SHA384
|
||||
, "sha384"
|
||||
#endif
|
||||
#ifdef CYASSL_SHA512
|
||||
#ifdef WOLFSSL_SHA512
|
||||
, "sha512"
|
||||
#endif
|
||||
#ifdef HAVE_BLAKE2
|
||||
|
@ -134,12 +135,12 @@ int wolfsslHashSetup(int argc, char** argv)
|
|||
size = SHA256_DIGEST_SIZE;
|
||||
#endif
|
||||
|
||||
#ifdef CYASSL_SHA384
|
||||
#ifdef WOLFSSL_SHA384
|
||||
if (strcmp(alg, "sha384") == 0)
|
||||
size = SHA384_DIGEST_SIZE;
|
||||
#endif
|
||||
|
||||
#ifdef CYASSL_SHA512
|
||||
#ifdef WOLFSSL_SHA512
|
||||
if (strcmp(alg, "sha512") == 0)
|
||||
size = SHA512_DIGEST_SIZE;
|
||||
#endif
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
/* wolfsslHexToBin.c
|
||||
*
|
||||
* Copyright (C) 2006-2014 wolfSSL Inc.
|
||||
* Copyright (C) 2006-2015 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of CyaSSL.
|
||||
* This file is part of wolfSSL. (formerly known as CyaSSL)
|
||||
*
|
||||
* CyaSSL is free software; you can redistribute it and/or modify
|
||||
* wolfSSL 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,
|
||||
* wolfSSL 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.
|
||||
|
@ -18,21 +18,21 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*
|
||||
* NOTE: need to compile CyaSSL with "--enable-opensslextra" to get access
|
||||
* NOTE: need to compile wolfSSL with "--enable-opensslextra" to get access
|
||||
* to Base16_Decode() function.
|
||||
*
|
||||
* Compile this example using:
|
||||
*
|
||||
*/
|
||||
|
||||
#include <cyassl/options.h>
|
||||
#include <cyassl/ctaocrypt/types.h>
|
||||
#include <cyassl/ctaocrypt/coding.h>
|
||||
#include <cyassl/ctaocrypt/error-crypt.h>
|
||||
#include <wolfssl/options.h>
|
||||
#include <wolfssl/wolfcrypt/types.h>
|
||||
#include <wolfssl/wolfcrypt/coding.h>
|
||||
#include <wolfssl/wolfcrypt/error-crypt.h>
|
||||
#include <stdio.h>
|
||||
#include <include/wolfssl.h>
|
||||
//#include <include/wolfssl.h>
|
||||
|
||||
/* free up to 5 binary buffers using cyassl abstraction layer */
|
||||
/* free up to 5 binary buffers using wolfssl abstraction layer */
|
||||
void wolfsslFreeBins(byte* b1, byte* b2, byte* b3, byte* b4, byte* b5)
|
||||
{
|
||||
XFREE(b1, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
|
|
|
@ -1,21 +1,22 @@
|
|||
/* wolfsslMain.c
|
||||
*
|
||||
* Copyright (C) 2006-2014 wolfSSL Inc.
|
||||
* This file is part of CyaSSL.
|
||||
* Copyright (C) 2006-2015 wolfSSL Inc.
|
||||
*
|
||||
* CyaSSL is free software; you can redistribute it and/or modify
|
||||
* This file is part of wolfSSL. (formerly known as CyaSSL)
|
||||
*
|
||||
* wolfSSL 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,
|
||||
* wolfSSL 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,USA
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "include/wolfssl.h"
|
||||
|
|
|
@ -1,21 +1,22 @@
|
|||
/* wolfsslSetup.c
|
||||
*
|
||||
* Copyright (C) 2006-2014 wolfSSL Inc.
|
||||
* This file is part of CyaSSL.
|
||||
* Copyright (C) 2006-2015 wolfSSL Inc.
|
||||
*
|
||||
* CyaSSL is free software; you can redistribute it and/or modify
|
||||
* This file is part of wolfSSL. (formerly known as CyaSSL)
|
||||
*
|
||||
* wolfSSL 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,
|
||||
* wolfSSL 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,USA
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "include/wolfssl.h"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
These are the NIST test vectors provided for functionality verification.
|
||||
|
||||
Simply run the two shell scripts (.sh files) in order to initiate the testing processes.
|
||||
This may take several minutes.
|
||||
|
||||
Make sure that you have run 'make' so the program will run correctly.
|
||||
These are the NIST test vectors provided for functionality verification.
|
||||
|
||||
Simply run the two shell scripts (.sh files) in order to initiate the testing processes.
|
||||
This may take several minutes.
|
||||
|
||||
Make sure that you have run 'make' so the program will run correctly.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#Test utility functionality
|
||||
#!/bin/bash
|
||||
PAT="cd ~/"
|
||||
CYASSL="wolfssl"
|
||||
WOLFSSL="wolfssl"
|
||||
ENC="-e"
|
||||
DEC="-d"
|
||||
HASH="-h"
|
||||
|
@ -17,7 +17,7 @@ SHA3="-sha384"
|
|||
SHA5="-sha512"
|
||||
BLAKE="-blake2b"
|
||||
zero=0
|
||||
OPTS="cyassl/cyassl/options.h"
|
||||
OPTS="wolfssl/wolfssl/options.h"
|
||||
|
||||
function crypto() {
|
||||
cd $currentDir
|
||||
|
@ -35,12 +35,12 @@ function crypto() {
|
|||
|
||||
echo $RANDF >> $IN
|
||||
|
||||
echo $CYASSL $ENC $1 size: $SIZEF bytes
|
||||
$CYASSL $ENC $1 -i $IN -o $OUT -p $KEY
|
||||
$CYASSL $DEC $1 -i $OUT -o $IN -p $KEY
|
||||
echo $CYASSL $ENC $1 -i $RANDT
|
||||
$CYASSL $ENC $1 -i $RANDT -o $OUT -p $KEY
|
||||
$CYASSL $DEC $1 -i $OUT -o $IN -p $KEY
|
||||
echo $WOLFSSL $ENC $1 size: $SIZEF bytes
|
||||
$WOLFSSL $ENC $1 -i $IN -o $OUT -p $KEY
|
||||
$WOLFSSL $DEC $1 -i $OUT -o $IN -p $KEY
|
||||
echo $WOLFSSL $ENC $1 -i $RANDT
|
||||
$WOLFSSL $ENC $1 -i $RANDT -o $OUT -p $KEY
|
||||
$WOLFSSL $DEC $1 -i $OUT -o $IN -p $KEY
|
||||
|
||||
rm $OUT
|
||||
rm $IN
|
||||
|
@ -65,10 +65,10 @@ function hashing() {
|
|||
RANDT=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w $SIZET | head -n 1)
|
||||
echo $RANDF >> $IN
|
||||
|
||||
echo $CYASSL -h $1 size: $SIZEF bytes
|
||||
$CYASSL -h $1 -i $IN -o $OUT
|
||||
echo $CYASSL -h $1 -i $RANDT
|
||||
$CYASSL -h $1 -i $RANDT -o $OUT
|
||||
echo $WOLFSSL -h $1 size: $SIZEF bytes
|
||||
$WOLFSSL -h $1 -i $IN -o $OUT
|
||||
echo $WOLFSSL -h $1 -i $RANDT
|
||||
$WOLFSSL -h $1 -i $RANDT -o $OUT
|
||||
|
||||
rm $IN
|
||||
rm $OUT
|
||||
|
@ -83,7 +83,7 @@ crypto $AES\128
|
|||
crypto $AES\192
|
||||
crypto $AES\256
|
||||
cd ~ #change to home directory
|
||||
grep -q "CYASSL_AES_COUNTER" $OPTS && if [[ $? -eq $zero ]]; then
|
||||
grep -q "WOLFSSL_AES_COUNTER" $OPTS && if [[ $? -eq $zero ]]; then
|
||||
crypto $AES2\128
|
||||
crypto $AES2\192
|
||||
crypto $AES2\256
|
||||
|
@ -104,11 +104,11 @@ hashing $SHA
|
|||
hashing $SHA2
|
||||
|
||||
cd ~ #change to home directory
|
||||
grep -q "CYASSL_SHA384" $OPTS && if [[ $? -eq $zero ]]; then
|
||||
grep -q "WOLFSSL_SHA384" $OPTS && if [[ $? -eq $zero ]]; then
|
||||
hashing $SHA3
|
||||
fi
|
||||
cd ~ #change to home directory
|
||||
grep -q "CYASSL_SHA512" $OPTS && if [[ $? -eq $zero ]]; then
|
||||
grep -q "WOLFSSL_SHA512" $OPTS && if [[ $? -eq $zero ]]; then
|
||||
hashing $SHA5
|
||||
fi
|
||||
cd ~ #change to home directory
|
||||
|
@ -116,4 +116,4 @@ grep -q "HAVE_BLAKE2" $OPTS && if [[ $? -eq $zero ]]; then
|
|||
hashing $BLAKE
|
||||
fi
|
||||
cd $currentDir
|
||||
$CYASSL -b -t 5 -a
|
||||
$WOLFSSL -b -t 5 -a
|
||||
|
|
Loading…
Reference in New Issue