]> wagner.pp.ru Git - openssl-gost/engine.git/blobdiff - gost_ec_keyx.c
Errors adjusted
[openssl-gost/engine.git] / gost_ec_keyx.c
index 409d8e19e07a480c2bb545fe4cdc12b3d62589c0..79e9a851dc47b33990c1bda328bdf489a6b2e8ee 100644 (file)
@@ -56,7 +56,7 @@ static int VKO_compute_key(unsigned char *shared_key, size_t shared_key_size,
         GOSTerr(GOST_F_VKO_COMPUTE_KEY, GOST_R_ERROR_POINT_MUL);
         goto err;
     }
-    EC_POINT_get_affine_coordinates_GFp(EC_KEY_get0_group(priv_key),
+    EC_POINT_get_affine_coordinates(EC_KEY_get0_group(priv_key),
                                         pnt, X, Y, ctx);
 
     half_len = BN_num_bytes(order);
@@ -553,7 +553,7 @@ static int pkey_gost2018_decrypt(EVP_PKEY_CTX *pctx, unsigned char *key,
     int ret = 0;
     unsigned char expkeys[64];
     EVP_PKEY *eph_key = NULL;
-    int pkey_nid = EVP_PKEY_base_id(eph_key);
+    int pkey_nid = EVP_PKEY_base_id(priv);
     int mac_nid = NID_undef;
     int iv_len = 0;
 
@@ -584,7 +584,17 @@ static int pkey_gost2018_decrypt(EVP_PKEY_CTX *pctx, unsigned char *key,
     }
 
     eph_key = X509_PUBKEY_get(pst->ephem_key);
+/*
+ * TODO beldmit
+   1.  Checks the next three conditions fulfilling and terminates the
+   connection with fatal error if not.
+
+   o  Q_eph is on the same curve as server public key;
+
+   o  Q_eph is not equal to zero point;
 
+   o  q * Q_eph is not equal to zero point.
+*/
     if (gost_keg(data->shared_ukm, pkey_nid,
                  EC_KEY_get0_public_key(EVP_PKEY_get0(eph_key)),
                  EVP_PKEY_get0(priv), expkeys) <= 0) {
@@ -597,7 +607,7 @@ static int pkey_gost2018_decrypt(EVP_PKEY_CTX *pctx, unsigned char *key,
                     ASN1_STRING_length(pst->psexp), data->cipher_nid,
                     expkeys + 32, mac_nid, expkeys + 0, data->shared_ukm + 24,
                     iv_len, key) <= 0) {
-        GOSTerr(GOST_F_PKEY_GOST2018_DECRYPT, GOST_R_CANNOT_PACK_EPHEMERAL_KEY);
+        GOSTerr(GOST_F_PKEY_GOST2018_DECRYPT, GOST_R_CANNOT_UNPACK_EPHEMERAL_KEY);
         goto err;
     }