Lines Matching refs:pin
82 u8 *pin;
92 static void wps_free_pin(struct wps_uuid_pin *pin)
94 bin_clear_free(pin->pin, pin->pin_len);
95 os_free(pin);
99 static void wps_remove_pin(struct wps_uuid_pin *pin)
101 dl_list_del(&pin->list);
102 wps_free_pin(pin);
108 struct wps_uuid_pin *pin, *prev;
109 dl_list_for_each_safe(pin, prev, pins, struct wps_uuid_pin, list)
110 wps_remove_pin(pin);
230 struct wps_uuid_pin *pin);
762 struct wps_uuid_pin *pin;
764 dl_list_for_each(pin, ®->pins, struct wps_uuid_pin, list) {
765 if (pin->wildcard_uuid == 1 && !(pin->flags & PIN_LOCKED)) {
767 "configured wildcard PIN");
768 wps_registrar_remove_pin(reg, pin);
776 * wps_registrar_add_pin - Configure a new PIN for Registrar
780 * @pin: PIN (Device Password)
781 * @pin_len: Length of pin in octets
782 * @timeout: Time (in seconds) when the PIN will be invalidated; 0 = no timeout
786 const u8 *uuid, const u8 *pin, size_t pin_len,
800 p->pin = os_memdup(pin, pin_len);
801 if (p->pin == NULL) {
818 wpa_printf(MSG_DEBUG, "WPS: A new PIN configured (timeout=%d)",
821 wpa_hexdump_ascii_key(MSG_DEBUG, "WPS: PIN", pin, pin_len);
840 struct wps_uuid_pin *pin)
845 if (is_zero_ether_addr(pin->enrollee_addr))
848 addr = pin->enrollee_addr;
850 wps_remove_pin(pin);
857 struct wps_uuid_pin *pin, *prev;
861 dl_list_for_each_safe(pin, prev, ®->pins, struct wps_uuid_pin, list)
863 if ((pin->flags & PIN_EXPIRES) &&
864 os_reltime_before(&pin->expiration, &now)) {
865 wpa_hexdump(MSG_DEBUG, "WPS: Expired PIN for UUID",
866 pin->uuid, WPS_UUID_LEN);
867 wps_registrar_remove_pin(reg, pin);
874 * wps_registrar_invalidate_wildcard_pin - Invalidate a wildcard PIN
876 * @dev_pw: PIN to search for or %NULL to match any
878 * Returns: 0 on success, -1 if not wildcard PIN is enabled
884 struct wps_uuid_pin *pin, *prev;
886 dl_list_for_each_safe(pin, prev, ®->pins, struct wps_uuid_pin, list)
888 if (dev_pw && pin->pin &&
889 (dev_pw_len != pin->pin_len ||
890 os_memcmp_const(dev_pw, pin->pin, dev_pw_len) != 0))
891 continue; /* different PIN */
892 if (pin->wildcard_uuid) {
893 wpa_hexdump(MSG_DEBUG, "WPS: Invalidated PIN for UUID",
894 pin->uuid, WPS_UUID_LEN);
895 wps_registrar_remove_pin(reg, pin);
905 * wps_registrar_invalidate_pin - Invalidate a PIN for a specific UUID-E
908 * Returns: 0 on success, -1 on failure (e.g., PIN not found)
912 struct wps_uuid_pin *pin, *prev;
914 dl_list_for_each_safe(pin, prev, ®->pins, struct wps_uuid_pin, list)
916 if (os_memcmp(pin->uuid, uuid, WPS_UUID_LEN) == 0) {
917 wpa_hexdump(MSG_DEBUG, "WPS: Invalidated PIN for UUID",
918 pin->uuid, WPS_UUID_LEN);
919 wps_registrar_remove_pin(reg, pin);
931 struct wps_uuid_pin *pin, *found = NULL;
936 dl_list_for_each(pin, ®->pins, struct wps_uuid_pin, list) {
937 if (!pin->wildcard_uuid &&
938 os_memcmp(pin->uuid, uuid, WPS_UUID_LEN) == 0) {
939 found = pin;
947 dl_list_for_each(pin, ®->pins, struct wps_uuid_pin, list) {
948 if (pin->wildcard_uuid == 1 ||
949 pin->wildcard_uuid == 2) {
951 "PIN. Assigned it for this UUID-E");
953 os_memcpy(pin->uuid, uuid, WPS_UUID_LEN);
954 found = pin;
964 * Lock the PIN to avoid attacks based on concurrent re-use of the PIN
965 * that could otherwise avoid PIN invalidations.
968 wpa_printf(MSG_DEBUG, "WPS: Selected PIN locked - do not "
976 return found->pin;
981 * wps_registrar_unlock_pin - Unlock a PIN for a specific UUID-E
987 * PIN to allow it to be used again. If the specified PIN was configured using
992 struct wps_uuid_pin *pin;
994 dl_list_for_each(pin, ®->pins, struct wps_uuid_pin, list) {
995 if (os_memcmp(pin->uuid, uuid, WPS_UUID_LEN) == 0) {
996 if (pin->wildcard_uuid == 3) {
998 "wildcard PIN");
1001 pin->flags &= ~PIN_LOCKED;
1087 wpa_printf(MSG_DEBUG, "WPS: PIN completed using internal Registrar");
1112 wpa_hexdump_key(MSG_DEBUG, "WPS: Invalidated wildcard PIN",
1126 /* PIN Method */
1127 wpa_printf(MSG_DEBUG, "WPS: PIN is set - cancelling it");
1407 const u8 *pin;
1414 wpa_printf(MSG_DEBUG, "WPS: Use default PIN for PBC");
1415 pin = (const u8 *) "00000000";
1428 pin = wps->nfc_pw_token->dev_pw;
1434 pin = wpabuf_head(wps->wps->ap_nfc_dev_pw);
1438 pin = wps_registrar_get_pin(wps->wps->registrar, wps->uuid_e,
1440 if (pin && wps->dev_pw_id >= 0x10) {
1442 "Password ID, but PIN found");
1444 * See whether Enrollee is willing to use PIN instead.
1449 if (pin == NULL) {
1458 wps->dev_password = os_memdup(pin, pin_len);
2375 * In case wildcard PIN is used and WPS handshake succeeds in the first
2376 * attempt, wps_registrar_unlock_pin() would not free the PIN, so make
2377 * sure the PIN gets invalidated here.
2941 * Use the AP PIN only to receive the current AP settings, not