diff options
author | se-prok <81800148+se-prok@users.noreply.github.com> | 2021-04-02 10:51:28 +0300 |
---|---|---|
committer | Dmitry Belyavskiy <beldmit@users.noreply.github.com> | 2021-04-02 12:48:12 +0300 |
commit | 336c30e54ca42f54641ee06c9dce26ecd454b6ea (patch) | |
tree | a117927524106526df14a7b8af8303c9710972a3 | |
parent | 09bc339bdce87d513b029b9be91b6cb73b6cc2b7 (diff) | |
download | gost-engine-336c30e54ca42f54641ee06c9dce26ecd454b6ea.zip gost-engine-336c30e54ca42f54641ee06c9dce26ecd454b6ea.tar.gz gost-engine-336c30e54ca42f54641ee06c9dce26ecd454b6ea.tar.bz2 |
Update gost_ec_keyx.c
It's not right to have segmentation faults.
-rw-r--r-- | gost_ec_keyx.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/gost_ec_keyx.c b/gost_ec_keyx.c index eeb0122..40cad2b 100644 --- a/gost_ec_keyx.c +++ b/gost_ec_keyx.c @@ -672,6 +672,13 @@ static int pkey_gost2018_decrypt(EVP_PKEY_CTX *pctx, unsigned char *key, o q * Q_eph is not equal to zero point. */ + if (eph_key == NULL || priv == NULL || data == NULL) { + GOSTerr(GOST_F_PKEY_GOST2018_DECRYPT, + GOST_R_ERROR_COMPUTING_EXPORT_KEYS); + ret = 0; + goto err; + } + if (data->shared_ukm_size == 0 && pst->ukm != NULL) { if (EVP_PKEY_CTX_ctrl(pctx, -1, -1, EVP_PKEY_CTRL_SET_IV, ASN1_STRING_length(pst->ukm), (void *)ASN1_STRING_get0_data(pst->ukm)) < 0) { |