KBKDF cleanup (#2929)
* unicode characters make everything angry
* changelog entry and make skip msgs more informative
* typo fix
diff --git a/CHANGELOG.rst b/CHANGELOG.rst
index 1ac1297..00a0a01 100644
--- a/CHANGELOG.rst
+++ b/CHANGELOG.rst
@@ -8,6 +8,7 @@
* Support for OpenSSL 0.9.8 has been removed. Users on older version of OpenSSL
will need to upgrade.
+* Added :class:`~cryptography.hazmat.primitives.kdf.kbkdf.KBKDFHMAC`.
1.3.2 - 2016-05-04
~~~~~~~~~~~~~~~~~~
diff --git a/src/cryptography/hazmat/primitives/kdf/kbkdf.py b/src/cryptography/hazmat/primitives/kdf/kbkdf.py
index 70a0fdc..29ac0fa 100644
--- a/src/cryptography/hazmat/primitives/kdf/kbkdf.py
+++ b/src/cryptography/hazmat/primitives/kdf/kbkdf.py
@@ -112,7 +112,7 @@
output = [b'']
# For counter mode, the number of iterations shall not be
- # larger than 2^r-1, where r ≤ 32 is the binary length of the counter
+ # larger than 2^r-1, where r <= 32 is the binary length of the counter
# This ensures that the counter values used as an input to the
# PRF will not repeat during a particular call to the KDF function.
r_bin = utils.int_to_bytes(1, self._rlen)
diff --git a/tests/hazmat/primitives/utils.py b/tests/hazmat/primitives/utils.py
index e45466d..8705cdc 100644
--- a/tests/hazmat/primitives/utils.py
+++ b/tests/hazmat/primitives/utils.py
@@ -391,19 +391,21 @@
'hmac_sha512': hashes.SHA512,
}
- supportd_counter_locations = {
+ supported_counter_locations = {
"before_fixed": CounterLocation.BeforeFixed,
"after_fixed": CounterLocation.AfterFixed,
}
algorithm = supported_algorithms.get(params.get('prf'))
if algorithm is None or not backend.hmac_supported(algorithm()):
- pytest.skip('Does not support algorithm')
+ pytest.skip("KBKDF does not support algorithm: {0}".format(
+ params.get('prf')
+ ))
- ctr_loc = supportd_counter_locations.get(params.get("ctrlocation"))
+ ctr_loc = supported_counter_locations.get(params.get("ctrlocation"))
if ctr_loc is None or not isinstance(ctr_loc, CounterLocation):
- pytest.skip("Does not support counter location".format(
- location=params.get('ctrlocation')
+ pytest.skip("Does not support counter location: {0}".format(
+ params.get('ctrlocation')
))
ctrkdf = KBKDFHMAC(