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

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

Issue 210323002: Update tlslite to 0.4.6. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Executable bit and --similarity=80 Created 6 years, 8 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/asn1parser.py ('k') | third_party/tlslite/tlslite/utils/codec.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 331f72469c50373387e165f0f61e10096e207701..20e20f11003dccc12551a795c37cd0bcc384dd2f 100644
--- a/third_party/tlslite/tlslite/utils/cipherfactory.py
+++ b/third_party/tlslite/tlslite/utils/cipherfactory.py
@@ -1,30 +1,27 @@
+# Author: Trevor Perrin
+# See the LICENSE file for legal information regarding use of this file.
+
"""Factory functions for symmetric cryptography."""
import os
-import python_aes
-import python_rc4
+from tlslite.utils import python_aes
+from tlslite.utils import python_rc4
-import cryptomath
+from tlslite.utils import cryptomath
tripleDESPresent = False
if cryptomath.m2cryptoLoaded:
- import openssl_aes
- import openssl_rc4
- import openssl_tripledes
- tripleDESPresent = True
-
-if cryptomath.cryptlibpyLoaded:
- import cryptlib_aes
- import cryptlib_rc4
- import cryptlib_tripledes
+ from tlslite.utils import openssl_aes
+ from tlslite.utils import openssl_rc4
+ from tlslite.utils import openssl_tripledes
tripleDESPresent = True
if cryptomath.pycryptoLoaded:
- import pycrypto_aes
- import pycrypto_rc4
- import pycrypto_tripledes
+ from tlslite.utils import pycrypto_aes
+ from tlslite.utils import pycrypto_rc4
+ from tlslite.utils import pycrypto_tripledes
tripleDESPresent = True
# **************************************************************************
@@ -44,12 +41,10 @@ def createAES(key, IV, implList=None):
@return: An AES object.
"""
if implList == None:
- implList = ["cryptlib", "openssl", "pycrypto", "python"]
+ implList = ["openssl", "pycrypto", "python"]
for impl in implList:
- if impl == "cryptlib" and cryptomath.cryptlibpyLoaded:
- return cryptlib_aes.new(key, 2, IV)
- elif impl == "openssl" and cryptomath.m2cryptoLoaded:
+ if impl == "openssl" and cryptomath.m2cryptoLoaded:
return openssl_aes.new(key, 2, IV)
elif impl == "pycrypto" and cryptomath.pycryptoLoaded:
return pycrypto_aes.new(key, 2, IV)
@@ -70,14 +65,12 @@ def createRC4(key, IV, implList=None):
@return: An RC4 object.
"""
if implList == None:
- implList = ["cryptlib", "openssl", "pycrypto", "python"]
+ implList = ["openssl", "pycrypto", "python"]
if len(IV) != 0:
raise AssertionError()
for impl in implList:
- if impl == "cryptlib" and cryptomath.cryptlibpyLoaded:
- return cryptlib_rc4.new(key)
- elif impl == "openssl" and cryptomath.m2cryptoLoaded:
+ if impl == "openssl" and cryptomath.m2cryptoLoaded:
return openssl_rc4.new(key)
elif impl == "pycrypto" and cryptomath.pycryptoLoaded:
return pycrypto_rc4.new(key)
@@ -99,13 +92,11 @@ def createTripleDES(key, IV, implList=None):
@return: A 3DES object.
"""
if implList == None:
- implList = ["cryptlib", "openssl", "pycrypto"]
+ implList = ["openssl", "pycrypto"]
for impl in implList:
- if impl == "cryptlib" and cryptomath.cryptlibpyLoaded:
- return cryptlib_tripledes.new(key, 2, IV)
- elif impl == "openssl" and cryptomath.m2cryptoLoaded:
+ if impl == "openssl" and cryptomath.m2cryptoLoaded:
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/asn1parser.py ('k') | third_party/tlslite/tlslite/utils/codec.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698