diff --git a/src/common/sae.c b/src/common/sae.c index 0d56e5505..466d0a853 100644 --- a/src/common/sae.c +++ b/src/common/sae.c @@ -134,15 +134,6 @@ void sae_clear_data(struct sae_data *sae) } -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; -} - - static struct crypto_bignum * sae_get_rand(struct sae_data *sae) { u8 val[SAE_MAX_PRIME_LEN]; diff --git a/src/eap_common/eap_pwd_common.c b/src/eap_common/eap_pwd_common.c index 6ca2c8bad..2efcfc7f9 100644 --- a/src/eap_common/eap_pwd_common.c +++ b/src/eap_common/eap_pwd_common.c @@ -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. diff --git a/src/utils/common.c b/src/utils/common.c index b9c8bfdb9..836fef190 100644 --- a/src/utils/common.c +++ b/src/utils/common.c @@ -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; diff --git a/src/utils/common.h b/src/utils/common.h index 792a30ab9..36f67fa71 100644 --- a/src/utils/common.h +++ b/src/utils/common.h @@ -477,6 +477,7 @@ int hwaddr_aton2(const char *txt, u8 *addr); int hex2byte(const char *hex); int hexstr2bin(const char *hex, u8 *buf, size_t len); void inc_byte_array(u8 *counter, size_t len); +void buf_shift_right(u8 *buf, size_t len, size_t bits); void wpa_get_ntp_timestamp(u8 *buf); int wpa_scnprintf(char *buf, size_t size, const char *fmt, ...); int wpa_snprintf_hex_sep(char *buf, size_t buf_size, const u8 *data, size_t len,