I'm working on AES Encryption with PJSIP open source library. The library which is used for AES Encryption is not built-in library available in C Programming. So, I have gone with external library (Libmcrypt) for AES Encryption.
I followed this site for build the libmcrypt library into my machine(MAC OSX). https://coolestguidesontheplanet.com/install-mcrypt-php-mac-osx-10-10-yosemite-development-server/
https://gist.github.com/bricef/2436364
While building those library it created one dynamic library(libmcrypt.dylib) in /usr/local/lib/ path. when checking the architecture of that library using lipo -info libmcrypt.dylib command, it shows
Non-fat file: libmcrypt.dylib is architecture: x86_64
But I'm creating these applications for Android and IOS devices using PJSIP. Their architectures are armeabi(android) and armv7(IOS).
While Linking the libmcrypt.dylib(x86_64) into PJSIP library(armv7), it shows following errors.
Undefined symbols for architecture armv7:
"_mcrypt_enc_get_block_size", referenced from:
_encrypt_AES in libpjsip-armv7-apple-darwin_ios.a(aes.o)
_decrypt_AES in libpjsip-armv7-apple-darwin_ios.a(aes.o)
"_mcrypt_generic", referenced from:
_encrypt_AES in libpjsip-armv7-apple-darwin_ios.a(aes.o)
"_mcrypt_generic_deinit", referenced from:
_encrypt_AES in libpjsip-armv7-apple-darwin_ios.a(aes.o)
_decrypt_AES in libpjsip-armv7-apple-darwin_ios.a(aes.o)
"_mcrypt_generic_init", referenced from:
_encrypt_AES in libpjsip-armv7-apple-darwin_ios.a(aes.o)
_decrypt_AES in libpjsip-armv7-apple-darwin_ios.a(aes.o)
"_mcrypt_module_close", referenced from:
_encrypt_AES in libpjsip-armv7-apple-darwin_ios.a(aes.o)
_decrypt_AES in libpjsip-armv7-apple-darwin_ios.a(aes.o)
"_mcrypt_module_open", referenced from:
_encrypt_AES in libpjsip-armv7-apple-darwin_ios.a(aes.o)
_decrypt_AES in libpjsip-armv7-apple-darwin_ios.a(aes.o)
"_mdecrypt_generic", referenced from:
_decrypt_AES in libpjsip-armv7-apple-darwin_ios.a(aes.o)
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [../bin/pjsip-test-armv7-apple-darwin_ios] Error 1
make[1]: *** [pjsip-test-armv7-apple-darwin_ios] Error 2
make: *** [all] Error 1
I don't know a lot about these architectures. Is it possible to convert libmcrypt.dylib(x86_64) into libmcrypt.dylib(armv7). If Yes, then guide me how to convert it into armv7 architecture and if not then sorry for wasting your time.
Thanks in Advance!
Don't use mcrypt. The MCrypt library has not been updated since 2007. It is highly recommended you switch to OpenSSL or another maintained encryption project.
The PJSIP documentation has instructions on how to use OpenSSL for both IOS and Android devices:
Instead of using libmcrypt library, we can use below openssl(Github) projects for creating libraries on all architectures as Suggested by above answer. Thank you @Tim.
Use this project build-libssl.sh file for compiling for all architectures both on Android and IOS.
For Android,
https://github.com/ruslansalikhov/openssl-for-android
For IOS,
https://github.com/x2on/OpenSSL-for-iPhone
Just download and compile the project using build-libssl.sh file. It will creates all library for your platform. Either in Android or IOS.
Download the Project and go to the project directory using cmd/terminal.
cd OpenSSL-for-iPhone/
Compile the Project using following command,
./build-libssl.sh
NOTE: Machine must have gcc compiler and SDK installed(Android ndk and IOS).
After Successfull Compilation, go to you PROJECT_DIR(OpenSSL-for-iPhone)/lib folder. Check there is four libraries created for all architectures.
Use following command to check supported Architectures by the library file. Go to the lib path on cmd/terminal interface and check,
lipo -info libcrypto.a
It will show which architectures are supported by the library file.
Architectures in the fat file: libcrypto.a are: i386 armv7s armv7 x86_64 arm64
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With