title: Unable to authenticate using HostAPD
body: <p>I have a raspberry PI 2 and have configured HOSTAPD and udhcpd to work as a hot spot.
  The first issue i faced was the driver. THe WiFi adapter i purchased was a Realtek chip set. This is now solved by following this post.
  <a href="https://www.raspberrypi.org/forums/view" rel="nofollow noreferrer">https://www.raspberrypi.org/forums/view</a> ... hp?t=62371</p>
  
  <p>Now the second issue i faced is WPA2 authentication. If i set hostapd for open\no authentication it works like a charm. If i set authentication, i am unable to connect. Andriod devices circle around connecting, iPhone comes back with incorrect password - even thought i am typing correct password.</p>
  
  <p>Below is the config in hostapd.conf and log from hostapd --ddK /etc/hostapd/hostapd.conf</p>
  
  <pre><code>interface=wlan0
  #driver=
  ssid=&lt;removed&gt;
  hw_mode=g
  channel=1
  macaddr_acl=0
  auth_algs=1
  ignore_broadcast_ssid=0
  wpa=2
  wpa_passphrase=&lt;removed&gt;
  wpa_key_mgmt=WPA-PSK
  wpa_pairwise=TKIP
  rsn_pairwise=CCMP
  
  #log
  logger_syslog=-1
  logger_syslog_level=2
  logger_stdout=-1
  logger_stdout_level=2
  
  
  pi@raspberrypi ~ $ sudo hostapd -ddK /etc/hostapd/hostapd.conf
  random: Trying to read entropy from /dev/random
  Configuration file: /etc/hostapd/hostapd.conf
  nl80211: interface wlan0 in phy phy0
  rfkill: initial event: idx=0 type=1 op=0 soft=0 hard=0
  nl80211: Using driver-based off-channel TX
  nl80211: Add own interface ifindex 3
  nl80211: Set mode ifindex 3 iftype 3 (AP)
  nl80211: Create interface iftype 6 (MONITOR)
  nl80211: New interface mon.wlan0 created: ifindex=6
  nl80211: Add own interface ifindex 6
  BSS count 1, BSSID mask 00:00:00:00:00:00 (0 bits)
  nl80211: Regulatory information - country=00
  nl80211: 2402-2472 @ 40 MHz
  nl80211: 2457-2482 @ 20 MHz
  nl80211: 2474-2494 @ 20 MHz
  nl80211: 5170-5250 @ 80 MHz
  nl80211: 5250-5330 @ 80 MHz
  nl80211: 5490-5730 @ 160 MHz
  nl80211: 5735-5835 @ 80 MHz
  nl80211: 57240-63720 @ 2160 MHz
  nl80211: Added 802.11b mode based on 802.11g information
  Allowed channel: mode=1 chan=1 freq=2412 MHz max_tx_power=20 dBm
  Allowed channel: mode=1 chan=2 freq=2417 MHz max_tx_power=20 dBm
  Allowed channel: mode=1 chan=3 freq=2422 MHz max_tx_power=20 dBm
  Allowed channel: mode=1 chan=4 freq=2427 MHz max_tx_power=20 dBm
  Allowed channel: mode=1 chan=5 freq=2432 MHz max_tx_power=20 dBm
  Allowed channel: mode=1 chan=6 freq=2437 MHz max_tx_power=20 dBm
  Allowed channel: mode=1 chan=7 freq=2442 MHz max_tx_power=20 dBm
  Allowed channel: mode=1 chan=8 freq=2447 MHz max_tx_power=20 dBm
  Allowed channel: mode=1 chan=9 freq=2452 MHz max_tx_power=20 dBm
  Allowed channel: mode=1 chan=10 freq=2457 MHz max_tx_power=20 dBm
  Allowed channel: mode=1 chan=11 freq=2462 MHz max_tx_power=20 dBm
  Allowed channel: mode=0 chan=1 freq=2412 MHz max_tx_power=20 dBm
  Allowed channel: mode=0 chan=2 freq=2417 MHz max_tx_power=20 dBm
  Allowed channel: mode=0 chan=3 freq=2422 MHz max_tx_power=20 dBm
  Allowed channel: mode=0 chan=4 freq=2427 MHz max_tx_power=20 dBm
  Allowed channel: mode=0 chan=5 freq=2432 MHz max_tx_power=20 dBm
  Allowed channel: mode=0 chan=6 freq=2437 MHz max_tx_power=20 dBm
  Allowed channel: mode=0 chan=7 freq=2442 MHz max_tx_power=20 dBm
  Allowed channel: mode=0 chan=8 freq=2447 MHz max_tx_power=20 dBm
  Allowed channel: mode=0 chan=9 freq=2452 MHz max_tx_power=20 dBm
  Allowed channel: mode=0 chan=10 freq=2457 MHz max_tx_power=20 dBm
  Allowed channel: mode=0 chan=11 freq=2462 MHz max_tx_power=20 dBm
  Completing interface initialization
  Mode: IEEE 802.11g  Channel: 1  Frequency: 2412 MHz
  nl80211: Set freq 2412 (ht_enabled=0 sec_channel_offset=0)
  RATE[0] rate=10 flags=0x1
  RATE[1] rate=20 flags=0x1
  RATE[2] rate=55 flags=0x1
  RATE[3] rate=110 flags=0x1
  RATE[4] rate=60 flags=0x0
  RATE[5] rate=90 flags=0x0
  RATE[6] rate=120 flags=0x0
  RATE[7] rate=180 flags=0x0
  RATE[8] rate=240 flags=0x0
  RATE[9] rate=360 flags=0x0
  RATE[10] rate=480 flags=0x0
  RATE[11] rate=540 flags=0x0
  Flushing old station entries
  Deauthenticate all stations
  wpa_driver_nl80211_set_key: ifindex=3 alg=0 addr=(nil) key_idx=0 set_tx=0 seq_len=0 key_len=0
  wpa_driver_nl80211_set_key: ifindex=3 alg=0 addr=(nil) key_idx=1 set_tx=0 seq_len=0 key_len=0
  wpa_driver_nl80211_set_key: ifindex=3 alg=0 addr=(nil) key_idx=2 set_tx=0 seq_len=0 key_len=0
  wpa_driver_nl80211_set_key: ifindex=3 alg=0 addr=(nil) key_idx=3 set_tx=0 seq_len=0 key_len=0
  Using interface wlan0 with hwaddr 40:a5:ef:07:b4:0e and ssid 'kid'
  Deriving WPA PSK based on passphrase
  SSID - hexdump_ascii(len=3):
       6b 69 64                                          &lt;removed&gt;             
  PSK (ASCII passphrase) - hexdump_ascii(len=8):
       4b 69 64 31 32 33 34 35                           &lt;removed&gt;       
  PSK (from passphrase) - hexdump(len=32): eb f3 9f 60 48 03 d8 c2 6d 29 b5 34 1f 22 fe cd 02 ff 43 6e 7e 35 88 d9 41 49 42 27 26 c5 08 ad
  random: Got 16/20 bytes from /dev/random
  random: Only 16/20 bytes of strong random data available from /dev/random
  random: Not enough entropy pool available for secure operations
  WPA: Not enough entropy in random pool for secure operations - update keys later when the first station connects
  Get randomness: len=32 entropy=0
  GMK - hexdump(len=32): 8b 1b 05 6b 6c a3 27 3b 7d 4c 8d 08 75 c0 94 2e e9 ad cd 06 90 6b c3 8f 10 74 96 6e 07 a7 44 b7
  Get randomness: len=32 entropy=0
  Key Counter - hexdump(len=32): 8d 5d 7d 92 d4 6c 8b 56 cd f2 10 a6 4a ba 4f c9 96 1d 93 28 db d2 3b 1d e2 a2 74 02 c8 41 cf 26
  WPA: Delay group state machine start until Beacon frames have been configured
  VLAN: vlan_set_name_type(name_type=2)
  nl80211: Set beacon (beacon_set=0)
  WPA: Start group state machine to set initial keys
  WPA: group state machine entering state GTK_INIT (VLAN-ID 0)
  Get randomness: len=16 entropy=0
  GTK - hexdump(len=16): ba 94 df 43 2f 11 50 e1 86 45 25 87 fb 9a f3 b8
  WPA: group state machine entering state SETKEYSDONE (VLAN-ID 0)
  wpa_driver_nl80211_set_key: ifindex=3 alg=3 addr=0x890c8 key_idx=1 set_tx=1 seq_len=0 key_len=16
     broadcast key
  wpa_driver_nl80211_set_operstate: operstate 0-&gt;1 (UP)
  netlink: Operstate: linkmode=-1, operstate=6
  Failed to set TX queue parameters for queue 0.
  Failed to set TX queue parameters for queue 1.
  Failed to set TX queue parameters for queue 2.
  Failed to set TX queue parameters for queue 3.
  wlan0: Setup of interface done.
  random: Got 4/4 bytes from /dev/random
  RTM_NEWLINK: operstate=1 ifi_flags=0x1002 ()
  nl80211: Ignore interface down event since interface wlan0 is up
  RTM_NEWLINK: operstate=1 ifi_flags=0x1002 ()
  nl80211: Ignore interface down event since interface mon.wlan0 is up
  RTM_NEWLINK: operstate=1 ifi_flags=0x11043 ([UP][RUNNING][LOWER_UP])
  RTM_NEWLINK, IFLA_IFNAME: Interface 'mon.wlan0' added
  Unknown event 5
  RTM_NEWLINK: operstate=1 ifi_flags=0x1003 ([UP])
  RTM_NEWLINK, IFLA_IFNAME: Interface 'wlan0' added
  nl80211: if_removed already cleared - ignore event
  RTM_NEWLINK: operstate=1 ifi_flags=0x11043 ([UP][RUNNING][LOWER_UP])
  RTM_NEWLINK, IFLA_IFNAME: Interface 'wlan0' added
  nl80211: if_removed already cleared - ignore event
  VLAN: vlan_newlink(wlan0)
  nl80211: Event message available
  nl80211: New station &lt;iphone MAC address&gt;
  nl80211: Event message available
  nl80211: Delete station &lt;iphone MAC address&gt;
  wlan0: WPA rekeying GTK
  WPA: group state machine entering state SETKEYS (VLAN-ID 0)
  Get randomness: len=16 entropy=0
  GTK - hexdump(len=16): 06 b2 b8 05 a7 b6 a6 03 81 1b a4 9a 01 bb 8c 29
  wpa_group_setkeys: GKeyDoneStations=0
  WPA: group state machine entering state SETKEYSDONE (VLAN-ID 0)
  wpa_driver_nl80211_set_key: ifindex=3 alg=3 addr=0x890c8 key_idx=2 set_tx=1 seq_len=0 key_len=16
     broadcast key
  ^CSignal 2 received - terminating
  Flushing old station entries
  Deauthenticate all stations
  nl80211: Remove interface ifindex=6
  netlink: Operstate: linkmode=0, operstate=6
  nl80211: Set mode ifindex 3 iftype 2 (STATION)
  </code></pre>
  
  <p>I have tried uninstall and reinstall hostapd</p>