[curves] Fw: Aw: SPEKE using Curve25519 - elligator2 required or recommended?

Mike Hamburg mike at shiftleft.org
Tue Oct 24 13:44:20 PDT 2017


Hi Arasch,

If the password is salted, then the issue is probably exploitable.  This is because you will give away one bit of the password per salt.  Whether the exploit is against the user or the device depend on protocol flow and on who choses the salt.

If the password is not salted, then you give away one bit of the password total.  This might not be exploitable, but it’s definitely not ideal.  Also, lack of salt isn’t ideal either.

If properly implemented (i.e. using one inverse square root), Elligator 2 adds about 10% to the curve25519 operation, which is to say 5% to each party’s runtime (since they do 2 curve25519 operations).  It probably adds a few hundred bytes to the code size as well.  It can reuse all the existing field operations, except that you need to extend your inverse operation to inverse square root.

On a related note, if you haven an M4 and are truly strapped for code size, you might want to consider STROBE.  It supports Curve25519 key exchange, signing and verification, as well as (totally non-standard) hashing, AEAD encryption, pseudorandom generation, PBKDF2-quality password strengthening, and a lightweight protocol framework in as little as 3kB of code (probably more like 4k since you’d have to talk with Rambus to get the M4 asm version).  So implementing SPEKE would just require the addition of Elligator.  It’s probably not as fast as Wouter’s Curve25519 implementation though.

— Mike

> On Oct 24, 2017, at 1:14 PM, Arasch Honarbacht <honarbacht at ubisys.de> wrote:
> 
> Hi Björn,
>  
> Thank you for your prompt reply. Actually your paper is one of the sources I’ve been reading the past days. We’ll certainly consider the suggestions you have made. In fact, the hash could incorporate a random session ID (as I understood there is an attack against SPEKE where you create multiple concurrent sessions), but those are separate concerns – and therefore I was referring to a random base point.
>  
> Your note about an ephemeral generator is apparently also orthogonal, right?
>  
> So to better understand your point, if for example the hash of the password has n bits of effective security, say 128, then we would leak one bit of the hash (not the password itself), correct? Put differently, how could this information practically be exploited? Is it a realistic attack today or e.g. a potential weakness that could be attacked using a quantum computer and a nuclear power plant in e.g. 20 years from now?
>  
> The question is, whether or not added code space, execution time and battery drain for eliigator2 are worth it, for our particular use case. Or would you consider the additional complexity negligible compared to X25519. For example on a Cortex-M4 (ATSAM4S8B) the scalar product requires 4kB flash and roughly 1.8M cycles using Wouter de Groot’s implementation. What would elligator2 add to this, assuming an implementation of similar quality – or even reusing the field primitives already present (as far as possible)?
>  
> Thanks again
>  
> Arasch
>  
> Von: Curves [mailto:curves-bounces at moderncrypto.org] Im Auftrag von "Björn Haase"
> Gesendet: Dienstag, 24. Oktober 2017 17:17
> An: curves at moderncrypto.org
> Betreff: [curves] Fw: Aw: SPEKE using Curve25519 - elligator2 required or recommended?
>  
> Hi,
>  
> first of all, I agree that using a PAKE scheme for password-based authentication on zigbee networks is a good idea. Also, SPEKE-based protocols are IMHO the fastest choice available. Since SPEKE patents have expired, there is no need to avoid that the password itself enters the calculation of the generator, which was (IIUC) the main reason for the patent circumvention approach for that PACE has been developped.
>  
> Regarding the base point selection, I'd strongly recommend to use Elligator2 and not just the hash of the password. The reason is, that depending on your construction, you will at least leak one bit of the password. If you just use the hash, you will either be having a point on the curve or on it's twist and this information could be exploited.
> 
> IMO there are a couple of things to consider when suggesting standardization: I'd recommend to combine the construction with use of a sound password hash, such as scrypt or argon2, mainly because it's likely that you will never enter the password on the small node. At least one should use PBKDF2 with a strong parameter set.
> 
> The second thing is consideration of side-channel stuff. I'd advocate on using an ephemeral generator. This costs essentially one additional communication round, but this might be worth the effort, since you anyway might be having a communication telegram exchange before the actual PAKE scheme.
> 
> When combining some ephemeral (and publicly known) random with the password hash for generating an ephemeral generator with Elligator2, you will be ending up with something very similar to our PACE paper at chess (https://eprint.iacr.org/2017/562.pdf <https://eprint.iacr.org/2017/562.pdf>).
> 
> Note that the fact that you are using an ephemeral generator comes virtually at no added cost. I'd suggest to use a permutation or a hash for combining random values from both sides, and the password hash and feed the result into elligator2 to get an ephemeral generator. The patent circumvention step in our PACE paper (that forced us to use a symmetric cipher, in our case Salsa20, on top) is now no longer necessary.
> 
> Yours,
> 
> Björn
> Gesendet: Dienstag, 24. Oktober 2017 um 14:03 Uhr
> Von: "Arasch Honarbacht" <honarbacht at ubisys.de <mailto:honarbacht at ubisys.de>>
> An: curves at moderncrypto.org <mailto:curves at moderncrypto.org>
> Betreff: [curves] SPEKE using Curve25519 - elligator2 required or recommended?
> Hi all,
>  
> I’m working on a proposal for key agreement in zigbee networks. The idea is to use SPEKE and Curve25519. My understanding is that Curve25519 accepts all 32-byte strings as valid public keys. Now, instead of the default base point 9, the base point is generated using a hash of the password. For argument’s sake, assume the base point would be a random number. I’ve implemented a test bench and tested this approach and it works well (for the small set of experiments I made, i.e. a couple of thousand executions).
>  
> The approach as it stands:
>  
> Alice generates a secret a, Bob generates a secret b.
> Alice computes P = aG and sends it to Bob. Bob computes Q = bG and sends it to Alice.
> Alice computes k = aQ = abG. Bob computes k = bP = baG.
>  
> When the base point G is chosen as one of the 12 points listed under the “contributory” behavior on Bernstein’s site (https://cr.yp.to/ecdh.html <https://cr.yp.to/ecdh.html>) the scalar products P and Q and the shared secret become zero – so these points need to be avoided.
>  
> Now, I saw in literature that reverse elligator2 mapping is used to map a random string to a Montgomery x coordinate u, e.g. instead of G simply being the hash, G = elligator2(hash), c.f. Figure 1 in this paper: https://eprint.iacr.org/2017/562.pdf <https://eprint.iacr.org/2017/562.pdf>, or section 2.6 here: https://signal.org/docs/specifications/xeddsa/ <https://signal.org/docs/specifications/xeddsa/>.
>  
> My question is: Would a elligator2 mapping be required for the SPEKE use case outlined above, or is any point, except for the 12 points mentioned above suitable as a generator?
>  
> Thanks, Arasch
> _______________________________________________ Curves mailing list Curves at moderncrypto.org <mailto:Curves at moderncrypto.org>https://moderncrypto.org/mailman/listinfo/curves <https://moderncrypto.org/mailman/listinfo/curves>_______________________________________________
> Curves mailing list
> Curves at moderncrypto.org
> https://moderncrypto.org/mailman/listinfo/curves

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://moderncrypto.org/mail-archive/curves/attachments/20171024/d70250df/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3571 bytes
Desc: not available
URL: <http://moderncrypto.org/mail-archive/curves/attachments/20171024/d70250df/attachment.bin>


More information about the Curves mailing list