]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: Provide digestmod to hmac.new() for Python 3.8
authorJouni Malinen <j@w1.fi>
Sun, 3 May 2020 08:43:23 +0000 (11:43 +0300)
committerJouni Malinen <j@w1.fi>
Sun, 3 May 2020 08:58:54 +0000 (11:58 +0300)
Python 3.8 removed the previously used default of MD5 algorithm, so
provide the explicit digestmod=hashlib.md5 parameter to the couple of
places that were missing it.

Signed-off-by: Jouni Malinen <j@w1.fi>
tests/hwsim/test_eap_proto.py
tests/hwsim/test_radius.py

index 59519bd6b1b68a3b0d2c0e3d01abebfbd6a59d04..7494b429a15fc91faa46a91defadb540eed564e7 100644 (file)
@@ -106,7 +106,7 @@ def start_radius_server(eap_handler):
                 logger.info("No EAP request available")
             reply.code = pyrad.packet.AccessChallenge
 
-            hmac_obj = hmac.new(reply.secret)
+            hmac_obj = hmac.new(reply.secret, digestmod=hashlib.md5)
             hmac_obj.update(struct.pack("B", reply.code))
             hmac_obj.update(struct.pack("B", reply.id))
 
index 84163f36d68ae47fd526b5bda51edc4362ebee6e..16a29ec858228e0f4610cb6c930871d803fdc4e6 100644 (file)
@@ -760,7 +760,7 @@ def test_radius_das_disconnect(dev, apdev):
 
 def add_message_auth_req(req):
     req.authenticator = req.CreateAuthenticator()
-    hmac_obj = hmac.new(req.secret)
+    hmac_obj = hmac.new(req.secret, digestmod=hashlib.md5)
     hmac_obj.update(struct.pack("B", req.code))
     hmac_obj.update(struct.pack("B", req.id))
 
@@ -1046,7 +1046,7 @@ def test_radius_protocol(dev, apdev):
                     pw = b"incorrect"
                 else:
                     pw = reply.secret
-                hmac_obj = hmac.new(pw)
+                hmac_obj = hmac.new(pw, digestmod=hashlib.md5)
                 hmac_obj.update(struct.pack("B", reply.code))
                 hmac_obj.update(struct.pack("B", reply.id))
 
@@ -1389,7 +1389,7 @@ def test_radius_auth_force_invalid_client_addr(dev, apdev):
 
 def add_message_auth(req):
     req.authenticator = req.CreateAuthenticator()
-    hmac_obj = hmac.new(req.secret)
+    hmac_obj = hmac.new(req.secret, digestmod=hashlib.md5)
     hmac_obj.update(struct.pack("B", req.code))
     hmac_obj.update(struct.pack("B", req.id))