iOS sqlcipher: configure openssl with option -no-md5

427 views
Skip to first unread message

Andrej van der Zee

unread,
Jun 25, 2012, 10:35:54 PM6/25/12
to sqlc...@googlegroups.com
Hi,

I am using the sqlcipher project for iOS which works great! Though, I
have a duplicate symbol _MD5 with another lib. Now I would like to
compile openssl without MD5. There is a configure option in openssl
"./config -no-md5" that does this nicely. Now I am not sure where I
can/should put this option in my xCode4 project.

Thank you!
Andrej

Stephen Lombardo

unread,
Jun 25, 2012, 11:43:50 PM6/25/12
to sqlc...@googlegroups.com
Hi Andrej,

You can apply this change in your copy of the openssl-xcode project. You should just need to open your project, navigate to the openssl-xcode sub project, crypto target, build phases tab, and edit the run script. Just add -no-md5 to the OPENSSL_OPTIONS variable.

Thanks!

Cheers,
Stephen

Andrej van der Zee

unread,
Jun 26, 2012, 12:00:42 AM6/26/12
to sqlc...@googlegroups.com
Hi Stephen,

Thanks for your reply.

> You can apply this change in your copy of the openssl-xcode project. You
> should just need to open your project, navigate to the openssl-xcode sub
> project, crypto target, build phases tab, and edit the run script. Just add
> -no-md5 to the OPENSSL_OPTIONS variable.

I was looking for a build script, now I found it, thanks :) Fairly new to xCode.

After adding the no-md5 option the ssl-lib fails to build (see below).
Though, when I press build one more time after the build error, the
build succeeds. Should I add another flag somewhere, or is it safe to
ignore?

Cheers,
Andrej

making all in ssl...
cc -I../crypto -I.. -I../include -D_DARWIN_C_SOURCE
-UOPENSSL_BN_ASM_PART_WORDS -arch armv7 -isysroot
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk
-c -o s2_meth.o s2_meth.c
cc -I../crypto -I.. -I../include -D_DARWIN_C_SOURCE
-UOPENSSL_BN_ASM_PART_WORDS -arch armv7 -isysroot
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk
-c -o s2_srvr.o s2_srvr.c
cc -I../crypto -I.. -I../include -D_DARWIN_C_SOURCE
-UOPENSSL_BN_ASM_PART_WORDS -arch armv7 -isysroot
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk
-c -o s2_clnt.o s2_clnt.c
cc -I../crypto -I.. -I../include -D_DARWIN_C_SOURCE
-UOPENSSL_BN_ASM_PART_WORDS -arch armv7 -isysroot
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk
-c -o s2_lib.o s2_lib.c
cc -I../crypto -I.. -I../include -D_DARWIN_C_SOURCE
-UOPENSSL_BN_ASM_PART_WORDS -arch armv7 -isysroot
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk
-c -o s2_enc.o s2_enc.c
cc -I../crypto -I.. -I../include -D_DARWIN_C_SOURCE
-UOPENSSL_BN_ASM_PART_WORDS -arch armv7 -isysroot
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk
-c -o s2_pkt.o s2_pkt.c
cc -I../crypto -I.. -I../include -D_DARWIN_C_SOURCE
-UOPENSSL_BN_ASM_PART_WORDS -arch armv7 -isysroot
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk
-c -o s3_meth.o s3_meth.c
cc -I../crypto -I.. -I../include -D_DARWIN_C_SOURCE
-UOPENSSL_BN_ASM_PART_WORDS -arch armv7 -isysroot
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk
-c -o s3_srvr.o s3_srvr.c
In file included from s3_srvr.c:170:
../include/openssl/md5.h:70:2: error: #error MD5 is disabled.
s3_srvr.c: In function 'ssl3_get_cert_verify':
s3_srvr.c:2993: warning: assignment makes pointer from integer without a cast
make[1]: *** [s3_srvr.o] Error 1
make: *** [build_ssl] Error 1
+ echo '***** copying intermediate libraries to
/Users/andrej/Library/Developer/Xcode/DerivedData/WordBoxer-bfulhixjjeffizcugftxfaxfwwpn/Build/Intermediates/openssl.build/Debug-iphoneos/armv7-*.a
*****'
***** copying intermediate libraries to
/Users/andrej/Library/Developer/Xcode/DerivedData/WordBoxer-bfulhixjjeffizcugftxfaxfwwpn/Build/Intermediates/openssl.build/Debug-iphoneos/armv7-*.a
*****
+ cp libcrypto.a
/Users/andrej/Library/Developer/Xcode/DerivedData/WordBoxer-bfulhixjjeffizcugftxfaxfwwpn/Build/Intermediates/openssl.build/Debug-iphoneos/armv7-libcrypto.a
+ cp libssl.a /Users/andrej/Library/Developer/Xcode/DerivedData/WordBoxer-bfulhixjjeffizcugftxfaxfwwpn/Build/Intermediates/openssl.build/Debug-iphoneos/armv7-libssl.a
cp: libssl.a: No such file or directory
+ echo '***** creating universallibraries in
/Users/andrej/Library/Developer/Xcode/DerivedData/WordBoxer-bfulhixjjeffizcugftxfaxfwwpn/Build/Products/Debug-iphoneos
*****'
***** creating universallibraries in
/Users/andrej/Library/Developer/Xcode/DerivedData/WordBoxer-bfulhixjjeffizcugftxfaxfwwpn/Build/Products/Debug-iphoneos
*****
+ mkdir -p /Users/andrej/Library/Developer/Xcode/DerivedData/WordBoxer-bfulhixjjeffizcugftxfaxfwwpn/Build/Products/Debug-iphoneos
+ lipo -create /Users/andrej/Library/Developer/Xcode/DerivedData/WordBoxer-bfulhixjjeffizcugftxfaxfwwpn/Build/Intermediates/openssl.build/Debug-iphoneos/armv7-libcrypto.a
-output /Users/andrej/Library/Developer/Xcode/DerivedData/WordBoxer-bfulhixjjeffizcugftxfaxfwwpn/Build/Products/Debug-iphoneos/libcrypto.a
+ lipo -create '/Users/andrej/Library/Developer/Xcode/DerivedData/WordBoxer-bfulhixjjeffizcugftxfaxfwwpn/Build/Intermediates/openssl.build/Debug-iphoneos/*-libssl.a'
-output /Users/andrej/Library/Developer/Xcode/DerivedData/WordBoxer-bfulhixjjeffizcugftxfaxfwwpn/Build/Products/Debug-iphoneos/libssl.a
lipo: can't open input file:
/Users/andrej/Library/Developer/Xcode/DerivedData/WordBoxer-bfulhixjjeffizcugftxfaxfwwpn/Build/Intermediates/openssl.build/Debug-iphoneos/*-libssl.a
(No such file or directory)
+ echo '***** removing temporary files from
/Users/andrej/Library/Developer/Xcode/DerivedData/WordBoxer-bfulhixjjeffizcugftxfaxfwwpn/Build/Intermediates/openssl.build/Debug-iphoneos
*****'
***** removing temporary files from
/Users/andrej/Library/Developer/Xcode/DerivedData/WordBoxer-bfulhixjjeffizcugftxfaxfwwpn/Build/Intermediates/openssl.build/Debug-iphoneos
*****
+ rm -f /Users/andrej/Library/Developer/Xcode/DerivedData/WordBoxer-bfulhixjjeffizcugftxfaxfwwpn/Build/Intermediates/openssl.build/Debug-iphoneos/armv7-libcrypto.a
+ rm -f '/Users/andrej/Library/Developer/Xcode/DerivedData/WordBoxer-bfulhixjjeffizcugftxfaxfwwpn/Build/Intermediates/openssl.build/Debug-iphoneos/*-libssl.a'
+ echo '***** executing ranlib on libraries in
/Users/andrej/Library/Developer/Xcode/DerivedData/WordBoxer-bfulhixjjeffizcugftxfaxfwwpn/Build/Products/Debug-iphoneos
*****'
***** executing ranlib on libraries in
/Users/andrej/Library/Developer/Xcode/DerivedData/WordBoxer-bfulhixjjeffizcugftxfaxfwwpn/Build/Products/Debug-iphoneos
*****
+ ranlib /Users/andrej/Library/Developer/Xcode/DerivedData/WordBoxer-bfulhixjjeffizcugftxfaxfwwpn/Build/Products/Debug-iphoneos/libcrypto.a
ranlib: file: /Users/andrej/Library/Developer/Xcode/DerivedData/WordBoxer-bfulhixjjeffizcugftxfaxfwwpn/Build/Products/Debug-iphoneos/libcrypto.a(rand_win.o)
has no symbols
ranlib: file: /Users/andrej/Library/Developer/Xcode/DerivedData/WordBoxer-bfulhixjjeffizcugftxfaxfwwpn/Build/Products/Debug-iphoneos/libcrypto.a(rand_os2.o)
has no symbols
ranlib: file: /Users/andrej/Library/Developer/Xcode/DerivedData/WordBoxer-bfulhixjjeffizcugftxfaxfwwpn/Build/Products/Debug-iphoneos/libcrypto.a(rand_nw.o)
has no symbols
ranlib: file: /Users/andrej/Library/Developer/Xcode/DerivedData/WordBoxer-bfulhixjjeffizcugftxfaxfwwpn/Build/Products/Debug-iphoneos/libcrypto.a(e_rc5.o)
has no symbols
ranlib: file: /Users/andrej/Library/Developer/Xcode/DerivedData/WordBoxer-bfulhixjjeffizcugftxfaxfwwpn/Build/Products/Debug-iphoneos/libcrypto.a(m_md2.o)
has no symbols
ranlib: file: /Users/andrej/Library/Developer/Xcode/DerivedData/WordBoxer-bfulhixjjeffizcugftxfaxfwwpn/Build/Products/Debug-iphoneos/libcrypto.a(m_md5.o)
has no symbols
ranlib: file: /Users/andrej/Library/Developer/Xcode/DerivedData/WordBoxer-bfulhixjjeffizcugftxfaxfwwpn/Build/Products/Debug-iphoneos/libcrypto.a(evp_fips.o)
has no symbols
ranlib: file: /Users/andrej/Library/Developer/Xcode/DerivedData/WordBoxer-bfulhixjjeffizcugftxfaxfwwpn/Build/Products/Debug-iphoneos/libcrypto.a(e_rc4_hmac_md5.o)
has no symbols
ranlib: file: /Users/andrej/Library/Developer/Xcode/DerivedData/WordBoxer-bfulhixjjeffizcugftxfaxfwwpn/Build/Products/Debug-iphoneos/libcrypto.a(v3_asid.o)
has no symbols
ranlib: file: /Users/andrej/Library/Developer/Xcode/DerivedData/WordBoxer-bfulhixjjeffizcugftxfaxfwwpn/Build/Products/Debug-iphoneos/libcrypto.a(v3_addr.o)
has no symbols
ranlib: file: /Users/andrej/Library/Developer/Xcode/DerivedData/WordBoxer-bfulhixjjeffizcugftxfaxfwwpn/Build/Products/Debug-iphoneos/libcrypto.a(cms_cd.o)
has no symbols
+ ranlib /Users/andrej/Library/Developer/Xcode/DerivedData/WordBoxer-bfulhixjjeffizcugftxfaxfwwpn/Build/Products/Debug-iphoneos/libssl.a
ranlib: can't open file:
/Users/andrej/Library/Developer/Xcode/DerivedData/WordBoxer-bfulhixjjeffizcugftxfaxfwwpn/Build/Products/Debug-iphoneos/libssl.a
(No such file or directory)
Showing first 200 notices only

Stephen Lombardo

unread,
Jun 27, 2012, 12:35:31 PM6/27/12
to sqlc...@googlegroups.com
Hi Andrej,

The openssl.xcode project attempts do to some caching to speed up project builds (i.e. to avoid having to rebuild every time), which probably explains why the second build succeeded. From the build log it looks like libssl failed. I would suggest running a project clean, and then rebuilding to see if libcrypto.a is properly generated. SQLCipher doesn't depend on libssl.a directly, but it is built during the process (openssl-xcode is a general purpose project). Unfortunately, this issue would probably prevent you from doing archive builds.

Therefore, your best option would be to go into your openssl source directory and run through the config and make steps outside of SQLCipher until you can determine a set of config flags that will result in a clean build. This will probably involve soem research into OpenSSL to determine which flags are compatible, and would likely involved additional flags to OpenSSL configure step,

If I might ask, might it be possible to just eliminate the conflicting _MD5 symbol from your app? Or is that baked into some other library you are using? 

Cheers,
Stephen

Andrej van der Zee

unread,
Jun 27, 2012, 12:59:24 PM6/27/12
to sqlc...@googlegroups.com
Hi Stephen,

Thanks for your reply.

> If I might ask, might it be possible to just eliminate the conflicting _MD5
> symbol from your app? Or is that baked into some other library you are
> using?

I commented out the MD5 function in openssl that causes the conflict
and this solves my issue. I dont like the solution, but I have to move
on.

How can I remove the symbol from the static lib? Can I do that in one
of the build scripts so that other developers will not notice?

Cheers,
Andre

Stephen Lombardo

unread,
Jun 28, 2012, 12:29:55 PM6/28/12
to sqlc...@googlegroups.com
Hi Andrej,

Apologies for the confusion, I wasn't suggesting that you strip the symbol from the static lib, rather, I was wondering if you could remove / rename the MD5 symbol from your application (i.e. rename that function in your application code, rather than modifying openssl.

Cheers,
Stephen

Andrej van der Zee

unread,
Jun 28, 2012, 9:36:23 PM6/28/12
to sqlc...@googlegroups.com
Hi Stephen,

> Apologies for the confusion, I wasn't suggesting that you strip the symbol
> from the static lib, rather, I was wondering if you could remove / rename
> the MD5 symbol from your application (i.e. rename that function in your
> application code, rather than modifying openssl.

Ah OK, I misunderstood! The other symbol _MD5 comes from another
static library (AdMob). One way or the other, it seems that I need to
change one of the two, unfortunately.

I just wonder why md5.h is (unconditionally) included from s3_srvr.c
while the no-md5 option is given, as in the compile-error below. Could
it be that s3_srvr.c should not be build at all with no-md5 is set?

cc -I../crypto -I.. -I../include -D_DARWIN_C_SOURCE
-UOPENSSL_BN_ASM_PART_WORDS -arch armv7 -isysroot
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk
-c -o s3_srvr.o s3_srvr.c
In file included from s3_srvr.c:170:
../include/openssl/md5.h:70:2: error: #error MD5 is disabled.

Cheers,
Andrej
Reply all
Reply to author
Forward
0 new messages