EAP_ERP_TLV_NAS_IP_ADDRESS = 131
EAP_ERP_TLV_NAS_IPV6_ADDRESS = 132
+def add_message_authenticator_attr(reply, digest):
+ if digest.startswith(b'0x'):
+ # Work around pyrad tools.py EncodeOctets() functionality that
+ # assumes a binary value that happens to start with "0x" to be
+ # a hex string.
+ digest = b"0x" + binascii.hexlify(digest)
+ reply.AddAttribute("Message-Authenticator", digest)
+
def run_pyrad_server(srv, t_stop, eap_handler):
srv.RunWithStop(t_stop, eap_handler)
hmac_obj.update(pkt.authenticator)
hmac_obj.update(attrs)
del reply[80]
- reply.AddAttribute("Message-Authenticator", hmac_obj.digest())
+ add_message_authenticator_attr(reply, hmac_obj.digest())
self.SendReplyPacket(pkt.fd, reply)
from utils import *
from test_ap_hs20 import build_dhcp_ack
from test_ap_ft import ft_params1
+from test_eap_proto import add_message_authenticator_attr
def connect(dev, ssid, wait_connect=True):
dev.connect(ssid, key_mgmt="WPA-EAP", scan_freq="2412",
hmac_obj.update(16*b"\x00") # all zeros Authenticator in calculation
hmac_obj.update(attrs)
del req[80]
- req.AddAttribute("Message-Authenticator", hmac_obj.digest())
+ add_message_authenticator_attr(req, hmac_obj.digest())
def test_radius_das_disconnect_time_window(dev, apdev):
"""RADIUS Dynamic Authorization Extensions - Disconnect - time window"""
logger.info("Include two Message-Authenticator attributes")
else:
del reply[80]
- reply.AddAttribute("Message-Authenticator", hmac_obj.digest())
+ add_message_authenticator_attr(reply, hmac_obj.digest())
self.SendReplyPacket(pkt.fd, reply)
def RunWithStop(self, t_events):
hmac_obj.update(req.authenticator)
hmac_obj.update(attrs)
del req[80]
- req.AddAttribute("Message-Authenticator", hmac_obj.digest())
+ add_message_authenticator_attr(req, hmac_obj.digest())
def test_radius_server_failures(dev, apdev):
"""RADIUS server failure cases"""