30 static int compute_pair_key_le(
unsigned char *pair_key,
BIGNUM *pub_key,
DH *dh)
32 unsigned char be_key[128];
35 if (!key_size)
return 0;
36 memset(pair_key,0,128);
37 for (i=0;i<key_size;i++)
39 pair_key[i]=be_key[key_size-1-i];
47 static int make_cp_exchange_key(
BIGNUM *priv_key,
EVP_PKEY *pubk,
unsigned char *shared_key)
49 unsigned char dh_key [128];
78 if (key == NULL)
return 1;
91 unsigned char shared_key[32], ukm[8],crypted_key[44];
96 int key_is_ephemeral=1;
119 key_is_ephemeral = 1;
151 gkt = GOST_KEY_TRANSPORT_new();
169 if (key_is_ephemeral) {
179 *outlen = i2d_GOST_KEY_TRANSPORT(gkt,out?&out:NULL);
185 if (!key_is_ephemeral)
195 GOST_KEY_TRANSPORT_free(gkt);
198 if (key_is_ephemeral) {
204 GOST_KEY_TRANSPORT_free(gkt);
213 const unsigned char *
p = in;
215 unsigned char wrappedKey[44];
216 unsigned char sharedKey[32];
219 EVP_PKEY *eph_key=NULL, *peerkey=NULL;
228 gkt = d2i_GOST_KEY_TRANSPORT(NULL,(
const unsigned char **)&p,
284 GOST_KEY_TRANSPORT_free(gkt);
288 GOST_KEY_TRANSPORT_free(gkt);