]> wagner.pp.ru Git - openssl-gost/engine.git/commitdiff
Try to fix segfault
authorDmitry Belyavskiy <beldmit@gmail.com>
Wed, 30 Mar 2016 18:02:54 +0000 (21:02 +0300)
committerDmitry Belyavskiy <beldmit@gmail.com>
Wed, 30 Mar 2016 18:02:54 +0000 (21:02 +0300)
gost_crypt.c

index b9385a16517f61d40bd9d9e10938268abdd729e3..59d75d788a5493fb1c9d2c6d624f8085d2691a0b 100644 (file)
@@ -696,15 +696,10 @@ int gost89_get_asn1_parameters(EVP_CIPHER_CTX *ctx, ASN1_TYPE *params)
     }
 
     {
-        ASN1_TYPE *tmp = ASN1_TYPE_new();
-        if (tmp == NULL) {
-            GOST_CIPHER_PARAMS_free(gcp);
-            GOSTerr(GOST_F_GOST89_GET_ASN1_PARAMETERS, ERR_R_MALLOC_FAILURE);
-            return -1;
-        }
-        ASN1_TYPE_set(tmp, V_ASN1_OCTET_STRING, gcp->iv);
-        EVP_CIPHER_get_asn1_iv(ctx, tmp);
-        ASN1_TYPE_free(tmp);
+        ASN1_TYPE tmp;
+        tmp.value.octet_string = gcp->iv;
+        tmp.type = V_ASN1_OCTET_STRING;
+        EVP_CIPHER_get_asn1_iv(ctx, &tmp);
     }
 
     GOST_CIPHER_PARAMS_free(gcp);