logo

English

이곳의 프로그래밍관련 정보와 소스는 마음대로 활용하셔도 좋습니다. 다만 쓰시기 전에 통보 정도는 해주시는 것이 예의 일것 같습니다. 질문이나 오류 수정은 siseong@gmail.com 으로 주세요. 감사합니다.

iOS - Openssl 빌드하기

by digipine posted Nov 01, 2017
?

Shortcut

PrevPrev Article

NextNext Article

Larger Font Smaller Font Up Down Go comment Print
?

Shortcut

PrevPrev Article

NextNext Article

Larger Font Smaller Font Up Down Go comment Print

1. openssl 다운로드

http://www.openssl.org 에서 다운로드
(2011.1.12 현재 openssl-1.0.0c  버전이 최신버전)
사용자의 위치에 압축풀기
ex) /Users/사용자이름/AppDev/openssl-1.0.0c
 
인스톨 위치 결정
ex)
cd /Users/사용자이름/AppDev/
mkdir openssl
cd openssl
mkdir openssl_i386 openssl_armv6 openssl_armv7
 
2. 소스코드 수정
Filename : openssl-1.0.0c/crypto/ui/ui_openssl.c 
수정할 부분 : static volatile sig_atomic_t intr_signal;
수정후 내용 : static volatile int intr_signal;
 
tip. 소스의 수정은 vi 에디터 등으로 할 수 있다. ":"를 눌러 커맨드 모드에서 
"/static volatile " 와 같이 치면 해당 부분을 바로 찾아준다.
 
3. makefile 수정
1) build 디렉토리를 다음과 같이 만든다.
mkdir openssl_temp
 
2) Config 파일을 구성한다.
./Configure BSD-generic32 enable-seed --openssldir=/Users/사용자명/AppDev/openssl-1.0.0c/openssl_temp
 
 
4. i386 (시뮬레이터)용 openssl 빌드
1) Makefile 을 수정한다.
수정전 내용 : CC = gcc
수정후 내용 : CC= /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc -arch i386
 
수정전 내용 : CFLAG= -DOPENSSL_THREADS -pthread -D_THREAD_SAFE -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -DTERMIOS -O3 -fomit-frame-pointer -Wall
수정후 내용 : CFLAG= -DOPENSSL_THREADS -pthread -D_THREAD_SAFE -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -DTERMIOS -O3 -fomit-frame-pointer -Wall -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk
 
2) build 수행
make
make install
 
3) Build 확인
ls -l openssl_test/lib
drwxr-xr-x  2 사용자명  staff       68  1 12 16:05 engines
-rw-r--r--  1 사용자명  staff  2584744  1 12 16:05 libcrypto.a
-rw-r--r--  1 사용자명  staff   454896  1 12 16:05 libssl.a
drwxr-xr-x  5 사용자명  staff      170  1 12 16:05 pkgconfig
 
4) Build 버전 이동
mv openssl_temp/ ../openssl/openssl_i386
 
 
5. arm6 (아이폰/아이패드)용 openssl 빌드
1) Makefile 을 수정한다.
수정전 내용 : CC= /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc -arch i386
수정후 내용 : CC = /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc -arch armv6
 
수정후 내용 : CFLAG= -DOPENSSL_THREADS -pthread -D_THREAD_SAFE -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -DTERMIOS -O3 -fomit-frame-pointer -Wall -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.2.sdk
수정후 내용 : CFLAG= -DOPENSSL_THREADS -pthread -D_THREAD_SAFE -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -DTERMIOS -O3 -fomit-frame-pointer -Wall -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk
 
2) build 수행
make clean
make
make install
 
3) Build 확인
ls -l openssl_temp/lib
drwxr-xr-x  2 사용자명  staff       68  1 12 16:20 engines
-rw-r--r--  1 사용자명  staff  2999344  1 12 16:20 libcrypto.a
-rw-r--r--  1 사용자명  staff   497936  1 12 16:20 libssl.a
drwxr-xr-x  5 사용자명  staff      170  1 12 16:20 pkgconfig
 
4) Build 버전 이동
mv openssl_temp/ ../openssl/openssl-armv6
 
 
 
6. arm7 (아이폰/아이패드)용 openssl 빌드
1) Makefile 을 수정한다.
수정전 내용 : CC= /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc -arch i386
수정후 내용 : CC = /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc -arch armv7
 
수정후 내용 : CFLAG= -DOPENSSL_THREADS -pthread -D_THREAD_SAFE -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -DTERMIOS -O3 -fomit-frame-pointer -Wall -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.2.sdk
수정후 내용 : CFLAG= -DOPENSSL_THREADS -pthread -D_THREAD_SAFE -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -DTERMIOS -O3 -fomit-frame-pointer -Wall -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk
 
2) build 수행
make clean
make
make install
 
3) Build 확인
ls -l openssl_temp/lib
drwxr-xr-x  2 사용자명  staff       68  1 12 16:35 engines
-rw-r--r--  1 사용자명  staff  2666440  1 12 16:35 libcrypto.a
-rw-r--r--  1 사용자명  staff   425368  1 12 16:35 libssl.a
drwxr-xr-x  5 사용자명  staff      170  1 12 16:35 pkgconfig
 
4) Build 버전 이동
mv openssl_temp/ ../openssl/openssl-armv7
 
7. Univerals (통합버전) 만들기
1) include 파일 복사
cd /Users/사용자명/AppDev/openssl-1.0.0c
cp -RL include ../openssl/include
 
tip. -R 옵션은 디렉토리 복사이고, -L 옵션은 심볼릭링크 파일인 경우, 원본을 찾아서 이를 복사하는 옵션이다. 해당 include의 파일들을 보면 알겠지만, 모두 심볼릭 링크 파일로 되어있다.
 
2) lib 파일 통합
cd /Users/사용자명/AppDev/openssl 
lipo -create openssl_i386/lib/libssl.a openssl_armv6/lib/libssl.a openssl_armv7/lib/libssl.a -output libssl.a
lipo -create openssl_i386/lib/libcrypto.a openssl_armv6/lib/libcrypto.a openssl_armv7/lib/libcrypto.a -output libcrypto.a
 
tip. 이후 배포할때 include 디렉토리와 libssl.a 및 libcrypto.a 파일을 함께 배포하면 된다.
 
TAG •

List of Articles
No. Subject Author Date Views
36 OSX - Screen Serial Terminal - OSX에서 시리얼 터미널 사용하기 digipine 2017.11.03 6870
35 OSX 사파리 최신 버전 폰트 변경하기 file digipine 2017.11.03 1224
34 [Swift 3] TCPIP Socket 통신 클래스 소스 코드 및 사용법 digipine 2017.11.02 4649
33 [Swift 3] HTTP Request 사용하기, 클래스 소스코드 및 사용법 digipine 2017.11.02 9775
32 [macOS] Sandbox 정책 극복기 Accessing Security Scoped Resource 1 file digipine 2017.11.02 1781
31 [Objective C] NSString 앞뒤 공백 문자 및 줄바꿈 문자 제거 digipine 2017.11.02 1655
30 XCode 8 업데이트 후 Code Sign Error 발생 시 해결법 1 digipine 2017.11.02 711
29 [iOS, MacOS] NSNotification, NSNotificationCenter 사용법 digipine 2017.11.02 1026
28 [iOS, MacOS] Singleton 싱글톤 패턴 사용하기 2 digipine 2017.11.02 1080
27 [iOS, MacOS] NSArray 정렬 Sorting에 대해서 digipine 2017.11.02 667
26 [iOS, MacOS] ATS 보안 정책 가이드 digipine 2017.11.02 570
25 OpenAL PDF, Sample Source file digipine 2017.11.02 796
24 Apple AppStore App Review 시 Reject 피하기 위한 방법 digipine 2017.11.02 447
23 iOS - UILabel 에서 AttributeString 사용하기 digipine 2017.11.02 640
22 iOS - BLE 장치용 ANCS Library for ANCS digipine 2017.11.02 950
21 iOS - UITextField의 Placeholder Color 색 변경하기 file digipine 2017.11.02 1152
20 iOS - sizeWithFont 메소드 deprecated와 sizeWithAttributes digipine 2017.11.02 610
19 iOS - Sleep Mode Blocking 방법, 앱실행시 슬립모드 진입 방지 digipine 2017.11.01 572
18 iOS , MacOS, iPhone용 GZipStream class 구현하기 digipine 2017.11.01 358
17 iOS - View 이동 전환 하기 총정리 digipine 2017.11.01 537
Board Pagination Prev 1 2 3 Next
/ 3