From 931fbde41dfde632c8cb58c99d1e22a74ebbedb8 Mon Sep 17 00:00:00 2001 From: John Safranek Date: Mon, 18 Sep 2017 14:20:00 -0700 Subject: [PATCH] iOS/Android 1. Updated the iOS user_settings.h with the hardened settings. 2. Updated the iOS project file with Xcode's suggested settings. 3. Added an IDE project for building wolfSSL for Android using Visual Studio 2017. --- .gitignore | 4 +- IDE/VS-ARM/README.md | 11 ++ IDE/VS-ARM/include.am | 8 + IDE/VS-ARM/user_settings.h | 24 +++ IDE/VS-ARM/wolfssl.sln | 43 ++++ IDE/VS-ARM/wolfssl.vcxproj | 227 ++++++++++++++++++++++ IDE/iOS/user_settings.h | 18 +- IDE/iOS/wolfssl.xcodeproj/project.pbxproj | 21 +- IDE/include.am | 1 + 9 files changed, 348 insertions(+), 9 deletions(-) create mode 100644 IDE/VS-ARM/README.md create mode 100644 IDE/VS-ARM/include.am create mode 100644 IDE/VS-ARM/user_settings.h create mode 100644 IDE/VS-ARM/wolfssl.sln create mode 100644 IDE/VS-ARM/wolfssl.vcxproj diff --git a/.gitignore b/.gitignore index 079e69581..9f16a6fbb 100644 --- a/.gitignore +++ b/.gitignore @@ -215,8 +215,10 @@ wrapper/CSharp/x64/ # Visual Studio Code Workspace Files *.vscode +*.userprefs IDE/INTIME-RTOS/Debug_* +IDE/VS-ARM/.vs # Hexiwear IDE/HEXIWEAR/wolfSSL_HW/Debug @@ -227,4 +229,4 @@ IDE/LINUX-SGX/*.a # Binaries wolfcrypt/src/port/intel/qat_test /mplabx/wolfssl.X/dist/default/ -/mplabx/wolfcrypt_test.X/dist/default/ \ No newline at end of file +/mplabx/wolfcrypt_test.X/dist/default/ diff --git a/IDE/VS-ARM/README.md b/IDE/VS-ARM/README.md new file mode 100644 index 000000000..9ec4b75fc --- /dev/null +++ b/IDE/VS-ARM/README.md @@ -0,0 +1,11 @@ +VisualStudio for ARM build +========================== + +VS2017 now offers solution options for Android and iOS applications. It includes +the GCC cross-compiler suite and property sheets for configuring a project +for those platforms and libraries for cross-platform mobile application +development. + +The provided solution file will build wolfSSL for linking into an ARM based +application, *libwolfssl.a*. The *user_settings.h* file enables some of the +hardened settings and disables most uncommon ciphers. diff --git a/IDE/VS-ARM/include.am b/IDE/VS-ARM/include.am new file mode 100644 index 000000000..aa54c617e --- /dev/null +++ b/IDE/VS-ARM/include.am @@ -0,0 +1,8 @@ +# vim:ft=automake +# included from Top Level Makefile.am +# All paths should be given relative to the root + +EXTRA_DIST+= IDE/VS-ARM/README.md +EXTRA_DIST+= IDE/VS-ARM/wolfssl.sln +EXTRA_DIST+= IDE/VS-ARM/wolfssl.vcxproj +EXTRA_DIST+= IDE/VS-ARM/user_settings.h diff --git a/IDE/VS-ARM/user_settings.h b/IDE/VS-ARM/user_settings.h new file mode 100644 index 000000000..426e78843 --- /dev/null +++ b/IDE/VS-ARM/user_settings.h @@ -0,0 +1,24 @@ +#ifndef _VSARM_USER_SETTINGS_H_ +#define _VSARM_USER_SETTINGS_H_ + +/* Enables blinding mode, to prevent timing attacks */ +#define WC_RSA_BLINDING + +#define WOLFSSL_SHA512 +#define NO_PSK +#define HAVE_EXTENDED_MASTER +#define HAVE_TLS_EXTENSIONS +#define HAVE_AESGCM +#define USE_FAST_MATH +#define TFM_TIMING_RESISTANT +#define ECC_TIMING_RESISTANT +#define NO_HC128 +#define NO_RC4 +#define NO_RABBIT +#define NO_DSA +#define NO_MD4 +#define HAVE_ECC +#define HAVE_HASHDRBG + + +#endif /* _VSARM_USER_SETTINGS_H_ */ diff --git a/IDE/VS-ARM/wolfssl.sln b/IDE/VS-ARM/wolfssl.sln new file mode 100644 index 000000000..79b03c063 --- /dev/null +++ b/IDE/VS-ARM/wolfssl.sln @@ -0,0 +1,43 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26730.16 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wolfssl", "wolfssl.vcxproj", "{39E7CF74-B491-4CC4-B600-95664A25CC80}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|ARM = Debug|ARM + Debug|ARM64 = Debug|ARM64 + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|ARM = Release|ARM + Release|ARM64 = Release|ARM64 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {39E7CF74-B491-4CC4-B600-95664A25CC80}.Debug|ARM.ActiveCfg = Debug|ARM + {39E7CF74-B491-4CC4-B600-95664A25CC80}.Debug|ARM.Build.0 = Debug|ARM + {39E7CF74-B491-4CC4-B600-95664A25CC80}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {39E7CF74-B491-4CC4-B600-95664A25CC80}.Debug|ARM64.Build.0 = Debug|ARM64 + {39E7CF74-B491-4CC4-B600-95664A25CC80}.Debug|x64.ActiveCfg = Debug|x64 + {39E7CF74-B491-4CC4-B600-95664A25CC80}.Debug|x64.Build.0 = Debug|x64 + {39E7CF74-B491-4CC4-B600-95664A25CC80}.Debug|x86.ActiveCfg = Debug|x86 + {39E7CF74-B491-4CC4-B600-95664A25CC80}.Debug|x86.Build.0 = Debug|x86 + {39E7CF74-B491-4CC4-B600-95664A25CC80}.Release|ARM.ActiveCfg = Release|ARM + {39E7CF74-B491-4CC4-B600-95664A25CC80}.Release|ARM.Build.0 = Release|ARM + {39E7CF74-B491-4CC4-B600-95664A25CC80}.Release|ARM64.ActiveCfg = Release|ARM64 + {39E7CF74-B491-4CC4-B600-95664A25CC80}.Release|ARM64.Build.0 = Release|ARM64 + {39E7CF74-B491-4CC4-B600-95664A25CC80}.Release|x64.ActiveCfg = Release|x64 + {39E7CF74-B491-4CC4-B600-95664A25CC80}.Release|x64.Build.0 = Release|x64 + {39E7CF74-B491-4CC4-B600-95664A25CC80}.Release|x86.ActiveCfg = Release|x86 + {39E7CF74-B491-4CC4-B600-95664A25CC80}.Release|x86.Build.0 = Release|x86 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {E00DBEEF-9E96-4FEF-A0B9-F64C2CB1B4E0} + EndGlobalSection +EndGlobal diff --git a/IDE/VS-ARM/wolfssl.vcxproj b/IDE/VS-ARM/wolfssl.vcxproj new file mode 100644 index 000000000..6769f429b --- /dev/null +++ b/IDE/VS-ARM/wolfssl.vcxproj @@ -0,0 +1,227 @@ + + + + + Debug + ARM + + + Release + ARM + + + Debug + ARM64 + + + Release + ARM64 + + + Debug + x64 + + + Release + x64 + + + Debug + x86 + + + Release + x86 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {39e7cf74-b491-4cc4-b600-95664a25cc80} + Android + wolfssl + 14.0 + Android + 3.0 + wolfssl + + + + StaticLibrary + true + Clang_3_8 + + + StaticLibrary + false + Clang_3_8 + + + StaticLibrary + true + Clang_3_8 + + + StaticLibrary + false + Clang_3_8 + + + StaticLibrary + true + Clang_3_8 + + + StaticLibrary + false + Clang_3_8 + + + StaticLibrary + true + Clang_3_8 + + + StaticLibrary + false + Clang_3_8 + + + + + + + + + + + + + + + + + + + + + + + + + NotUsing + .\;..\..;%(AdditionalIncludeDirectories) + DEBUG_WOLFSSL;WOLFSSL_LIB;WOLFSSL_USER_SETTINGS;%(PreprocessorDefinitions) + + + + + NotUsing + .\;..\..;%(AdditionalIncludeDirectories) + WOLFSSL_LIB;WOLFSSL_USER_SETTINGS;%(PreprocessorDefinitions) + + + + + NotUsing + .\;..\..;%(AdditionalIncludeDirectories) + DEBUG_WOLFSSL;WOLFSSL_LIB;WOLFSSL_USER_SETTINGS;%(PreprocessorDefinitions) + + + + + NotUsing + .\;..\..;%(AdditionalIncludeDirectories) + WOLFSSL_LIB;WOLFSSL_USER_SETTINGS;%(PreprocessorDefinitions) + + + + + NotUsing + .\;..\..;%(AdditionalIncludeDirectories) + DEBUG_WOLFSSL;WOLFSSL_LIB;WOLFSSL_USER_SETTINGS;%(PreprocessorDefinitions) + + + + + NotUsing + .\;..\..;%(AdditionalIncludeDirectories) + WOLFSSL_LIB;WOLFSSL_USER_SETTINGS;%(PreprocessorDefinitions) + + + + + NotUsing + .\;..\..;%(AdditionalIncludeDirectories) + DEBUG_WOLFSSL;WOLFSSL_LIB;WOLFSSL_USER_SETTINGS;%(PreprocessorDefinitions) + + + + + NotUsing + .\;..\..;%(AdditionalIncludeDirectories) + WOLFSSL_LIB;WOLFSSL_USER_SETTINGS;%(PreprocessorDefinitions) + + + + + diff --git a/IDE/iOS/user_settings.h b/IDE/iOS/user_settings.h index 627188c81..80a1d021e 100644 --- a/IDE/iOS/user_settings.h +++ b/IDE/iOS/user_settings.h @@ -1,16 +1,20 @@ /* Configuration */ -#define IPHONE /* Needed for Xcode */ +#define IPHONE /* Needed for Xcode */ #define HAVE_HASHDRBG #define HAVE_AESGCM #define WOLFSSL_SHA512 #define WOLFSSL_SHA384 #ifdef HAVE_FIPS -#define NO_MD4 -#define NO_HC128 -#define NO_RABBIT -#define NO_DSA -#define NO_PWDBASED + #define NO_MD4 + #define NO_HC128 + #define NO_RABBIT + #define NO_DSA + #define NO_PWDBASED #else -#define USE_FAST_MATH + #define WC_RSA_BLINDING + #define USE_FAST_MATH + #define TFM_TIMING_RESISTANT + #define HAVE_ECC + #define ECC_TIMING_RESISTANT #endif diff --git a/IDE/iOS/wolfssl.xcodeproj/project.pbxproj b/IDE/iOS/wolfssl.xcodeproj/project.pbxproj index 92c863b4e..8caef4f16 100644 --- a/IDE/iOS/wolfssl.xcodeproj/project.pbxproj +++ b/IDE/iOS/wolfssl.xcodeproj/project.pbxproj @@ -1371,7 +1371,7 @@ 52B1344516F3C9E800C07B32 /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0460; + LastUpgradeCheck = 0820; ORGANIZATIONNAME = "wolfSSL Inc"; TargetAttributes = { 30B0604A1C6DDAEA00D46008 = { @@ -1623,23 +1623,33 @@ ALWAYS_SEARCH_USER_PATHS = NO; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; + CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CONFIGURATION_BUILD_DIR = "$(SYMROOT)"; COPY_PHASE_STRIP = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", "$(inherited)", ); GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; ONLY_ACTIVE_ARCH = YES; PRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR = NO; @@ -1654,16 +1664,25 @@ ALWAYS_SEARCH_USER_PATHS = NO; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; + CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CONFIGURATION_BUILD_DIR = "$(SYMROOT)"; COPY_PHASE_STRIP = YES; + ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; PRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR = NO; SDKROOT = iphoneos; diff --git a/IDE/include.am b/IDE/include.am index cda748fef..aeb8b43d0 100644 --- a/IDE/include.am +++ b/IDE/include.am @@ -11,5 +11,6 @@ include IDE/ROWLEY-CROSSWORKS-ARM/include.am include IDE/ARDUINO/include.am include IDE/INTIME-RTOS/include.am include IDE/OPENSTM32/include.am +include IDE/VS-ARM/include.am EXTRA_DIST+= IDE/IAR-EWARM IDE/MDK-ARM IDE/MDK5-ARM IDE/MYSQL IDE/LPCXPRESSO IDE/HEXIWEAR