Lines Matching refs:pin
80 u8 *pin;
90 static void wps_free_pin(struct wps_uuid_pin *pin)
92 os_free(pin->pin);
93 os_free(pin);
97 static void wps_remove_pin(struct wps_uuid_pin *pin)
99 dl_list_del(&pin->list);
100 wps_free_pin(pin);
106 struct wps_uuid_pin *pin, *prev;
107 dl_list_for_each_safe(pin, prev, pins, struct wps_uuid_pin, list)
108 wps_remove_pin(pin);
195 struct wps_uuid_pin *pin);
708 struct wps_uuid_pin *pin;
710 dl_list_for_each(pin, ®->pins, struct wps_uuid_pin, list) {
711 if (pin->wildcard_uuid == 1 && !(pin->flags & PIN_LOCKED)) {
713 "configured wildcard PIN");
714 wps_registrar_remove_pin(reg, pin);
722 * wps_registrar_add_pin - Configure a new PIN for Registrar
726 * @pin: PIN (Device Password)
727 * @pin_len: Length of pin in octets
728 * @timeout: Time (in seconds) when the PIN will be invalidated; 0 = no timeout
732 const u8 *uuid, const u8 *pin, size_t pin_len,
746 p->pin = os_malloc(pin_len);
747 if (p->pin == NULL) {
751 os_memcpy(p->pin, pin, pin_len);
765 wpa_printf(MSG_DEBUG, "WPS: A new PIN configured (timeout=%d)",
768 wpa_hexdump_ascii_key(MSG_DEBUG, "WPS: PIN", pin, pin_len);
787 struct wps_uuid_pin *pin)
792 if (is_zero_ether_addr(pin->enrollee_addr))
795 addr = pin->enrollee_addr;
797 wps_remove_pin(pin);
804 struct wps_uuid_pin *pin, *prev;
808 dl_list_for_each_safe(pin, prev, ®->pins, struct wps_uuid_pin, list)
810 if ((pin->flags & PIN_EXPIRES) &&
811 os_time_before(&pin->expiration, &now)) {
812 wpa_hexdump(MSG_DEBUG, "WPS: Expired PIN for UUID",
813 pin->uuid, WPS_UUID_LEN);
814 wps_registrar_remove_pin(reg, pin);
821 * wps_registrar_invalidate_wildcard_pin - Invalidate a wildcard PIN
823 * @dev_pw: PIN to search for or %NULL to match any
825 * Returns: 0 on success, -1 if not wildcard PIN is enabled
831 struct wps_uuid_pin *pin, *prev;
833 dl_list_for_each_safe(pin, prev, ®->pins, struct wps_uuid_pin, list)
835 if (dev_pw && pin->pin &&
836 (dev_pw_len != pin->pin_len ||
837 os_memcmp(dev_pw, pin->pin, dev_pw_len) != 0))
838 continue; /* different PIN */
839 if (pin->wildcard_uuid) {
840 wpa_hexdump(MSG_DEBUG, "WPS: Invalidated PIN for UUID",
841 pin->uuid, WPS_UUID_LEN);
842 wps_registrar_remove_pin(reg, pin);
852 * wps_registrar_invalidate_pin - Invalidate a PIN for a specific UUID-E
855 * Returns: 0 on success, -1 on failure (e.g., PIN not found)
859 struct wps_uuid_pin *pin, *prev;
861 dl_list_for_each_safe(pin, prev, ®->pins, struct wps_uuid_pin, list)
863 if (os_memcmp(pin->uuid, uuid, WPS_UUID_LEN) == 0) {
864 wpa_hexdump(MSG_DEBUG, "WPS: Invalidated PIN for UUID",
865 pin->uuid, WPS_UUID_LEN);
866 wps_registrar_remove_pin(reg, pin);
878 struct wps_uuid_pin *pin, *found = NULL;
882 dl_list_for_each(pin, ®->pins, struct wps_uuid_pin, list) {
883 if (!pin->wildcard_uuid &&
884 os_memcmp(pin->uuid, uuid, WPS_UUID_LEN) == 0) {
885 found = pin;
893 dl_list_for_each(pin, ®->pins, struct wps_uuid_pin, list) {
894 if (pin->wildcard_uuid == 1 ||
895 pin->wildcard_uuid == 2) {
897 "PIN. Assigned it for this UUID-E");
898 pin->wildcard_uuid++;
899 os_memcpy(pin->uuid, uuid, WPS_UUID_LEN);
900 found = pin;
910 * Lock the PIN to avoid attacks based on concurrent re-use of the PIN
911 * that could otherwise avoid PIN invalidations.
914 wpa_printf(MSG_DEBUG, "WPS: Selected PIN locked - do not "
920 return found->pin;
925 * wps_registrar_unlock_pin - Unlock a PIN for a specific UUID-E
931 * PIN to allow it to be used again. If the specified PIN was configured using
936 struct wps_uuid_pin *pin;
938 dl_list_for_each(pin, ®->pins, struct wps_uuid_pin, list) {
939 if (os_memcmp(pin->uuid, uuid, WPS_UUID_LEN) == 0) {
940 if (pin->wildcard_uuid == 3) {
942 "wildcard PIN");
945 pin->flags &= ~PIN_LOCKED;
1031 wpa_printf(MSG_DEBUG, "WPS: PIN completed using internal Registrar");
1054 wpa_hexdump_key(MSG_DEBUG, "WPS: Invalidated wildcard PIN",
1068 /* PIN Method */
1069 wpa_printf(MSG_DEBUG, "WPS: PIN is set - cancelling it");
1351 const u8 *pin;
1358 wpa_printf(MSG_DEBUG, "WPS: Use default PIN for PBC");
1359 pin = (const u8 *) "00000000";
1365 pin = wps->nfc_pw_token->dev_pw;
1369 pin = wps_registrar_get_pin(wps->wps->registrar, wps->uuid_e,
1371 if (pin && wps->dev_pw_id >= 0x10) {
1373 "Password ID, but PIN found");
1375 * See whether Enrollee is willing to use PIN instead.
1380 if (pin == NULL) {
1391 os_memcpy(wps->dev_password, pin, pin_len);
2235 * In case wildcard PIN is used and WPS handshake succeeds in the first
2236 * attempt, wps_registrar_unlock_pin() would not free the PIN, so make
2237 * sure the PIN gets invalidated here.
2761 * Use the AP PIN only to receive the current AP settings, not