├── .gitignore ├── README.markdown └── openssl.xcodeproj └── project.pbxproj /.gitignore: -------------------------------------------------------------------------------- 1 | *.mode1v3 2 | *.pbxuser 3 | -------------------------------------------------------------------------------- /README.markdown: -------------------------------------------------------------------------------- 1 | openssl-xcode 2 | ============= 3 | 4 | This is an XCode project skeleton structure that can be used to build a static 5 | libcrypto.a library for use in Mac and iPhone projects. 6 | 7 | It is specifically intended for use in building secure iPhone 8 | applications alongside [SQLCipher](http://www.zetetic.net/software/sqlcipher). 9 | 10 | openssl-xcode was developed by Stephen Lombardo at Zetetic LLC. 11 | 12 | sjlombardo at zetetic.net 13 | http://www.zetetic.net 14 | 15 | It was adapted for use with source archives by Michael Tyson of 16 | A Tasty Pixel (michael at atastypixel.com) 17 | 18 | Usage 19 | ----- 20 | 21 | In a normal case you would use it thusly: 22 | 23 | 1. Download the OpenSSL source code directly from 24 | http://www.openssl.org/source/ 25 | 2. Clone the openssl-xcode git repo to make a local copy 26 | 3. Put the downloaded OpenSSL source tar.gz into the same folder 27 | as openssl.xcodeproj. 28 | The extracted OpenSSL distribution can also be placed in a folder called 'openssl' 29 | within the same folder as openssl.xcodeproj, or just extracted within the 30 | same folder as openssl.xcodeproj. 31 | 32 | Then, either open openssl.xcodeproj in XCode and initiate a build, or integrate 33 | it within another project: 34 | 35 | 1. Drag the openssl.xcodeproj file into your main project 36 | 2. Right-click on your project target, and add openssl.xcodeproj under "Direct 37 | Dependencies" on the General tab. 38 | 3. On the Build tab for your project's target, find the "Header Search Paths" 39 | option, and add the path: 40 | > `$(SRCROOT)/Library/openssl/build/openssl.build/openssl/include` 41 | 42 | (Assuming you've put openssl.xcodeproj at the path Library/openssl, and are 43 | building from a source tarball) 44 | 4. Expand your target's "Link Binary With Libraries" build stage, and drag 45 | libcrypto.a from the openssl.xcodeproj group. 46 | 47 | 48 | This project actually relies on the OpenSSL configure and make 49 | system to build the libraries. However, it does attempt to automatically 50 | detect and use the appropriate build settings for arch (i386/ppc/armv6), 51 | build tools, and SDK directories. This makes it appropriate for inclusion 52 | as a project reference into an iPhone application project. 53 | 54 | License 55 | ------- 56 | 57 | Copyright (c) 2009, ZETETIC LLC 58 | All rights reserved. 59 | 60 | Redistribution and use in source and binary forms, with or without 61 | modification, are permitted provided that the following conditions are met: 62 | 63 | * Redistributions of source code must retain the above copyright 64 | notice, this list of conditions and the following disclaimer. 65 | * Redistributions in binary form must reproduce the above copyright 66 | notice, this list of conditions and the following disclaimer in the 67 | documentation and/or other materials provided with the distribution. 68 | * Neither the name of the ZETETIC LLC nor the 69 | names of its contributors may be used to endorse or promote products 70 | derived from this software without specific prior written permission. 71 | 72 | THIS SOFTWARE IS PROVIDED BY ZETETIC LLC ''AS IS'' AND ANY 73 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 74 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 75 | DISCLAIMED. IN NO EVENT SHALL ZETETIC LLC BE LIABLE FOR ANY 76 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 77 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 78 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 79 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 80 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 81 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 82 | 83 | -------------------------------------------------------------------------------- /openssl.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 42; 7 | objects = { 8 | 9 | /* Begin PBXFileReference section */ 10 | 9069D28C0FCE659A0042E34C /* libcrypto.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libcrypto.a; sourceTree = BUILT_PRODUCTS_DIR; }; 11 | /* End PBXFileReference section */ 12 | 13 | /* Begin PBXGroup section */ 14 | 9069D12D0FCE340B0042E34C = { 15 | isa = PBXGroup; 16 | children = ( 17 | 9069D25C0FCE62420042E34C /* Products */, 18 | ); 19 | sourceTree = ""; 20 | }; 21 | 9069D25C0FCE62420042E34C /* Products */ = { 22 | isa = PBXGroup; 23 | children = ( 24 | 9069D28C0FCE659A0042E34C /* libcrypto.a */, 25 | ); 26 | name = Products; 27 | sourceTree = ""; 28 | }; 29 | /* End PBXGroup section */ 30 | 31 | /* Begin PBXNativeTarget section */ 32 | 9069D28B0FCE659A0042E34C /* crypto */ = { 33 | isa = PBXNativeTarget; 34 | buildConfigurationList = 9069D2980FCE65C10042E34C /* Build configuration list for PBXNativeTarget "crypto" */; 35 | buildPhases = ( 36 | 27558DB412CE64BC00692BA9 /* ShellScript */, 37 | ); 38 | buildRules = ( 39 | ); 40 | dependencies = ( 41 | ); 42 | name = crypto; 43 | productName = crypto; 44 | productReference = 9069D28C0FCE659A0042E34C /* libcrypto.a */; 45 | productType = "com.apple.product-type.library.static"; 46 | }; 47 | /* End PBXNativeTarget section */ 48 | 49 | /* Begin PBXProject section */ 50 | 9069D12F0FCE340B0042E34C /* Project object */ = { 51 | isa = PBXProject; 52 | buildConfigurationList = 9069D1320FCE340B0042E34C /* Build configuration list for PBXProject "openssl" */; 53 | compatibilityVersion = "Xcode 2.4"; 54 | developmentRegion = English; 55 | hasScannedForEncodings = 0; 56 | knownRegions = ( 57 | English, 58 | Japanese, 59 | French, 60 | German, 61 | ); 62 | mainGroup = 9069D12D0FCE340B0042E34C; 63 | projectDirPath = ""; 64 | projectRoot = ""; 65 | targets = ( 66 | 9069D28B0FCE659A0042E34C /* crypto */, 67 | ); 68 | }; 69 | /* End PBXProject section */ 70 | 71 | /* Begin PBXShellScriptBuildPhase section */ 72 | 27558DB412CE64BC00692BA9 /* ShellScript */ = { 73 | isa = PBXShellScriptBuildPhase; 74 | buildActionMask = 2147483647; 75 | files = ( 76 | ); 77 | inputPaths = ( 78 | ); 79 | outputPaths = ( 80 | ); 81 | runOnlyForDeploymentPostprocessing = 0; 82 | shellPath = /bin/sh; 83 | shellScript = "if [ -f \"$CONFIGURATION_BUILD_DIR/libcrypto.a\" ]; then\n\texit 0;\nfi\n\nOPENSSL_SRCROOT=\"$SRCROOT/openssl\"\nif [ ! -d \"$OPENSSL_SRCROOT\" ]; then\n OPENSSL_SRCROOT=\"$SRCROOT\"\nfi;\n\nSRC_ARCHIVE=`ls openssl*tar.gz 2>/dev/null`\nif [ -f \"$SRC_ARCHIVE\" ]; then\n\tOPENSSL_SRCROOT=\"$PROJECT_TEMP_DIR/openssl\"\n\tif [ ! -d \"$OPENSSL_SRCROOT\" ]; then\n\t\techo \"Extracting $SRC_ARCHIVE...\"\n\t\tmkdir \"$OPENSSL_SRCROOT\"\n\t\ttar -C \"$OPENSSL_SRCROOT\" --strip-components=1 -zxf \"$SRC_ARCHIVE\" || exit 1\n\t\tcp -RL \"$OPENSSL_SRCROOT/include\" \"$CONFIGURATION_BUILD_DIR\"\n\tfi\nfi\n\nif [ \"$SDKROOT\" != \"\" ]; then\n\tISYSROOT=\"-isysroot $SDKROOT\"\nfi\n\nOPENSSL_OPTIONS=\"no-krb5 no-gost\"\n\ncd \"$OPENSSL_SRCROOT\"\n\n## this is a universal build\nif [ \"$ARCHS_STANDARD_32_BIT\" = \"i386 ppc\" ]; then\n\n\tBUILDARCH=\"ppc\"\n\techo \"***** BUILDING UNIVERSAL ARCH $BUILDARCH ******\"\n\tmake clean\n\t./config no-asm $OPENSSL_OPTIONS -openssldir=\"$BUILD_DIR\"\n\tASM_DEF=\"-UOPENSSL_BN_ASM_PART_WORDS\"\n\tmake CC=$PLATFORM_DEVELOPER_BIN_DIR/gcc CFLAG=\"-D_DARWIN_C_SOURCE $ASM_DEF -arch $BUILDARCH $ISYSROOT\" SHARED_LDFLAGS=\"-arch $BUILDARCH -dynamiclib\"\n\tcp libcrypto.a \"$CONFIGURATION_TEMP_DIR\"/$BUILDARCH-libcrypto.a\n\tcp libssl.a \"$CONFIGURATION_TEMP_DIR\"/$BUILDARCH-libssl.a\n\t\n\tBUILDARCH=\"i386\"\n\techo \"***** BUILDING UNIVERSAL ARCH $BUILDARCH ******\"\n\tmake clean\n\t./config $OPENSSL_OPTIONS -openssldir=\"$BUILD_DIR\"\n\tASM_DEF=\"-DOPENSSL_BN_ASM_PART_WORDS\"\n\tmake CC=$PLATFORM_DEVELOPER_BIN_DIR/gcc CFLAG=\"-D_DARWIN_C_SOURCE $ASM_DEF -arch $BUILDARCH $ISYSROOT\" SHARED_LDFLAGS=\"-arch $BUILDARCH -dynamiclib\"\n\tcp libcrypto.a \"$CONFIGURATION_TEMP_DIR\"/$BUILDARCH-libcrypto.a\n\tcp libssl.a \"$CONFIGURATION_TEMP_DIR\"/$BUILDARCH-libssl.a\n\tmkdir -p \"$CONFIGURATION_BUILD_DIR\"\n\tlipo -create \"$CONFIGURATION_TEMP_DIR\"/*-libcrypto.a -output \"$CONFIGURATION_BUILD_DIR/libcrypto.a\"\n \tlipo -create \"$CONFIGURATION_TEMP_DIR\"/*-libssl.a -output \"$CONFIGURATION_BUILD_DIR/libssl.a\"\nelse\n\tBUILDARCH=$ARCHS\n\techo \"***** BUILDING ARCH $BUILDARCH ******\"\n\tmake clean\n\n\tif [ \"$BUILDARCH\" = \"i386\" ]; then\n\t\t./config $OPENSSL_OPTIONS -openssldir=\"$BUILD_DIR\"\n\t\tASM_DEF=\"-DOPENSSL_BN_ASM_PART_WORDS\"\n else\n\t\t./config no-asm $OPENSSL_OPTIONS -openssldir=\"$BUILD_DIR\"\n\t\tASM_DEF=\"-UOPENSSL_BN_ASM_PART_WORDS\"\n fi\n\tmake CC=$PLATFORM_DEVELOPER_BIN_DIR/gcc CFLAG=\"-D_DARWIN_C_SOURCE $ASM_DEF -arch $BUILDARCH $ISYSROOT\" SHARED_LDFLAGS=\"-arch $BUILDARCH -dynamiclib\"\n\tmkdir -p \"$CONFIGURATION_BUILD_DIR\"\n\tcp libcrypto.a \"$CONFIGURATION_BUILD_DIR\"\n\tcp libssl.a \"$CONFIGURATION_BUILD_DIR\"\nfi\n\nranlib \"$CONFIGURATION_BUILD_DIR/libcrypto.a\"\nranlib \"$CONFIGURATION_BUILD_DIR/libssl.a\""; 84 | }; 85 | /* End PBXShellScriptBuildPhase section */ 86 | 87 | /* Begin XCBuildConfiguration section */ 88 | 9069D1300FCE340B0042E34C /* Debug */ = { 89 | isa = XCBuildConfiguration; 90 | buildSettings = { 91 | COPY_PHASE_STRIP = NO; 92 | }; 93 | name = Debug; 94 | }; 95 | 9069D1310FCE340B0042E34C /* Release */ = { 96 | isa = XCBuildConfiguration; 97 | buildSettings = { 98 | COPY_PHASE_STRIP = YES; 99 | }; 100 | name = Release; 101 | }; 102 | 9069D28D0FCE659B0042E34C /* Debug */ = { 103 | isa = XCBuildConfiguration; 104 | buildSettings = { 105 | ALWAYS_SEARCH_USER_PATHS = NO; 106 | COPY_PHASE_STRIP = NO; 107 | GCC_DYNAMIC_NO_PIC = NO; 108 | GCC_ENABLE_FIX_AND_CONTINUE = YES; 109 | GCC_MODEL_TUNING = G5; 110 | GCC_OPTIMIZATION_LEVEL = 0; 111 | INSTALL_PATH = /usr/local/lib; 112 | PREBINDING = NO; 113 | PRODUCT_NAME = crypto; 114 | }; 115 | name = Debug; 116 | }; 117 | 9069D28E0FCE659B0042E34C /* Release */ = { 118 | isa = XCBuildConfiguration; 119 | buildSettings = { 120 | ALWAYS_SEARCH_USER_PATHS = NO; 121 | COPY_PHASE_STRIP = YES; 122 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 123 | GCC_ENABLE_FIX_AND_CONTINUE = NO; 124 | GCC_MODEL_TUNING = G5; 125 | INSTALL_PATH = /usr/local/lib; 126 | PREBINDING = NO; 127 | PRODUCT_NAME = crypto; 128 | ZERO_LINK = NO; 129 | }; 130 | name = Release; 131 | }; 132 | /* End XCBuildConfiguration section */ 133 | 134 | /* Begin XCConfigurationList section */ 135 | 9069D1320FCE340B0042E34C /* Build configuration list for PBXProject "openssl" */ = { 136 | isa = XCConfigurationList; 137 | buildConfigurations = ( 138 | 9069D1300FCE340B0042E34C /* Debug */, 139 | 9069D1310FCE340B0042E34C /* Release */, 140 | ); 141 | defaultConfigurationIsVisible = 0; 142 | defaultConfigurationName = Release; 143 | }; 144 | 9069D2980FCE65C10042E34C /* Build configuration list for PBXNativeTarget "crypto" */ = { 145 | isa = XCConfigurationList; 146 | buildConfigurations = ( 147 | 9069D28D0FCE659B0042E34C /* Debug */, 148 | 9069D28E0FCE659B0042E34C /* Release */, 149 | ); 150 | defaultConfigurationIsVisible = 0; 151 | defaultConfigurationName = Release; 152 | }; 153 | /* End XCConfigurationList section */ 154 | }; 155 | rootObject = 9069D12F0FCE340B0042E34C /* Project object */; 156 | } 157 | --------------------------------------------------------------------------------