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

Unified Diff: third_party/tlslite/tlslite/utils/pycrypto_aes.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/pem.py ('k') | third_party/tlslite/tlslite/utils/pycrypto_rc4.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/tlslite/tlslite/utils/pycrypto_aes.py
diff --git a/third_party/tlslite/tlslite/utils/pycrypto_aes.py b/third_party/tlslite/tlslite/utils/pycrypto_aes.py
index a44094185e21d04cad46529385a8679dcef84568..b3425c047d7b3b78d7fb396baeeae47ceafea46a 100644
--- a/third_party/tlslite/tlslite/utils/pycrypto_aes.py
+++ b/third_party/tlslite/tlslite/utils/pycrypto_aes.py
@@ -1,7 +1,10 @@
+# Author: Trevor Perrin
+# See the LICENSE file for legal information regarding use of this file.
+
"""PyCrypto AES implementation."""
-from cryptomath import *
-from aes import *
+from .cryptomath import *
+from .aes import *
if pycryptoLoaded:
import Crypto.Cipher.AES
@@ -13,10 +16,14 @@ if pycryptoLoaded:
def __init__(self, key, mode, IV):
AES.__init__(self, key, mode, IV, "pycrypto")
+ key = bytes(key)
+ IV = bytes(IV)
self.context = Crypto.Cipher.AES.new(key, mode, IV)
def encrypt(self, plaintext):
- return self.context.encrypt(plaintext)
+ plaintext = bytes(plaintext)
+ return bytearray(self.context.encrypt(plaintext))
def decrypt(self, ciphertext):
- return self.context.decrypt(ciphertext)
+ ciphertext = bytes(ciphertext)
+ return bytearray(self.context.decrypt(ciphertext))
« no previous file with comments | « third_party/tlslite/tlslite/utils/pem.py ('k') | third_party/tlslite/tlslite/utils/pycrypto_rc4.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698