summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xsrc/lib/tlslite/TLSRecordLayer.py8
-rwxr-xr-xsrc/lib/tlslite/mathtls.py8
-rwxr-xr-xsrc/lib/tlslite/messages.py10
-rwxr-xr-xsrc/lib/tlslite/utils/cryptomath.py5
4 files changed, 23 insertions, 8 deletions
diff --git a/src/lib/tlslite/TLSRecordLayer.py b/src/lib/tlslite/TLSRecordLayer.py
index 002a56862..8b200e1ec 100755
--- a/src/lib/tlslite/TLSRecordLayer.py
+++ b/src/lib/tlslite/TLSRecordLayer.py
@@ -12,8 +12,12 @@ from constants import *
from utils.cryptomath import getRandomBytes
from utils import hmac
from FileObject import FileObject
-import sha
-import md5
+try:
+ import hashlib as sha
+ import hashlib as md5
+except:
+ import sha
+ import md5
import socket
import errno
import traceback
diff --git a/src/lib/tlslite/mathtls.py b/src/lib/tlslite/mathtls.py
index 3b8ede601..59f1f10d6 100755
--- a/src/lib/tlslite/mathtls.py
+++ b/src/lib/tlslite/mathtls.py
@@ -4,8 +4,12 @@ from utils.compat import *
from utils.cryptomath import *
import hmac
-import md5
-import sha
+try:
+ import hashlib as md5
+ import hashlib as sha
+except:
+ import md5
+ import sha
#1024, 1536, 2048, 3072, 4096, 6144, and 8192 bit groups]
goodGroupParameters = [(2,0xEEAF0AB9ADB38DD69C33F80AFA8FC5E86072618775FF3C0B9EA2314C9C256576D674DF7496EA81D3383B4813D692C6E0E0D5D8E250B98BE48E495C1D6089DAD15DC7D7B46154D6B6CE8EF4AD69B15D4982559B297BCF1885C529F566660E57EC68EDBC3C05726CC02FD4CBF4976EAA9AFD5138FE8376435B9FC61D2FC0EB06E3),\
diff --git a/src/lib/tlslite/messages.py b/src/lib/tlslite/messages.py
index afccc793a..1eb20fed7 100755
--- a/src/lib/tlslite/messages.py
+++ b/src/lib/tlslite/messages.py
@@ -8,8 +8,12 @@ from constants import *
from X509 import X509
from X509CertChain import X509CertChain
-import sha
-import md5
+try:
+ import hashlib as sha
+ import hashlib as md5
+except:
+ import sha
+ import md5
class RecordHeader3:
def __init__(self):
@@ -558,4 +562,4 @@ class ApplicationData(Msg):
return self
def write(self):
- return self.bytes \ No newline at end of file
+ return self.bytes
diff --git a/src/lib/tlslite/utils/cryptomath.py b/src/lib/tlslite/utils/cryptomath.py
index 9b6f0495f..07f76641c 100755
--- a/src/lib/tlslite/utils/cryptomath.py
+++ b/src/lib/tlslite/utils/cryptomath.py
@@ -6,7 +6,10 @@ import os
import math
import base64
import binascii
-import sha
+try:
+ import hashlib as sha
+except:
+ import sha
from compat import *