projects
/
openssl.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
PR: 2586
[openssl.git]
/
engines
/
ccgost
/
gost_crypt.c
diff --git
a/engines/ccgost/gost_crypt.c
b/engines/ccgost/gost_crypt.c
index 39bb6964469b203e8a426aa9ae3030d11a71888c..565146aad5146b4c1ce99f671848f8fc4d032c13 100644
(file)
--- a/
engines/ccgost/gost_crypt.c
+++ b/
engines/ccgost/gost_crypt.c
@@
-7,6
+7,7
@@
* Requires OpenSSL 0.9.9 for compilation *
**********************************************************************/
#include <string.h>
* 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"
#include "gost89.h"
#include <openssl/rand.h>
#include "e_gost_err.h"
@@
-34,7
+35,7
@@
EVP_CIPHER cipher_gost =
NID_id_Gost28147_89,
1,/*block_size*/
32,/*key_size*/
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,
EVP_CIPH_CFB_MODE| EVP_CIPH_NO_PADDING |
EVP_CIPH_CUSTOM_IV| EVP_CIPH_RAND_KEY | EVP_CIPH_ALWAYS_CALL_INIT,
gost_cipher_init,
@@
-52,7
+53,7
@@
EVP_CIPHER cipher_gost_cpacnt =
NID_gost89_cnt,
1,/*block_size*/
32,/*key_size*/
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,
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,
@@
-299,7
+300,7
@@
int gost_cipher_do_cfb(EVP_CIPHER_CTX *ctx, unsigned char *out,
if (i<inl)
{
gost_crypt_mesh(ctx->cipher_data,ctx->iv,ctx->buf);
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];
for (j=0;i<inl;j++,i++)
{
out_ptr[j]=ctx->buf[j]^in_ptr[j];
@@
-371,7
+372,7
@@
static int gost_cipher_do_cnt(EVP_CIPHER_CTX *ctx, unsigned char *out,
/* Cleaning up of EVP_CIPHER_CTX */
int gost_cipher_cleanup(EVP_CIPHER_CTX *ctx)
{
/* 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;
}
ctx->app_data = NULL;
return 1;
}
@@
-459,13
+460,15
@@
int gost89_get_asn1_parameters(EVP_CIPHER_CTX *ctx,ASN1_TYPE *params)
int ret = -1;
int len;
GOST_CIPHER_PARAMS *gcp = NULL;
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;
}
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);
gcp = d2i_GOST_CIPHER_PARAMS(NULL, (const unsigned char **)&p,
params->value.sequence->length);
@@
-493,7
+496,8
@@
int gost89_get_asn1_parameters(EVP_CIPHER_CTX *ctx,ASN1_TYPE *params)
int gost_imit_init_cpa(EVP_MD_CTX *ctx)
{
struct ossl_gost_imit_ctx *c = ctx->md_data;
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;
c->count = 0;
c->bytes_left=0;
c->key_meshing=1;