I have downloaded the latest source from OpenSSL Page (released on April 7th, 2014), and created a libcrypto.a library using Tutorial Where i have followed the steps in which i run ./build-openssl.sh script file to generate libcrypto.a file for all environments (armv7s, armv7, i386) on Mac OS X having version 10.9.2.
I am able to encrypt / decrypt the date using EVP_aes_256_cbc encryption but my code gets failed when i try to get RAND_byte. The code gets crashed on RAND_byte call.
Below are the codes, which i am trying to get the RAND_byte seeds:
// Code 1
unsigned char seed[32];
RAND_bytes(seed, 32);
// Code 2
int count = 24;
unsigned char *buffer = (unsigned char *)calloc(count, sizeof(unsigned char));
RAND_bytes(buffer, count);
// Code 3
int count = 24;
unsigned char *buffer = (unsigned char *)malloc(sizeof(int)*count);
RAND_bytes(buffer, count);
// Code 4
int count = 24;
unsigned char *buffer = OPENSSL_malloc(count);
RAND_bytes(buffer, count);
When I run above code on iOS 6.0/6.1 Simulator, It gets crashed on RAND_byte call and I get “_interposition_vtable_unimplemented” on Thread 1 and no message get displayed on console.
When I run the same code on iOS 7.0+ Simulator, It gets crashed on RAND_byte call and I get “__pthread_kill” on Thread 1 and “Detected an attempt to call a symbol in system libraries that is not present on the iPhone: open$UNIX2003 called from function RAND_poll in image CryptographyTest.” on Console.
But WHEN I run the same code on iPad with iOS 7.0.4, All above codes runs perfectly. Where i get the return value from RAND_byte is 1.
I don’t understand the behavior that some of the functions does not work on iOS simulator but everything works with iOS devices.
Any help highly appreciated! Many thanks in advance.