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

Unified Diff: third_party/tlslite/tlslite/utils/cryptomath.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/tlslite/tlslite/utils/compat.py ('k') | third_party/tlslite/tlslite/utils/pycrypto_rsakey.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/tlslite/tlslite/utils/cryptomath.py
diff --git a/third_party/tlslite/tlslite/utils/cryptomath.py b/third_party/tlslite/tlslite/utils/cryptomath.py
index 30354b2c56cebe688c9e80fb056979268dee3c92..61fd1432d566a0e936760c3bca98e124bd0b0b08 100644
--- a/third_party/tlslite/tlslite/utils/cryptomath.py
+++ b/third_party/tlslite/tlslite/utils/cryptomath.py
@@ -1,6 +1,7 @@
# Authors:
# Trevor Perrin
# Martin von Loewis - python 3 port
+# Yngve Pettersen (ported by Paul Sokolovsky) - TLS 1.2
#
# See the LICENSE file for legal information regarding use of this file.
@@ -82,6 +83,10 @@ def HMAC_SHA1(k, b):
b = compatHMAC(b)
return bytearray(hmac.new(k, b, hashlib.sha1).digest())
+def HMAC_SHA256(k, b):
+ k = compatHMAC(k)
+ b = compatHMAC(b)
+ return bytearray(hmac.new(k, b, hashlib.sha256).digest())
# **************************************************************************
# Converter Functions
@@ -94,9 +99,7 @@ def bytesToNumber(b):
byte = b[count]
total += multiplier * byte
multiplier *= 256
- # Force-cast to long to appease PyCrypto.
- # https://github.com/trevp/tlslite/issues/15
- return long(total)
+ return total
def numberToByteArray(n, howManyBytes=None):
"""Convert an integer into a bytearray, zero-pad to howManyBytes.
@@ -218,7 +221,7 @@ else:
#Pre-calculate a sieve of the ~100 primes < 1000:
def makeSieve(n):
sieve = list(range(n))
- for count in range(2, int(math.sqrt(n))):
+ for count in range(2, int(math.sqrt(n))+1):
if sieve[count] == 0:
continue
x = sieve[count] * 2
« no previous file with comments | « third_party/tlslite/tlslite/utils/compat.py ('k') | third_party/tlslite/tlslite/utils/pycrypto_rsakey.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698