From 7bb217aedd421fc89120baf98b719bf49c4f5fb7 Mon Sep 17 00:00:00 2001 From: Dwayne Litzenberger Date: Sun, 20 Oct 2013 17:46:14 -0700 Subject: Rename S2V -> _S2V until we come up with a real PRF API --- lib/Crypto/Cipher/blockalgo.py | 4 ++-- lib/Crypto/Protocol/KDF.py | 4 ++-- lib/Crypto/SelfTest/Protocol/test_KDF.py | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) (limited to 'lib') diff --git a/lib/Crypto/Cipher/blockalgo.py b/lib/Crypto/Cipher/blockalgo.py index 98e0e00..84b9bc3 100644 --- a/lib/Crypto/Cipher/blockalgo.py +++ b/lib/Crypto/Cipher/blockalgo.py @@ -35,7 +35,7 @@ from Crypto.Util.number import long_to_bytes, bytes_to_long import Crypto.Util.Counter from Crypto.Hash import CMAC from Crypto.Hash.CMAC import _SmoothMAC -from Crypto.Protocol.KDF import S2V +from Crypto.Protocol.KDF import _S2V from Crypto.Util import galois @@ -461,7 +461,7 @@ class BlockAlgo: # IV is optional self.nonce = _getParameter('nonce', 1, args, kwargs) - self._cipherMAC = S2V(key[:subkey_size], ciphermod=factory) + self._cipherMAC = _S2V(key[:subkey_size], ciphermod=factory) self._subkey_ctr = key[subkey_size:] self._mac_len = factory.block_size diff --git a/lib/Crypto/Protocol/KDF.py b/lib/Crypto/Protocol/KDF.py index 127be0c..c5967e4 100644 --- a/lib/Crypto/Protocol/KDF.py +++ b/lib/Crypto/Protocol/KDF.py @@ -126,7 +126,7 @@ def PBKDF2(password, salt, dkLen=16, count=1000, prf=None): i = i + 1 return key[:dkLen] -class S2V(object): +class _S2V(object): """String-to-vector PRF as defined in `RFC5297`_. This class implements a pseudorandom function family @@ -161,7 +161,7 @@ class S2V(object): ciphermod : module A block cipher module from `Crypto.Cipher`. """ - return S2V(key, ciphermod) + return _S2V(key, ciphermod) new = staticmethod(new) def _double(self, bs): diff --git a/lib/Crypto/SelfTest/Protocol/test_KDF.py b/lib/Crypto/SelfTest/Protocol/test_KDF.py index 37cfb55..de09b41 100644 --- a/lib/Crypto/SelfTest/Protocol/test_KDF.py +++ b/lib/Crypto/SelfTest/Protocol/test_KDF.py @@ -31,7 +31,7 @@ from Crypto.SelfTest.st_common import list_test_cases from Crypto.Hash import SHA1, HMAC from Crypto.Cipher import AES, DES3 -from Crypto.Protocol.KDF import PBKDF1, PBKDF2, S2V +from Crypto.Protocol.KDF import PBKDF1, PBKDF2, _S2V def t2b(t): return unhexlify(b(t)) @@ -127,7 +127,7 @@ class S2V_Tests(unittest.TestCase): def test1(self): """Verify correctness of test vector""" for tv in self._testData: - s2v = S2V.new(t2b(tv[1]), tv[3]) + s2v = _S2V.new(t2b(tv[1]), tv[3]) for s in tv[0]: s2v.update(t2b(s)) result = s2v.derive() @@ -138,7 +138,7 @@ class S2V_Tests(unittest.TestCase): components are accepted.""" key = bchr(0)*16 for module in (AES, DES3): - s2v = S2V.new(key, module) + s2v = _S2V.new(key, module) max_comps = module.block_size*8-1 for i in xrange(max_comps): s2v.update(b("XX")) -- cgit v1.2.1