Search code examples
iosperformancecryptographyopensslhardware-acceleration

iOS -- OpenSSL and Accelerated Cryptography?


I know that all but the older iPhones and all iPads have a built-in cryptographic accelerator, used to make key generation and encryption faster on those devices. In my application, I am using OpenSSL to perform those functions, rather than CommonCrypto. Does anyone know if OpenSSL will take advantage of the built-in crypto processor? Or will crypto done using OpenSSL be noticeably slower than if I used CommonCrypto?


Solution

  • The IOKit hooks for hardware crypto acceleration are not public API; it's thus unlikely that any iOS packaging of the OpenSSL library intended for developers targeting the App Store will include them. (You could always check the source, though: look for IOAESAccelerator.)

    It's also worth noting that "older devices" missing hardware crypto are pretty old at this point: everything that can run iOS 5.x (or 6.x) has hardware crypto, and that accounts for an overwhelming majority of the active installed base at this point. You may want to consider whether supporting 4+ year old devices is worth the investment.

    If you do use CommonCrypto, you do get hardware acceleration where appropriate, but note that it's only under certain conditions: you might want to make sure your usage fits those conditions before adopting.