Home | History | Annotate | Download | only in wps

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);
194 struct wps_uuid_pin *pin);
706 struct wps_uuid_pin *pin;
708 dl_list_for_each(pin, &reg->pins, struct wps_uuid_pin, list) {
709 if (pin->wildcard_uuid == 1 && !(pin->flags & PIN_LOCKED)) {
711 "configured wildcard PIN");
712 wps_registrar_remove_pin(reg, pin);
720 * wps_registrar_add_pin - Configure a new PIN for Registrar
724 * @pin: PIN (Device Password)
725 * @pin_len: Length of pin in octets
726 * @timeout: Time (in seconds) when the PIN will be invalidated; 0 = no timeout
730 const u8 *uuid, const u8 *pin, size_t pin_len,
744 p->pin = os_malloc(pin_len);
745 if (p->pin == NULL) {
749 os_memcpy(p->pin, pin, pin_len);
763 wpa_printf(MSG_DEBUG, "WPS: A new PIN configured (timeout=%d)",
766 wpa_hexdump_ascii_key(MSG_DEBUG, "WPS: PIN", pin, pin_len);
785 struct wps_uuid_pin *pin)
790 if (is_zero_ether_addr(pin->enrollee_addr))
793 addr = pin->enrollee_addr;
795 wps_remove_pin(pin);
802 struct wps_uuid_pin *pin, *prev;
806 dl_list_for_each_safe(pin, prev, &reg->pins, struct wps_uuid_pin, list)
808 if ((pin->flags & PIN_EXPIRES) &&
809 os_time_before(&pin->expiration, &now)) {
810 wpa_hexdump(MSG_DEBUG, "WPS: Expired PIN for UUID",
811 pin->uuid, WPS_UUID_LEN);
812 wps_registrar_remove_pin(reg, pin);
819 * wps_registrar_invalidate_wildcard_pin - Invalidate a wildcard PIN
821 * @dev_pw: PIN to search for or %NULL to match any
823 * Returns: 0 on success, -1 if not wildcard PIN is enabled
829 struct wps_uuid_pin *pin, *prev;
831 dl_list_for_each_safe(pin, prev, &reg->pins, struct wps_uuid_pin, list)
833 if (dev_pw && pin->pin &&
834 (dev_pw_len != pin->pin_len ||
835 os_memcmp(dev_pw, pin->pin, dev_pw_len) != 0))
836 continue; /* different PIN */
837 if (pin->wildcard_uuid) {
838 wpa_hexdump(MSG_DEBUG, "WPS: Invalidated PIN for UUID",
839 pin->uuid, WPS_UUID_LEN);
840 wps_registrar_remove_pin(reg, pin);
850 * wps_registrar_invalidate_pin - Invalidate a PIN for a specific UUID-E
853 * Returns: 0 on success, -1 on failure (e.g., PIN not found)
857 struct wps_uuid_pin *pin, *prev;
859 dl_list_for_each_safe(pin, prev, &reg->pins, struct wps_uuid_pin, list)
861 if (os_memcmp(pin->uuid, uuid, WPS_UUID_LEN) == 0) {
862 wpa_hexdump(MSG_DEBUG, "WPS: Invalidated PIN for UUID",
863 pin->uuid, WPS_UUID_LEN);
864 wps_registrar_remove_pin(reg, pin);
876 struct wps_uuid_pin *pin, *found = NULL;
880 dl_list_for_each(pin, &reg->pins, struct wps_uuid_pin, list) {
881 if (!pin->wildcard_uuid &&
882 os_memcmp(pin->uuid, uuid, WPS_UUID_LEN) == 0) {
883 found = pin;
891 dl_list_for_each(pin, &reg->pins, struct wps_uuid_pin, list) {
892 if (pin->wildcard_uuid == 1 ||
893 pin->wildcard_uuid == 2) {
895 "PIN. Assigned it for this UUID-E");
896 pin->wildcard_uuid++;
897 os_memcpy(pin->uuid, uuid, WPS_UUID_LEN);
898 found = pin;
908 * Lock the PIN to avoid attacks based on concurrent re-use of the PIN
909 * that could otherwise avoid PIN invalidations.
912 wpa_printf(MSG_DEBUG, "WPS: Selected PIN locked - do not "
918 return found->pin;
923 * wps_registrar_unlock_pin - Unlock a PIN for a specific UUID-E
929 * PIN to allow it to be used again. If the specified PIN was configured using
934 struct wps_uuid_pin *pin;
936 dl_list_for_each(pin, &reg->pins, struct wps_uuid_pin, list) {
937 if (os_memcmp(pin->uuid, uuid, WPS_UUID_LEN) == 0) {
938 if (pin->wildcard_uuid == 3) {
940 "wildcard PIN");
943 pin->flags &= ~PIN_LOCKED;
1027 wpa_printf(MSG_DEBUG, "WPS: PIN completed using internal Registrar");
1050 wpa_hexdump_key(MSG_DEBUG, "WPS: Invalidated wildcard PIN",
1064 /* PIN Method */
1065 wpa_printf(MSG_DEBUG, "WPS: PIN is set - cancelling it");
1346 const u8 *pin;
1353 wpa_printf(MSG_DEBUG, "WPS: Use default PIN for PBC");
1354 pin = (const u8 *) "00000000";
1360 pin = wps->nfc_pw_token->dev_pw;
1364 pin = wps_registrar_get_pin(wps->wps->registrar, wps->uuid_e,
1366 if (pin && wps->dev_pw_id >= 0x10) {
1368 "Password ID, but PIN found");
1370 * See whether Enrollee is willing to use PIN instead.
1375 if (pin == NULL) {
1386 os_memcpy(wps->dev_password, pin, pin_len);
2238 * In case wildcard PIN is used and WPS handshake succeeds in the first
2239 * attempt, wps_registrar_unlock_pin() would not free the PIN, so make
2240 * sure the PIN gets invalidated here.
2764 * Use the AP PIN only to receive the current AP settings, not