aboutsummaryrefslogtreecommitdiffstats
path: root/cryptography
diff options
context:
space:
mode:
authorPaul Kehrer <paul.l.kehrer@gmail.com>2013-09-10 22:15:00 -0500
committerPaul Kehrer <paul.l.kehrer@gmail.com>2013-09-10 22:15:00 -0500
commitc507412ec09e6fa502fbd8587824901e1cf9a935 (patch)
tree0154752c7457233ad5de47f99ddeeb4f127b9c05 /cryptography
parent6f412a0fc35386ad980c5b3fa2bdb3c90436f3b6 (diff)
downloadcryptography-c507412ec09e6fa502fbd8587824901e1cf9a935.tar.gz
cryptography-c507412ec09e6fa502fbd8587824901e1cf9a935.tar.bz2
cryptography-c507412ec09e6fa502fbd8587824901e1cf9a935.zip
change OFB iv to nonce to reflect dstufft nomenclature pitch
* Namely, we should try to call things IV if reuse leaks a small amount of data and nonce if reuse can result in a complete break. This can be somewhat ambiguous, but we'll track in #58
Diffstat (limited to 'cryptography')
-rw-r--r--cryptography/bindings/openssl/api.py2
-rw-r--r--cryptography/primitives/block/modes.py6
-rw-r--r--cryptography/primitives/interfaces.py4
3 files changed, 9 insertions, 3 deletions
diff --git a/cryptography/bindings/openssl/api.py b/cryptography/bindings/openssl/api.py
index 917c1846..af7fe438 100644
--- a/cryptography/bindings/openssl/api.py
+++ b/cryptography/bindings/openssl/api.py
@@ -76,6 +76,8 @@ class API(object):
assert evp_cipher != self._ffi.NULL
if isinstance(mode, interfaces.ModeWithInitializationVector):
iv_nonce = mode.initialization_vector
+ elif isinstance(mode, interfaces.ModeWithNonce):
+ iv_nonce = mode.nonce
else:
iv_nonce = self._ffi.NULL
diff --git a/cryptography/primitives/block/modes.py b/cryptography/primitives/block/modes.py
index 70ef8178..62a1c2c9 100644
--- a/cryptography/primitives/block/modes.py
+++ b/cryptography/primitives/block/modes.py
@@ -31,10 +31,10 @@ class ECB(object):
class OFB(object):
name = "OFB"
- def __init__(self, initialization_vector):
+ def __init__(self, nonce):
super(OFB, self).__init__()
- self.initialization_vector = initialization_vector
+ self.nonce = nonce
interfaces.ModeWithInitializationVector.register(CBC)
-interfaces.ModeWithInitializationVector.register(OFB)
+interfaces.ModeWithNonce.register(OFB)
diff --git a/cryptography/primitives/interfaces.py b/cryptography/primitives/interfaces.py
index 6f74ccf7..c1fc9910 100644
--- a/cryptography/primitives/interfaces.py
+++ b/cryptography/primitives/interfaces.py
@@ -20,3 +20,7 @@ import six
class ModeWithInitializationVector(six.with_metaclass(abc.ABCMeta)):
pass
+
+
+class ModeWithNonce(six.with_metaclass(abc.ABCMeta)):
+ pass