Giter Site home page Giter Site logo

x2on / openssl-for-iphone Goto Github PK

View Code? Open in Web Editor NEW
2.5K 142.0 802.0 7.48 MB

A script for compiling OpenSSL for iOS Devices (iPhone, iPad, Watch, iPod Touch, AppleTV, MacCatalyst)

Home Page: https://www.felixschulze.de

License: Apache License 2.0

Objective-C 13.74% Shell 62.13% Swift 6.57% Perl 16.53% C 1.02%
openssl ios encryption iphone objective-c openssl-library openssl-libraries tvos xcode

openssl-for-iphone's Introduction

OpenSSL-for-iOS Build Status license OpenSSL version iOS support tvOS support MacCatalyst support

This is a script 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.

Enjoy OpenSSL on the iPhone!

You must build the OpenSSL-Libraries (1.1.1w) before running the sample with:

./build-libssl.sh

For other versions build the OpenSSL-Libraries with:

./build-libssl.sh --version=1.1.1k

For all options see the help

./build-libssl.sh --help

This repository contains an iOS 16.0 Xcode Project which uses the OpenSSL Libraries. The examples uses the MD5 or SHA256-algorithm to calculate an md5 or sha256 hash from an UITextfield.

System support

iOS 12.0 - iOS 16.6 (x86_64 , arm64, arm64e bitcode), tvOS 12.0 - tvOS 16.6 (x86_64, arm64, bitcode), WatchOS 8 and MacCatalyst 15.6 (MacOSX_x86_64) are currently supported.

For iOS < 7.0 you must use Xcode < 7 and an older version of the build script. For iOS < 12.0 you must use Xcode < 11 and an older version of the build script.

If you have problems building for arm64 please uninstall MacPorts (see #28).

Original tutorials for this project:

Changelog

  • 2023-09-20: OpenSSL 1.1.1w
  • 2023-08-21: OpenSSL 1.1.1v, iOS 16.6 support
  • 2023-07-04: OpenSSL 1.1.1u
  • 2023-02-09: OpenSSL 1.1.1t
  • 2023-01-10: Xcode 14.2 support, iOS 16.2 support, SHA512 Example
  • 2022-11-16: Xcode 14.1 support, iOS 16.1 support, OpenSSL 1.1.1s
  • 2022-09-15: Xcode 14 support, iOS 16 support
  • 2022-07-20: OpenSSL 1.1.1q, Fix Travix Build, Xcode 13,4, iOS 15 Support, Add support for Simulator and Catalyst on M1 (arm64), and Apple Watch, Support for XCFramework
  • 2019-11-27: OpenSSL 1.1.1d, Add Support for arm64e
  • 2019-11-27: Add support for MacCatalyst, Xcode 11.2.1 (iOS 12.0 - 13.2), Migrate to Swift 5, Remove OpenSSL 1.0.2 support
  • 2017-05-25: OpenSSL 1.0.2l, 1.1.0f
  • 2017-02-16: OpenSSL 1.1.0e
  • 2017-01-28: OpenSSL 1.0.2k, 1.1.0d, Xcode 8.2 (iOS 10.2 and tvOS 10.1)
  • 2016-11-13: OpenSSL 1.1.0c
  • 2016-11-07: Optional support for OpenSSL 1.1.0b
  • 2016-09-28: OpenSSL 1.0.2j
  • 2016-09-22: OpenSSL 1.0.2i
  • 2016-09-18: Xcode 8 support, iOS 10.0, Add command line options, Optimize build
  • 2016-08-09: Xcode 7.3 support, iOS 9.3
  • 2016-05-04: OpenSSL 1.0.2h
  • 2015-12-11: Xcode 7.2 support, iOS 9.2
  • 2015-12-03: OpenSSL 1.0.2e
  • 2015-11-17: tvOS example app, Migrate to Swift for example app
  • 2015-11-16: tvOS support
  • 2015-10-25: Xcode 7.1 support
  • 2015-08-06: iOS 9.0 support, Bitcode support
  • 2015-07-09: OpenSSL 1.0.2d, iOS 8.4
  • 2015-06-15: OpenSSL 1.0.2c, iOS 8.3
  • 2015-06-11: OpenSSL 1.0.2b
  • 2015-03-19: OpenSSL 1.0.2a
  • 2015-01-28: OpenSSL 1.0.2
  • 2015-01-10: OpenSSL 1.0.1k
  • 2014-10-15: OpenSSL 1.0.1j
  • 2014-09-18: iOS 8.0 support
  • 2014-08-08: OpenSSL 1.0.1i
  • 2014-06-05: OpenSSL 1.0.1h
  • 2014-04-07: OpenSSL 1.0.1g
  • 2014-03-12: iOS 7.1 support
  • 2014-01-07: OpenSSL 1.0.1f
  • 2013-10-12: x86_64 support, Migrate project to iOS 7.0
  • 2013-09-23: iOS 7.0 support
  • 2013-03-01: OpenSSL 1.0.1e, iOS 6.1
  • 2012-09-21: Support for iOS 6.0 and iPhone 5 (armv7s) - Remove armv6 support
  • 2012-05-17: OpenSSL 1.0.1c
  • 2012-05-02: OpenSSL 1.0.1b
  • 2012-04-01: OpenSSL 1.0.1, Modernizes project to use ARC
  • 2012-01-28: OpenSSL 1.0.0g, Optimized build script
  • 2011-10-23: OpenSSL 1.0.0e, iOS 5.0
  • 2011-02-08: OpenSSL 1.0.0d
  • 2010-12-16: Script for building OpenSSL
  • 2010-12-04: SHA256 Hash, Clean project file with iOS 4.2 as base SDK
  • 2010-12-04: OpenSSL 1.0.0c
  • 2010-11-16: OpenSSL 1.0.0b
  • 2010-06-30: OpenSSL 1.0.0a, iOS 4.0 as base SDK
  • 2010-06-10: OpenSSL 0.9.8o, iPad Version
  • 2010-03-31: OpenSSL 0.9.8n
  • 2010-02-26: OpenSSL 0.9.8m

openssl-for-iphone's People

Contributors

andrewh42 avatar bithug avatar cgutman avatar chebur avatar dapperstout avatar dyashkir avatar fake666 avatar fjolnir avatar gpongelli avatar khaitu avatar lifeisfoo avatar marcelosalloum avatar martijnlaan avatar matoma avatar mconintet avatar megastep avatar mpfluger avatar mwermeester avatar omochi avatar oneton avatar pieterclaerhout avatar revolter avatar steffenl avatar vitalyster avatar x2on avatar zeroimpl avatar zhzenghui avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

openssl-for-iphone's Issues

Build stops with error

Hello!
I downloaded your branch, and try to build openssl to use it in my iOS application. After a while the build process stops, and in the log file I have something like this (the demo xcode project keep says I have to run the script first):

cp: openssl: No such file or directory
make[1]: *** [install] Error 1
make: *** [install_sw] Error 1

build-openssl-1.0.2e.log.zip

I'm using xCode 7.2 (7C68). Do you have any idea what am I doing wrong? I attached the full log I get
Thanks for your help

arm64 support

Please add support for the new arm64 architecture supported by iPhone 5S

Crash on Unicode characters

The sample app crashes when there is any Unicode characters (e.g. 月 - an chinese character which means moon). Any suggestion on how to handle Unicode strings?

Support for bitcode?

I'm finding that when I build this project and include in am Xcode 7 / iOS 9 project, I can't enable bitcode because OpenSSL was not compiled with bitcode enabled. I've been able to build the project with Xcode 7 beta, but I think OpenSSL itself is being built with GCC?

Thanks for this project!

Example-app can't be built if the architectures is set to "Standard architectures (including 64-bit)"

With the latest XCode 5 I built openssl-1.0.1e for iPhone successfully. Thanks for the good job. However, when I open the example app and set the architecture to include 64 bit, it complains "missing required architecture x86_64 in file". It's one weird error, because x86_64 is not one target architecture. Maybe I'm missing something simple.

Below is the screen-shot.

screen shot 2013-10-09 at 3 36 41 pm

And all error message.

Ld /Users/nex/Library/Developer/Xcode/DerivedData/OpenSSL-for-iOS-cszcrrhokzjwzkgouhrolwsblubq/Build/Intermediates/OpenSSL-for-iOS.build/Debug-iphonesimulator/OpenSSL-for-iOS.build/Objects-normal/x86_64/OpenSSL normal x86_64
cd /Users/nex/Desktop/OpenSSL-for-iPhone-master
setenv IPHONEOS_DEPLOYMENT_TARGET 7.0
setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.0.sdk -L/Users/nex/Library/Developer/Xcode/DerivedData/OpenSSL-for-iOS-cszcrrhokzjwzkgouhrolwsblubq/Build/Products/Debug-iphonesimulator -L/Users/nex/Desktop/OpenSSL-for-iPhone-master/lib -F/Users/nex/Library/Developer/Xcode/DerivedData/OpenSSL-for-iOS-cszcrrhokzjwzkgouhrolwsblubq/Build/Products/Debug-iphonesimulator -filelist /Users/nex/Library/Developer/Xcode/DerivedData/OpenSSL-for-iOS-cszcrrhokzjwzkgouhrolwsblubq/Build/Intermediates/OpenSSL-for-iOS.build/Debug-iphonesimulator/OpenSSL-for-iOS.build/Objects-normal/x86_64/OpenSSL.LinkFileList -Xlinker -objc_abi_version -Xlinker 2 -fobjc-arc -fobjc-link-runtime -Xlinker -no_implicit_dylibs -mios-simulator-version-min=7.0 -framework UIKit -framework Foundation -framework CoreGraphics -lcrypto -lssl -Xlinker -dependency_info -Xlinker /Users/nex/Library/Developer/Xcode/DerivedData/OpenSSL-for-iOS-cszcrrhokzjwzkgouhrolwsblubq/Build/Intermediates/OpenSSL-for-iOS.build/Debug-iphonesimulator/OpenSSL-for-iOS.build/Objects-normal/x86_64/OpenSSL_dependency_info.dat -o /Users/nex/Library/Developer/Xcode/DerivedData/OpenSSL-for-iOS-cszcrrhokzjwzkgouhrolwsblubq/Build/Intermediates/OpenSSL-for-iOS.build/Debug-iphonesimulator/OpenSSL-for-iOS.build/Objects-normal/x86_64/OpenSSL

ld: warning: ignoring file /Users/nex/Desktop/OpenSSL-for-iPhone-master/lib/libcrypto.a, missing required architecture x86_64 in file /Users/nex/Desktop/OpenSSL-for-iPhone-master/lib/libcrypto.a (4 slices)
ld: warning: ignoring file /Users/nex/Desktop/OpenSSL-for-iPhone-master/lib/libssl.a, missing required architecture x86_64 in file /Users/nex/Desktop/OpenSSL-for-iPhone-master/lib/libssl.a (4 slices)
Undefined symbols for architecture x86_64:
"_BIO_ctrl", referenced from:
+[FSOpenSSL base64FromString:encodeWithNewlines:] in FSOpenSSL.o
"_BIO_f_base64", referenced from:
+[FSOpenSSL base64FromString:encodeWithNewlines:] in FSOpenSSL.o
"_BIO_free_all", referenced from:
+[FSOpenSSL base64FromString:encodeWithNewlines:] in FSOpenSSL.o
"_BIO_new", referenced from:
+[FSOpenSSL base64FromString:encodeWithNewlines:] in FSOpenSSL.o
"_BIO_push", referenced from:
+[FSOpenSSL base64FromString:encodeWithNewlines:] in FSOpenSSL.o
"_BIO_s_mem", referenced from:
+[FSOpenSSL base64FromString:encodeWithNewlines:] in FSOpenSSL.o
"_BIO_set_flags", referenced from:
+[FSOpenSSL base64FromString:encodeWithNewlines:] in FSOpenSSL.o
"_BIO_write", referenced from:
+[FSOpenSSL base64FromString:encodeWithNewlines:] in FSOpenSSL.o
"_MD5", referenced from:
+[FSOpenSSL md5FromString:] in FSOpenSSL.o
"_SHA256_Final", referenced from:
+[FSOpenSSL sha256FromString:] in FSOpenSSL.o
"_SHA256_Init", referenced from:
+[FSOpenSSL sha256FromString:] in FSOpenSSL.o
"_SHA256_Update", referenced from:
+[FSOpenSSL sha256FromString:] in FSOpenSSL.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Let me know if you've any clues. Thanks.

Connection reset by peer

When trying to run the script I get the following output:
Downloading openssl-1.0.1j.tar.gz

% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- 0:01:10 --:--:-- 0curl: (56) Recv failure: Connection reset by peer

OpenSSL build failed if the script file is present in the source code directory or the directory inside the source code

Hi Felix Schulze

First all of all thanks for the amazing script for building openSSL for iphone.
I have been facing an issue with that if I place the script inside the openssl source code directory the openssl script failed. I skipped some steps in scripts of downloading the source code then making the src folder to extract the source code and building from there. The script works fine if run it one level up from source code directory.
I am attaching the screenshot of the log fie showing error.

build

Evaluate upgrade to OpenSSL 1.0.2f (CVE-2016-0701)

https://www.openssl.org/news/secadv/20160128.txt

OpenSSL provides the option SSL_OP_SINGLE_DH_USE for ephemeral DH (DHE) in TLS.
It is not on by default. If the option is not set then the server reuses the
same private DH exponent for the life of the server process and would be
vulnerable to this attack. It is believed that many popular applications do set
this option and would therefore not be at risk.

OpenSSL before 1.0.2f will reuse the key if:

  • SSL_CTX_set_tmp_dh()/SSL_set_tmp_dh() is used and SSL_OP_SINGLE_DH_USE is not
    set.
  • SSL_CTX_set_tmp_dh_callback()/SSL_set_tmp_dh_callback() is used, and both the
    parameters and the key are set and SSL_OP_SINGLE_DH_USE is not used. This is
    an undocumted feature and parameter files don't contain the key.
  • Static DH ciphersuites are used. The key is part of the certificate and
    so it will always reuse it. This is only supported in 1.0.2.

It will not reuse the key for DHE ciphers suites if:

  • SSL_OP_SINGLE_DH_USE is set
  • SSL_CTX_set_tmp_dh_callback()/SSL_set_tmp_dh_callback() is used and the
    callback does not provide the key, only the parameters. The callback is
    almost always used like this.

Non-safe primes are generated by OpenSSL when using:

  • genpkey with the dh_rfc5114 option. This will write an X9.42 style file
    including the prime-order subgroup size "q". This is supported since the 1.0.2
    version. Older versions can't read files generated in this way.
  • dhparam with the -dsaparam option. This has always been documented as
    requiring the single use.

The fix for this issue adds an additional check where a "q" parameter is
available (as is the case in X9.42 based parameters). This detects the
only known attack, and is the only possible defense for static DH ciphersuites.
This could have some performance impact.

Additionally the SSL_OP_SINGLE_DH_USE option has been switched on by default
and cannot be disabled. This could have some performance impact.

This issue affects OpenSSL version 1.0.2.

OpenSSL 1.0.2 users should upgrade to 1.0.2f

Debug mode to step in

Hi, I know that by using "./config -d" I can compile the OpenSSL library with debug symbol. Does this project provide such option that I can generate a library that allow me to step into the function in OpenSSL?

Thank you in advance!

Compile with Clang?

Hey I've had success compiling with clang, except for i386 and x86_64

export CC="${CLANG} -std=gnu11"
OLD_LANG=$LANG
unset LANG
sed -i "" 's|\"iphoneos-cross\"\,\"llvm-gcc\:-O3|\"iphoneos-cross\"\,\"${CLANG}\:-Os|g' Configure
            sed -i "" 's/CFLAG= -O/CFLAG= -Os /g' Makefile.org
            sed -ie "s!^CFLAG=!CFLAG=-isysroot ${CROSS_TOP}/SDKs/${CROSS_SDK} -arch ${IOS_ARCH} -Os -fPIC  -stdlib=$STDLIB -miphoneos-version-min=$MIN_IOS_VERSION !" Makefile.org
            sed -i "" 's/MAKEDEPPROG=makedepend/MAKEDEPPROG=$(CC) -M/g' Makefile.org

export LANG=$OLD_LANG

Throwing:

Undefined symbols for architecture i386:
  "start", referenced from:
     implicit entry/start for main executable
     (maybe you meant: _start_hash, _BN_CTX_start , _dtls1_start_timer )
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [link_app.] Error 1
make[1]: *** [openssl] Error 2
make: *** [build_apps] Error 1

build script quits with a syntax error on [install-docs]

build script quits with a syntax error on [install-docs]:

Also, the modification of CFLAG seems to leave us with 2 sys root(s) set (!!)
and $CURRENTPATH doesn't like my directory: "XCode Projects" - ie, the space in its name

(sorry, have not yet had a chance to do further digging yet...)

making all in tools...
make[1]: Nothing to be done for all'. /bin/sh: -c: line 0: syntax error near unexpected tokenProjects/OpenSSL-for-iPhone/bin/iPhoneSimulator6.1-i386.sdk/man/man$sec/$fn.${sec}'
/bin/sh: -c: line 0: pod2man="cd ./util; ./pod2mantest /usr/bin/perl"; here="pwd"; filecase=; if [ "iphoneos-cross" = "DJGPP" -o "iphoneos-cross" = "Cygwin" -o "iphoneos-cross" = "mingw" ]; then filecase=-i; fi; set -e; for i in doc/apps/*.pod; do fn=basename $i .pod; sec=/usr/bin/perl util/extract-section.pl 1 < $i; echo "installing man$sec/$fn.${sec}"; (cd/usr/bin/perl util/dirname.pl $i; sh -c "$pod2man --section=$sec --center=OpenSSL --release=1.0.1ebasename $i") > /Users/drlou/DEVELOPMENT/XCode Projects/OpenSSL-for-iPhone/bin/iPhoneSimulator6.1-i386.sdk/man/man$sec/$fn.${sec}; /usr/bin/perl util/extract-names.pl < $i | (grep -v $filecase "^$fn\$"; true) | (grep -v "[ ]"; true) | (cd /Users/drlou/DEVELOPMENT/XCode Projects/OpenSSL-for-iPhone/bin/iPhoneSimulator6.1-i386.sdk/man/man$sec/; while read n; do PLATFORM=iphoneos-cross $here/util/point.sh $fn.${sec} "$n".${sec}; done); done; set -e; for i in doc/crypto/*.pod doc/ssl/*.pod; do fn=basename $i .pod; sec=/usr/bin/perl util/extract-section.pl 3 < $i; echo "installing man$sec/$fn.${sec}"; (cd/usr/bin/perl util/dirname.pl $i; sh -c "$pod2man --section=$sec --center=OpenSSL --release=1.0.1ebasename $i`") > /Users/drlou/DEVELOPMENT/XCode Projects/OpenSSL-for-iPhone/bin/iPhoneSimulator6.1-i386.sdk/man/man$sec/$fn.${sec}; /usr/bin/perl util/extract-names.pl < $i | (grep -v $filecase "^$fn$"; true) | (grep -v "[ ]"; true) | (cd /Users/drlou/DEVELOPMENT/XCode Projects/OpenSSL-for-iPhone/bin/iPhoneSimulator6.1-i386.sdk/man/man$sec/; while read n; do PLATFORM=iphoneos-cross $here/util/point.sh $fn.${sec} "$n".${sec}; done); done'
make: *** [install_docs] Error 2

Request: provide git tag for CocoaPods

I'm creating a CocoaPods spec for OpenSSL using your excellent script. But for that to work nicely, I need a version tag in the git repo. Would you be so kind to tag the latest commit (f267da5) as '1.0.2'?

Incorrect hash

Testing this tonight I noticed something weird...

Added this line 'NSLog(@"%@ %@", textField.text, [FSOpenSSL md5FromString:textField.text]);'

2014-02-24 04:04:41.340 OpenSSL[1760:60b] mike 18126e7bd3f84b3f3e4df094def5b7de

mike@OSX ~ echo "mike" | md5
2ff8557a16f674e466ee4ae619f22758

mike@smartos ~ echo "mike" | md5sum
2ff8557a16f674e466ee4ae619f22758 -

Not sure if its the openssl thats built or if its + (NSString *)md5FromString:(NSString *)string;

Arm64 problem while configure

I have the latest Xcode version, and when executing the build script, all architectures work fine, except for arm64. When I get to arm64, the shell prints:
Problem while make - Please check […]/OpenSSL-for-iPhone-master/bin/iPhoneOS7.1-arm64.sdk/build-openssl-1.0.1g.log

When looking at the log, these are the last lines:
/opt/local/bin/ranlib: /opt/local/bin/ranlib: cannot execute binary file
ar: internal ranlib command failed
make[1]: *** [../libcrypto.a] Error 1
make: *** [build_crypto] Error 1

I googled the issue, and found this page: http://lists.cs.uiuc.edu/pipermail/llvmbugs/2014-March/033328.html, which suggested I change the ranlib path. So I changed my /opt/local/bin/ranlib alias to the recommended path suggested on the page, '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib', add then all architectures stopped working. I filtered the generation to arm64, but it still didn't work for that one, and the error remained the same. So I reversed to the original ranlib alias, and the other architectures except for arm64 resumed working.

Still, I really need it to compile for arm64. Could you suggest any resolutions to the issue?

Works with Xcode 6.4?

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: file:     /Users/victorcase/workspace/Telegram-2.8/MtProtoKit/../../../Downloads/openssl.framework/openssl(ebcdic.o) has no symbols

OpenSSL RSA : CRYPTO_malloc memory leaks

@interface KCRSA : NSObject{
RSA *_rsa;
}

@implementation KCRSA

  • (BOOL)importRSAPublicKey
    {
    FILE *file;
    NSString *keyPath = [[NSBundle mainBundle] pathForResource:@"public_key" ofType:@"pem"];
    file = fopen([keyPath cStringUsingEncoding:NSASCIIStringEncoding], "rb");

    if (NULL != file)
    {
    _rsa = PEM_read_RSA_PUBKEY(file, NULL, NULL, NULL);
    assert(_rsa != NULL);
    fclose(file);
    return (_rsa != NULL) ? YES : NO;
    }
    return NO;
    }

Tested by Instruments, Call "PEM_read_RSA_PUBKEY" method lead to memory leaks caused by "CRYPTO_malloc" (Responsible Frame). I don't know how to solve this problem, please help me , thanks !

Project not compiling

I've downloaded the project but it won't compile.
It throws the following error:
linker command failed with exit code 1 (use -v to see invocation)

any idea on what's going on?

Deploy error : "Failed to load Info.plist from bundle at path ...", fixed with pull request

when deploying the application that contain openssl.framework, following error occurs :

Dec 28 15:49:09 <> com.apple.dt.Xcode[61626] : Error Domain=LaunchServicesError Code=0 "The operation couldn’t be completed. (LaunchServicesError error 0.)" UserInfo=0x7f9e29779800 {Error=PackageInspectionFailed, ErrorDescription=Failed to load Info.plist from bundle at path /Users/<>/Library/Developer/CoreSimulator/Devices/3E6E4AF2-BC06-499D-9628-CD4726B076F8/data/Library/Caches/com.apple.mobile.installd.staging/temp.aoJgbR/extracted/Payload/<>.app/Frameworks/openssl.framework}

already fixed by including Info.plist into the framework

pull request submitted

Xcode (4.3 >) path invalid

The path of Xcode has changed from /Developer to /Applications after the 4.3 update breaking the script at line 67.

Build error - header file not found

Hi!

When trying to build the latest version I get at this line in ViewController.m

include <openssl/opensslv.h>

the error: file not found.

Any ideas?

Stopping the build process without error

When I start the build process with
./build-libssl.sh
it suddenly stops and does not continue till the Done message.
The lib library is empty.
It used to work, but now it is not working anymore

This is my complete console output:
Using openssl-1.0.2e.tar.gz
Building openssl-1.0.2e for iPhoneSimulator 9.1 i386
Please stand by...

Do you have any ideas?

New Building Scripts for OpenSSL FIPS Object Module for iOS >= 7

Hello x2on and team.

Thank you very much for your building script for compiling OpenSSL for iOS >= 7 Devices on Mac OS X El Capitan (Darwin Kernel Version 15.0.0) for iOS >=7 device.

I have built a general OpenSSL module successfully using build-libssl.sh. The built OpenSSL library works well for iOS 9 device.

However, I failed to build OpenSSL FIPS module for iOS >=7 using three different approaches.

(1) I failed to build OpenSSL FIPS module after adding FIPS option to build-libssl.sh.

(Method A) failed

Line 27
CONFIG_OPTIONS=""

with FIPS option

CONFIG_OPTIONS="fips"

(Method B) also failed

Line 165
./Configure no-asm darwin64-x86_64-cc --openssldir="${CURRENTPATH}/bin/${PLATFORM}${SDKVERSION}-${ARCH}.sdk" ${LOCAL_CONFIG_OPTIONS}

with FIPS option

./Configure no-asm darwin64-x86_64-cc fips --openssldir="${CURRENTPATH}/bin/${PLATFORM}${SDKVERSION}-${ARCH}.sdk" ${LOCAL_CONFIG_OPTIONS}

Similar changes are also applied to Lines 167, 171, 173

https://github.com/x2on/OpenSSL-for-iPhone/blob/master/build-libssl.sh

(Method C) also failed

Line 24

VERSION="1.0.2f"

is modified to the source code of OpenSSL FIPS Object Module

VERSION="fips-2.0.11"

(2) I failed to build OpenSSL FIPS module for iOS >= 7 using the old version of building script provided by the OpenSSL website.

http://openssl.com/fips/2.0/platforms/ios/

https://mta.openssl.org/pipermail/openssl-users/2016-February/002940.html

(3) I failed to build OpenSSL FIPS module for iOS >= 7 on using the new version of building script provided by the OpenSSL website.

http://openssl.com/testing/validation-2.0/platforms/ios-7.1/

https://mta.openssl.org/pipermail/openssl-users/2016-February/002955.html

I have used Beyond Compare 4 to check the difference between openssl-1.0.2f/config (or Configure) and openssl-fips-2.0.11/config (or Configure). I do NOT know how to modify the setenv-ios-11.sh to build OpenSSL FIPS module for iOS >=8 under the new Mac OS available from Apple website.

The source code for OpenSSL FIPS Object Module is

https://www.openssl.org/source/openssl-fips-2.0.11.tar.gz

The source code for general OpenSSL Object Module (used by https://github.com/x2on/OpenSSL-for-iPhone/blob/master/build-libssl.sh) is

https://www.openssl.org/source/openssl-1.0.2f.tar.gz

Could you please also develop the building scripts for compiling OpenSSL FIPS Object Module on for iOS >= 7 device based on the following the old version script? Thank you very much.

http://openssl.com/testing/validation-2.0/platforms/ios-7.1/setenv-ios-11.sh

Or

Would you please shed some light on how to modify the above building script setenv-ios-11.sh on Mac OS X El Capitan (Darwin Kernel Version 15.0.0) for iOS >=8 device? Thank you very much.

With best regards,

Winston Hong

missing required architecture x86_64 for Simulator - only in Xcode 5.1

I just tried compiling my app in the new Xcode 5.1 Beta 5 for the iPhone Retina (64-bit) Simulator and got "missing required architecture x86_64" errors.

I am aware of issue #21 and think I have the correct build settings for architectures. Plus, it all works correctly on the 64-bit Simulators in Xcode 5.0.

What's going on here?

Apple TV support

Is this supported on Apple TV? Or we have to add new target for apple tv

tvOS issues

Attempting to use this "out of the box" for a tvOS app.
For the simulator we get the following linker error: "ld: warning: URGENT: building for tvOS simulator, but linking in object file (XXX)) built for iOS. Note: This will be an error in the future."
While for a device we get: "building for tvOS, but linking in object file built for iOS, for architecture arm64"

Attempted to create a tvOS version of build-libssl.sh by changing things like:
SDKVERSION=xcrun -sdk appletvos --show-sdk-version and PLATFORM="AppleTVSimulator" for the simulator and PLATFORM="AppleTVOS" for the device, but I'm running into additional issues.

Fail to build arm7 (symbol(s) not found for architecture armv7)

Hi, I'm having a problem trying to build both the armv7 and armv7s libraries. The i386 builds okay.

My log file looks like this; sorry it's long:

Configuring for iphoneos-cross
    no-ec_nistp_64_gcc_128 [default]  OPENSSL_NO_EC_NISTP_64_GCC_128 (skip dir)
    no-gmp          [default]  OPENSSL_NO_GMP (skip dir)
    no-jpake        [experimental] OPENSSL_NO_JPAKE (skip dir)
    no-krb5         [krb5-flavor not specified] OPENSSL_NO_KRB5
    no-md2          [default]  OPENSSL_NO_MD2 (skip dir)
    no-rc5          [default]  OPENSSL_NO_RC5 (skip dir)
    no-rfc3779      [default]  OPENSSL_NO_RFC3779 (skip dir)
    no-sctp         [default]  OPENSSL_NO_SCTP (skip dir)
    no-shared       [default] 
    no-store        [experimental] OPENSSL_NO_STORE (skip dir)
    no-zlib         [default] 
    no-zlib-dynamic [default] 
IsMK1MF=0
CC            =/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc -arch armv7
CFLAG         =-DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -O3 -isysroot $(CROSS_TOP)/SDKs/$(CROSS_SDK) -fomit-frame-pointer -fno-common
EX_LIBS       =
CPUID_OBJ     =mem_clr.o
BN_ASM        =bn_asm.o
DES_ENC       =des_enc.o fcrypt_b.o
AES_ENC       =aes_core.o aes_cbc.o
BF_ENC        =bf_enc.o
CAST_ENC      =c_enc.o
RC4_ENC       =rc4_enc.o rc4_skey.o
RC5_ENC       =rc5_enc.o
MD5_OBJ_ASM   =
SHA1_OBJ_ASM  =
RMD160_OBJ_ASM=
CMLL_ENC      =camellia.o cmll_misc.o cmll_cbc.o
MODES_OBJ     =
ENGINES_OBJ   =
PROCESSOR     =
RANLIB        =/opt/local/bin/ranlib
ARFLAGS       =
PERL          =/opt/local/bin/perl5
THIRTY_TWO_BIT mode
DES_UNROLL used
BN_LLONG mode
RC4 uses uchar
RC4_CHUNK is unsigned long
BF_PTR used
e_os2.h => include/openssl/e_os2.h
making links in crypto...
crypto.h => ../include/openssl/crypto.h
opensslv.h => ../include/openssl/opensslv.h
opensslconf.h => ../include/openssl/opensslconf.h
ebcdic.h => ../include/openssl/ebcdic.h
symhacks.h => ../include/openssl/symhacks.h
ossl_typ.h => ../include/openssl/ossl_typ.h
making links in crypto/objects...
objects.h => ../../include/openssl/objects.h
obj_mac.h => ../../include/openssl/obj_mac.h
making links in crypto/md4...
md4.h => ../../include/openssl/md4.h
md4test.c => ../../test/md4test.c
md4.c => ../../apps/md4.c
making links in crypto/md5...
md5.h => ../../include/openssl/md5.h
md5test.c => ../../test/md5test.c
making links in crypto/sha...
sha.h => ../../include/openssl/sha.h
shatest.c => ../../test/shatest.c
sha1test.c => ../../test/sha1test.c
sha256t.c => ../../test/sha256t.c
sha512t.c => ../../test/sha512t.c
making links in crypto/mdc2...
mdc2.h => ../../include/openssl/mdc2.h
mdc2test.c => ../../test/mdc2test.c
making links in crypto/hmac...
hmac.h => ../../include/openssl/hmac.h
hmactest.c => ../../test/hmactest.c
making links in crypto/ripemd...
ripemd.h => ../../include/openssl/ripemd.h
rmdtest.c => ../../test/rmdtest.c
making links in crypto/whrlpool...
whrlpool.h => ../../include/openssl/whrlpool.h
wp_test.c => ../../test/wp_test.c
making links in crypto/des...
des.h => ../../include/openssl/des.h
des_old.h => ../../include/openssl/des_old.h
destest.c => ../../test/destest.c
making links in crypto/aes...
aes.h => ../../include/openssl/aes.h
making links in crypto/rc2...
rc2.h => ../../include/openssl/rc2.h
rc2test.c => ../../test/rc2test.c
making links in crypto/rc4...
rc4.h => ../../include/openssl/rc4.h
rc4test.c => ../../test/rc4test.c
making links in crypto/idea...
idea.h => ../../include/openssl/idea.h
ideatest.c => ../../test/ideatest.c
making links in crypto/bf...
blowfish.h => ../../include/openssl/blowfish.h
bftest.c => ../../test/bftest.c
making links in crypto/cast...
cast.h => ../../include/openssl/cast.h
casttest.c => ../../test/casttest.c
making links in crypto/camellia...
camellia.h => ../../include/openssl/camellia.h
making links in crypto/seed...
seed.h => ../../include/openssl/seed.h
making links in crypto/modes...
modes.h => ../../include/openssl/modes.h
making links in crypto/bn...
bn.h => ../../include/openssl/bn.h
bntest.c => ../../test/bntest.c
exptest.c => ../../test/exptest.c
making links in crypto/ec...
ec.h => ../../include/openssl/ec.h
ectest.c => ../../test/ectest.c
making links in crypto/rsa...
rsa.h => ../../include/openssl/rsa.h
rsa_test.c => ../../test/rsa_test.c
making links in crypto/dsa...
dsa.h => ../../include/openssl/dsa.h
dsatest.c => ../../test/dsatest.c
making links in crypto/ecdsa...
ecdsa.h => ../../include/openssl/ecdsa.h
ecdsatest.c => ../../test/ecdsatest.c
making links in crypto/dh...
dh.h => ../../include/openssl/dh.h
dhtest.c => ../../test/dhtest.c
making links in crypto/ecdh...
ecdh.h => ../../include/openssl/ecdh.h
ecdhtest.c => ../../test/ecdhtest.c
making links in crypto/dso...
dso.h => ../../include/openssl/dso.h
making links in crypto/engine...
engine.h => ../../include/openssl/engine.h
enginetest.c => ../../test/enginetest.c
making links in crypto/buffer...
buffer.h => ../../include/openssl/buffer.h
making links in crypto/bio...
bio.h => ../../include/openssl/bio.h
making links in crypto/stack...
stack.h => ../../include/openssl/stack.h
safestack.h => ../../include/openssl/safestack.h
making links in crypto/lhash...
lhash.h => ../../include/openssl/lhash.h
making links in crypto/rand...
rand.h => ../../include/openssl/rand.h
randtest.c => ../../test/randtest.c
making links in crypto/err...
err.h => ../../include/openssl/err.h
making links in crypto/evp...
evp.h => ../../include/openssl/evp.h
evp_test.c => ../../test/evp_test.c
[ ! -f evptests.txt ] || cp evptests.txt ../../test
making links in crypto/asn1...
asn1.h => ../../include/openssl/asn1.h
asn1_mac.h => ../../include/openssl/asn1_mac.h
asn1t.h => ../../include/openssl/asn1t.h
making links in crypto/pem...
pem.h => ../../include/openssl/pem.h
pem2.h => ../../include/openssl/pem2.h
making links in crypto/x509...
x509.h => ../../include/openssl/x509.h
x509_vfy.h => ../../include/openssl/x509_vfy.h
making links in crypto/x509v3...
x509v3.h => ../../include/openssl/x509v3.h
making links in crypto/conf...
conf.h => ../../include/openssl/conf.h
conf_api.h => ../../include/openssl/conf_api.h
making links in crypto/txt_db...
txt_db.h => ../../include/openssl/txt_db.h
making links in crypto/pkcs7...
pkcs7.h => ../../include/openssl/pkcs7.h
making links in crypto/pkcs12...
pkcs12.h => ../../include/openssl/pkcs12.h
making links in crypto/comp...
comp.h => ../../include/openssl/comp.h
making links in crypto/ocsp...
ocsp.h => ../../include/openssl/ocsp.h
making links in crypto/ui...
ui.h => ../../include/openssl/ui.h
ui_compat.h => ../../include/openssl/ui_compat.h
making links in crypto/krb5...
krb5_asn.h => ../../include/openssl/krb5_asn.h
making links in crypto/cms...
cms.h => ../../include/openssl/cms.h
making links in crypto/pqueue...
pqueue.h => ../../include/openssl/pqueue.h
making links in crypto/ts...
ts.h => ../../include/openssl/ts.h
making links in crypto/srp...
srp.h => ../../include/openssl/srp.h
srptest.c => ../../test/srptest.c
making links in crypto/cmac...
cmac.h => ../../include/openssl/cmac.h
making links in ssl...
ssl.h => ../include/openssl/ssl.h
ssl2.h => ../include/openssl/ssl2.h
ssl3.h => ../include/openssl/ssl3.h
ssl23.h => ../include/openssl/ssl23.h
tls1.h => ../include/openssl/tls1.h
dtls1.h => ../include/openssl/dtls1.h
kssl.h => ../include/openssl/kssl.h
srtp.h => ../include/openssl/srtp.h
ssltest.c => ../test/ssltest.c
making links in engines...
making links in engines/ccgost...
make[2]: Nothing to be done for `links'.
making links in apps...
make[1]: Nothing to be done for `links'.
making links in test...
make[1]: Nothing to be done for `links'.
making links in tools...
make[1]: Nothing to be done for `links'.
generating dummy tests (if needed)...
make[1]: Nothing to be done for `generate'.

Configured for iphoneos-cross.
making all in crypto...
( echo "#ifndef MK1MF_BUILD"; \
    echo '  /* auto-generated by crypto/Makefile for crypto/cversion.c */'; \
    echo '  #define CFLAGS "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc -arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk  -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -O3 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk -fomit-frame-pointer -fno-common"'; \
    echo '  #define PLATFORM "iphoneos-cross"'; \
    echo "  #define DATE \"`LC_ALL=C LC_TIME=C date`\""; \
    echo '#endif' ) >buildinf.h
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc -arch armv7 -I. -I.. -I../include  -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk  -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -O3 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk -fomit-frame-pointer -fno-common   -c -o cryptlib.o cryptlib.c
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc -arch armv7 -I. -I.. -I../include  -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk  -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -O3 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk -fomit-frame-pointer -fno-common   -c -o mem.o mem.c
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc -arch armv7 -I. -I.. -I../include  -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk  -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -O3 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk -fomit-frame-pointer -fno-common   -c -o mem_dbg.o mem_dbg.c
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc -arch armv7 -I. -I.. -I../include  -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk  -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -O3 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk -fomit-frame-pointer -fno-common   -c -o cversion.o cversion.c
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc -arch armv7 -I. -I.. -I../include  -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk  -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -O3 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk -fomit-frame-pointer -fno-common   -c -o ex_data.o ex_data.c
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc -arch armv7 -I. -I.. -I../include  -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk  -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -O3 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk -fomit-frame-pointer -fno-common   -c -o cpt_err.o cpt_err.c
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc -arch armv7 -I. -I.. -I../include  -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk  -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -O3 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk -fomit-frame-pointer -fno-common   -c -o ebcdic.o ebcdic.c
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc -arch armv7 -I. -I.. -I../include  -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk  -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -O3 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk -fomit-frame-pointer -fno-common   -c -o uid.o uid.c
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc -arch armv7 -I. -I.. -I../include  -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk  -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -O3 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk -fomit-frame-pointer -fno-common   -c -o o_time.o o_time.c


    {...}


/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc -arch armv7 -DMONOLITH -I.. -I../include  -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk  -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -O3 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk -fomit-frame-pointer -fno-common   -c -o prime.o prime.c
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc -arch armv7 -DMONOLITH -I.. -I../include  -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk  -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -O3 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk -fomit-frame-pointer -fno-common   -c -o ts.o ts.c
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc -arch armv7 -DMONOLITH -I.. -I../include  -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk  -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -O3 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk -fomit-frame-pointer -fno-common   -c -o srp.o srp.c
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc -arch armv7 -DMONOLITH -I.. -I../include  -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk  -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -O3 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk -fomit-frame-pointer -fno-common   -c -o openssl.o openssl.c
rm -f openssl
shlib_target=; if [ -n "" ]; then \
        shlib_target="darwin-shared"; \
    elif [ -n "" ]; then \
      FIPSLD_CC="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc -arch armv7"; CC=/usr/local/ssl/fips-2.0/bin/fipsld; export CC FIPSLD_CC; \
    fi; \
    LIBRARIES="-L.. -lssl  -L.. -lcrypto" ; \
    make -f ../Makefile.shared -e \
        APPNAME=openssl OBJECTS="openssl.o verify.o asn1pars.o req.o dgst.o dh.o dhparam.o enc.o passwd.o gendh.o errstr.o ca.o pkcs7.o crl2p7.o crl.o rsa.o rsautl.o dsa.o dsaparam.o ec.o ecparam.o x509.o genrsa.o gendsa.o genpkey.o s_server.o s_client.o speed.o s_time.o apps.o s_cb.o s_socket.o app_rand.o version.o sess_id.o ciphers.o nseq.o pkcs12.o pkcs8.o pkey.o pkeyparam.o pkeyutl.o spkac.o smime.o cms.o rand.o engine.o ocsp.o prime.o ts.o srp.o" \
        LIBDEPS="-Wl,-search_paths_first $LIBRARIES " \
        link_app.${shlib_target}
( :; LIBDEPS="${LIBDEPS:--Wl,-search_paths_first -L.. -lssl  -L.. -lcrypto }"; LDCMD="${LDCMD:-/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc -arch armv7}"; LDFLAGS="${LDFLAGS:--isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk  -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -O3 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk -fomit-frame-pointer -fno-common}"; LIBPATH=`for x in $LIBDEPS; do echo $x; done | sed -e 's/^ *-L//;t' -e d | uniq`; LIBPATH=`echo $LIBPATH | sed -e 's/ /:/g'`; LD_LIBRARY_PATH=$LIBPATH:$LD_LIBRARY_PATH ${LDCMD} ${LDFLAGS} -o ${APPNAME:=openssl} openssl.o verify.o asn1pars.o req.o dgst.o dh.o dhparam.o enc.o passwd.o gendh.o errstr.o ca.o pkcs7.o crl2p7.o crl.o rsa.o rsautl.o dsa.o dsaparam.o ec.o ecparam.o x509.o genrsa.o gendsa.o genpkey.o s_server.o s_client.o speed.o s_time.o apps.o s_cb.o s_socket.o app_rand.o version.o sess_id.o ciphers.o nseq.o pkcs12.o pkcs8.o pkey.o pkeyparam.o pkeyutl.o spkac.o smime.o cms.o rand.o engine.o ocsp.o prime.o ts.o srp.o ${LIBDEPS} )
Undefined symbols for architecture armv7:
  "_accept$UNIX2003", referenced from:
      _do_server in s_socket.o
      _BIO_accept in libcrypto.a(b_sock.o)
  "_bind$UNIX2003", referenced from:
      _do_server in s_socket.o
      _BIO_get_accept_socket in libcrypto.a(b_sock.o)
  "_chmod$UNIX2003", referenced from:
      _RAND_write_file in libcrypto.a(randfile.o)
  "_close$UNIX2003", referenced from:
      _sv_body in s_server.o
      _s_client_main in s_client.o
      _speed_main in speed.o
      _s_time_main in s_time.o
      _init_client in s_socket.o
      _do_server in s_socket.o
      _acpt_ctrl in libcrypto.a(bss_acpt.o)
      ...
  "_closedir$UNIX2003", referenced from:
      _OPENSSL_DIR_end in libcrypto.a(o_dir.o)
  "_connect$UNIX2003", referenced from:
      _init_client in s_socket.o
      _conn_state in libcrypto.a(bss_conn.o)
      _BIO_get_accept_socket in libcrypto.a(b_sock.o)
      _RAND_query_egd_bytes in libcrypto.a(rand_egd.o)
  "_fdopen$UNIX2003", referenced from:
      _speed_main in speed.o
  "_fopen$UNIX2003", referenced from:
      _enc_main in enc.o
      _BIO_new_file in libcrypto.a(bss_file.o)
      _file_ctrl in libcrypto.a(bss_file.o)
      _RAND_load_file in libcrypto.a(randfile.o)
      _RAND_write_file in libcrypto.a(randfile.o)
      _open_console in libcrypto.a(ui_openssl.o)
  "_fputs$UNIX2003", referenced from:
      _main in openssl.o
      _BIO_debug_callback in libcrypto.a(bio_cb.o)
      _write_string in libcrypto.a(ui_openssl.o)
      _read_string in libcrypto.a(ui_openssl.o)
  "_fstat$INODE64", referenced from:
      _RAND_poll in libcrypto.a(rand_unix.o)
  "_fwrite$UNIX2003", referenced from:
      _main in openssl.o
      _check in verify.o
      _req_main in req.o
      _dsa_main in dsa.o
      _speed_main in speed.o
      _s_time_main in s_time.o
      _load_index in apps.o
      ...
  "_getsockname$UNIX2003", referenced from:
      _s_client_main in s_client.o
  "_listen$UNIX2003", referenced from:
      _do_server in s_socket.o
      _BIO_get_accept_socket in libcrypto.a(b_sock.o)
  "_open$UNIX2003", referenced from:
      _RAND_poll in libcrypto.a(rand_unix.o)
  "_opendir$INODE64$UNIX2003", referenced from:
      _OPENSSL_DIR_read in libcrypto.a(o_dir.o)
  "_read$UNIX2003", referenced from:
      _raw_read_stdin in apps.o
      _conn_read in libcrypto.a(bss_conn.o)
      _fd_read in libcrypto.a(bss_fd.o)
      _fd_gets in libcrypto.a(bss_fd.o)
      _sock_read in libcrypto.a(bss_sock.o)
      _RAND_query_egd_bytes in libcrypto.a(rand_egd.o)
      _RAND_poll in libcrypto.a(rand_unix.o)
      ...
  "_readdir$INODE64", referenced from:
      _OPENSSL_DIR_read in libcrypto.a(o_dir.o)
  "_recvfrom$UNIX2003", referenced from:
      _dgram_read in libcrypto.a(bss_dgram.o)
  "_select$UNIX2003", referenced from:
      _sv_body in s_server.o
      _s_client_main in s_client.o
      _doConnection in s_time.o
      _process_responder in ocsp.o
      _RAND_poll in libcrypto.a(rand_unix.o)
  "_sendto$UNIX2003", referenced from:
      _dgram_write in libcrypto.a(bss_dgram.o)
  "_sleep$UNIX2003", referenced from:
      _www_body in s_server.o
  "_stat$INODE64", referenced from:
      _app_isdir in apps.o
      _RAND_load_file in libcrypto.a(randfile.o)
      _RAND_write_file in libcrypto.a(randfile.o)
      _get_cert_by_subject in libcrypto.a(by_dir.o)
  "_strerror$UNIX2003", referenced from:
      _ERR_load_ERR_strings in libcrypto.a(err.o)
  "_write$UNIX2003", referenced from:
      _raw_write_stdout in apps.o
      _conn_write in libcrypto.a(bss_conn.o)
      _dgram_write in libcrypto.a(bss_dgram.o)
      _fd_write in libcrypto.a(bss_fd.o)
      _fd_puts in libcrypto.a(bss_fd.o)
      _sock_write in libcrypto.a(bss_sock.o)
      _sock_puts in libcrypto.a(bss_sock.o)
      ...
ld: symbol(s) not found for architecture armv7
collect2: ld returned 1 exit status
make[2]: *** [link_app.] Error 1
make[1]: *** [openssl] Error 2
make: *** [build_apps] Error 1

The important part is right there at the end, though. For some reason a bunch of the files are failing to build in the right architecture, it would seem. Is this something wrong with my system? I recently upgraded to Mountain Lion and installed Xcode 4.6. I came straight from Snow Leopard without ever installing Lion. I've installed the command-line tools. I've installed cmake.

I used to be able to build openssl for armv6 and armv7 when I was on Snow Leopard.
I had followed this guide:
http://blog.laurent.etiemble.com/index.php?post/2010/05/06/Building-OpenSSL-for-iPhone

However, now on Mountain Lion, both the guide and your Xcode Project fail to finish.

This person seems to have the same problem as me,
https://discussions.apple.com/thread/4963538?start=0&tstart=0
and they were guided towards your repo. (Which is how I ended up here as well.) Any advice would be much appreciated! Thanks!

Anyway, thanks for your help (This has been driving me nuts!)

Xcode 6 iOS SDK no longer contain version number

Previously the iOS SDKs had their version number in their path. With Xcode 6 they are all in one location.

So
/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk
is now:
/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk

A quick hack I used to fix it for me is excluding the version in CROSS_SDK depending on if it's the simulator or not.

if [[ "${ARCH}" == "i386" || "${ARCH}" == "x86_64" ]];
then
PLATFORM="iPhoneSimulator"
export CROSS_SDK="${PLATFORM}${SDKVERSION}.sdk"
else
sed -ie "s!static volatile sig_atomic_t intr_signal;!static volatile intr_signal;!" "crypto/ui/ui_openssl.c"
PLATFORM="iPhoneOS"
export CROSS_SDK="${PLATFORM}.sdk"
fi

I get the following error when building the libs

ar: creating archive ../libcrypto.a
/usr/bin/ranlib: object: ../libcrypto.a(cryptlib.o) malformed object (unknown load command 1)
ar: internal ranlib command failed
make[1]: *** [../libcrypto.a] Error 1
make: *** [build_crypto] Error 1

this is during arm64 build phase

Not able to build the library

Hi,

I want to use this OpenSSL library to perform the following operations

  1. Generate KeyPair
  2. Encrypt using PrivateKey
  3. Decrypt using PrivateKey

I have downloaded the Code and tried to build the OpenSSL libraries using the below command:
./build-libssl.sh

Below is the console result i.e. it stops after 'Please stand by...' stmt.
lion:OpenSSL-for-iPhone-master ssgadmin$ ./build-libssl.sh
Using openssl-1.0.1e.tar.gz
Building openssl-1.0.1e for iPhoneSimulator 6.1 i386
Please stand by...
lion:OpenSSL-for-iPhone-master ssgadmin$

I am using this lib for iOS SDK 6.1 and I want to support iPhone3G also i.e. armv6 architecture.

Please help

CocoaPod Install problems

OSX 10.11.1
Xcode 7.1.1

I've been using openssl as a dependency of RMStore for quite a while. I hadn't updated pods for a while and so now when I try it stops on OpenSSL with the output below, exiting to the command line. This happens whether I let RMStore trigger the dependency or manually add the pod like: pod 'OpenSSL-for-iOS', '1.0.2.d.1'

Thanks for any advice you have.


Installing OpenSSL 1.0.205 (was 1.0.203)
[!] /bin/bash -c 
set -e
VERSION="1.0.2e"
SDKVERSION=`xcrun --sdk iphoneos --show-sdk-version 2> /dev/null`
MIN_SDK_VERSION_FLAG="-miphoneos-version-min=7.0"

BASEPATH="${PWD}"
CURRENTPATH="/tmp/openssl"
ARCHS="i386 x86_64 armv7 armv7s arm64"
DEVELOPER=`xcode-select -print-path`

mkdir -p "${CURRENTPATH}"
mkdir -p "${CURRENTPATH}/bin"

cp "file.tgz" "${CURRENTPATH}/file.tgz"
cd "${CURRENTPATH}"
tar -xzf file.tgz
cd "openssl-${VERSION}"

for ARCH in ${ARCHS}
do
  CONFIGURE_FOR="iphoneos-cross"

  if [ "${ARCH}" == "i386" ] || [ "${ARCH}" == "x86_64" ] ;
  then
    PLATFORM="iPhoneSimulator"
    if [ "${ARCH}" == "x86_64" ] ;
    then
      CONFIGURE_FOR="darwin64-x86_64-cc"
    fi
  else
    sed -ie "s!static volatile sig_atomic_t intr_signal;!static volatile intr_signal;!" "crypto/ui/ui_openssl.c"
    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..."

  export CC="${DEVELOPER}/usr/bin/gcc -arch ${ARCH} ${MIN_SDK_VERSION_FLAG}"
  mkdir -p "${CURRENTPATH}/bin/${PLATFORM}${SDKVERSION}-${ARCH}.sdk"
  LOG="${CURRENTPATH}/bin/${PLATFORM}${SDKVERSION}-${ARCH}.sdk/build-openssl-${VERSION}.log"

  LIPO_LIBSSL="${LIPO_LIBSSL} ${CURRENTPATH}/bin/${PLATFORM}${SDKVERSION}-${ARCH}.sdk/lib/libssl.a"
  LIPO_LIBCRYPTO="${LIPO_LIBCRYPTO} ${CURRENTPATH}/bin/${PLATFORM}${SDKVERSION}-${ARCH}.sdk/lib/libcrypto.a"

  ./Configure ${CONFIGURE_FOR} --openssldir="${CURRENTPATH}/bin/${PLATFORM}${SDKVERSION}-${ARCH}.sdk" > "${LOG}" 2>&1
  sed -ie "s!^CFLAG=!CFLAG=-isysroot ${CROSS_TOP}/SDKs/${CROSS_SDK} !" "Makefile"

  make >> "${LOG}" 2>&1
  make all install_sw >> "${LOG}" 2>&1
  make clean >> "${LOG}" 2>&1
done


echo "Build library..."
rm -rf "${BASEPATH}/lib/"
mkdir -p "${BASEPATH}/lib/"
lipo -create ${LIPO_LIBSSL}    -output "${BASEPATH}/lib/libssl.a"
lipo -create ${LIPO_LIBCRYPTO} -output "${BASEPATH}/lib/libcrypto.a"

echo "Copying headers..."
rm -rf "${BASEPATH}/opensslIncludes/"
mkdir -p "${BASEPATH}/opensslIncludes/"
cp -RL "${CURRENTPATH}/openssl-${VERSION}/include/openssl" "${BASEPATH}/opensslIncludes/"

cd "${BASEPATH}"
echo "Building done."

echo "Cleaning up..."
rm -rf "${CURRENTPATH}"
echo "Done."

Building openssl-1.0.2e for iPhoneSimulator 9.1 i386
Please stand by...

iOS 9 and XCode 7

I know that both iOS 9 and XCode 7 are in beta, but do you have an estimate of when OpenSSL-for-iPhone will be updated? I have tried to current version, but not suprisingly XCode fails to find the OpenSSL header files.

Create dynamic framework fails

➜ OpenSSL-for-iPhone git:(master) ./create-openssl-framework.sh dynamic Creating openssl.framework ld: warning: -macosx_version_min not specified, assuming 10.9 ld: in lib/libcrypto.a(cryptlib.o), building for OSX, but linking in object file built for iOS, for architecture i386 fatal error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: internal link edit command failed Created openssl.framework

The example app will crash on loading view in iOS 8

Reproduce:

  1. run the script to build the library
  2. open the project and choose iOS 8.x simulator or connect to a real iOS 8.x device
  3. Launch the App and it will crash immediately when try to display the viewController's view

Reason:
Setting values into the subviews like textField in the viewDidLoad will lead to the error "unexpectedly found nil while unwrapping an Optional value". This is because the textField is nil.

Possible Solution:
In AppDelegate, ViewController initialization doesn't use the nib.
I add a line of code:
let viewController = ViewController(nibName: "ViewController", bundle: nil)
will solve the problem

Question about CSPRNG implementation of OpenSSL

Hi,

Do you know if OpenSSL for iPhone uses a good CSPRNG while creating RSA key pairs?

I just want to make sure that Dual Elliptic Curve Deterministic Random Bit Generation is not used.

Cheers!
Tony

Can't build (conflicting types for ‘CRYPTO_memcmp’)

I've cloned the repository and am trying to build using the script, but I get an error:

$ ./build-libssl.sh 
Using openssl-1.0.1f.tar.gz
Building openssl-1.0.1f for iPhoneSimulator 7.0 i386
Please stand by...
Problem while make - Please check /.../OpenSSL-for-iPhone/bin/iPhoneSimulator7.0-i386.sdk/build-openssl-1.0.1f.log

These are the contents of the log:

Configuring for iphoneos-cross
    no-ec_nistp_64_gcc_128 [default]  OPENSSL_NO_EC_NISTP_64_GCC_128 (skip dir)
    no-gmp          [default]  OPENSSL_NO_GMP (skip dir)
    no-jpake        [experimental] OPENSSL_NO_JPAKE (skip dir)
    no-krb5         [krb5-flavor not specified] OPENSSL_NO_KRB5
    no-md2          [default]  OPENSSL_NO_MD2 (skip dir)
    no-rc5          [default]  OPENSSL_NO_RC5 (skip dir)
    no-rfc3779      [default]  OPENSSL_NO_RFC3779 (skip dir)
    no-sctp         [default]  OPENSSL_NO_SCTP (skip dir)
    no-shared       [default] 
    no-store        [experimental] OPENSSL_NO_STORE (skip dir)
    no-zlib         [default] 
    no-zlib-dynamic [default] 
IsMK1MF=0
CC            =/Applications/Xcode.app/Contents/Developer/usr/bin/gcc -arch i386
CFLAG         =-DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -O3 -isysroot $(CROSS_TOP)/SDKs/$(CROSS_SDK) -fomit-frame-pointer -fno-common
EX_LIBS       =
CPUID_OBJ     =mem_clr.o
BN_ASM        =bn_asm.o
DES_ENC       =des_enc.o fcrypt_b.o
AES_ENC       =aes_core.o aes_cbc.o
BF_ENC        =bf_enc.o
CAST_ENC      =c_enc.o
RC4_ENC       =rc4_enc.o rc4_skey.o
RC5_ENC       =rc5_enc.o
MD5_OBJ_ASM   =
SHA1_OBJ_ASM  =
RMD160_OBJ_ASM=
CMLL_ENC      =camellia.o cmll_misc.o cmll_cbc.o
MODES_OBJ     =
ENGINES_OBJ   =
PROCESSOR     =
RANLIB        =/usr/bin/ranlib
ARFLAGS       =
PERL          =/usr/bin/perl
THIRTY_TWO_BIT mode
DES_UNROLL used
BN_LLONG mode
RC4 uses uchar
RC4_CHUNK is unsigned long
BF_PTR used
e_os2.h => include/openssl/e_os2.h
making links in crypto...
crypto.h => ../include/openssl/crypto.h
opensslv.h => ../include/openssl/opensslv.h
opensslconf.h => ../include/openssl/opensslconf.h
ebcdic.h => ../include/openssl/ebcdic.h
symhacks.h => ../include/openssl/symhacks.h
ossl_typ.h => ../include/openssl/ossl_typ.h
making links in crypto/objects...
objects.h => ../../include/openssl/objects.h
obj_mac.h => ../../include/openssl/obj_mac.h
making links in crypto/md4...
md4.h => ../../include/openssl/md4.h
md4test.c => ../../test/md4test.c
md4.c => ../../apps/md4.c
making links in crypto/md5...
md5.h => ../../include/openssl/md5.h
md5test.c => ../../test/md5test.c
making links in crypto/sha...
sha.h => ../../include/openssl/sha.h
shatest.c => ../../test/shatest.c
sha1test.c => ../../test/sha1test.c
sha256t.c => ../../test/sha256t.c
sha512t.c => ../../test/sha512t.c
making links in crypto/mdc2...
mdc2.h => ../../include/openssl/mdc2.h
mdc2test.c => ../../test/mdc2test.c
making links in crypto/hmac...
hmac.h => ../../include/openssl/hmac.h
hmactest.c => ../../test/hmactest.c
making links in crypto/ripemd...
ripemd.h => ../../include/openssl/ripemd.h
rmdtest.c => ../../test/rmdtest.c
making links in crypto/whrlpool...
whrlpool.h => ../../include/openssl/whrlpool.h
wp_test.c => ../../test/wp_test.c
making links in crypto/des...
des.h => ../../include/openssl/des.h
des_old.h => ../../include/openssl/des_old.h
destest.c => ../../test/destest.c
making links in crypto/aes...
aes.h => ../../include/openssl/aes.h
making links in crypto/rc2...
rc2.h => ../../include/openssl/rc2.h
rc2test.c => ../../test/rc2test.c
making links in crypto/rc4...
rc4.h => ../../include/openssl/rc4.h
rc4test.c => ../../test/rc4test.c
making links in crypto/idea...
idea.h => ../../include/openssl/idea.h
ideatest.c => ../../test/ideatest.c
making links in crypto/bf...
blowfish.h => ../../include/openssl/blowfish.h
bftest.c => ../../test/bftest.c
making links in crypto/cast...
cast.h => ../../include/openssl/cast.h
casttest.c => ../../test/casttest.c
making links in crypto/camellia...
camellia.h => ../../include/openssl/camellia.h
making links in crypto/seed...
seed.h => ../../include/openssl/seed.h
making links in crypto/modes...
modes.h => ../../include/openssl/modes.h
making links in crypto/bn...
bn.h => ../../include/openssl/bn.h
bntest.c => ../../test/bntest.c
exptest.c => ../../test/exptest.c
making links in crypto/ec...
ec.h => ../../include/openssl/ec.h
ectest.c => ../../test/ectest.c
making links in crypto/rsa...
rsa.h => ../../include/openssl/rsa.h
rsa_test.c => ../../test/rsa_test.c
making links in crypto/dsa...
dsa.h => ../../include/openssl/dsa.h
dsatest.c => ../../test/dsatest.c
making links in crypto/ecdsa...
ecdsa.h => ../../include/openssl/ecdsa.h
ecdsatest.c => ../../test/ecdsatest.c
making links in crypto/dh...
dh.h => ../../include/openssl/dh.h
dhtest.c => ../../test/dhtest.c
making links in crypto/ecdh...
ecdh.h => ../../include/openssl/ecdh.h
ecdhtest.c => ../../test/ecdhtest.c
making links in crypto/dso...
dso.h => ../../include/openssl/dso.h
making links in crypto/engine...
engine.h => ../../include/openssl/engine.h
enginetest.c => ../../test/enginetest.c
making links in crypto/buffer...
buffer.h => ../../include/openssl/buffer.h
making links in crypto/bio...
bio.h => ../../include/openssl/bio.h
making links in crypto/stack...
stack.h => ../../include/openssl/stack.h
safestack.h => ../../include/openssl/safestack.h
making links in crypto/lhash...
lhash.h => ../../include/openssl/lhash.h
making links in crypto/rand...
rand.h => ../../include/openssl/rand.h
randtest.c => ../../test/randtest.c
making links in crypto/err...
err.h => ../../include/openssl/err.h
making links in crypto/evp...
evp.h => ../../include/openssl/evp.h
evp_test.c => ../../test/evp_test.c
evptests.txt -> ../../test/evptests.txt
making links in crypto/asn1...
asn1.h => ../../include/openssl/asn1.h
asn1_mac.h => ../../include/openssl/asn1_mac.h
asn1t.h => ../../include/openssl/asn1t.h
making links in crypto/pem...
pem.h => ../../include/openssl/pem.h
pem2.h => ../../include/openssl/pem2.h
making links in crypto/x509...
x509.h => ../../include/openssl/x509.h
x509_vfy.h => ../../include/openssl/x509_vfy.h
making links in crypto/x509v3...
x509v3.h => ../../include/openssl/x509v3.h
making links in crypto/conf...
conf.h => ../../include/openssl/conf.h
conf_api.h => ../../include/openssl/conf_api.h
making links in crypto/txt_db...
txt_db.h => ../../include/openssl/txt_db.h
making links in crypto/pkcs7...
pkcs7.h => ../../include/openssl/pkcs7.h
making links in crypto/pkcs12...
pkcs12.h => ../../include/openssl/pkcs12.h
making links in crypto/comp...
comp.h => ../../include/openssl/comp.h
making links in crypto/ocsp...
ocsp.h => ../../include/openssl/ocsp.h
making links in crypto/ui...
ui.h => ../../include/openssl/ui.h
ui_compat.h => ../../include/openssl/ui_compat.h
making links in crypto/krb5...
krb5_asn.h => ../../include/openssl/krb5_asn.h
making links in crypto/cms...
cms.h => ../../include/openssl/cms.h
making links in crypto/pqueue...
pqueue.h => ../../include/openssl/pqueue.h
making links in crypto/ts...
ts.h => ../../include/openssl/ts.h
making links in crypto/srp...
srp.h => ../../include/openssl/srp.h
srptest.c => ../../test/srptest.c
making links in crypto/cmac...
cmac.h => ../../include/openssl/cmac.h
making links in ssl...
ssl.h => ../include/openssl/ssl.h
ssl2.h => ../include/openssl/ssl2.h
ssl3.h => ../include/openssl/ssl3.h
ssl23.h => ../include/openssl/ssl23.h
tls1.h => ../include/openssl/tls1.h
dtls1.h => ../include/openssl/dtls1.h
kssl.h => ../include/openssl/kssl.h
srtp.h => ../include/openssl/srtp.h
ssltest.c => ../test/ssltest.c
making links in engines...
making links in engines/ccgost...
make[2]: Nothing to be done for `links'.
making links in apps...
make[1]: Nothing to be done for `links'.
making links in test...
make[1]: Nothing to be done for `links'.
making links in tools...
make[1]: Nothing to be done for `links'.
generating dummy tests (if needed)...
make[1]: Nothing to be done for `generate'.

Configured for iphoneos-cross.
making all in crypto...
( echo "#ifndef MK1MF_BUILD"; \
    echo '  /* auto-generated by crypto/Makefile for crypto/cversion.c */'; \
    echo '  #define CFLAGS "/Applications/Xcode.app/Contents/Developer/usr/bin/gcc -arch i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.0.sdk -miphoneos-version-min=7.0  -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -O3 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.0.sdk -fomit-frame-pointer -fno-common"'; \
    echo '  #define PLATFORM "iphoneos-cross"'; \
    echo "  #define DATE \"`LC_ALL=C LC_TIME=C date`\""; \
    echo '#endif' ) >buildinf.h
/Applications/Xcode.app/Contents/Developer/usr/bin/gcc -arch i386 -I. -I.. -I../include  -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.0.sdk -miphoneos-version-min=7.0  -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -O3 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.0.sdk -fomit-frame-pointer -fno-common   -c -o cryptlib.o cryptlib.c
In file included from cryptlib.c:117:
cryptlib.h:62:20: error: stdlib.h: No such file or directory
cryptlib.h:63:20: error: string.h: No such file or directory
In file included from cryptlib.h:65,
                 from cryptlib.c:117:
../e_os.h:444:30: error: unistd.h: No such file or directory
../e_os.h:449:29: error: sys/types.h: No such file or directory
In file included from cryptlib.h:72,
                 from cryptlib.c:117:
../include/openssl/crypto.h:125:19: error: stdio.h: No such file or directory
In file included from cryptlib.h:72,
                 from cryptlib.c:117:
../include/openssl/crypto.h:175: error: expected specifier-qualifier-list before ‘size_t’
../include/openssl/crypto.h:465: warning: parameter names (without types) in function declaration
../include/openssl/crypto.h:465: error: expected declaration specifiers or ‘...’ before ‘size_t’
../include/openssl/crypto.h:466: warning: parameter names (without types) in function declaration
../include/openssl/crypto.h:467: error: expected ‘)’ before ‘const’
../include/openssl/crypto.h:468: error: expected ‘;’, ‘,’ or ‘)’ before ‘void’
../include/openssl/crypto.h:470: error: expected ‘)’ before ‘const’
../include/openssl/crypto.h:471: error: expected ‘;’, ‘,’ or ‘)’ before ‘void’
../include/openssl/crypto.h:477: warning: parameter names (without types) in function declaration
../include/openssl/crypto.h:477: error: expected declaration specifiers or ‘...’ before ‘size_t’
../include/openssl/crypto.h:478: warning: parameter names (without types) in function declaration
../include/openssl/crypto.h:479: error: expected ‘)’ before ‘const’
../include/openssl/crypto.h:480: error: expected ‘;’, ‘,’ or ‘)’ before ‘void’
../include/openssl/crypto.h:482: error: expected ‘)’ before ‘const’
../include/openssl/crypto.h:483: error: expected ‘;’, ‘,’ or ‘)’ before ‘void’
../include/openssl/crypto.h:500: error: expected declaration specifiers or ‘...’ before ‘size_t’
../include/openssl/crypto.h:535: error: expected ‘)’ before ‘*’ token
../include/openssl/crypto.h:582: error: expected declaration specifiers or ‘...’ before ‘size_t’
In file included from cryptlib.h:74,
                 from cryptlib.c:117:
../include/openssl/bio.h:634: error: expected ‘)’ before ‘*’ token
../include/openssl/bio.h:706: error: expected ‘)’ before ‘*’ token
../include/openssl/bio.h:707: error: expected ‘)’ before ‘*’ token
In file included from ../include/openssl/err.h:127,
                 from cryptlib.h:75,
                 from cryptlib.c:117:
../include/openssl/lhash.h:186: error: expected declaration specifiers or ‘...’ before ‘FILE’
../include/openssl/lhash.h:187: error: expected declaration specifiers or ‘...’ before ‘FILE’
../include/openssl/lhash.h:188: error: expected declaration specifiers or ‘...’ before ‘FILE’
In file included from cryptlib.h:75,
                 from cryptlib.c:117:
../include/openssl/err.h:140:19: error: errno.h: No such file or directory
In file included from cryptlib.h:75,
                 from cryptlib.c:117:
../include/openssl/err.h:343: error: expected ‘)’ before ‘*’ token
cryptlib.c: In function ‘CRYPTO_THREADID_set_numeric’:
cryptlib.c:430: warning: incompatible implicit declaration of built-in function ‘memset’
cryptlib.c: In function ‘CRYPTO_THREADID_set_pointer’:
cryptlib.c:441: warning: incompatible implicit declaration of built-in function ‘memset’
cryptlib.c: In function ‘CRYPTO_THREADID_current’:
cryptlib.c:507: error: ‘errno’ undeclared (first use in this function)
cryptlib.c:507: error: (Each undeclared identifier is reported only once
cryptlib.c:507: error: for each function it appears in.)
cryptlib.c: In function ‘CRYPTO_THREADID_cpy’:
cryptlib.c:518: warning: incompatible implicit declaration of built-in function ‘memcpy’
cryptlib.c: In function ‘OPENSSL_showfatal’:
cryptlib.c:907: error: ‘stderr’ undeclared (first use in this function)
cryptlib.c: In function ‘OpenSSLDie’:
cryptlib.c:919: warning: incompatible implicit declaration of built-in function ‘abort’
cryptlib.c: In function ‘OPENSSL_stderr’:
cryptlib.c:927: error: ‘stderr’ undeclared (first use in this function)
cryptlib.c: At top level:
cryptlib.c:930: error: conflicting types for ‘CRYPTO_memcmp’
../include/openssl/crypto.h:582: error: previous declaration of ‘CRYPTO_memcmp’ was here
make[1]: *** [cryptlib.o] Error 1
make: *** [build_crypto] Error 1

MD5 output not same as openssl on Mac

In the sample app, the MD5 of text: abc shows

900150983cd24fb0d6963f7d28e17f72

In Mac bash: echo "abc" | openssl dgst -md5 shows

0bee89b07a248e27c83fc3d5951213c1

A kind request about RSA keys

Hi,

Is it possible for you to post a simple example which generates an RSA key pair (2048 bits, e=65537) and print it to screen?

I would very much appreciate it,

Best regards,
Tony

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.