summaryrefslogtreecommitdiffstats
path: root/engines/ccgost/gost2001_keyx.c
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>2007-05-18 15:55:55 +0000
committerDr. Stephen Henson <steve@openssl.org>2007-05-18 15:55:55 +0000
commitec06417d52e53cc66fbc2ffe3e45520514098cba (patch)
treea24a5e122adf2e21f7a61378b27019eb0f6c4444 /engines/ccgost/gost2001_keyx.c
parenta4346646f12f83f8058abd9d013824fb90abfe73 (diff)
Updated GOST MAC support.
Submitted by: vitus@cryptocom.ru
Diffstat (limited to 'engines/ccgost/gost2001_keyx.c')
-rw-r--r--engines/ccgost/gost2001_keyx.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/engines/ccgost/gost2001_keyx.c b/engines/ccgost/gost2001_keyx.c
index 1929dbdc68..3cef5f2e38 100644
--- a/engines/ccgost/gost2001_keyx.c
+++ b/engines/ccgost/gost2001_keyx.c
@@ -69,6 +69,7 @@ int pkey_GOST01cc_encrypt (EVP_PKEY_CTX *pctx,unsigned char *out,
struct gost_pmeth_data *data = EVP_PKEY_CTX_get_data(pctx);
GOST_KEY_TRANSPORT *gkt = NULL;
int ret=0;
+ const struct gost_cipher_info *cipher_info;
gost_ctx ctx;
EC_KEY *ephemeral=NULL;
const EC_POINT *pub_key_point=NULL;
@@ -84,7 +85,8 @@ int pkey_GOST01cc_encrypt (EVP_PKEY_CTX *pctx,unsigned char *out,
goto err;
}
/* encrypt session key */
- gost_init(&ctx, &GostR3411_94_CryptoProParamSet);
+ cipher_info = get_encryption_params(NULL);
+ gost_init(&ctx, cipher_info->sblock);
gost_key(&ctx,shared_key);
encrypt_cryptocom_key(key,key_len,encrypted_key,&ctx);
/* compute hmac of session key */
@@ -122,7 +124,7 @@ int pkey_GOST01cc_encrypt (EVP_PKEY_CTX *pctx,unsigned char *out,
goto err;
}
ASN1_OBJECT_free(gkt->key_agreement_info->cipher);
- gkt->key_agreement_info->cipher = OBJ_nid2obj(NID_id_Gost28147_89_cc);
+ gkt->key_agreement_info->cipher = OBJ_nid2obj(cipher_info->nid);
if ((*out_len = i2d_GOST_KEY_TRANSPORT(gkt,&out))>0) ret = 1;
;
err:
@@ -143,6 +145,7 @@ int pkey_GOST01cc_decrypt (EVP_PKEY_CTX *pctx, unsigned char *key, size_t *key_l
unsigned char hmac[4],hmac_comp[4];
unsigned char iv[8];
int i;
+ const struct gost_cipher_info *cipher_info;
gost_ctx ctx;
const EC_POINT *pub_key_point;
EVP_PKEY *eph_key;
@@ -178,7 +181,8 @@ int pkey_GOST01cc_decrypt (EVP_PKEY_CTX *pctx, unsigned char *key, size_t *key_l
return 0;
}
/* Decrypt session key */
- gost_init(&ctx, &GostR3411_94_CryptoProParamSet);
+ cipher_info = get_encryption_params(gkt->key_agreement_info->cipher);
+ gost_init(&ctx, cipher_info->sblock);
gost_key(&ctx,shared_key);
if (!decrypt_cryptocom_key(key,*key_len,gkt->key_info->encrypted_key->data,