From: Richard Levitte Date: Wed, 17 Feb 2016 11:32:16 +0000 (+0100) Subject: Get ASN.1 IV using public functions X-Git-Tag: v1.1.0.2~29^2~1 X-Git-Url: http://wagner.pp.ru/gitweb/?a=commitdiff_plain;h=d0e97865ae0499feb63e751b4cb2478c44d93247;p=openssl-gost%2Fengine.git Get ASN.1 IV using public functions The function EVP_CIPHER_get_asn1_iv(), which is the default get_asn1_params implementation, can be used to set the "original IV". No need to reach into the inside of EVP_CIPHER_CTX, which makes it much more future proof. --- diff --git a/gost_crypt.c b/gost_crypt.c index 259939d..8132a1e 100644 --- a/gost_crypt.c +++ b/gost_crypt.c @@ -649,7 +649,12 @@ int gost89_get_asn1_parameters(EVP_CIPHER_CTX *ctx, ASN1_TYPE *params) GOST_CIPHER_PARAMS_free(gcp); return -1; } - memcpy(ctx->oiv, gcp->iv->data, len); + + { + ASN1_TYPE tmp; + ASN1_TYPE_set(&tmp, V_ASN1_OCTET_STRING, gcp->iv); + EVP_CIPHER_get_asn1_iv(ctx, &tmp); + } GOST_CIPHER_PARAMS_free(gcp);