diff options
author | Kyungwook Tak <k.tak@samsung.com> | 2015-08-31 16:19:30 +0900 |
---|---|---|
committer | Kyungwook Tak <k.tak@samsung.com> | 2015-08-31 16:21:32 +0900 |
commit | ca2b56e2594c5e549d1c5c2e0ea625770f59bb75 (patch) | |
tree | 7712fcee7b020d7ebc0820aac202f8af2de6a924 /engines/ccgost/gost_ameth.c | |
parent | a23523f545972af9d67393bb41a17e1564e36cd4 (diff) | |
parent | 13ea66c69fd44fadc3e1493311a74537b8cb5d7c (diff) | |
download | openssl-ca2b56e2594c5e549d1c5c2e0ea625770f59bb75.tar.gz openssl-ca2b56e2594c5e549d1c5c2e0ea625770f59bb75.tar.bz2 openssl-ca2b56e2594c5e549d1c5c2e0ea625770f59bb75.zip |
Upgrade openssl version to 1.0.1ptizen_3.0.m2.a1_tv_releasetizen_3.0.m2.a1_mobile_releasetizen_3.0.m1_tv_releasetizen_3.0.m1_mobile_releasesubmit/tizen_common/20151026.085049submit/tizen_common/20151023.083358submit/tizen_common/20151019.135620submit/tizen_common/20151015.190624submit/tizen/20150831.092033submit/tizen/20150831.090327accepted/tizen/wearable/20150901.083422accepted/tizen/tv/20150901.083409accepted/tizen/mobile/20150901.083356tizen_3.0.m1_tvtizen_3.0.m1_mobile
Change-Id: I4adbd2d17c72f228aea1396678f1e11a67b63bdc
Diffstat (limited to 'engines/ccgost/gost_ameth.c')
-rw-r--r-- | engines/ccgost/gost_ameth.c | 36 |
1 files changed, 31 insertions, 5 deletions
diff --git a/engines/ccgost/gost_ameth.c b/engines/ccgost/gost_ameth.c index 713a0fa..b7c5354 100644 --- a/engines/ccgost/gost_ameth.c +++ b/engines/ccgost/gost_ameth.c @@ -115,7 +115,10 @@ static int decode_gost_algor_params(EVP_PKEY *pkey, X509_ALGOR *palg) } param_nid = OBJ_obj2nid(gkp->key_params); GOST_KEY_PARAMS_free(gkp); - EVP_PKEY_set_type(pkey, pkey_nid); + if(!EVP_PKEY_set_type(pkey, pkey_nid)) { + GOSTerr(GOST_F_DECODE_GOST_ALGOR_PARAMS, ERR_R_INTERNAL_ERROR); + return 0; + } switch (pkey_nid) { case NID_id_GostR3410_94: { @@ -552,9 +555,19 @@ static int param_copy_gost01(EVP_PKEY *to, const EVP_PKEY *from) } if (!eto) { eto = EC_KEY_new(); - EVP_PKEY_assign(to, EVP_PKEY_base_id(from), eto); + if(!eto) { + GOSTerr(GOST_F_PARAM_COPY_GOST01, ERR_R_MALLOC_FAILURE); + return 0; + } + if(!EVP_PKEY_assign(to, EVP_PKEY_base_id(from), eto)) { + GOSTerr(GOST_F_PARAM_COPY_GOST01, ERR_R_INTERNAL_ERROR); + return 0; + } + } + if(!EC_KEY_set_group(eto, EC_KEY_get0_group(efrom))) { + GOSTerr(GOST_F_PARAM_COPY_GOST01, ERR_R_INTERNAL_ERROR); + return 0; } - EC_KEY_set_group(eto, EC_KEY_get0_group(efrom)); if (EC_KEY_get0_private_key(eto)) { gost2001_compute_public(eto); } @@ -729,8 +742,21 @@ static int pub_encode_gost01(X509_PUBKEY *pub, const EVP_PKEY *pk) } X = BN_new(); Y = BN_new(); - EC_POINT_get_affine_coordinates_GFp(EC_KEY_get0_group(ec), - pub_key, X, Y, NULL); + if(!X || !Y) { + GOSTerr(GOST_F_PUB_ENCODE_GOST01, ERR_R_MALLOC_FAILURE); + if(X) BN_free(X); + if(Y) BN_free(Y); + BN_free(order); + return 0; + } + if(!EC_POINT_get_affine_coordinates_GFp(EC_KEY_get0_group(ec), + pub_key, X, Y, NULL)) { + GOSTerr(GOST_F_PUB_ENCODE_GOST01, ERR_R_INTERNAL_ERROR); + BN_free(X); + BN_free(Y); + BN_free(order); + return 0; + } data_len = 2 * BN_num_bytes(order); BN_free(order); databuf = OPENSSL_malloc(data_len); |