summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Matveev <stargrave@stargrave.org>2018-04-29 23:52:26 +0300
committerSergey Matveev <stargrave@stargrave.org>2018-12-09 13:01:00 +0300
commit4deec9f06b1b54b1cbf4027a49976fcbd4e20e57 (patch)
tree8c1b7f9a845f77e88f9c16efc193dcc602efeb04
parent212bb9852fd66cf0b1ac054ed36408fd29752c62 (diff)
downloadpygost-4deec9f06b1b54b1cbf4027a49976fcbd4e20e57.tar.xz
34.13-2015 does not require double blocksized IVs
-rw-r--r--NEWS1
-rw-r--r--pygost/gost3413.py20
-rw-r--r--www.texi1
3 files changed, 12 insertions, 10 deletions
diff --git a/NEWS b/NEWS
index 6feb6b8..a0ea75b 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,6 @@
3.8:
* 34.11-2012 based PBKDF2 function added
+ * 34.13-2015 does not require double blocksized IVs
3.7:
Fixed 34.13-2015 OFB bug with IVs longer than 2 blocks.
diff --git a/pygost/gost3413.py b/pygost/gost3413.py
index 5be6bc8..a350915 100644
--- a/pygost/gost3413.py
+++ b/pygost/gost3413.py
@@ -128,11 +128,11 @@ def ofb(encrypter, bs, data, iv):
:param encrypter: Encrypting function, that takes block as an input
:param int bs: cipher's blocksize
:param bytes data: plaintext/ciphertext
- :param bytes iv: double blocksize-sized initialization vector
+ :param bytes iv: blocksize-sized initialization vector
For decryption you use the same function again.
"""
- if len(iv) < 2 * bs or len(iv) % bs != 0:
+ if len(iv) < bs or len(iv) % bs != 0:
raise ValueError("Invalid IV size")
r = [iv[i:i + bs] for i in range(0, len(iv), bs)]
result = []
@@ -148,11 +148,11 @@ def cbc_encrypt(encrypter, bs, pt, iv):
:param encrypter: Encrypting function, that takes block as an input
:param int bs: cipher's blocksize
:param bytes pt: already padded plaintext
- :param bytes iv: double blocksize-sized initialization vector
+ :param bytes iv: blocksize-sized initialization vector
"""
if not pt or len(pt) % bs != 0:
raise ValueError("Plaintext is not blocksize aligned")
- if len(iv) < 2 * bs or len(iv) % bs != 0:
+ if len(iv) < bs or len(iv) % bs != 0:
raise ValueError("Invalid IV size")
r = [iv[i:i + bs] for i in range(0, len(iv), bs)]
ct = []
@@ -168,11 +168,11 @@ def cbc_decrypt(decrypter, bs, ct, iv):
:param decrypter: Decrypting function, that takes block as an input
:param int bs: cipher's blocksize
:param bytes ct: ciphertext
- :param bytes iv: double blocksize-sized initialization vector
+ :param bytes iv: blocksize-sized initialization vector
"""
if not ct or len(ct) % bs != 0:
raise ValueError("Ciphertext is not blocksize aligned")
- if len(iv) < 2 * bs or len(iv) % bs != 0:
+ if len(iv) < bs or len(iv) % bs != 0:
raise ValueError("Invalid IV size")
r = [iv[i:i + bs] for i in range(0, len(iv), bs)]
pt = []
@@ -189,9 +189,9 @@ def cfb_encrypt(encrypter, bs, pt, iv):
:param encrypter: Encrypting function, that takes block as an input
:param int bs: cipher's blocksize
:param bytes pt: plaintext
- :param bytes iv: double blocksize-sized initialization vector
+ :param bytes iv: blocksize-sized initialization vector
"""
- if len(iv) < 2 * bs or len(iv) % bs != 0:
+ if len(iv) < bs or len(iv) % bs != 0:
raise ValueError("Invalid IV size")
r = [iv[i:i + bs] for i in range(0, len(iv), bs)]
ct = []
@@ -207,9 +207,9 @@ def cfb_decrypt(encrypter, bs, ct, iv):
:param encrypter: Encrypting function, that takes block as an input
:param int bs: cipher's blocksize
:param bytes ct: ciphertext
- :param bytes iv: double blocksize-sized initialization vector
+ :param bytes iv: blocksize-sized initialization vector
"""
- if len(iv) < 2 * bs or len(iv) % bs != 0:
+ if len(iv) < bs or len(iv) % bs != 0:
raise ValueError("Invalid IV size")
r = [iv[i:i + bs] for i in range(0, len(iv), bs)]
pt = []
diff --git a/www.texi b/www.texi
index 93c27ca..5d2e8ed 100644
--- a/www.texi
+++ b/www.texi
@@ -94,6 +94,7 @@ mailing list. Announcements also go to this mailing list.
@item 3.8
@itemize
@item 34.11-2012 based PBKDF2 function added
+ @item 34.13-2015 does not require double blocksized IVs
@end itemize
@item 3.7