diff options
Diffstat (limited to 'openssl/engines/ccgost')
-rw-r--r-- | openssl/engines/ccgost/gost94_keyx.c | 2 | ||||
-rw-r--r-- | openssl/engines/ccgost/gost_ameth.c | 2 | ||||
-rw-r--r-- | openssl/engines/ccgost/gost_crypt.c | 6 |
3 files changed, 6 insertions, 4 deletions
diff --git a/openssl/engines/ccgost/gost94_keyx.c b/openssl/engines/ccgost/gost94_keyx.c index a183edbe8..624be586a 100644 --- a/openssl/engines/ccgost/gost94_keyx.c +++ b/openssl/engines/ccgost/gost94_keyx.c @@ -177,7 +177,7 @@ int pkey_GOST94cp_encrypt(EVP_PKEY_CTX *ctx, unsigned char *out, size_t *outlen, ASN1_OBJECT_free(gkt->key_agreement_info->cipher); gkt->key_agreement_info->cipher = OBJ_nid2obj(param->nid); *outlen = i2d_GOST_KEY_TRANSPORT(gkt,out?&out:NULL); - if (*outlen == 0) + if (*outlen <= 0) { GOSTerr(GOST_F_PKEY_GOST94CP_ENCRYPT,GOST_R_ERROR_PACKING_KEY_TRANSPORT_INFO); goto err; diff --git a/openssl/engines/ccgost/gost_ameth.c b/openssl/engines/ccgost/gost_ameth.c index 16a99ac2b..f620a216c 100644 --- a/openssl/engines/ccgost/gost_ameth.c +++ b/openssl/engines/ccgost/gost_ameth.c @@ -801,7 +801,7 @@ static int mac_ctrl_gost(EVP_PKEY *pkey, int op, long arg1, void *arg2) switch (op) { case ASN1_PKEY_CTRL_DEFAULT_MD_NID: - *(int *)arg2 = NID_undef; + *(int *)arg2 = NID_id_Gost28147_89_MAC; return 2; } return -2; diff --git a/openssl/engines/ccgost/gost_crypt.c b/openssl/engines/ccgost/gost_crypt.c index eb11f0e32..4977d1dcf 100644 --- a/openssl/engines/ccgost/gost_crypt.c +++ b/openssl/engines/ccgost/gost_crypt.c @@ -299,7 +299,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 (!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]; @@ -459,13 +459,15 @@ int gost89_get_asn1_parameters(EVP_CIPHER_CTX *ctx,ASN1_TYPE *params) 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); |