X-Git-Url: http://wagner.pp.ru/gitweb/?a=blobdiff_plain;f=gost_ameth.c;h=d53b89e89d577eab679b7602ec7e0d5158e21f76;hb=28314b3bcf3f6111a51b42c0168eaa30a938a40d;hp=437362c4b1fd0735e5bea33ddba49e31c9eb5231;hpb=82d1ac30943cbe9223f024466404e7be720379b6;p=openssl-gost%2Fengine.git diff --git a/gost_ameth.c b/gost_ameth.c index 437362c..d53b89e 100644 --- a/gost_ameth.c +++ b/gost_ameth.c @@ -181,7 +181,7 @@ static int gost_set_priv_key(EVP_PKEY *pkey, BIGNUM *priv) if (!EC_KEY_set_private_key(ec, priv)) return 0; if (!EVP_PKEY_missing_parameters(pkey)) - gost_ec_compute_public(ec); + return gost_ec_compute_public(ec); break; } default: @@ -419,6 +419,8 @@ static int priv_encode_gost(PKCS8_PRIV_KEY_INFO *p8, const EVP_PKEY *pk) ASN1_STRING *params = encode_gost_algor_params(pk); unsigned char *buf = NULL; int key_len = pkey_bits_gost(pk), i = 0; + /* unmasked private key */ + const char *pk_format = get_gost_engine_param(GOST_PARAM_PK_FORMAT); if (!params) { return 0; @@ -441,9 +443,7 @@ static int priv_encode_gost(PKCS8_PRIV_KEY_INFO *p8, const EVP_PKEY *pk) buf[key_len - 1 - i] = tmp; } - /* unmasked private key */ - const char *pk_param = get_gost_engine_param(GOST_PARAM_PK_PARAMS); - if(pk_param != NULL && strcmp(pk_param, PK_WRAP_PARAM) == 0) { + if(pk_format != NULL && strcmp(pk_format, PK_WRAP_PARAM) == 0) { ASN1_STRING *octet = NULL; int priv_len = 0; unsigned char *priv_buf = NULL;