diff options
author | Richard Levitte <richard@levitte.org> | 2016-02-17 12:32:16 +0100 |
---|---|---|
committer | Richard Levitte <richard@levitte.org> | 2016-02-17 12:32:16 +0100 |
commit | d0e97865ae0499feb63e751b4cb2478c44d93247 (patch) | |
tree | 3bd21d2d41bc275f8e7e2cf755c0990167543b26 /gost_crypt.c | |
parent | 4d14d0eb5555adec369d797cd4968c01c1e25cee (diff) | |
download | gost-engine-d0e97865ae0499feb63e751b4cb2478c44d93247.zip gost-engine-d0e97865ae0499feb63e751b4cb2478c44d93247.tar.gz gost-engine-d0e97865ae0499feb63e751b4cb2478c44d93247.tar.bz2 |
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.
Diffstat (limited to 'gost_crypt.c')
-rw-r--r-- | gost_crypt.c | 7 |
1 files changed, 6 insertions, 1 deletions
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); |