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

Side by Side Diff: third_party/tlslite/patches/pycrypto_python2.patch

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
(Empty)
1 diff --git a/third_party/tlslite/tlslite/utils/compat.py b/third_party/tlslite/t lslite/utils/compat.py
2 index 2bcaede..db95ac1 100755
3 --- a/third_party/tlslite/tlslite/utils/compat.py
4 +++ b/third_party/tlslite/tlslite/utils/compat.py
5 @@ -51,6 +51,9 @@ if sys.version_info >= (3,0):
6 def readStdinBinary():
7 return sys.stdin.buffer.read()
8
9 + def long(n):
10 + return n
11 +
12 else:
13 # Python 2.6 requires strings instead of bytearrays in a couple places,
14 # so we define this function so it does the conversion if needed.
15 diff --git a/third_party/tlslite/tlslite/utils/cryptomath.py b/third_party/tlsli te/tlslite/utils/cryptomath.py
16 index ce56b4b..30354b2 100755
17 --- a/third_party/tlslite/tlslite/utils/cryptomath.py
18 +++ b/third_party/tlslite/tlslite/utils/cryptomath.py
19 @@ -94,7 +94,9 @@ def bytesToNumber(b):
20 byte = b[count]
21 total += multiplier * byte
22 multiplier *= 256
23 - return total
24 + # Force-cast to long to appease PyCrypto.
25 + # https://github.com/trevp/tlslite/issues/15
26 + return long(total)
27
28 def numberToByteArray(n, howManyBytes=None):
29 """Convert an integer into a bytearray, zero-pad to howManyBytes.
30 diff --git a/third_party/tlslite/tlslite/utils/pycrypto_rsakey.py b/third_party/ tlslite/tlslite/utils/pycrypto_rsakey.py
31 index 3d56228..4de5436 100755
32 --- a/third_party/tlslite/tlslite/utils/pycrypto_rsakey.py
33 +++ b/third_party/tlslite/tlslite/utils/pycrypto_rsakey.py
34 @@ -26,13 +26,13 @@ if pycryptoLoaded:
35 return self.rsa.has_private()
36
37 def _rawPrivateKeyOp(self, m):
38 - s = numberToString(m, numBytes(self.n))
39 - c = stringToNumber(self.rsa.decrypt((s,)))
40 + s = bytes(numberToByteArray(m, numBytes(self.n)))
41 + c = bytesToNumber(bytearray(self.rsa.decrypt((s,))))
42 return c
43
44 def _rawPublicKeyOp(self, c):
45 - s = numberToString(c, numBytes(self.n))
46 - m = stringToNumber(self.rsa.encrypt(s, None)[0])
47 + s = bytes(numberToByteArray(c, numBytes(self.n)))
48 + m = bytesToNumber(bytearray(self.rsa.encrypt(s, None)[0]))
49 return m
50
51 def generate(bits):
OLDNEW
« no previous file with comments | « third_party/tlslite/patches/intolerance_options.patch ('k') | third_party/tlslite/patches/req_cert_types.patch » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698