|cd /path/OpenSSL-for-iPhone-master $ ./build-libssl.sh|
Feb 1, 2010
This is a tutorial for using self-compiled builds of the OpenSSL-library on the iPhone. You can build apps with XCode and the official SDK from Apple with this. I also made a small example-app for using the libraries with XCode and the iPhone/iPhone-Simulator. You can also download the precompiled OpenSSL-library (1.0.0a).
This tutorial works with OpenSSL 0.9.8o and Xcode 3.2 with iPhoneOS 3.1.3. An updated version of this tutorial for OpenSSL 1.0 and Xcode 3.2.3 with iOS 4 is here: http://www.x2on.de/2010/07/13/tutorial-iphone-app-with-compiled-openssl-1-0-0a-library/
UPDATE 2010-07-13: New tutorial for OpenSSL 1.0.0a and iOS4 UPDATE 2010-06-30: I have updated OpenSSL to 1.0.0a with iOS 4.0 as base SDK UPDATE 2010-06-10: I have updated OpenSSL to 0.9.8o + iPad Version UPDATE 2010-03-31: I have updated OpenSSL to 0.9.8n UPDATE 2010-02-26: I have updated OpenSSL to 0.9.8m
You can get the Source of the example app with compiled OpenSSL at http://github.com/x2on/OpenSSL-for-iPhone
Create OpenSSL Libary:
- Download OpenSSL Sourcecode
- Build OpenSSL for i368 iPhoneSimulator:
- Edit Makefile:
CC = ccto:
- Add as first item to CFLAG:
static volatile int intr_signal;
for preventing building error
* Build it:
Build OpenSSL for arm iPhoneOS:
mv openssl_i386 openssl_i386_lib make clean
- Search and replace openssl_i386 with openssl_arm
- Change -arch i386 in CFLAG to: -arch armv6
Edit your iPhone-XCode project:
Copy the “include” folder from OpenSSL into your project-folder
Copy the libcrypto_.a and libss_.a files into your project-folder
Drag the libcrypto_.a and libss_.a files into your XCode Framework Folder-Tree
Open the Build-Info from your “Target” (Righclick on Target - Get Info)
Change Library Search Paths to
Change User Header Search Paths to include
Activate Always Search User Paths
Enjoy OpenSSL on the iPhone!
I have made an iPhone OS 3.1.2 XCode Project with OpenSSL 0.9.8o libaries. The examples uses the MD5-algorithm to calculate an md5 hash from an UITextfield.
Disclaimer: Use this at your own risk.