From db20b61e5140098d92fbfb73c3d9d0b7df425025 Mon Sep 17 00:00:00 2001 From: Brian Aker Date: Sun, 15 Sep 2013 00:13:30 -0700 Subject: [PATCH 1/7] Update autoconf rules. Fixes bug url to point to github issues. --- autogen.sh | 12 +++- configure.ac | 23 +++--- m4/ax_append_to_file.m4 | 4 +- m4/ax_check_library.m4 | 95 +++++++++++++++++++++++++ m4/ax_compiler_version.m4 | 126 +++++++++++++++++++++++++-------- m4/ax_debug.m4 | 23 +++--- m4/ax_harden_compiler_flags.m4 | 1 - m4/ax_pthread.m4 | 30 ++++---- m4/ax_vcs_checkout.m4 | 34 ++++++--- 9 files changed, 269 insertions(+), 79 deletions(-) create mode 100644 m4/ax_check_library.m4 diff --git a/autogen.sh b/autogen.sh index 38665be47..b492bd9e9 100755 --- a/autogen.sh +++ b/autogen.sh @@ -3,6 +3,15 @@ # Create configure and makefile stuff... # +# Git hooks should come before autoreconf. +if test -d .git; then + if ! test -d .git; then + mkdir .git/hooks + fi + ln -s -f ../../pre-commit.sh .git/hooks/pre-commit +fi + +# If this is a source checkout then call autoreconf with error as well if test -d .git; then WARNINGS="all,error" else @@ -11,6 +20,3 @@ fi autoreconf --install --force --verbose -if test -d .git; then - ln -s -f ../../pre-commit.sh .git/hooks/pre-commit -fi diff --git a/configure.ac b/configure.ac index 04b9db2b0..561122815 100644 --- a/configure.ac +++ b/configure.ac @@ -6,25 +6,30 @@ # # -AC_INIT([cyassl],[2.8.1],[http://www.yassl.com]) +AC_INIT([cyassl],[2.8.1],[https://github.com/cyassl/cyassl/issues],[cyassl],[http://www.yassl.com]) AC_CONFIG_AUX_DIR([build-aux]) -AC_CONFIG_MACRO_DIR([m4]) - -AC_CANONICAL_TARGET -AC_USE_SYSTEM_EXTENSIONS - -AM_INIT_AUTOMAKE([1.11 -Wall -Werror -Wno-portability foreign tar-ustar subdir-objects]) AC_CANONICAL_HOST AC_CANONICAL_BUILD +AM_INIT_AUTOMAKE([1.11 -Wall -Werror -Wno-portability foreign tar-ustar subdir-objects no-define color-tests]) AC_PREREQ([2.63]) +AC_ARG_PROGRAM +AC_DEFUN([PROTECT_AC_USE_SYSTEM_EXTENSIONS], + [AX_SAVE_FLAGS + AC_LANG_PUSH([C]) + AC_USE_SYSTEM_EXTENSIONS + AC_LANG_POP([C]) + AX_RESTORE_FLAGS + ]) +#PROTECT_AC_USE_SYSTEM_EXTENSIONS + +AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_HEADERS([config.h:config.in])dnl Keep filename to 8.3 for MS-DOS. - #shared library versioning CYASSL_LIBRARY_VERSION=5:2:0 # | | | @@ -57,8 +62,6 @@ AS_IF([ test -n "$CFLAG_VISIBILITY" ], [ m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])]) -AX_CXX_COMPILER_VERSION - AC_CHECK_FUNCS([gethostbyname]) AC_CHECK_FUNCS([getaddrinfo]) AC_CHECK_FUNCS([gettimeofday]) diff --git a/m4/ax_append_to_file.m4 b/m4/ax_append_to_file.m4 index c88affb46..f9f54e088 100644 --- a/m4/ax_append_to_file.m4 +++ b/m4/ax_append_to_file.m4 @@ -19,9 +19,9 @@ # and this notice are preserved. This file is offered as-is, without any # warranty. -#serial 7 +#serial 8 AC_DEFUN([AX_APPEND_TO_FILE],[ AC_REQUIRE([AX_FILE_ESCAPES]) -printf "$2" >> "$1" +printf "$2\n" >> "$1" ]) diff --git a/m4/ax_check_library.m4 b/m4/ax_check_library.m4 new file mode 100644 index 000000000..dd27ff41f --- /dev/null +++ b/m4/ax_check_library.m4 @@ -0,0 +1,95 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_check_library.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_CHECK_LIBRARY(VARIABLE-PREFIX, HEADER-FILE, LIBRARY-FILE, +# [ACTION-IF-FOUND], [ACTION-IF-NOT_FOUND]) +# +# DESCRIPTION +# +# Provides a generic test for a given library, similar in concept to the +# PKG_CHECK_MODULES macro used by pkg-config. +# +# Most simplest libraries can be checked against simply through the +# presence of a header file and a library to link to. This macro allows to +# wrap around the test so that it doesn't have to be recreated each time. +# +# Rather than define --with-$LIBRARY arguments, it uses variables in the +# same way that PKG_CHECK_MODULES does. It doesn't, though, use the same +# names, since you shouldn't provide a value for LIBS or CFLAGS but rather +# for LDFLAGS and CPPFLAGS, to tell the linker and compiler where to find +# libraries and headers respectively. +# +# If the library is find, HAVE_PREFIX is defined, and in all cases +# PREFIX_LDFLAGS and PREFIX_CPPFLAGS are substituted. +# +# Example: +# +# AX_CHECK_LIBRARY([LIBEVENT], [event.h], [event], [], +# [AC_MSG_ERROR([Unable to find libevent])]) +# +# LICENSE +# +# Copyright (c) 2012 Brian Aker +# Copyright (c) 2010 Diego Elio Petteno` +# +# This program 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 3 of the License, or (at your +# option) any later version. +# +# This program 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, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 7 + +AC_DEFUN([AX_CHECK_LIBRARY], + [AC_ARG_VAR($1[_CPPFLAGS],[C preprocessor flags for ]$1[ headers]) + AC_ARG_VAR($1[_LDFLAGS],[linker flags for ]$1[ libraries]) + + AC_CACHE_VAL(AS_TR_SH([ax_cv_have_]$1), + [AX_SAVE_FLAGS + + AS_IF([test "x$]$1[_CPPFLAGS" != "x"], + [CPPFLAGS="$CPPFLAGS $]$1[_CPPFLAGS"]) + + AS_IF([test "x$]$1[_LDFLAGS" != "x"], + [LDFLAGS="$LDFLAGS $]$1[_LDFLAGS"]) + + AC_CHECK_HEADER($2, [ + AC_CHECK_LIB($3, [main], + [AS_TR_SH([ax_cv_have_]$1)=yes], + [AS_TR_SH([ax_cv_have_]$1)=no]) + ], [AS_TR_SH([ax_cv_have_]$1)=no]) + + AX_RESTORE_FLAGS + ]) + + AS_IF([test "$]AS_TR_SH([ax_cv_have_]$1)[" = "yes"], + [AC_DEFINE([HAVE_]$1, [1], [Define to 1 if ]$1[ is found]) + AC_SUBST($1[_CPPFLAGS]) + AC_SUBST($1[_LDFLAGS]) + AC_SUBST($1[_LIB],[-l]$3) + ifelse([$4], , :, [$4])], + [ifelse([$5], , :, [$5])]) + ]) diff --git a/m4/ax_compiler_version.m4 b/m4/ax_compiler_version.m4 index 7f6708d5d..e074cf743 100644 --- a/m4/ax_compiler_version.m4 +++ b/m4/ax_compiler_version.m4 @@ -1,36 +1,100 @@ -AC_DEFUN([AX_C_COMPILER_VERSION],[ +# =========================================================================== +# https://github.com/BrianAker/ddm4/ +# =========================================================================== +# +# SYNOPSIS +# +# AX_COMPILER_VERSION() +# +# DESCRIPTION +# +# Capture version of C/C++ compiler +# +# LICENSE +# +# Copyright (C) 2012 Brian Aker +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# +# * The names of its contributors may not be used to endorse or +# promote products derived from this software without specific prior +# written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - dnl Print version of C compiler - AC_MSG_CHECKING("C Compiler version--$GCC") - AS_IF([test "$GCC" = "yes"],[ - CC_VERSION=`$CC --version | sed 1q` ],[ - test "$SUNCC" = "yes"],[ - CC_VERSION=`$CC -V 2>&1 | sed 1q` ],[ - test "$CLANG" = "yes"],[ - CC_VERSION=`$CC --version 2>&1 | sed 1q` ],[ - CC_VERSION="" - ]) - AC_MSG_RESULT("$CC_VERSION") - AC_SUBST(CC_VERSION) - ]) +#serial 5 +AC_DEFUN([_C_COMPILER_VERSION], + [AC_MSG_CHECKING([C Compiler version]) + AS_CASE(["$ax_cv_c_compiler_vendor"], + [sun],[ax_c_compiler_version=`$CC -V 2>&1 | sed 1q`], + [intel],[ax_c_compiler_version=`$CC --version 2>&1 | sed 1q`], + [clang],[ax_c_compiler_version=`$CC --version 2>&1 | sed 1q`], + [gnu],[ax_c_compiler_version=`$CC --version | sed 1q`], + [mingw],[ax_c_compiler_version=`$CC --version | sed 1q`], + [ax_c_compiler_version="unknown: $ax_cv_c_compiler_vendor"]) -AC_DEFUN([AX_CXX_COMPILER_VERSION], [ - - dnl Check C version while at it - AC_REQUIRE([AX_C_COMPILER_VERSION]) - - dnl Print version of CXX compiler - AC_MSG_CHECKING("C++ Compiler version") - AS_IF([test "$GCC" = "yes"],[ - CXX_VERSION=`$CXX --version | sed 1q` ],[ - test "$SUNCC" = "yes"],[ - CXX_VERSION=`$CXX -V 2>&1 | sed 1q` ],[ - test "$CLANG" = "yes"],[ - CXX_VERSION=`$CXX --version 2>&1 | sed 1q` ],[ - CXX_VERSION="" - ]) - AC_MSG_RESULT("$CXX_VERSION") - AC_SUBST(CXX_VERSION) + AC_MSG_RESULT(["$ax_c_compiler_version"]) + AC_SUBST([CC_VERSION_VENDOR],["$ax_cv_c_compiler_vendor"]) + AC_SUBST([CC_VERSION],["$ax_c_compiler_version"]) ]) +AC_DEFUN([_CXX_COMPILER_VERSION], + [AC_MSG_CHECKING([C++ Compiler version]) + + AS_CASE(["$ax_cv_c_compiler_vendor"], + [sun],[ax_cxx_compiler_version=`$CXX -V 2>&1 | sed 1q`], + [intel],[ax_cxx_compiler_version=`$CXX --version 2>&1 | sed 1q`], + [clang],[ax_cxx_compiler_version=`$CXX --version 2>&1 | sed 1q`], + [gnu],[ax_cxx_compiler_version=`$CXX --version | sed 1q`], + [mingw],[ax_cxx_compiler_version=`$CXX --version | sed 1q`], + [ax_cxx_compiler_version="unknown: $ax_cv_c_compiler_vendor"]) + + AC_MSG_RESULT(["$ax_cxx_compiler_version"]) + AC_SUBST([CXX_VERSION_VENDOR],["$ax_cv_c_compiler_vendor"]) + AC_SUBST([CXX_VERSION],["$ax_cxx_compiler_version"]) + ]) + +AC_DEFUN([AX_COMPILER_VERSION], + [AC_REQUIRE([AX_COMPILER_VENDOR]) + + AC_MSG_CHECKING([MINGW]) + AC_CHECK_DECL([__MINGW32__], + [MINGW=yes + ax_c_compiler_version_vendor=mingw], + [MINGW=no]) + AC_MSG_RESULT([$MINGW]) + + AC_REQUIRE([_C_COMPILER_VERSION]) + AC_REQUIRE([_CXX_COMPILER_VERSION]) + AS_IF([test "x$GCC" = xyes], + [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ +#if !defined(__GNUC__) || (__GNUC__ < 4) || ((__GNUC__ >= 4) && (__GNUC_MINOR__ < 7)) +# error GCC is Too Old! +#endif + ]])], + [ac_c_gcc_recent=yes], + [ac_c_gcc_recent=no]) + ]) + ]) diff --git a/m4/ax_debug.m4 b/m4/ax_debug.m4 index 5c63daa11..5522d7215 100644 --- a/m4/ax_debug.m4 +++ b/m4/ax_debug.m4 @@ -43,19 +43,22 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -#serial 2 +#serial 6 -AC_DEFUN([AX_DEBUG],[ +AC_DEFUN([AX_DEBUG], + [AC_PREREQ([2.63])dnl AC_ARG_ENABLE([debug], [AS_HELP_STRING([--enable-debug], - [Add debug code/turns off optimizations (yes|no) @<:@default=no@:>@])],[ - ax_enable_debug=$enableval - AC_DEFINE(DEBUG, [ 1 ], [Define to 1 to enable debugging code.]) - ],[ - ax_enable_debug=no - AC_DEFINE(DEBUG, [ 0 ], [Define to 1 to enable debugging code.]) - ]) + [Add debug code/turns off optimizations (yes|no) @<:@default=no@:>@])], + [ax_enable_debug=yes + AC_DEFINE([DEBUG],[1],[Define to 1 to enable debugging code.]) + AX_CHECK_LIBRARY([MCHECK],[mcheck.h],[mcheck],[AX_APPEND_LINK_FLAGS([-lmcheck])]) + AX_ADD_AM_MACRO([--debug],[AM_YFLAGS]) + AX_ADD_AM_MACRO([-D_GLIBCXX_DEBUG],[AM_CPPFLAGS])], + [ax_enable_debug=no + AC_SUBST([MCHECK]) + AC_DEFINE([DEBUG],[0],[Define to 1 to enable debugging code.])]) AC_MSG_CHECKING([for debug]) AC_MSG_RESULT([$ax_enable_debug]) - ]) + AM_CONDITIONAL([DEBUG],[test "x${ax_enable_debug}" = "xyes"])]) diff --git a/m4/ax_harden_compiler_flags.m4 b/m4/ax_harden_compiler_flags.m4 index 2c225db58..6f01c1aca 100644 --- a/m4/ax_harden_compiler_flags.m4 +++ b/m4/ax_harden_compiler_flags.m4 @@ -67,7 +67,6 @@ AC_REQUIRE([AX_CHECK_LINK_FLAG]) AC_REQUIRE([AX_VCS_CHECKOUT]) AC_REQUIRE([AX_DEBUG]) - AC_REQUIRE([AX_CXX_COMPILER_VERSION]) dnl If we are inside of VCS we append -Werror, otherwise we just use it to test other flags AX_HARDEN_LIB= diff --git a/m4/ax_pthread.m4 b/m4/ax_pthread.m4 index 82ae1faf2..6d400ed4e 100644 --- a/m4/ax_pthread.m4 +++ b/m4/ax_pthread.m4 @@ -82,7 +82,7 @@ # modified version of the Autoconf Macro, you may extend this special # exception to the GPL to apply to your modified version as well. -#serial 19 +#serial 20 AU_ALIAS([ACX_PTHREAD], [AX_PTHREAD]) AC_DEFUN([AX_PTHREAD], [ @@ -159,12 +159,8 @@ case ${host_os} in ax_pthread_flags="-pthreads pthread -mt -pthread $ax_pthread_flags" ;; - darwin12* | darwin11.4*) - ax_pthread_flags="$ax_pthread_flags" - ;; - darwin*) - ax_pthread_flags="-pthreads $ax_pthread_flags" + ax_pthread_flags="-pthread $ax_pthread_flags" ;; esac @@ -287,16 +283,24 @@ if test "x$ax_pthread_ok" = xyes; then LIBS="$save_LIBS" CFLAGS="$save_CFLAGS" - # More AIX lossage: must compile with xlc_r or cc_r - if test x"$GCC" != xyes; then - AC_CHECK_PROGS(PTHREAD_CC, xlc_r cc_r, ${CC}) - else - PTHREAD_CC=$CC + # More AIX lossage: compile with *_r variant + if test "x$GCC" != xyes; then + case $host_os in + aix*) + AS_CASE(["x/$CC"], + [x*/c89|x*/c89_128|x*/c99|x*/c99_128|x*/cc|x*/cc128|x*/xlc|x*/xlc_v6|x*/xlc128|x*/xlc128_v6], + [#handle absolute path differently from PATH based program lookup + AS_CASE(["x$CC"], + [x/*], + [AS_IF([AS_EXECUTABLE_P([${CC}_r])],[PTHREAD_CC="${CC}_r"])], + [AC_CHECK_PROGS([PTHREAD_CC],[${CC}_r],[$CC])])]) + ;; + esac fi -else - PTHREAD_CC="$CC" fi +test -n "$PTHREAD_CC" || PTHREAD_CC="$CC" + AC_SUBST(PTHREAD_LIBS) AC_SUBST(PTHREAD_CFLAGS) AC_SUBST(PTHREAD_CC) diff --git a/m4/ax_vcs_checkout.m4 b/m4/ax_vcs_checkout.m4 index 08bd37465..8047b65ec 100644 --- a/m4/ax_vcs_checkout.m4 +++ b/m4/ax_vcs_checkout.m4 @@ -45,15 +45,31 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -#serial 1 - -AC_DEFUN([AX_VCS_CHECKOUT],[ - AC_CACHE_CHECK([for vcs checkout], [ac_cv_vcs_checkout], [ - AS_IF([test -d ".bzr"],[ac_cv_vcs_checkout=yes]) - AS_IF([test -d ".svn"],[ac_cv_vcs_checkout=yes]) - AS_IF([test -d ".hg"], [ac_cv_vcs_checkout=yes]) - AS_IF([test -d ".git"],[ac_cv_vcs_checkout=yes]) +#serial 6 + +AC_DEFUN([AX_VCS_SYSTEM], + [AC_PREREQ([2.63])dnl + AC_CACHE_CHECK([for vcs system], [ac_cv_vcs_system], + [ac_cv_vcs_system="none" + AS_IF([test -d ".bzr"],[ac_cv_vcs_system="bazaar"]) + AS_IF([test -d ".svn"],[ac_cv_vcs_system="svn"]) + AS_IF([test -d ".hg"],[ac_cv_vcs_system="mercurial"]) + AS_IF([test -d ".git"],[ac_cv_vcs_system="git"]) + ]) + AC_DEFINE_UNQUOTED([VCS_SYSTEM],["$ac_cv_vcs_system"],[VCS system]) + ]) + +AC_DEFUN([AX_VCS_CHECKOUT], + [AC_PREREQ([2.63])dnl + AC_REQUIRE([AX_VCS_SYSTEM]) + AC_CACHE_CHECK([for vcs checkout],[ac_cv_vcs_checkout], + [AS_IF([test "x$ac_cv_vcs_system" != "xnone"], + [ac_cv_vcs_checkout=yes], + [ac_cv_vcs_checkout=no]) ]) - AS_IF([test "$ac_cv_vcs_checkout" = yes], []) + AM_CONDITIONAL([IS_VCS_CHECKOUT],[test "x$ac_cv_vcs_checkout" = "xyes"]) + AS_IF([test "x$ac_cv_vcs_checkout" = "xyes"], + [AC_DEFINE([VCS_CHECKOUT],[1],[Define if the code was built from VCS.])], + [AC_DEFINE([VCS_CHECKOUT],[0],[Define if the code was built from VCS.])]) ]) From 8e5dab1ef3ac3ab307c2d35fb0c54bbb7814272e Mon Sep 17 00:00:00 2001 From: toddouska Date: Fri, 20 Sep 2013 10:34:29 -0700 Subject: [PATCH 2/7] clang can't use pthread(s) flag --- autogen.sh | 2 +- m4/ax_pthread.m4 | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/autogen.sh b/autogen.sh index b492bd9e9..1a41d8942 100755 --- a/autogen.sh +++ b/autogen.sh @@ -5,7 +5,7 @@ # Git hooks should come before autoreconf. if test -d .git; then - if ! test -d .git; then + if ! test -d .git/hooks; then mkdir .git/hooks fi ln -s -f ../../pre-commit.sh .git/hooks/pre-commit diff --git a/m4/ax_pthread.m4 b/m4/ax_pthread.m4 index 6d400ed4e..d09a1cd68 100644 --- a/m4/ax_pthread.m4 +++ b/m4/ax_pthread.m4 @@ -160,7 +160,11 @@ case ${host_os} in ;; darwin*) - ax_pthread_flags="-pthread $ax_pthread_flags" + if test "$CC" = "clang"; then + ax_pthread_flags="$ax_pthread_flags" + else + ax_pthread_flags="-pthread $ax_pthread_flags" + fi ;; esac From d1fcce2f739a556099c95fb7e803d39cf725bb0a Mon Sep 17 00:00:00 2001 From: toddouska Date: Fri, 20 Sep 2013 10:36:05 -0700 Subject: [PATCH 3/7] more settings --- cyassl/ctaocrypt/settings.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cyassl/ctaocrypt/settings.h b/cyassl/ctaocrypt/settings.h index a3c532e2f..345e3a0d8 100644 --- a/cyassl/ctaocrypt/settings.h +++ b/cyassl/ctaocrypt/settings.h @@ -144,6 +144,13 @@ #define NO_HC128 #endif /* MBED */ +#ifdef CYASSL_TYTO + #define FREERTOS + #define NO_FILESYSTEM + #define CYASSL_USER_IO + #define NO_DEV_RANDOM +#endif + #ifdef FREERTOS_WINSIM #define FREERTOS #define USE_WINDOWS_API From 363f157f5017a26e09c5b660974d19b3ea7f8771 Mon Sep 17 00:00:00 2001 From: toddouska Date: Mon, 23 Sep 2013 13:37:04 -0700 Subject: [PATCH 4/7] fix sniffer build w/o fastmath --- ctaocrypt/src/integer.c | 2 +- cyassl/ctaocrypt/integer.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ctaocrypt/src/integer.c b/ctaocrypt/src/integer.c index 2d79da593..d3cb044b8 100644 --- a/ctaocrypt/src/integer.c +++ b/ctaocrypt/src/integer.c @@ -3765,7 +3765,7 @@ int mp_sqrmod (mp_int * a, mp_int * b, mp_int * c) #endif -#if defined(HAVE_ECC) || !defined(NO_PWDBASED) +#if defined(HAVE_ECC) || !defined(NO_PWDBASED) || defined(CYASSL_SNIFFER) /* single digit addition */ int mp_add_d (mp_int* a, mp_digit b, mp_int* c) diff --git a/cyassl/ctaocrypt/integer.h b/cyassl/ctaocrypt/integer.h index 2c4d80a7f..2f7ab84fa 100644 --- a/cyassl/ctaocrypt/integer.h +++ b/cyassl/ctaocrypt/integer.h @@ -305,7 +305,7 @@ int mp_init_multi(mp_int* a, mp_int* b, mp_int* c, mp_int* d, mp_int* e, int mp_lcm (mp_int * a, mp_int * b, mp_int * c); #endif -#if defined(HAVE_ECC) || !defined(NO_PWDBASED) +#if defined(HAVE_ECC) || !defined(NO_PWDBASED) || defined(CYASSL_SNIFFER) int mp_sub_d (mp_int * a, mp_digit b, mp_int * c); #endif From 27078bb89cbb8e0346263e5cf4788e07992ddceb Mon Sep 17 00:00:00 2001 From: toddouska Date: Tue, 24 Sep 2013 12:15:28 -0700 Subject: [PATCH 5/7] use to detect x86_64 for fastmath default --- configure.ac | 2 ++ 1 file changed, 2 insertions(+) diff --git a/configure.ac b/configure.ac index 561122815..d5c36b45a 100644 --- a/configure.ac +++ b/configure.ac @@ -10,6 +10,8 @@ AC_INIT([cyassl],[2.8.1],[https://github.com/cyassl/cyassl/issues],[cyassl],[htt AC_CONFIG_AUX_DIR([build-aux]) +# using $targget_cpu to only turn on fastmath by default on x86_64 +AC_CANONICAL_TARGET AC_CANONICAL_HOST AC_CANONICAL_BUILD From 17b220e9c77af47a722d09a2f451f8cb00295a3e Mon Sep 17 00:00:00 2001 From: Chris Conlon Date: Tue, 24 Sep 2013 20:12:48 -0600 Subject: [PATCH 6/7] add Freescale MQX time functionality --- ctaocrypt/src/asn.c | 24 ++++++++++++++++++++++++ src/internal.c | 11 +++++++++++ 2 files changed, 35 insertions(+) diff --git a/ctaocrypt/src/asn.c b/ctaocrypt/src/asn.c index 145c11a44..6c77b5ac4 100644 --- a/ctaocrypt/src/asn.c +++ b/ctaocrypt/src/asn.c @@ -100,6 +100,11 @@ #define XTIME(t1) pic32_time((t1)) #define XGMTIME(c) gmtime((c)) #define XVALIDATE_DATE(d, f, t) ValidateDate((d), (f), (t)) +#elif defined(FREESCALE_MQX) + #include + #define XTIME(t1) mqx_time((t1)) + #define XGMTIME(c) gmtime((c)) + #define XVALIDATE_DATE(d, f, t) ValidateDate((d), (f), (t)) #elif defined(CYASSL_MDK_ARM) #include #undef RNG @@ -289,6 +294,25 @@ time_t pic32_time(time_t* timer) #endif /* MICROCHIP_TCPIP */ +#ifdef FREESCALE_MQX + +time_t mqx_time(time_t* timer) +{ + time_t localTime; + TIME_STRUCT time_s; + + if (timer == NULL) + timer = &localTime; + + _time_get(&time_s); + *timer = (time_t) time_s.SECONDS; + + return *timer; +} + +#endif /* FREESCALE_MQX */ + + static INLINE word32 btoi(byte b) { return b - 0x30; diff --git a/src/internal.c b/src/internal.c index 3cb41db14..7f783240b 100644 --- a/src/internal.c +++ b/src/internal.c @@ -2216,6 +2216,17 @@ ProtocolVersion MakeDTLSv1_2(void) return (word32) SYS_TICK_Get(); } +#elif defined(FREESCALE_MQX) + + word32 LowResTimer(void) + { + TIME_STRUCT mqxTime; + + _time_get_elapsed(&mqxTime); + + return (word32) mqxTime.SECONDS; + } + #elif defined(USER_TICKS) #if 0 From 3e12f433423fd09effcf406f3360481545915f61 Mon Sep 17 00:00:00 2001 From: Chris Conlon Date: Wed, 25 Sep 2013 14:20:36 -0600 Subject: [PATCH 7/7] add CyaSSL_GetHmacMaxSize for JNI wrapper --- ctaocrypt/src/hmac.c | 5 +++++ cyassl/ctaocrypt/hmac.h | 1 + 2 files changed, 6 insertions(+) diff --git a/ctaocrypt/src/hmac.c b/ctaocrypt/src/hmac.c index f9a8b0adf..9b03087f4 100644 --- a/ctaocrypt/src/hmac.c +++ b/ctaocrypt/src/hmac.c @@ -487,5 +487,10 @@ static void HmacCaviumSetKey(Hmac* hmac, int type, const byte* key, #endif /* HAVE_CAVIUM */ +int CyaSSL_GetHmacMaxSize(void) +{ + return MAX_DIGEST_SIZE; +} + #endif /* NO_HMAC */ diff --git a/cyassl/ctaocrypt/hmac.h b/cyassl/ctaocrypt/hmac.h index 596d6e4c1..8a71450a7 100644 --- a/cyassl/ctaocrypt/hmac.h +++ b/cyassl/ctaocrypt/hmac.h @@ -147,6 +147,7 @@ CYASSL_API void HmacFinal(Hmac*, byte*); CYASSL_API void HmacFreeCavium(Hmac*); #endif +CYASSL_API int CyaSSL_GetHmacMaxSize(void); #ifdef __cplusplus } /* extern "C" */