X-Git-Url: http://www.git.cypherpunks.ru/?a=blobdiff_plain;f=pygost%2Fwrap.py;h=9deeff591f49647cc11afb19c5d8af548d5d54e0;hb=b8b853ca49a9dca40f446880fa809af51c611fe0;hp=b063fec48600f65a2f0e7bcd426587154c2cbb67;hpb=5ecaafbe1a87f9a311a18574653e6dbc75a776b9;p=pygost.git diff --git a/pygost/wrap.py b/pygost/wrap.py index b063fec..9deeff5 100644 --- a/pygost/wrap.py +++ b/pygost/wrap.py @@ -1,6 +1,6 @@ # coding: utf-8 # PyGOST -- Pure Python GOST cryptographic functions library -# Copyright (C) 2015-2019 Sergey Matveev +# Copyright (C) 2015-2022 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 @@ -18,6 +18,7 @@ :rfc:`4357` key wrapping (28147-89 and CryptoPro). """ +from hmac import compare_digest from struct import pack from struct import unpack @@ -26,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): @@ -111,3 +114,34 @@ def diversify(kek, ukm, sbox=DEFAULT_SBOX): iv = pack("