X-Git-Url: http://wagner.pp.ru/gitweb/?a=blobdiff_plain;f=gost89.c;h=593bc237257cd568594a4a5a03a69bce3d2382e2;hb=26e4388e1d5f7f2b62067442aabb72c10e66ed3e;hp=c670bb61cb6bf8eefdc7fda790882db55cc28de0;hpb=9b3fe585952cddaf6381f0ff54aa02dd1320f717;p=openssl-gost%2Fengine.git diff --git a/gost89.c b/gost89.c index c670bb6..593bc23 100644 --- a/gost89.c +++ b/gost89.c @@ -621,15 +621,18 @@ int gost_mac_iv(gost_ctx * ctx, int mac_len, const unsigned char *iv, /* Implements key meshing algorithm by modifing ctx and IV in place */ void cryptopro_key_meshing(gost_ctx * ctx, unsigned char *iv) { - unsigned char newkey[32], newiv[8]; + unsigned char newkey[32]; /* Set static keymeshing key */ /* "Decrypt" key with keymeshing key */ gost_dec(ctx, CryptoProKeyMeshingKey, newkey, 4); /* set new key */ gost_key(ctx, newkey); /* Encrypt iv with new key */ - gostcrypt(ctx, iv, newiv); - memcpy(iv, newiv, 8); + if (iv != NULL ) { + unsigned char newiv[8]; + gostcrypt(ctx, iv, newiv); + memcpy(iv, newiv, 8); + } } void acpkm_magma_key_meshing(gost_ctx * ctx)