]> www.wagner.pp.ru Git - openssl-gost/engine.git/commitdiff
Update gost_ec_keyx.c
authorse-prok <81800148+se-prok@users.noreply.github.com>
Fri, 2 Apr 2021 07:51:28 +0000 (10:51 +0300)
committerDmitry Belyavskiy <beldmit@users.noreply.github.com>
Fri, 2 Apr 2021 09:48:12 +0000 (12:48 +0300)
It's not right to have segmentation faults.

gost_ec_keyx.c

index eeb0122960594d01634123ebf7c51e7418f04187..40cad2bc34f2240bc146e9fab562734f47abef77 100644 (file)
@@ -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) {