diff options
-rw-r--r-- | cryptography/hazmat/primitives/kdf/pbkdf2.py | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/cryptography/hazmat/primitives/kdf/pbkdf2.py b/cryptography/hazmat/primitives/kdf/pbkdf2.py index fec1d5c2..2c8dd541 100644 --- a/cryptography/hazmat/primitives/kdf/pbkdf2.py +++ b/cryptography/hazmat/primitives/kdf/pbkdf2.py @@ -30,7 +30,7 @@ class PBKDF2HMAC(object): "{0} is not supported for PBKDF2 by this backend".format( algorithm.name) ) - self._called = False + self._used = False self.algorithm = algorithm self._length = length if isinstance(salt, six.text_type): @@ -43,10 +43,9 @@ class PBKDF2HMAC(object): self._backend = backend def derive(self, key_material): - if self._called: + if self._used: raise AlreadyFinalized("PBKDF2 instances can only be called once") - else: - self._called = True + self._used = True if isinstance(key_material, six.text_type): raise TypeError( |