diff options
author | Donald Stufft <donald@stufft.io> | 2013-09-10 20:24:20 -0700 |
---|---|---|
committer | Donald Stufft <donald@stufft.io> | 2013-09-10 20:24:20 -0700 |
commit | 9287c2344c6c91ad838a251d3b6fde2a6ea88b56 (patch) | |
tree | ee0d0161e0b8856385e0762653f610b2f36bc851 /cryptography | |
parent | a672bbe6226648c68cdb628b5b7d67f2e8270698 (diff) | |
parent | c507412ec09e6fa502fbd8587824901e1cf9a935 (diff) | |
download | cryptography-9287c2344c6c91ad838a251d3b6fde2a6ea88b56.tar.gz cryptography-9287c2344c6c91ad838a251d3b6fde2a6ea88b56.tar.bz2 cryptography-9287c2344c6c91ad838a251d3b6fde2a6ea88b56.zip |
Merge pull request #57 from reaperhulk/ofb-support
Output feedback mode support + test vectors (aes)
Diffstat (limited to 'cryptography')
-rw-r--r-- | cryptography/bindings/openssl/api.py | 2 | ||||
-rw-r--r-- | cryptography/primitives/block/modes.py | 9 | ||||
-rw-r--r-- | cryptography/primitives/interfaces.py | 4 |
3 files changed, 15 insertions, 0 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 c722e739..62a1c2c9 100644 --- a/cryptography/primitives/block/modes.py +++ b/cryptography/primitives/block/modes.py @@ -28,4 +28,13 @@ class ECB(object): name = "ECB" +class OFB(object): + name = "OFB" + + def __init__(self, nonce): + super(OFB, self).__init__() + self.nonce = nonce + + interfaces.ModeWithInitializationVector.register(CBC) +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 |