Replace GOST_R_MALLOC_FAILURE and GOST_R_NO_MEMORY with ERR_R_MALLOC_FAILURE
[openssl.git] / engines / ccgost / gost94_keyx.c
index 624be586a5bbceaab80417e8ffd6c2571b983f5b..d48e21ae7ccb7dfb700f10060e5986e8eba8af51 100644 (file)
@@ -199,7 +199,7 @@ int pkey_GOST94cp_encrypt(EVP_PKEY_CTX *ctx, unsigned char *out, size_t *outlen,
                        EVP_PKEY_free(mykey);
                }       
        GOSTerr(GOST_F_PKEY_GOST94CP_ENCRYPT,
-               GOST_R_MALLOC_FAILURE);
+               ERR_R_MALLOC_FAILURE);
        err:            
        GOST_KEY_TRANSPORT_free(gkt);
        return -1;
@@ -261,6 +261,10 @@ int pkey_GOST94cp_decrypt(EVP_PKEY_CTX *ctx, unsigned char *key, size_t *key_len
                }
 
        param = get_encryption_params(gkt->key_agreement_info->cipher);
+    if(!param){
+        goto err;
+    }
+       
        gost_init(&cctx,param->sblock); 
        OPENSSL_assert(gkt->key_agreement_info->eph_iv->length==8);
        memcpy(wrappedKey,gkt->key_agreement_info->eph_iv->data,8);