X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=engines%2Fccgost%2Fgost_pmeth.c;h=4520387fc8a7d07824d494ebf6f37e560b6e59f8;hb=1e8f69c6a5b52ac2f3941b49d710912ffe0f04ca;hp=3189798cf4b64337760fa248729ea8f98be66e27;hpb=810639536cfa66df0c232fa4f15a7e5f00f31ce8;p=oweals%2Fopenssl.git diff --git a/engines/ccgost/gost_pmeth.c b/engines/ccgost/gost_pmeth.c index 3189798cf4..4520387fc8 100644 --- a/engines/ccgost/gost_pmeth.c +++ b/engines/ccgost/gost_pmeth.c @@ -10,6 +10,7 @@ #include #include #include +#include #include /*For string_to_hex */ #include #include @@ -106,6 +107,11 @@ static int pkey_gost_ctrl(EVP_PKEY_CTX *ctx, int type, int p1, void *p2) return 1; case EVP_PKEY_CTRL_SET_IV: pctx->shared_ukm=OPENSSL_malloc((int)p1); + if (pctx->shared_ukm == NULL) + { + GOSTerr(GOST_F_PKEY_GOST_CTRL, ERR_R_MALLOC_FAILURE); + return 0; + } memcpy(pctx->shared_ukm,p2,(int) p1); return 1; case EVP_PKEY_CTRL_PEER_KEY: @@ -557,6 +563,8 @@ static int pkey_gost_mac_keygen(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey) return 0; } keydata = OPENSSL_malloc(32); + if (keydata == NULL) + return 0; memcpy(keydata,data->key,32); EVP_PKEY_assign(pkey, NID_id_Gost28147_89_MAC, keydata); return 1; @@ -633,4 +641,3 @@ int register_pmeth_gost(int id, EVP_PKEY_METHOD **pmeth,int flags) return 1; } -