3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-26 18:59:22 +01:00

wscutil: Add wsc_is_pin_valid

This commit is contained in:
Denis Kenzior 2017-02-13 19:37:10 -06:00
parent 1307a815a6
commit 89d6b85f1d
2 changed files with 18 additions and 0 deletions

View File

@ -2515,3 +2515,19 @@ bool wsc_kdf(const void *key, void *output, size_t size)
return true;
}
bool wsc_pin_is_valid(const char *pin)
{
unsigned int i;
for (i = 0; pin[i] >= '0' && pin[i] <= '9'; i++)
;
if (pin[i])
return false;
if (i != 8 && i != 4)
return false;
return true;
}

View File

@ -637,3 +637,5 @@ struct wsc_session_key {
} __attribute__ ((packed));
bool wsc_kdf(const void *kdk, void *output, size_t size);
bool wsc_pin_is_valid(const char *pin);