X-Git-Url: http://www.git.cypherpunks.ru/?a=blobdiff_plain;f=pygost%2Fwrap.py;h=301023eda18228d35ca1b00d2916afc30495e30a;hb=2bb1a163d32e4167e6904ff3c6b4cf64ea7287bb;hp=59f26bf773a878e419638b62377d9a5b985ce0b4;hpb=e8a28983794d026ccb59439a684dbdc363fcc8c6;p=pygost.git diff --git a/pygost/wrap.py b/pygost/wrap.py index 59f26bf..301023e 100644 --- a/pygost/wrap.py +++ b/pygost/wrap.py @@ -1,11 +1,10 @@ # coding: utf-8 # PyGOST -- Pure Python GOST cryptographic functions library -# Copyright (C) 2015-2018 Sergey Matveev +# Copyright (C) 2015-2020 Sergey Matveev # # 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 -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. +# the Free Software Foundation, version 3 of the License. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -19,6 +18,7 @@ :rfc:`4357` key wrapping (28147-89 and CryptoPro). """ +from hmac import compare_digest from struct import pack from struct import unpack @@ -27,6 +27,8 @@ from pygost.gost28147 import DEFAULT_SBOX from pygost.gost28147 import ecb_decrypt from pygost.gost28147 import ecb_encrypt from pygost.gost28147_mac import MAC +from pygost.gost3413 import ctr +from pygost.gost3413 import mac def wrap_gost(ukm, kek, cek, sbox=DEFAULT_SBOX): @@ -112,3 +114,34 @@ def diversify(kek, ukm, sbox=DEFAULT_SBOX): iv = pack("