Share a single buf_shift_right() implementation
Move the identical function used by both SAE and EAP-pwd to src/utils/common.c to avoid duplicated implementation. Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
This commit is contained in:
parent
1e237903f5
commit
ff229da309
4 changed files with 11 additions and 18 deletions
|
@ -230,6 +230,16 @@ void inc_byte_array(u8 *counter, size_t len)
|
|||
}
|
||||
|
||||
|
||||
void buf_shift_right(u8 *buf, size_t len, size_t bits)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
for (i = len - 1; i > 0; i--)
|
||||
buf[i] = (buf[i - 1] << (8 - bits)) | (buf[i] >> bits);
|
||||
buf[0] >>= bits;
|
||||
}
|
||||
|
||||
|
||||
void wpa_get_ntp_timestamp(u8 *buf)
|
||||
{
|
||||
struct os_time now;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue