Chromium Code Reviews| Index: third_party/tlslite/tlslite/utils/cipherfactory.py |
| diff --git a/third_party/tlslite/tlslite/utils/cipherfactory.py b/third_party/tlslite/tlslite/utils/cipherfactory.py |
| index 20e20f11003dccc12551a795c37cd0bcc384dd2f..d52564413fccd29fa1a3d0981f7d0167b7fbb357 100644 |
| --- a/third_party/tlslite/tlslite/utils/cipherfactory.py |
| +++ b/third_party/tlslite/tlslite/utils/cipherfactory.py |
| @@ -6,6 +6,7 @@ |
| import os |
| from tlslite.utils import python_aes |
| +from tlslite.utils import python_aesgcm |
| from tlslite.utils import python_rc4 |
| from tlslite.utils import cryptomath |
| @@ -20,6 +21,7 @@ if cryptomath.m2cryptoLoaded: |
| if cryptomath.pycryptoLoaded: |
| from tlslite.utils import pycrypto_aes |
| + from tlslite.utils import pycrypto_aesgcm |
| from tlslite.utils import pycrypto_rc4 |
| from tlslite.utils import pycrypto_tripledes |
| tripleDESPresent = True |
| @@ -52,6 +54,25 @@ def createAES(key, IV, implList=None): |
| return python_aes.new(key, 2, IV) |
| raise NotImplementedError() |
| +def createAESGCM(key, implList=None): |
| + """Create a new AESGCM object. |
| + |
| + @type key: bytearray |
| + @param key: A 16 or 32 byte byte array. |
| + |
| + @rtype: L{tlslite.utils.AESGCM} |
| + @return: An AESGCM object. |
| + """ |
| + if implList == None: |
| + implList = ["pycrypto", "python"] |
|
davidben
2015/01/25 02:43:41
"openssl", or rather, M2Crypto is intentionally om
|
| + |
| + for impl in implList: |
| + if impl == "pycrypto" and cryptomath.pycryptoLoaded: |
| + return pycrypto_aesgcm.new(key) |
| + if impl == "python": |
| + return python_aesgcm.new(key) |
| + raise NotImplementedError() |
| + |
| def createRC4(key, IV, implList=None): |
| """Create a new RC4 object. |
| @@ -99,4 +120,4 @@ def createTripleDES(key, IV, implList=None): |
| return openssl_tripledes.new(key, 2, IV) |
| elif impl == "pycrypto" and cryptomath.pycryptoLoaded: |
| return pycrypto_tripledes.new(key, 2, IV) |
| - raise NotImplementedError() |
| + raise NotImplementedError() |