Avoid a NULL ptr deref if group is not set
authorMatt Caswell <matt@openssl.org>
Fri, 29 Apr 2016 10:44:39 +0000 (11:44 +0100)
committerMatt Caswell <matt@openssl.org>
Fri, 29 Apr 2016 15:47:41 +0000 (16:47 +0100)
commit40a8643a37ea50781872acd740020ac5b6c8f699
treee30d882def5a1348579d9985f4d6a97ab3d55b20
parent7001571330ce2e31234660c10ef26089a07b17c1
Avoid a NULL ptr deref if group is not set

We should only copy parameters and keys if the group is set. Otherwise
they don't really make any sense. Previously we copied the private key
regardless of whether the group was set...but if it wasn't a NULL ptr
deref could occur. It's unclear whether we could ever get into that
situation, but since we were already checking it for the public key we
should be consistent.

Reviewed-by: Rich Salz <rsalz@openssl.org>
crypto/ec/ec_key.c