On Thu, Jun 02, 2016 at 12:06:48PM +0000, Benedetto, Salvatore wrote: > > Off the top of my head, with ECDH when the user gets a EGAIN, he wants > to reset the secret key only, not the params. I don't see any performance benefit in changing one and not the other. Besides, you could always check the params in the algo and only update if necessary. > > > * generate_public_key() - It generates the public key to be sent to > > > the other counterpart involved in the key-agreement session. The > > > function has to be called after set_params() and set_secret() > > > * generate_secret() - It generates the shared secret for the session > > > > Ditto, we only need one operation and that is multiplication by the secret. > > Sorry, but I don't understand your point. > We do always need one math operation with different params. Look at your actual implementations of DH and ECDH, they are the same except for the multiplicand, which is fixed to G for the public key. Now you could argue that having to reparse G every time could be bad for performance, but that's easily fixed by making the case of a zero-length input value an implicit request to use G. Even better, just drop G from the params and you won't need to reparse it or do anything special. The point of all this is to make the lives of future driver authors simpler, the less they have to do the less that could go wrong. Cheers, -- Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt -- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html