Skip to content

Commit

Permalink
Add an OP for random number generator
Browse files Browse the repository at this point in the history
Useful in generating random MAC address.

Signed-off-by: Chaitanya Tata <[email protected]>
  • Loading branch information
krish2718 committed Dec 12, 2024
1 parent b6a6409 commit 690596c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
11 changes: 11 additions & 0 deletions nrf_wifi/os_if/inc/osal_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -1609,4 +1609,15 @@ int nrf_wifi_osal_mem_cmp(struct nrf_wifi_osal_priv *opriv,
const void *addr1,
const void *addr2,
size_t count);

/**
* nrf_wifi_osal_rand8_get() - Get a random 8 bit number.
* @opriv: Pointer to the OSAL context returned by the @nrf_wifi_osal_init API.
*
* Generates an 8 bit random number.
*
* Return:
* returns an 8 bit random number.
*/
unsigned char nrf_wifi_osal_rand8_get(struct nrf_wifi_osal_priv *opriv);
#endif /* __OSAL_API_H__ */
1 change: 1 addition & 0 deletions nrf_wifi/os_if/inc/osal_ops.h
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,7 @@ struct nrf_wifi_osal_ops {
char *assert_msg);

unsigned int (*strlen)(const void *str);
unsigned char (*rand8_get)(void);
};


Expand Down
5 changes: 5 additions & 0 deletions nrf_wifi/os_if/src/osal.c
Original file line number Diff line number Diff line change
Expand Up @@ -922,3 +922,8 @@ unsigned int nrf_wifi_osal_strlen(struct nrf_wifi_osal_priv *opriv,
{
return opriv->ops->strlen(str);
}

unsigned char nrf_wifi_osal_rand8_get(struct nrf_wifi_osal_priv *opriv)
{
return opriv->ops->rand8_get();
}

0 comments on commit 690596c

Please sign in to comment.