Merge branch 'master' of github.com:wolfSSL/wolfssl

This commit is contained in:
kaleb-himes 2015-01-09 16:03:07 -07:00
commit f138faa565
4 changed files with 242 additions and 30 deletions

View File

@ -31,18 +31,18 @@ AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_HEADERS([config.h:config.in])dnl Keep filename to 8.3 for MS-DOS.
#shared library versioning
WOLFSSL_LIBRARY_VERSION=6:0:1
# | | |
# +------+ | +---+
# | | |
# current:revision:age
# | | |
# | | +- increment if interfaces have been added
# | | set to zero if interfaces have been removed
# | | or changed
# | +- increment if source code has changed
# | set to zero if current is incremented
# +- increment if interfaces have been added, removed or changed
WOLFSSL_LIBRARY_VERSION=0:0:0
# | | |
# +------+ | +---+
# | | |
# current:revision:age
# | | |
# | | +- increment if interfaces have been added
# | | set to zero if interfaces have been removed
# | | or changed
# | +- increment if source code has changed
# | set to zero if current is incremented
# +- increment if interfaces have been added, removed or changed
AC_SUBST([WOLFSSL_LIBRARY_VERSION])
# capture user C_EXTRA_FLAGS from ./configure line, CFLAGS may hold -g -O2 even

View File

@ -1,8 +1,8 @@
Summary: Embedded SSL Library
Summary: Embedded SSL Library
Name: @PACKAGE@
Version: @VERSION@
Release: 1
License: GPLv2
License: GPLv2
Group: System Environment/Libraries
BuildRequires: gcc
BuildRequires: glibc
@ -13,15 +13,15 @@ BuildRequires: make
BuildRequires: pkgconfig
BuildRequires: sed
BuildRequires: tar
URL: http://www.yassl.com/yaSSL/Home.html
URL: http://www.wolfssl.com/
Packager: Brian Aker <brian@tangent.org>
Source: http://yassl.com/yaSSL/download/%{name}-%{version}.tar.gz
Source: http://wolfssl.com/yaSSL/download/%{name}-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
%description
Misc tools for Yassl.
Misc tools for wolfSSL.
%package devel
Summary: Header files and development libraries for %{name}
@ -30,7 +30,7 @@ Requires: %{name} = %{version}-%{release}
%description devel
This package contains the header files and development libraries
for %{name}. If you like to develop programs using %{name},
for %{name}. If you like to develop programs using %{name},
you will need to install %{name}-devel.
%prep
@ -60,21 +60,21 @@ mkdir -p $RPM_BUILD_ROOT/
%files
%defattr(-,root,root,-)
%doc AUTHORS ChangeLog COPYING NEWS README
%{_docdir}/cyassl/taoCert.txt
%{_docdir}/cyassl/example/echoserver.c
%{_docdir}/cyassl/example/server.c
%{_docdir}/cyassl/example/echoclient.c
%{_docdir}/cyassl/example/client.c
%{_docdir}/cyassl/README.txt
%{_docdir}/wolfssl/taoCert.txt
%{_docdir}/wolfssl/example/echoserver.c
%{_docdir}/wolfssl/example/server.c
%{_docdir}/wolfssl/example/echoclient.c
%{_docdir}/wolfssl/example/client.c
%{_docdir}/wolfssl/README.txt
%{_libdir}/libwolfssl.la
%{_libdir}/libwolfssl.so
%{_libdir}/libwolfssl.so.5
%{_libdir}/libwolfssl.so.5.0.5
%{_libdir}/libwolfssl.so.0
%{_libdir}/libwolfssl.so.0.0.0
%files devel
%defattr(-,root,root,-)
%doc AUTHORS ChangeLog COPYING NEWS README
%{_bindir}/cyassl-config
%{_bindir}/wolfssl-config
%{_includedir}/cyassl/callbacks.h
%{_includedir}/cyassl/certs_test.h
%{_includedir}/cyassl/crl.h
@ -86,6 +86,7 @@ mkdir -p $RPM_BUILD_ROOT/
%{_includedir}/cyassl/ctaocrypt/blake2-int.h
%{_includedir}/cyassl/ctaocrypt/blake2.h
%{_includedir}/cyassl/ctaocrypt/camellia.h
%{_includedir}/cyassl/ctaocrypt/chacha.h
%{_includedir}/cyassl/ctaocrypt/coding.h
%{_includedir}/cyassl/ctaocrypt/compress.h
%{_includedir}/cyassl/ctaocrypt/des3.h
@ -106,6 +107,7 @@ mkdir -p $RPM_BUILD_ROOT/
%{_includedir}/cyassl/ctaocrypt/mpi_class.h
%{_includedir}/cyassl/ctaocrypt/mpi_superclass.h
%{_includedir}/cyassl/ctaocrypt/pkcs7.h
%{_includedir}/cyassl/ctaocrypt/poly1305.h
%{_includedir}/cyassl/ctaocrypt/wc_port.h
%{_includedir}/cyassl/ctaocrypt/pwdbased.h
%{_includedir}/cyassl/ctaocrypt/rabbit.h
@ -113,6 +115,7 @@ mkdir -p $RPM_BUILD_ROOT/
%{_includedir}/cyassl/ctaocrypt/ripemd.h
%{_includedir}/cyassl/ctaocrypt/rsa.h
%{_includedir}/cyassl/ctaocrypt/settings.h
%{_includedir}/cyassl/ctaocrypt/settings_comp.h
%{_includedir}/cyassl/ctaocrypt/sha.h
%{_includedir}/cyassl/ctaocrypt/sha256.h
%{_includedir}/cyassl/ctaocrypt/sha512.h
@ -159,8 +162,96 @@ mkdir -p $RPM_BUILD_ROOT/
%{_includedir}/cyassl/ssl.h
%{_includedir}/cyassl/test.h
%{_includedir}/cyassl/version.h
%{_libdir}/pkgconfig/cyassl.pc
%{_includedir}/wolfssl/callbacks.h
%{_includedir}/wolfssl/certs_test.h
%{_includedir}/wolfssl/crl.h
%{_includedir}/wolfssl/wolfcrypt/aes.h
%{_includedir}/wolfssl/wolfcrypt/arc4.h
%{_includedir}/wolfssl/wolfcrypt/asn.h
%{_includedir}/wolfssl/wolfcrypt/asn_public.h
%{_includedir}/wolfssl/wolfcrypt/blake2-impl.h
%{_includedir}/wolfssl/wolfcrypt/blake2-int.h
%{_includedir}/wolfssl/wolfcrypt/blake2.h
%{_includedir}/wolfssl/wolfcrypt/camellia.h
%{_includedir}/wolfssl/wolfcrypt/chacha.h
%{_includedir}/wolfssl/wolfcrypt/coding.h
%{_includedir}/wolfssl/wolfcrypt/compress.h
%{_includedir}/wolfssl/wolfcrypt/des3.h
%{_includedir}/wolfssl/wolfcrypt/dh.h
%{_includedir}/wolfssl/wolfcrypt/dsa.h
%{_includedir}/wolfssl/wolfcrypt/ecc.h
%{_includedir}/wolfssl/wolfcrypt/error-crypt.h
%{_includedir}/wolfssl/wolfcrypt/fips_test.h
%{_includedir}/wolfssl/wolfcrypt/hc128.h
%{_includedir}/wolfssl/wolfcrypt/hmac.h
%{_includedir}/wolfssl/wolfcrypt/integer.h
%{_includedir}/wolfssl/wolfcrypt/logging.h
%{_includedir}/wolfssl/wolfcrypt/md2.h
%{_includedir}/wolfssl/wolfcrypt/md4.h
%{_includedir}/wolfssl/wolfcrypt/md5.h
%{_includedir}/wolfssl/wolfcrypt/memory.h
%{_includedir}/wolfssl/wolfcrypt/misc.h
%{_includedir}/wolfssl/wolfcrypt/mpi_class.h
%{_includedir}/wolfssl/wolfcrypt/mpi_superclass.h
%{_includedir}/wolfssl/wolfcrypt/pkcs7.h
%{_includedir}/wolfssl/wolfcrypt/wc_port.h
%{_includedir}/wolfssl/wolfcrypt/poly1305.h
%{_includedir}/wolfssl/wolfcrypt/pwdbased.h
%{_includedir}/wolfssl/wolfcrypt/rabbit.h
%{_includedir}/wolfssl/wolfcrypt/random.h
%{_includedir}/wolfssl/wolfcrypt/ripemd.h
%{_includedir}/wolfssl/wolfcrypt/rsa.h
%{_includedir}/wolfssl/wolfcrypt/settings.h
%{_includedir}/wolfssl/wolfcrypt/sha.h
%{_includedir}/wolfssl/wolfcrypt/sha256.h
%{_includedir}/wolfssl/wolfcrypt/sha512.h
%{_includedir}/wolfssl/wolfcrypt/tfm.h
%{_includedir}/wolfssl/wolfcrypt/types.h
%{_includedir}/wolfssl/wolfcrypt/visibility.h
%{_includedir}/wolfssl/error-ssl.h
%{_includedir}/wolfssl/ocsp.h
%{_includedir}/wolfssl/openssl/asn1.h
%{_includedir}/wolfssl/openssl/bio.h
%{_includedir}/wolfssl/openssl/bn.h
%{_includedir}/wolfssl/openssl/conf.h
%{_includedir}/wolfssl/openssl/crypto.h
%{_includedir}/wolfssl/openssl/des.h
%{_includedir}/wolfssl/openssl/dh.h
%{_includedir}/wolfssl/openssl/dsa.h
%{_includedir}/wolfssl/openssl/ec.h
%{_includedir}/wolfssl/openssl/ecdsa.h
%{_includedir}/wolfssl/openssl/engine.h
%{_includedir}/wolfssl/openssl/err.h
%{_includedir}/wolfssl/openssl/evp.h
%{_includedir}/wolfssl/openssl/hmac.h
%{_includedir}/wolfssl/openssl/lhash.h
%{_includedir}/wolfssl/openssl/md4.h
%{_includedir}/wolfssl/openssl/md5.h
%{_includedir}/wolfssl/openssl/ocsp.h
%{_includedir}/wolfssl/openssl/opensslconf.h
%{_includedir}/wolfssl/openssl/opensslv.h
%{_includedir}/wolfssl/openssl/ossl_typ.h
%{_includedir}/wolfssl/openssl/pem.h
%{_includedir}/wolfssl/openssl/pkcs12.h
%{_includedir}/wolfssl/openssl/rand.h
%{_includedir}/wolfssl/openssl/ripemd.h
%{_includedir}/wolfssl/openssl/rsa.h
%{_includedir}/wolfssl/openssl/sha.h
%{_includedir}/wolfssl/openssl/ssl.h
%{_includedir}/wolfssl/openssl/stack.h
%{_includedir}/wolfssl/openssl/ui.h
%{_includedir}/wolfssl/openssl/x509.h
%{_includedir}/wolfssl/openssl/x509v3.h
%{_includedir}/wolfssl/options.h
%{_includedir}/wolfssl/sniffer.h
%{_includedir}/wolfssl/sniffer_error.h
%{_includedir}/wolfssl/ssl.h
%{_includedir}/wolfssl/test.h
%{_includedir}/wolfssl/version.h
%{_libdir}/pkgconfig/wolfssl.pc
%changelog
* Fri Jan 09 2015 John Safranek <john@wolfssl.com>
- Update for cyassl->wolfssl name change
* Fri Oct 20 2012 Brian Aker <brian@tangent.org>
- Initial package

View File

@ -19,8 +19,6 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/* Name change compatibility layer */
#include <cyassl/ssl.h>
#ifdef HAVE_CONFIG_H
#include <config.h>

View File

@ -159,6 +159,7 @@ int arc4_test(void);
int hc128_test(void);
int rabbit_test(void);
int chacha_test(void);
int chacha_poly_test(void);
int des_test(void);
int des3_test(void);
int aes_test(void);
@ -407,6 +408,13 @@ int wolfcrypt_test(void* args)
printf( "POLY1305 test passed!\n");
#endif
#if defined(HAVE_CHACHA) && defined(HAVE_POLY1305)
if ( (ret = chacha_poly_test()) != 0)
return err_sys("CHACHA-POLY AEAD test failed!\n", ret);
else
printf( "ChachaAEAD test passed!\n");
#endif
#ifndef NO_DES3
if ( (ret = des_test()) != 0)
return err_sys("DES test failed!\n", ret);
@ -2052,6 +2060,121 @@ int poly1305_test(void)
#endif /* HAVE_POLY1305 */
#if defined(HAVE_CHACHA) && defined(HAVE_POLY1305)
int chacha_poly_test(void)
{
const byte key[] = {
0x42,0x90,0xbc,0xb1,0x54,0x17,0x35,0x31,
0xf3,0x14,0xaf,0x57,0xf3,0xbe,0x3b,0x50,
0x06,0xda,0x37,0x1e,0xce,0x27,0x2a,0xfa,
0x1b,0x5d,0xbd,0xd1,0x10,0x0a,0x10,0x07
};
const byte input[] = {
0x86,0xd0,0x99,0x74,0x84,0x0b,0xde,0xd2,
0xa5,0xca
};
const byte nonce[] = {
0x00,0x00,0x00,0x00,0xcd,0x7c,0xf6,0x7b,
0xe3,0x9c,0x79,0x4a
};
const byte ad[] = { /* aditional data */
0x87,0xe2,0x29,0xd4,0x50,0x08,0x45,0xa0,
0x79,0xc0,0x0a,0x00,0x00,0x00,0x00,0x00,
0x00,0x00
};
const byte test[] = { /* expected output from operation */
0xe3,0xe4,0x46,0xf7,0xed,0xe9,0xa1,0x9b,
0x62,0xa4,0x98,0xa5,0x9a,0x87,0xf9,0x82,
0xa1,0xfe,0xcb,0xac,0xd3,0xff,0xe8,0x29,
0x31,0x04
};
byte polyKey[64];
byte cipher[32];
byte tag[16]; /* tag made from Poly1305 MAC algorithm */
byte out[48]; /* cipher (32) + tag size of (16) */
byte msg[10]; /* message after decryption */
word32 keySz = 32;
int ret = 0;
ChaCha chaEnc, chaDec;
Poly1305 polyEnc, polyDec;
XMEMSET(polyKey, 0, sizeof(polyKey));
XMEMSET(cipher, 0, sizeof(cipher));
XMEMSET(tag, 0, sizeof(tag));
XMEMSET(out, 0, sizeof(out));
XMEMSET(msg, 0, sizeof(msg));
/***** ENCRYPTION ******/
/* Initialise chacha / poly and get poly key */
ret += wc_Chacha_SetKey(&chaEnc, key, keySz);
ret += wc_Chacha_SetIV(&chaEnc, nonce, 0); /* start with counter at 0 */
/* AEAD poly key is created by first run of ChaCha */
ret += wc_Chacha_Process(&chaEnc, polyKey, polyKey, 64);
ret += wc_Poly1305SetKey(&polyEnc, polyKey, 32);
/* encrypt the plain text then append tag */
ret += wc_Chacha_SetIV(&chaEnc, nonce, 1);
ret += wc_Chacha_Process(&chaEnc, cipher, input, sizeof(input));
/* tag is created with using ad and cipher (SSL/TLS uses padding as well) */
ret += wc_Poly1305Update(&polyEnc, ad, sizeof(ad));
ret += wc_Poly1305Update(&polyEnc, cipher, sizeof(input));
ret += wc_Poly1305Final(&polyEnc, tag);
XMEMCPY(out, cipher, sizeof(input)); /* copy cipher to first of out */
XMEMCPY(out + sizeof(input), tag, sizeof(tag)); /* append tag to out */
/****** TEST *****/
/* encrypted AEAD msg is now in out[] it's length is sizeof input + tag size
to test correctness we will compare the out[] to the expected output */
if (memcmp(out, test, sizeof(test)))
return -1062;
/****** DECRYPTION ******/
XMEMSET(polyKey, 0, sizeof(polyKey));
XMEMSET(tag, 0, sizeof(tag));
/* Initialise chacha / poly and get poly key */
ret += wc_Chacha_SetKey(&chaDec, key, keySz);
ret += wc_Chacha_SetIV(&chaDec, nonce, 0); /* start with counter at 0 */
/* AEAD poly key is created by first run of ChaCha */
ret += wc_Chacha_Process(&chaDec, polyKey, polyKey, 64);
ret += wc_Poly1305SetKey(&polyDec, polyKey, 32);
/* compare generated tag to what was sent */
ret += wc_Poly1305Update(&polyDec, ad, sizeof(ad));
ret += wc_Poly1305Update(&polyDec, out, sizeof(input)); /* cipher sent */
ret += wc_Poly1305Final(&polyDec, tag);
/* comparison of tags should be in constant time when implemented */
if (memcmp(tag, out + sizeof(input), sizeof(tag))) /* compare tags */
return -1063;
/* decrypt the cipher text */
ret += wc_Chacha_Process(&chaDec, msg, out, sizeof(input));
/****** TEST *****/
/* plain text msg has been recieved compare it to expected for test */
if (memcmp(msg, input, sizeof(input)))
return -1064;
return ret;
}
#endif /* HAVE_CHACHA && HAVE_POLY1305 */
#ifndef NO_DES3
int des_test(void)
{