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:
Jouni Malinen 2019-04-25 19:29:39 +03:00 committed by Jouni Malinen
parent 1e237903f5
commit ff229da309
4 changed files with 11 additions and 18 deletions

View file

@ -119,15 +119,6 @@ EAP_PWD_group * get_eap_pwd_group(u16 num)
}
static 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;
}
/*
* compute a "random" secret point on an elliptic curve based
* on the password and identities.