Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(153)

Unified Diff: third_party/tlslite/tlslite/utils/cipherfactory.py

Issue 875683002: Implement AES-GCM in tlslite. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/tlslite/tlslite/utils/aesgcm.py ('k') | third_party/tlslite/tlslite/utils/pycrypto_aesgcm.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"]
+
+ 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()
« no previous file with comments | « third_party/tlslite/tlslite/utils/aesgcm.py ('k') | third_party/tlslite/tlslite/utils/pycrypto_aesgcm.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698