Re: [PATCH v3 1/2] crypto: ecdh - add privkey generation support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi, Stephan,

On 30.05.2017 18:10, Stephan Müller wrote:
Am Dienstag, 30. Mai 2017, 16:52:48 CEST schrieb Tudor Ambarus:

Hi Tudor,

+	if (!params.key || !params.key_size)
+		return ecc_gen_privkey(ctx->curve_id, ctx->ndigits,
+				       ctx->private_key);
+
  	if (ecc_is_key_valid(ctx->curve_id, ctx->ndigits,
  			     (const u64 *)params.key, params.key_size) < 0)

Hm, wouldn't this check be a problem in case a private key is generated by the
kernel? The ecc_gen_privkey stores the key in ctx whereas this check operates
on the input buffer. Furthermore, there is an unconditional memcpy further
down that would overwrite the key in the ctx, no?

You missed the return. When generating the key I just exit with the
return value of ecc_gen_privkey().

Thanks,
ta



[Index of Archives]     [Kernel]     [Gnu Classpath]     [Gnu Crypto]     [DM Crypt]     [Netfilter]     [Bugtraq]

  Powered by Linux