EXEC_BAD_ACCESS when using BF_cfb64_encrypt
<p>I want to encrypt/decrypt files or data that is send over the network with Blowfish using openssl. I use theese functions for this: <a href="https://www.openssl.org/docs/manmaster/crypto/BF_options.html" rel="nofollow">https://www.openssl.org/docs/manmaster/crypto/BF_options.html</a></p>

<p>However, i cant get it to work right, i get a EXEC_BAD_ACCESS when running into 'BF_cfb64_encrypt'</p>

<p>the 'BF_set_key' does run without problems. I guess im doing something wrong with the variables..</p>

<p>here is some of my code:</p>

<pre><code>BF_KEY key;

const unsigned char *bf_key_data, *enc_data = new unsigned char[64];
unsigned char *out_data = new unsigned char[64], *ivec = new unsigned char[8];

long curr_length = 32;

int *num = 0;

bf_key_data = (const unsigned char *)"mysecretkey";

BF_set_key(&amp;key, strlen("mysecretkey"), bf_key_data);

enc_data = (const unsigned char *)data.c_str(); // read the data that i want to encrypt from a std::string
ivec[0] = 'f';
ivec[1] = 'f';
ivec[2] = 'f';
ivec[3] = 'f';
ivec[4] = 'f';
ivec[5] = 'f';
ivec[6] = 'f';
ivec[7] = 'f';

BF_cfb64_encrypt(enc_data, out_data, curr_length, &amp;key, ivec, num, BF_DECRYPT); // EXEC_BAD_ACCESS
</code></pre>

<p>I know this could be done using other functions, but i really want to use theese ones. Can someone point me in the right direction?</p>