]> Cypherpunks.ru repositories - pygost.git/blobdiff - pygost/kdf.py
Raise copyright years
[pygost.git] / pygost / kdf.py
index 73d716fb1e420b8fe061735ce907a216c7d12b23..345f324d9de7bcaf30974f8a95a0b8c9cb30f199 100644 (file)
@@ -1,6 +1,6 @@
 # coding: utf-8
 # PyGOST -- Pure Python GOST cryptographic functions library
-# Copyright (C) 2015-2020 Sergey Matveev <stargrave@stargrave.org>
+# Copyright (C) 2015-2021 Sergey Matveev <stargrave@stargrave.org>
 #
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -61,7 +61,7 @@ def kdf_tree_gostr3411_2012_256(key, label, seed, keys, i_len=1):
     return keymat
 
 
-def keg(curve, prv, pub, h, mode=2001):
+def keg(curve, prv, pub, h):
     """Export key generation (Р 1323565.1.020-2018)
 
     :param GOST3410Curve curve: curve to use
@@ -75,7 +75,7 @@ def keg(curve, prv, pub, h, mode=2001):
     ukm = bytes2long(h[:16])
     if ukm == 0:
         ukm = 1
-    if mode == 2012:
+    if curve.point_size == 64:
         return kek_34102012512(curve, prv, pub, ukm)
-    k_exp = kek_34102012256(curve, prv, pub, ukm, mode=2001)
+    k_exp = kek_34102012256(curve, prv, pub, ukm)
     return b"".join(kdf_tree_gostr3411_2012_256(k_exp, b"kdf tree", h[16:24], 2))