]> www.wagner.pp.ru Git - openssl-gost/engine.git/blobdiff - gost_ameth.c
Fix #67
[openssl-gost/engine.git] / gost_ameth.c
index 12ea593ed5fdb8a297b2cb96d9fc2ec148bdbd83..d53b89e89d577eab679b7602ec7e0d5158e21f76 100644 (file)
@@ -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,8 +443,6 @@ 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_format = get_gost_engine_param(GOST_PARAM_PK_FORMAT);
     if(pk_format != NULL && strcmp(pk_format, PK_WRAP_PARAM) == 0) {
         ASN1_STRING *octet = NULL;
         int priv_len = 0;