test_peerkey.py 1.1 KB

12345678910111213141516171819202122232425262728293031
  1. # PeerKey tests
  2. # Copyright (c) 2013, Jouni Malinen <j@w1.fi>
  3. #
  4. # This software may be distributed under the terms of the BSD license.
  5. # See README for more details.
  6. import logging
  7. logger = logging.getLogger()
  8. import time
  9. import hwsim_utils
  10. import hostapd
  11. def test_peerkey(dev, apdev):
  12. """RSN AP and PeerKey between two STAs"""
  13. ssid = "test-peerkey"
  14. passphrase = "12345678"
  15. params = hostapd.wpa2_params(ssid=ssid, passphrase=passphrase)
  16. params['peerkey'] = "1"
  17. hostapd.add_ap(apdev[0]['ifname'], params)
  18. dev[0].connect(ssid, psk=passphrase, scan_freq="2412", peerkey=True)
  19. dev[1].connect(ssid, psk=passphrase, scan_freq="2412", peerkey=True)
  20. hwsim_utils.test_connectivity_sta(dev[0], dev[1])
  21. dev[0].request("STKSTART " + dev[1].p2p_interface_addr())
  22. time.sleep(0.5)
  23. # NOTE: Actual use of the direct link (DLS) is not supported in
  24. # mac80211_hwsim, so this operation fails at setting the keys after
  25. # successfully completed 4-way handshake. This test case does allow the
  26. # key negotiation part to be tested for coverage, though.