[wireless] add set/get pmksa api for fast-auth
Signed-off-by: meijian <meijian@xiaomi.com>
This commit is contained in:
parent
cf7491a1fe
commit
7bf20f1a89
@ -964,6 +964,28 @@ int wapi_set_pta_prio(int sock, FAR const char *ifname,
|
|||||||
int wapi_get_pta_prio(int sock, FAR const char *ifname,
|
int wapi_get_pta_prio(int sock, FAR const char *ifname,
|
||||||
enum wapi_pta_prio_e *pta_prio);
|
enum wapi_pta_prio_e *pta_prio);
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: wapi_set_pmksa
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Set the wlan pmksa.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
int wapi_set_pmksa(int sock, FAR const char *ifname,
|
||||||
|
FAR const uint8_t *pmk, int len);
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: wapi_get_pmksa
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Get the wlan pmksa.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
int wapi_get_pmksa(int sock, FAR const char *ifname,
|
||||||
|
FAR uint8_t *pmk, int len);
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: wapi_extend_params
|
* Name: wapi_extend_params
|
||||||
*
|
*
|
||||||
|
@ -275,6 +275,12 @@ FAR const char *wapi_ioctl_command_name(int cmd)
|
|||||||
case SIOCSIWPTAPRIO:
|
case SIOCSIWPTAPRIO:
|
||||||
return "SIOCSIWPTAPRIO";
|
return "SIOCSIWPTAPRIO";
|
||||||
|
|
||||||
|
case SIOCSIWPMKSA:
|
||||||
|
return "SIOCSIWPMKSA";
|
||||||
|
|
||||||
|
case SIOCGIWPMKSA:
|
||||||
|
return "SIOCGIWPMKSA";
|
||||||
|
|
||||||
default:
|
default:
|
||||||
snprintf(g_ioctl_command_namebuf, WAPI_IOCTL_COMMAND_NAMEBUFSIZ,
|
snprintf(g_ioctl_command_namebuf, WAPI_IOCTL_COMMAND_NAMEBUFSIZ,
|
||||||
"0x%x", cmd);
|
"0x%x", cmd);
|
||||||
|
@ -1628,6 +1628,74 @@ int wapi_get_pta_prio(int sock, FAR const char *ifname,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: wapi_set_pmksa
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Set the wlan pmksa.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
int wapi_set_pmksa(int sock, FAR const char *ifname,
|
||||||
|
FAR const uint8_t *pmk, int len)
|
||||||
|
{
|
||||||
|
struct iwreq wrq =
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
WAPI_VALIDATE_PTR(pmk);
|
||||||
|
|
||||||
|
wrq.u.data.pointer = (FAR void *)pmk;
|
||||||
|
wrq.u.data.length = len;
|
||||||
|
|
||||||
|
strlcpy(wrq.ifr_name, ifname, IFNAMSIZ);
|
||||||
|
ret = ioctl(sock, SIOCSIWPMKSA, (unsigned long)((uintptr_t)&wrq));
|
||||||
|
if (ret < 0)
|
||||||
|
{
|
||||||
|
int errcode = errno;
|
||||||
|
WAPI_IOCTL_STRERROR(SIOCSIWPMKSA, errcode);
|
||||||
|
ret = -errcode;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: wapi_get_pmksa
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Get the wlan pmksa.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
int wapi_get_pmksa(int sock, FAR const char *ifname,
|
||||||
|
FAR uint8_t *pmk, int len)
|
||||||
|
{
|
||||||
|
struct iwreq wrq =
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
WAPI_VALIDATE_PTR(pmk);
|
||||||
|
|
||||||
|
wrq.u.data.pointer = pmk;
|
||||||
|
wrq.u.data.length = len;
|
||||||
|
|
||||||
|
strlcpy(wrq.ifr_name, ifname, IFNAMSIZ);
|
||||||
|
ret = ioctl(sock, SIOCGIWPMKSA, (unsigned long)((uintptr_t)&wrq));
|
||||||
|
if (ret < 0)
|
||||||
|
{
|
||||||
|
int errcode = errno;
|
||||||
|
WAPI_IOCTL_STRERROR(SIOCGIWPMKSA, errcode);
|
||||||
|
ret = -errcode;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: wapi_extend_params
|
* Name: wapi_extend_params
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user