* Requires OpenSSL 0.9.9 for compilation *
**********************************************************************/
#include <string.h>
+#include <openssl/crypto.h>
#include "gost89.h"
#include <openssl/rand.h>
#include "e_gost_err.h"
NID_id_Gost28147_89,
1,/*block_size*/
32,/*key_size*/
- 8,/*iv_len - ñèíõðîïîñûëêà*/
+ 8,/*iv_len */
EVP_CIPH_CFB_MODE| EVP_CIPH_NO_PADDING |
EVP_CIPH_CUSTOM_IV| EVP_CIPH_RAND_KEY | EVP_CIPH_ALWAYS_CALL_INIT,
gost_cipher_init,
NID_gost89_cnt,
1,/*block_size*/
32,/*key_size*/
- 8,/*iv_len - ñèíõðîïîñûëêà*/
+ 8,/*iv_len */
EVP_CIPH_OFB_MODE| EVP_CIPH_NO_PADDING |
EVP_CIPH_CUSTOM_IV| EVP_CIPH_RAND_KEY | EVP_CIPH_ALWAYS_CALL_INIT,
gost_cipher_init_cpa,
if (i<inl)
{
gost_crypt_mesh(ctx->cipher_data,ctx->iv,ctx->buf);
- if (!ctx->encrypt) memcpy(ctx->buf+8,in_ptr,j);
+ if (!ctx->encrypt) memcpy(ctx->buf+8,in_ptr,inl-i);
for (j=0;i<inl;j++,i++)
{
out_ptr[j]=ctx->buf[j]^in_ptr[j];
/* Cleaning up of EVP_CIPHER_CTX */
int gost_cipher_cleanup(EVP_CIPHER_CTX *ctx)
{
- gost_destroy((gost_ctx *)ctx->cipher_data);
+ gost_destroy(&((struct ossl_gost_cipher_ctx *)ctx->cipher_data)->cctx);
ctx->app_data = NULL;
return 1;
}
int ret = -1;
int len;
GOST_CIPHER_PARAMS *gcp = NULL;
- unsigned char *p = params->value.sequence->data;
+ unsigned char *p;
struct ossl_gost_cipher_ctx *c=ctx->cipher_data;
if (ASN1_TYPE_get(params) != V_ASN1_SEQUENCE)
{
return ret;
}
+ p = params->value.sequence->data;
+
gcp = d2i_GOST_CIPHER_PARAMS(NULL, (const unsigned char **)&p,
params->value.sequence->length);
int gost_imit_init_cpa(EVP_MD_CTX *ctx)
{
struct ossl_gost_imit_ctx *c = ctx->md_data;
- memset(c->buffer,0,16);
+ memset(c->buffer,0,sizeof(c->buffer));
+ memset(c->partial_block,0,sizeof(c->partial_block));
c->count = 0;
c->bytes_left=0;
c->key_meshing=1;