Updated cryptopp-mobile.zip

20 views
Skip to first unread message

Jeffrey Walton

unread,
Jan 6, 2015, 4:15:12 AM1/6/15
to cryptop...@googlegroups.com
cryptopp-mobile.zip was updated. The ZIP adds support for ARM embedded, Android, iOS, iOS Simulator, and some Windows RT|Phone.

I had to update it because the preprocessor macro logic was flawed for Apple platforms. I dumb-lucked into a good configuration, though.

The file is available at http://www.cryptopp.com/wiki/File:cryptopp-mobile.zip. The pages that use it, like iOS (Command Line) and iOS (Xcode), are listed on the file's page.

-----

Here's the updated logic:

#if defined(__APPLE__)
# include "TargetConditionals.h"

# if defined(TARGET_IPHONE_SIMULATOR) && (TARGET_IPHONE_SIMULATOR != 0)
#  define CRYPTOPP_IPHONE_SIMULATOR 1
# elif defined(TARGET_OS_IPHONE) && (TARGET_OS_IPHONE != 0)
#  define CRYPTOPP_IPHONE 1
# elif defined(TARGET_OS_MAC) && (TARGET_OS_MAC != 0)
#  define CRYPTOPP_MAC_OSX 1
# else
#  error Unknown Apple platform
# endif

#endif /* Apple */

My problem was Apple defined the non-targeted platform to 0, so it would pass the [incorrect] "#if defined" test. I got lucky because TARGET_OS_IPHONE and TARGET_IPHONE_SIMULATOR were used together, so the bad identification was masked.

On the good side, I finally pulled the trigger on CRYPTOPP_IPHONE and CRYPTOPP_IPHONE_SIMULATOR. It works as expected with "#if defined", and abstracts the defines into the Crypto++ namespace.
Reply all
Reply to author
Forward
0 new messages