0

I'm using the following openssl functions:

  • PKCS5_PBKDF2_HMAC_SHA1
  • EVP_BytesToKey
  • EVP_aes_256_cbc
  • EVP_sha1
  • EVP_CIPHER_CTX_init
  • EVP_EncryptInit_ex
  • EVP_DecryptInit_ex
  • EVP_CIPHER_CTX_cleanup
  • EVP_DecryptUpdate
  • EVP_DecryptFinal_ex
  • EVP_EncryptUpdate
  • EVP_EncryptFinal_ex

When decrypting data on a background thread, there are no issues if the data size is fairly small.

For data around 500 kilobytes the decrypt routine will always crash on EVP_DecryptUpdate but is fine on the main thread.

What gives?

Vamos
  • 2,701
  • 2
  • 24
  • 37
  • http://www.openssl.org/support/faq.html#PROG1 <-- Did you satisfy this? – borrrden May 23 '13 at 09:32
  • how are you **using** this code? can you show us your code that makes use of these functions? – Nate May 23 '13 at 09:36
  • @borrden, thanks, I did not. When I read "On Windows and many Unix systems, OpenSSL automatically uses the multi-threaded versions of the standard libraries. If your platform is not one of these, consult the INSTALL file", I'm guessing iOS isn't one of these platforms... ok will take a look at that. – Vamos May 23 '13 at 09:37
  • @Nate, will edit the question with the details in a bit – Vamos May 23 '13 at 09:40
  • @borrrden check this: http://www.openssl.org/docs/crypto/threads.html#notes it appears thread support is enabled... anyway, will look into trying it with the callbacks to see if it helps – Vamos May 23 '13 at 10:31
  • @Rls Actually I was referring to *only using a connection from one thread at a time*. If your operation takes too long, then you are probably trying to perform two at once, resulting in that error. Even with multi-thread support enabled, it is not truly "thread-safe" in the sense that you want it to be. – borrrden May 24 '13 at 01:13

0 Answers0