aboutsummaryrefslogtreecommitdiff
path: root/gost_ec_keyx.c
diff options
context:
space:
mode:
authorVitaly Chikunov <vt@altlinux.org>2019-10-15 19:22:45 +0300
committerVitaly Chikunov <vt@altlinux.org>2019-10-15 19:36:15 +0300
commita57bcd50c280fd2c48fd28de93dd94023ebdc980 (patch)
tree86167b56f68bac5feda5b9d706380e486dc19855 /gost_ec_keyx.c
parent7f55249334f0dd265a3c2579812cbcec6c946944 (diff)
downloadgost-engine-a57bcd50c280fd2c48fd28de93dd94023ebdc980.zip
gost-engine-a57bcd50c280fd2c48fd28de93dd94023ebdc980.tar.gz
gost-engine-a57bcd50c280fd2c48fd28de93dd94023ebdc980.tar.bz2
gost_ec_keyx: Fix CID 253282 Dereference null return value
`param' is used unconditionally in pkey_GOST_ECcp_encrypt() so we can unconditionally check (vs in any particular `if' branch) for it's being non-NULL. This is similar to how pkey_GOST_ECcp_decrypt() works with `param'. Closes #174.
Diffstat (limited to 'gost_ec_keyx.c')
-rw-r--r--gost_ec_keyx.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/gost_ec_keyx.c b/gost_ec_keyx.c
index fa068ae..963cd8a 100644
--- a/gost_ec_keyx.c
+++ b/gost_ec_keyx.c
@@ -263,6 +263,8 @@ static int pkey_GOST_ECcp_encrypt(EVP_PKEY_CTX *pctx, unsigned char *out,
return 0;
}
}
+ if (!param)
+ goto err;
/* Check for private key in the peer_key of context */
if (sec_key) {
key_is_ephemeral = 0;