From 60824d742d3f3ebb929b554b2e9b3ab29fb0473b Mon Sep 17 00:00:00 2001 From: Stephane Peter Date: Sun, 22 Jul 2012 05:01:18 -0700 Subject: [PATCH 1/2] Use the OpenSSL iphoneos-cross target instead of the generic BSD one. --- build-libssl.sh | 5 ++++- include/openssl/opensslconf.h | 17 ++++++++++------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/build-libssl.sh b/build-libssl.sh index d25d219..10caf78 100755 --- a/build-libssl.sh +++ b/build-libssl.sh @@ -70,6 +70,9 @@ do PLATFORM="iPhoneOS" fi + export CROSS_TOP="${DEVELOPER}/Platforms/${PLATFORM}.platform/Developer/" + export CROSS_SDK="${PLATFORM}${SDKVERSION}.sdk" + echo "Building openssl-${VERSION} for ${PLATFORM} ${SDKVERSION} ${ARCH}" echo "Please stand by..." @@ -77,7 +80,7 @@ do mkdir -p "${CURRENTPATH}/bin/${PLATFORM}${SDKVERSION}-${ARCH}.sdk" LOG="${CURRENTPATH}/bin/${PLATFORM}${SDKVERSION}-${ARCH}.sdk/build-openssl-${VERSION}.log" - ./Configure BSD-generic32 --openssldir="${CURRENTPATH}/bin/${PLATFORM}${SDKVERSION}-${ARCH}.sdk" > "${LOG}" 2>&1 + ./Configure iphoneos-cross --openssldir="${CURRENTPATH}/bin/${PLATFORM}${SDKVERSION}-${ARCH}.sdk" > "${LOG}" 2>&1 # add -isysroot to CC= sed -ie "s!^CFLAG=!CFLAG=-isysroot ${DEVELOPER}/Platforms/${PLATFORM}.platform/Developer/SDKs/${PLATFORM}${SDKVERSION}.sdk !" "Makefile" diff --git a/include/openssl/opensslconf.h b/include/openssl/opensslconf.h index 17cecea..19a828a 100644 --- a/include/openssl/opensslconf.h +++ b/include/openssl/opensslconf.h @@ -2,6 +2,9 @@ /* WARNING: Generated automatically from opensslconf.h.in by Configure. */ /* OpenSSL was configured with the following options: */ +#ifndef OPENSSL_SYSNAME_iOS +# define OPENSSL_SYSNAME_iOS +#endif #ifndef OPENSSL_DOING_MAKEDEPEND @@ -83,8 +86,8 @@ #if !(defined(VMS) || defined(__VMS)) /* VMS uses logical names instead */ #if defined(HEADER_CRYPTLIB_H) && !defined(OPENSSLDIR) -#define ENGINESDIR "/data/home/fschulze/dev/ios/OpenSSL-for-iPhone/bin/iPhoneSimulator5.1-i386.sdk/lib/engines" -#define OPENSSLDIR "/data/home/fschulze/dev/ios/OpenSSL-for-iPhone/bin/iPhoneSimulator5.1-i386.sdk" +#define ENGINESDIR "/Users/megastep/src/OpenSSL-for-iPhone/bin/iPhoneSimulator5.1-i386.sdk/lib/engines" +#define OPENSSLDIR "/Users/megastep/src/OpenSSL-for-iPhone/bin/iPhoneSimulator5.1-i386.sdk" #endif #endif @@ -115,14 +118,14 @@ * - Intel P6 because partial register stalls are very expensive; * - elder Alpha because it lacks byte load/store instructions; */ -#define RC4_INT unsigned int +#define RC4_INT unsigned char #endif #if !defined(RC4_CHUNK) /* * This enables code handling data aligned at natural CPU word * boundary. See crypto/rc4/rc4_enc.c for further details. */ -#undef RC4_CHUNK +#define RC4_CHUNK unsigned long #endif #endif @@ -130,7 +133,7 @@ /* If this is set to 'unsigned int' on a DEC Alpha, this gives about a * %20 speed up (longs are 8 bytes, int's are 4). */ #ifndef DES_LONG -#define DES_LONG unsigned int +#define DES_LONG unsigned long #endif #endif @@ -150,12 +153,12 @@ #define CONFIG_HEADER_RC4_LOCL_H /* if this is defined data[i] is used instead of *data, this is a %20 * speedup on x86 */ -#define RC4_INDEX +#undef RC4_INDEX #endif #if defined(HEADER_BF_LOCL_H) && !defined(CONFIG_HEADER_BF_LOCL_H) #define CONFIG_HEADER_BF_LOCL_H -#undef BF_PTR +#define BF_PTR #endif /* HEADER_BF_LOCL_H */ #if defined(HEADER_DES_LOCL_H) && !defined(CONFIG_HEADER_DES_LOCL_H) From 50892593668d4a8824489a8deda5f4770ab82b87 Mon Sep 17 00:00:00 2001 From: Stephane Peter Date: Sun, 22 Jul 2012 05:08:12 -0700 Subject: [PATCH 2/2] Use the CROSS_* variables to simplify the script a bit. --- build-libssl.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build-libssl.sh b/build-libssl.sh index 10caf78..67f820d 100755 --- a/build-libssl.sh +++ b/build-libssl.sh @@ -70,19 +70,19 @@ do PLATFORM="iPhoneOS" fi - export CROSS_TOP="${DEVELOPER}/Platforms/${PLATFORM}.platform/Developer/" + export CROSS_TOP="${DEVELOPER}/Platforms/${PLATFORM}.platform/Developer" export CROSS_SDK="${PLATFORM}${SDKVERSION}.sdk" echo "Building openssl-${VERSION} for ${PLATFORM} ${SDKVERSION} ${ARCH}" echo "Please stand by..." - export CC="${DEVELOPER}/Platforms/${PLATFORM}.platform/Developer/usr/bin/gcc -arch ${ARCH}" + export CC="${CROSS_TOP}/usr/bin/gcc -arch ${ARCH}" mkdir -p "${CURRENTPATH}/bin/${PLATFORM}${SDKVERSION}-${ARCH}.sdk" LOG="${CURRENTPATH}/bin/${PLATFORM}${SDKVERSION}-${ARCH}.sdk/build-openssl-${VERSION}.log" ./Configure iphoneos-cross --openssldir="${CURRENTPATH}/bin/${PLATFORM}${SDKVERSION}-${ARCH}.sdk" > "${LOG}" 2>&1 # add -isysroot to CC= - sed -ie "s!^CFLAG=!CFLAG=-isysroot ${DEVELOPER}/Platforms/${PLATFORM}.platform/Developer/SDKs/${PLATFORM}${SDKVERSION}.sdk !" "Makefile" + sed -ie "s!^CFLAG=!CFLAG=-isysroot ${CROSS_TOP}/SDKs/${CROSS_SDK} !" "Makefile" make >> "${LOG}" 2>&1 make install >> "${LOG}" 2>&1