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

Side by Side Diff: third_party/tlslite/tlslite/TLSRecordLayer.py

Issue 2881026: Replaced sha, md5 module imports with hashlib (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 4 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | third_party/tlslite/tlslite/mathtls.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 """Helper class for TLSConnection.""" 1 """Helper class for TLSConnection."""
2 from __future__ import generators 2 from __future__ import generators
3 3
4 from utils.compat import * 4 from utils.compat import *
5 from utils.cryptomath import * 5 from utils.cryptomath import *
6 from utils.cipherfactory import createAES, createRC4, createTripleDES 6 from utils.cipherfactory import createAES, createRC4, createTripleDES
7 from utils.codec import * 7 from utils.codec import *
8 from errors import * 8 from errors import *
9 from messages import * 9 from messages import *
10 from mathtls import * 10 from mathtls import *
11 from constants import * 11 from constants import *
12 from utils.cryptomath import getRandomBytes 12 from utils.cryptomath import getRandomBytes
13 from utils import hmac 13 from utils import hmac
14 from FileObject import FileObject 14 from FileObject import FileObject
15 import sha 15
16 import md5 16 # The sha module is deprecated in Python 2.6
17 try:
18 import sha
19 except ImportError:
20 from hashlib import sha1 as sha
21
22 # The md5 module is deprecated in Python 2.6
23 try:
24 import md5
25 except ImportError:
26 from hashlib import md5
27
17 import socket 28 import socket
18 import errno 29 import errno
19 import traceback 30 import traceback
20 31
21 class _ConnectionState: 32 class _ConnectionState:
22 def __init__(self): 33 def __init__(self):
23 self.macContext = None 34 self.macContext = None
24 self.encContext = None 35 self.encContext = None
25 self.seqnum = 0 36 self.seqnum = 0
26 37
(...skipping 1092 matching lines...) Expand 10 before | Expand all | Expand 10 after
1119 1130
1120 imac_md5.update(label + masterSecretStr + '\x36'*48) 1131 imac_md5.update(label + masterSecretStr + '\x36'*48)
1121 imac_sha.update(label + masterSecretStr + '\x36'*40) 1132 imac_sha.update(label + masterSecretStr + '\x36'*40)
1122 1133
1123 md5Str = md5.md5(masterSecretStr + ('\x5c'*48) + \ 1134 md5Str = md5.md5(masterSecretStr + ('\x5c'*48) + \
1124 imac_md5.digest()).digest() 1135 imac_md5.digest()).digest()
1125 shaStr = sha.sha(masterSecretStr + ('\x5c'*40) + \ 1136 shaStr = sha.sha(masterSecretStr + ('\x5c'*40) + \
1126 imac_sha.digest()).digest() 1137 imac_sha.digest()).digest()
1127 1138
1128 return stringToBytes(md5Str + shaStr) 1139 return stringToBytes(md5Str + shaStr)
OLDNEW
« no previous file with comments | « no previous file | third_party/tlslite/tlslite/mathtls.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698