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

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

Issue 858373002: Update third_party/tlslite to 0.4.8. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Finish fixing client auth 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 unified diff | Download patch
OLDNEW
1 # Authors: 1 # Authors:
2 # Trevor Perrin 2 # Trevor Perrin
3 # Google (adapted by Sam Rushing) - NPN support 3 # Google (adapted by Sam Rushing) - NPN support
4 # Martin von Loewis - python 3 port 4 # Martin von Loewis - python 3 port
5 # Yngve Pettersen (ported by Paul Sokolovsky) - TLS 1.2
5 # 6 #
6 # See the LICENSE file for legal information regarding use of this file. 7 # See the LICENSE file for legal information regarding use of this file.
7 8
8 """Helper class for TLSConnection.""" 9 """Helper class for TLSConnection."""
9 from __future__ import generators 10 from __future__ import generators
10 11
11 from .utils.compat import * 12 from .utils.compat import *
12 from .utils.cryptomath import * 13 from .utils.cryptomath import *
13 from .utils.cipherfactory import createAES, createRC4, createTripleDES 14 from .utils.cipherfactory import createAES, createRC4, createTripleDES
14 from .utils.codec import * 15 from .utils.codec import *
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 self._client = None 110 self._client = None
110 111
111 #Buffers for processing messages 112 #Buffers for processing messages
112 self._handshakeBuffer = [] 113 self._handshakeBuffer = []
113 self.clearReadBuffer() 114 self.clearReadBuffer()
114 self.clearWriteBuffer() 115 self.clearWriteBuffer()
115 116
116 #Handshake digests 117 #Handshake digests
117 self._handshake_md5 = hashlib.md5() 118 self._handshake_md5 = hashlib.md5()
118 self._handshake_sha = hashlib.sha1() 119 self._handshake_sha = hashlib.sha1()
120 self._handshake_sha256 = hashlib.sha256()
119 121
120 #TLS Protocol Version 122 #TLS Protocol Version
121 self.version = (0,0) #read-only 123 self.version = (0,0) #read-only
122 self._versionCheck = False #Once we choose a version, this is True 124 self._versionCheck = False #Once we choose a version, this is True
123 125
124 #Current and Pending connection states 126 #Current and Pending connection states
125 self._writeState = _ConnectionState() 127 self._writeState = _ConnectionState()
126 self._readState = _ConnectionState() 128 self._readState = _ConnectionState()
127 self._pendingWriteState = _ConnectionState() 129 self._pendingWriteState = _ConnectionState()
128 self._pendingReadState = _ConnectionState() 130 self._pendingReadState = _ConnectionState()
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 raise 371 raise
370 except: 372 except:
371 self._shutdown(False) 373 self._shutdown(False)
372 raise 374 raise
373 375
374 def getVersionName(self): 376 def getVersionName(self):
375 """Get the name of this TLS version. 377 """Get the name of this TLS version.
376 378
377 @rtype: str 379 @rtype: str
378 @return: The name of the TLS version used with this connection. 380 @return: The name of the TLS version used with this connection.
379 Either None, 'SSL 3.0', 'TLS 1.0', or 'TLS 1.1'. 381 Either None, 'SSL 3.0', 'TLS 1.0', 'TLS 1.1', or 'TLS 1.2'.
380 """ 382 """
381 if self.version == (3,0): 383 if self.version == (3,0):
382 return "SSL 3.0" 384 return "SSL 3.0"
383 elif self.version == (3,1): 385 elif self.version == (3,1):
384 return "TLS 1.0" 386 return "TLS 1.0"
385 elif self.version == (3,2): 387 elif self.version == (3,2):
386 return "TLS 1.1" 388 return "TLS 1.1"
389 elif self.version == (3,3):
390 return "TLS 1.2"
387 else: 391 else:
388 return None 392 return None
389 393
390 def getCipherName(self): 394 def getCipherName(self):
391 """Get the name of the cipher used with this connection. 395 """Get the name of the cipher used with this connection.
392 396
393 @rtype: str 397 @rtype: str
394 @return: The name of the cipher used with this connection. 398 @return: The name of the cipher used with this connection.
395 Either 'aes128', 'aes256', 'rc4', or '3des'. 399 Either 'aes128', 'aes256', 'rc4', or '3des'.
396 """ 400 """
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
558 # first(only) byte off above, we may have a 0-length msg: 562 # first(only) byte off above, we may have a 0-length msg:
559 if len(b) == 0: 563 if len(b) == 0:
560 return 564 return
561 565
562 contentType = msg.contentType 566 contentType = msg.contentType
563 567
564 #Update handshake hashes 568 #Update handshake hashes
565 if contentType == ContentType.handshake: 569 if contentType == ContentType.handshake:
566 self._handshake_md5.update(compat26Str(b)) 570 self._handshake_md5.update(compat26Str(b))
567 self._handshake_sha.update(compat26Str(b)) 571 self._handshake_sha.update(compat26Str(b))
572 self._handshake_sha256.update(compat26Str(b))
568 573
569 #Calculate MAC 574 #Calculate MAC
570 if self._writeState.macContext: 575 if self._writeState.macContext:
571 seqnumBytes = self._writeState.getSeqNumBytes() 576 seqnumBytes = self._writeState.getSeqNumBytes()
572 mac = self._writeState.macContext.copy() 577 mac = self._writeState.macContext.copy()
573 mac.update(compatHMAC(seqnumBytes)) 578 mac.update(compatHMAC(seqnumBytes))
574 mac.update(compatHMAC(bytearray([contentType]))) 579 mac.update(compatHMAC(bytearray([contentType])))
575 if self.version == (3,0): 580 if self.version == (3,0):
576 mac.update( compatHMAC( bytearray([len(b)//256] ))) 581 mac.update( compatHMAC( bytearray([len(b)//256] )))
577 mac.update( compatHMAC( bytearray([len(b)%256] ))) 582 mac.update( compatHMAC( bytearray([len(b)%256] )))
578 elif self.version in ((3,1), (3,2)): 583 elif self.version in ((3,1), (3,2), (3,3)):
579 mac.update(compatHMAC( bytearray([self.version[0]] ))) 584 mac.update(compatHMAC( bytearray([self.version[0]] )))
580 mac.update(compatHMAC( bytearray([self.version[1]] ))) 585 mac.update(compatHMAC( bytearray([self.version[1]] )))
581 mac.update( compatHMAC( bytearray([len(b)//256] ))) 586 mac.update( compatHMAC( bytearray([len(b)//256] )))
582 mac.update( compatHMAC( bytearray([len(b)%256] ))) 587 mac.update( compatHMAC( bytearray([len(b)%256] )))
583 else: 588 else:
584 raise AssertionError() 589 raise AssertionError()
585 mac.update(compatHMAC(b)) 590 mac.update(compatHMAC(b))
586 macBytes = bytearray(mac.digest()) 591 macBytes = bytearray(mac.digest())
587 if self.fault == Fault.badMAC: 592 if self.fault == Fault.badMAC:
588 macBytes[0] = (macBytes[0]+1) % 256 593 macBytes[0] = (macBytes[0]+1) % 256
589 594
590 #Encrypt for Block or Stream Cipher 595 #Encrypt for Block or Stream Cipher
591 if self._writeState.encContext: 596 if self._writeState.encContext:
592 #Add padding and encrypt (for Block Cipher): 597 #Add padding and encrypt (for Block Cipher):
593 if self._writeState.encContext.isBlockCipher: 598 if self._writeState.encContext.isBlockCipher:
594 599
595 #Add TLS 1.1 fixed block 600 #Add TLS 1.1 fixed block
596 if self.version == (3,2): 601 if self.version >= (3,2):
597 b = self.fixedIVBlock + b 602 b = self.fixedIVBlock + b
598 603
599 #Add padding: b = b + (macBytes + paddingBytes) 604 #Add padding: b = b+ (macBytes + paddingBytes)
600 currentLength = len(b) + len(macBytes) 605 currentLength = len(b) + len(macBytes)
601 blockLength = self._writeState.encContext.block_size 606 blockLength = self._writeState.encContext.block_size
602 paddingLength = blockLength - 1 - (currentLength % blockLength) 607 paddingLength = blockLength - 1 - (currentLength % blockLength)
603 608
604 paddingBytes = bytearray([paddingLength] * (paddingLength+1)) 609 paddingBytes = bytearray([paddingLength] * (paddingLength+1))
605 if self.fault == Fault.badPadding: 610 if self.fault == Fault.badPadding:
606 paddingBytes[0] = (paddingBytes[0]+1) % 256 611 paddingBytes[0] = (paddingBytes[0]+1) % 256
607 endBytes = macBytes + paddingBytes 612 endBytes = macBytes + paddingBytes
608 b += endBytes 613 b += endBytes
609 #Encrypt 614 #Encrypt
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
780 subType = p.get(1) 785 subType = p.get(1)
781 if subType not in secondaryType: 786 if subType not in secondaryType:
782 for result in self._sendError(\ 787 for result in self._sendError(\
783 AlertDescription.unexpected_message, 788 AlertDescription.unexpected_message,
784 "Expecting %s, got %s" % (str(secondaryType), su bType)): 789 "Expecting %s, got %s" % (str(secondaryType), su bType)):
785 yield result 790 yield result
786 791
787 #Update handshake hashes 792 #Update handshake hashes
788 self._handshake_md5.update(compat26Str(p.bytes)) 793 self._handshake_md5.update(compat26Str(p.bytes))
789 self._handshake_sha.update(compat26Str(p.bytes)) 794 self._handshake_sha.update(compat26Str(p.bytes))
795 self._handshake_sha256.update(compat26Str(p.bytes))
790 796
791 #Parse based on handshake type 797 #Parse based on handshake type
792 if subType == HandshakeType.client_hello: 798 if subType == HandshakeType.client_hello:
793 yield ClientHello(recordHeader.ssl2).parse(p) 799 yield ClientHello(recordHeader.ssl2).parse(p)
794 elif subType == HandshakeType.server_hello: 800 elif subType == HandshakeType.server_hello:
795 yield ServerHello().parse(p) 801 yield ServerHello().parse(p)
796 elif subType == HandshakeType.certificate: 802 elif subType == HandshakeType.certificate:
797 yield Certificate(constructorType).parse(p) 803 yield Certificate(constructorType).parse(p)
798 elif subType == HandshakeType.certificate_request: 804 elif subType == HandshakeType.certificate_request:
799 yield CertificateRequest().parse(p) 805 yield CertificateRequest(self.version).parse(p)
800 elif subType == HandshakeType.certificate_verify: 806 elif subType == HandshakeType.certificate_verify:
801 yield CertificateVerify().parse(p) 807 yield CertificateVerify(self.version).parse(p)
802 elif subType == HandshakeType.server_key_exchange: 808 elif subType == HandshakeType.server_key_exchange:
803 yield ServerKeyExchange(constructorType).parse(p) 809 yield ServerKeyExchange(constructorType,
810 self.version).parse(p)
804 elif subType == HandshakeType.server_hello_done: 811 elif subType == HandshakeType.server_hello_done:
805 yield ServerHelloDone().parse(p) 812 yield ServerHelloDone().parse(p)
806 elif subType == HandshakeType.client_key_exchange: 813 elif subType == HandshakeType.client_key_exchange:
807 yield ClientKeyExchange(constructorType, \ 814 yield ClientKeyExchange(constructorType, \
808 self.version).parse(p) 815 self.version).parse(p)
809 elif subType == HandshakeType.finished: 816 elif subType == HandshakeType.finished:
810 yield Finished(self.version).parse(p) 817 yield Finished(self.version).parse(p)
811 elif subType == HandshakeType.next_protocol: 818 elif subType == HandshakeType.next_protocol:
812 yield NextProtocol().parse(p) 819 yield NextProtocol().parse(p)
813 elif subType == HandshakeType.encrypted_extensions: 820 elif subType == HandshakeType.encrypted_extensions:
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
963 970
964 #Decrypt if it's a block cipher 971 #Decrypt if it's a block cipher
965 if self._readState.encContext.isBlockCipher: 972 if self._readState.encContext.isBlockCipher:
966 blockLength = self._readState.encContext.block_size 973 blockLength = self._readState.encContext.block_size
967 if len(b) % blockLength != 0: 974 if len(b) % blockLength != 0:
968 for result in self._sendError(\ 975 for result in self._sendError(\
969 AlertDescription.decryption_failed, 976 AlertDescription.decryption_failed,
970 "Encrypted data not a multiple of blocksize"): 977 "Encrypted data not a multiple of blocksize"):
971 yield result 978 yield result
972 b = self._readState.encContext.decrypt(b) 979 b = self._readState.encContext.decrypt(b)
973 if self.version == (3,2): #For TLS 1.1, remove explicit IV 980 if self.version >= (3,2): #For TLS 1.1, remove explicit IV
974 b = b[self._readState.encContext.block_size : ] 981 b = b[self._readState.encContext.block_size : ]
975 982
976 #Check padding 983 #Check padding
977 paddingGood = True 984 paddingGood = True
978 paddingLength = b[-1] 985 paddingLength = b[-1]
979 if (paddingLength+1) > len(b): 986 if (paddingLength+1) > len(b):
980 paddingGood=False 987 paddingGood=False
981 totalPaddingLength = 0 988 totalPaddingLength = 0
982 else: 989 else:
983 if self.version == (3,0): 990 if self.version == (3,0):
984 totalPaddingLength = paddingLength+1 991 totalPaddingLength = paddingLength+1
985 elif self.version in ((3,1), (3,2)): 992 elif self.version in ((3,1), (3,2), (3,3)):
986 totalPaddingLength = paddingLength+1 993 totalPaddingLength = paddingLength+1
987 paddingBytes = b[-totalPaddingLength:-1] 994 paddingBytes = b[-totalPaddingLength:-1]
988 for byte in paddingBytes: 995 for byte in paddingBytes:
989 if byte != paddingLength: 996 if byte != paddingLength:
990 paddingGood = False 997 paddingGood = False
991 totalPaddingLength = 0 998 totalPaddingLength = 0
992 else: 999 else:
993 raise AssertionError() 1000 raise AssertionError()
994 1001
995 #Decrypt if it's a stream cipher 1002 #Decrypt if it's a stream cipher
(...skipping 16 matching lines...) Expand all
1012 1019
1013 #Calculate MAC 1020 #Calculate MAC
1014 seqnumBytes = self._readState.getSeqNumBytes() 1021 seqnumBytes = self._readState.getSeqNumBytes()
1015 b = b[:-endLength] 1022 b = b[:-endLength]
1016 mac = self._readState.macContext.copy() 1023 mac = self._readState.macContext.copy()
1017 mac.update(compatHMAC(seqnumBytes)) 1024 mac.update(compatHMAC(seqnumBytes))
1018 mac.update(compatHMAC(bytearray([recordType]))) 1025 mac.update(compatHMAC(bytearray([recordType])))
1019 if self.version == (3,0): 1026 if self.version == (3,0):
1020 mac.update( compatHMAC(bytearray( [len(b)//256] ) )) 1027 mac.update( compatHMAC(bytearray( [len(b)//256] ) ))
1021 mac.update( compatHMAC(bytearray( [len(b)%256] ) )) 1028 mac.update( compatHMAC(bytearray( [len(b)%256] ) ))
1022 elif self.version in ((3,1), (3,2)): 1029 elif self.version in ((3,1), (3,2), (3,3)):
1023 mac.update(compatHMAC(bytearray( [self.version[0]] ) )) 1030 mac.update(compatHMAC(bytearray( [self.version[0]] ) ))
1024 mac.update(compatHMAC(bytearray( [self.version[1]] ) )) 1031 mac.update(compatHMAC(bytearray( [self.version[1]] ) ))
1025 mac.update(compatHMAC(bytearray( [len(b)//256] ) )) 1032 mac.update(compatHMAC(bytearray( [len(b)//256] ) ))
1026 mac.update(compatHMAC(bytearray( [len(b)%256] ) )) 1033 mac.update(compatHMAC(bytearray( [len(b)%256] ) ))
1027 else: 1034 else:
1028 raise AssertionError() 1035 raise AssertionError()
1029 mac.update(compatHMAC(b)) 1036 mac.update(compatHMAC(b))
1030 macBytes = bytearray(mac.digest()) 1037 macBytes = bytearray(mac.digest())
1031 1038
1032 #Compare MACs 1039 #Compare MACs
1033 if macBytes != checkBytes: 1040 if macBytes != checkBytes:
1034 macGood = False 1041 macGood = False
1035 1042
1036 if not (paddingGood and macGood): 1043 if not (paddingGood and macGood):
1037 for result in self._sendError(AlertDescription.bad_record_mac, 1044 for result in self._sendError(AlertDescription.bad_record_mac,
1038 "MAC failure (or padding failure)"): 1045 "MAC failure (or padding failure)"):
1039 yield result 1046 yield result
1040 1047
1041 yield b 1048 yield b
1042 1049
1043 def _handshakeStart(self, client): 1050 def _handshakeStart(self, client):
1044 if not self.closed: 1051 if not self.closed:
1045 raise ValueError("Renegotiation disallowed for security reasons") 1052 raise ValueError("Renegotiation disallowed for security reasons")
1046 self._client = client 1053 self._client = client
1047 self._handshake_md5 = hashlib.md5() 1054 self._handshake_md5 = hashlib.md5()
1048 self._handshake_sha = hashlib.sha1() 1055 self._handshake_sha = hashlib.sha1()
1056 self._handshake_sha256 = hashlib.sha256()
1049 self._handshakeBuffer = [] 1057 self._handshakeBuffer = []
1050 self.allegedSrpUsername = None 1058 self.allegedSrpUsername = None
1051 self._refCount = 1 1059 self._refCount = 1
1052 1060
1053 def _handshakeDone(self, resumed): 1061 def _handshakeDone(self, resumed):
1054 self.resumed = resumed 1062 self.resumed = resumed
1055 self.closed = False 1063 self.closed = False
1056 1064
1057 def _calcPendingStates(self, cipherSuite, masterSecret, 1065 def _calcPendingStates(self, cipherSuite, masterSecret,
1058 clientRandom, serverRandom, implementations): 1066 clientRandom, serverRandom, implementations):
(...skipping 12 matching lines...) Expand all
1071 elif cipherSuite in CipherSuite.tripleDESSuites: 1079 elif cipherSuite in CipherSuite.tripleDESSuites:
1072 keyLength = 24 1080 keyLength = 24
1073 ivLength = 8 1081 ivLength = 8
1074 createCipherFunc = createTripleDES 1082 createCipherFunc = createTripleDES
1075 else: 1083 else:
1076 raise AssertionError() 1084 raise AssertionError()
1077 1085
1078 if cipherSuite in CipherSuite.shaSuites: 1086 if cipherSuite in CipherSuite.shaSuites:
1079 macLength = 20 1087 macLength = 20
1080 digestmod = hashlib.sha1 1088 digestmod = hashlib.sha1
1089 elif cipherSuite in CipherSuite.sha256Suites:
1090 macLength = 32
1091 digestmod = hashlib.sha256
1081 elif cipherSuite in CipherSuite.md5Suites: 1092 elif cipherSuite in CipherSuite.md5Suites:
1082 macLength = 16 1093 macLength = 16
1083 digestmod = hashlib.md5 1094 digestmod = hashlib.md5
1084 1095
1085 if self.version == (3,0): 1096 if self.version == (3,0):
1086 createMACFunc = createMAC_SSL 1097 createMACFunc = createMAC_SSL
1087 elif self.version in ((3,1), (3,2)): 1098 elif self.version in ((3,1), (3,2), (3,3)):
1088 createMACFunc = createHMAC 1099 createMACFunc = createHMAC
1089 1100
1090 outputLength = (macLength*2) + (keyLength*2) + (ivLength*2) 1101 outputLength = (macLength*2) + (keyLength*2) + (ivLength*2)
1091 1102
1092 #Calculate Keying Material from Master Secret 1103 #Calculate Keying Material from Master Secret
1093 if self.version == (3,0): 1104 if self.version == (3,0):
1094 keyBlock = PRF_SSL(masterSecret, 1105 keyBlock = PRF_SSL(masterSecret,
1095 serverRandom + clientRandom, 1106 serverRandom + clientRandom,
1096 outputLength) 1107 outputLength)
1097 elif self.version in ((3,1), (3,2)): 1108 elif self.version in ((3,1), (3,2)):
1098 keyBlock = PRF(masterSecret, 1109 keyBlock = PRF(masterSecret,
1099 b"key expansion", 1110 b"key expansion",
1100 serverRandom + clientRandom, 1111 serverRandom + clientRandom,
1101 outputLength) 1112 outputLength)
1113 elif self.version == (3,3):
1114 keyBlock = PRF_1_2(masterSecret,
1115 b"key expansion",
1116 serverRandom + clientRandom,
1117 outputLength)
1102 else: 1118 else:
1103 raise AssertionError() 1119 raise AssertionError()
1104 1120
1105 #Slice up Keying Material 1121 #Slice up Keying Material
1106 clientPendingState = _ConnectionState() 1122 clientPendingState = _ConnectionState()
1107 serverPendingState = _ConnectionState() 1123 serverPendingState = _ConnectionState()
1108 p = Parser(keyBlock) 1124 p = Parser(keyBlock)
1109 clientMACBlock = p.getFixBytes(macLength) 1125 clientMACBlock = p.getFixBytes(macLength)
1110 serverMACBlock = p.getFixBytes(macLength) 1126 serverMACBlock = p.getFixBytes(macLength)
1111 clientKeyBlock = p.getFixBytes(keyLength) 1127 clientKeyBlock = p.getFixBytes(keyLength)
(...skipping 12 matching lines...) Expand all
1124 implementations) 1140 implementations)
1125 1141
1126 #Assign new connection states to pending states 1142 #Assign new connection states to pending states
1127 if self._client: 1143 if self._client:
1128 self._pendingWriteState = clientPendingState 1144 self._pendingWriteState = clientPendingState
1129 self._pendingReadState = serverPendingState 1145 self._pendingReadState = serverPendingState
1130 else: 1146 else:
1131 self._pendingWriteState = serverPendingState 1147 self._pendingWriteState = serverPendingState
1132 self._pendingReadState = clientPendingState 1148 self._pendingReadState = clientPendingState
1133 1149
1134 if self.version == (3,2) and ivLength: 1150 if self.version >= (3,2) and ivLength:
1135 #Choose fixedIVBlock for TLS 1.1 (this is encrypted with the CBC 1151 #Choose fixedIVBlock for TLS 1.1 (this is encrypted with the CBC
1136 #residue to create the IV for each sent block) 1152 #residue to create the IV for each sent block)
1137 self.fixedIVBlock = getRandomBytes(ivLength) 1153 self.fixedIVBlock = getRandomBytes(ivLength)
1138 1154
1139 def _changeWriteState(self): 1155 def _changeWriteState(self):
1140 self._writeState = self._pendingWriteState 1156 self._writeState = self._pendingWriteState
1141 self._pendingWriteState = _ConnectionState() 1157 self._pendingWriteState = _ConnectionState()
1142 1158
1143 def _changeReadState(self): 1159 def _changeReadState(self):
1144 self._readState = self._pendingReadState 1160 self._readState = self._pendingReadState
1145 self._pendingReadState = _ConnectionState() 1161 self._pendingReadState = _ConnectionState()
1146 1162
1147 #Used for Finished messages and CertificateVerify messages in SSL v3 1163 #Used for Finished messages and CertificateVerify messages in SSL v3
1148 def _calcSSLHandshakeHash(self, masterSecret, label): 1164 def _calcSSLHandshakeHash(self, masterSecret, label):
1149 imac_md5 = self._handshake_md5.copy() 1165 imac_md5 = self._handshake_md5.copy()
1150 imac_sha = self._handshake_sha.copy() 1166 imac_sha = self._handshake_sha.copy()
1151 1167
1152 imac_md5.update(compatHMAC(label + masterSecret + bytearray([0x36]*48))) 1168 imac_md5.update(compatHMAC(label + masterSecret + bytearray([0x36]*48)))
1153 imac_sha.update(compatHMAC(label + masterSecret + bytearray([0x36]*40))) 1169 imac_sha.update(compatHMAC(label + masterSecret + bytearray([0x36]*40)))
1154 1170
1155 md5Bytes = MD5(masterSecret + bytearray([0x5c]*48) + \ 1171 md5Bytes = MD5(masterSecret + bytearray([0x5c]*48) + \
1156 bytearray(imac_md5.digest())) 1172 bytearray(imac_md5.digest()))
1157 shaBytes = SHA1(masterSecret + bytearray([0x5c]*40) + \ 1173 shaBytes = SHA1(masterSecret + bytearray([0x5c]*40) + \
1158 bytearray(imac_sha.digest())) 1174 bytearray(imac_sha.digest()))
1159 1175
1160 return md5Bytes + shaBytes 1176 return md5Bytes + shaBytes
1161 1177
OLDNEW
« no previous file with comments | « third_party/tlslite/tlslite/tlsconnection.py ('k') | third_party/tlslite/tlslite/utils/compat.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698