<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">
<html><body style='font-family: Verdana,Geneva,sans-serif'>
<p>Thanks Bruno and Erik Jan for the quick and detailed answers!</p>
<p>I noticed indeed that you are using the Elliptic curves crypto of NaCl on iOS, which is a smart choice.</p>
<p>And thanks for pointing out the timing attack (tables and cache) published in 2009.</p>
<p>I am well aware of this kind of attack on AES and GCM when lookup tables are used, but since 2009, we got some improvements, on intel CPU (AES-NI) at least, which patches are already included in openssl (Gueron et al). But I agree with you that for ARM, we are a bit left behind.</p>
<p>About the question if elliptic curves are safer than AES-GCM, i would say it is a question of trust.... ECC is way too young for me to trust it. I prefer plain old "modulo a prime" groups, with their caveats (longer keys, more cpu intensive) and their limitations (side-channel attacks) but that have benefited from a huge community of cryptographers, coders and debuggers for now 40 years.</p>
<p>I believe that, if used correctly, RSA, AES, GCM, and DHE can be very efficient. And I am a bit afraid of the sudden euphoria for "magical" curves.</p>
<p>Now if we come back to our subject of interest, which is ARM and iOS, i would say that the situation is tricky, but we can find a solution, and I am interested in helping.</p>
<p>For ARMv7 we have NEON VMULL.P8 instructions (from iPhone 3GS and above, if i am not mistaken, ARM11 doesnt have VMULL.P8)</p>
<p>For ARMv8 we have much more, including AES HW accel... (this is in iPhone 5S and above)</p>
<p>You can have a look at :</p>
<p>- About binary polynominal multiplication for GCM on ARMv7: "Fast Software Polynomial Multiplication on ARM Processors using the NEON Engine." Danilo Camara, Conrado P. L. Gouvea⋆, Julio Lopez and Ricardo Dahab. 2010/2013  <br />their code available here  hasn't made it into openssl (AFAIK)</p>
<p>- Implementing GCM on ARMv8. Conrado P. L. Gouvêa, Julio López. 2015 <br />Which details also the ARMv7 case, and was presented at the RSA Conference 2015 in the US, 2 months ago.<br />The paper is here .<br />The code is available here .</p>
<p>It seems that the openssl implementation benefits from NEON in the GHASH (coded by Polyakov) since march 2011  which means GCM timing attack is not possible (no lookup tables).</p>
<p>Also to be checked, is the AES timing resistant bitsliced implementation from Bernstein and Schwabe that Bruno referred to in the linked PDF. It is probable that the ARM version has been integrated into openssl, but I haven't double checked. If it is not there, then it most probably is present in .</p>
<p>So... I am quite interested in helping with having a fully secure AES-GCM stack on ARM, including on iOS. Let's see how to proceed, starting probably from  and then integrate it in OpenSSL? Any idea is welcomed.</p>
<p>Finally, just a small comment: If AES-GCM is not as secure as ECC, then why are you still using it in the android implementation of your crypto box? (Dont get me wrong, i prefer AES-GCM over ECC!)<br />Also, bouncy castle's implementation of AES-GCM is known to be slow, not accelerated at all (even on intel) and not even parallelized. What performances have you got on that?</p>
<p>All the best,<br />Niko.<br /><br /></p>
<p>On 2015-06-19 13:54, abstractj wrote:</p>
<blockquote type="cite" style="padding-left:5px; border-left:#1010ff 2px solid; margin-left:5px; width:100%"><!-- html ignored --><!-- head ignored --><!-- meta ignored -->
<pre>Good morning Niko, I hope you're doing well. Please, notice that GCM mode
support is not a limitation of AG iOS, but a restriction from Apple.
If the document on
states that GCM is support, it pretty much relates to Android. If the
senteces are not clear enough, feel free to file a Jira
Answering your questions:
- Is GCM mode for AES encryption supported on iOS aerogear crypto module
(and the cordova plugin) ?
No. But, we are open for suggestions. In the future we plan to make
aerogear-ios-crypto pluggable. Into this way you're free to go with
CommonCrypto or whatever provider you want.
- If not, how difficult would it be to use the private API in iOS
CommonCrypto ? I didnt try it myself, i have just been reading the code....
I'd say, would take time and the only way I see today is plugging OpenSSL.
The reason why NaCl was choosen, was not only the fact of CommonCrypto not
supporting GCM, but also, because it's safer.
If you feel like, that should be reconsidered. Feel free to create a feature
request against <a href="https://issues.jboss.org/browse/agios">https://issues.jboss.org/browse/agios</a>. I hope it helps.
 - <a href="https://cryptojedi.org/papers/aesbs-20090616.pdf">https://cryptojedi.org/papers/aesbs-20090616.pdf</a>
View this message in context: <a href="http://aerogear-users.1116366.n5.nabble.com/Aerogear-users-AeroGear-Crypto-API-on-iOS-with-AES-GCM-tp55p61.html">http://aerogear-users.1116366.n5.nabble.com/Aerogear-users-AeroGear-Crypto-API-on-iOS-with-AES-GCM-tp55p61.html</a>
Sent from the aerogear-users mailing list archive at Nabble.com.
Aerogear-users mailing list