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
56 [Swift 3] HTTP Request 사용하기, 클래스 소스코드 및 사용법 digipine 2017.11.02 10525
55 OSX - Screen Serial Terminal - OSX에서 시리얼 터미널 사용하기 digipine 2017.11.03 7574
54 [iOS/Objective-C] __weak, __block 사용법 digipine 2021.02.16 6011
53 [Swift 3] TCPIP Socket 통신 클래스 소스 코드 및 사용법 digipine 2017.11.02 5321
52 [Objective-C] NSOperation과 NSOperationQueue를 사용하는 방법 - 설명 및 예제 엉뚱도마뱀 2018.03.14 4735
51 [iOS/macOS] 사설 인증서를 사용한 SSL HTTPS 통신 시 우회처리 digipine 2021.07.06 3967
50 iOS - Objective - C, URL 인코딩과 디코딩 digipine 2017.11.01 2640
49 [macOS] Sandbox 정책 극복기 Accessing Security Scoped Resource 1 file digipine 2017.11.02 2537
48 [MacOS, Swift] 스크롤뷰, NSScrollView 사용법 엉뚱도마뱀 2018.11.01 2082
47 [Objective C] NSString 앞뒤 공백 문자 및 줄바꿈 문자 제거 digipine 2017.11.02 2070
46 [macOS] Xcode 디버깅 시 Could not attach pid 오류 해결 file lizard2019 2023.06.05 1828
45 [swfit 4] 스위프트 Swift 동시성 동기화 정리 엉뚱도마뱀 2018.09.06 1763
44 iOS - Objective C 정규식 사용법 2 digipine 2017.11.01 1733
43 iOS - UITextField의 Placeholder Color 색 변경하기 file digipine 2017.11.02 1671
» iOS - Openssl 빌드하기 digipine 2017.11.01 1541
41 [iOS, MacOS] Singleton 싱글톤 패턴 사용하기 2 digipine 2017.11.02 1497
40 OSX 사파리 최신 버전 폰트 변경하기 file digipine 2017.11.03 1488
39 [swift 4] 변경 사항 정리 file 엉뚱도마뱀 2018.07.23 1470
38 MacOS mysql 비밀번호 분실 시 재설정하기 digipine 2017.11.14 1428
37 [iOS, MacOS] NSArray 정렬 Sorting에 대해서 digipine 2017.11.02 1398
Board Pagination Prev 1 2 3 Next
/ 3