Avoid aliasing symbols in newer kernels

This commit is contained in:
Stephen Oliver 2020-12-14 23:52:48 -05:00
parent f71a963ad7
commit baaa09253d
2 changed files with 23 additions and 23 deletions

View File

@ -2133,7 +2133,7 @@ BIP_exit:
#ifndef PLATFORM_FREEBSD
#if defined(CONFIG_TDLS)
/* compress 512-bits */
static int sha256_compress(struct sha256_state *md, unsigned char *buf)
static int rtw_sha256_compress(struct rtw_sha256_state *md, unsigned char *buf)
{
u32 S[8], W[64], t0, t1;
u32 t;
@ -2181,7 +2181,7 @@ static int sha256_compress(struct sha256_state *md, unsigned char *buf)
}
/* Initialize the hash state */
static void sha256_init(struct sha256_state *md)
static void rtw_sha256_init(struct rtw_sha256_state *md)
{
md->curlen = 0;
md->length = 0;
@ -2202,7 +2202,7 @@ static void sha256_init(struct sha256_state *md)
@param inlen The length of the data (octets)
@return CRYPT_OK if successful
*/
static int sha256_process(struct sha256_state *md, unsigned char *in,
static int rtw_sha256_process(struct rtw_sha256_state *md, unsigned char *in,
unsigned long inlen)
{
unsigned long n;
@ -2213,7 +2213,7 @@ static int sha256_process(struct sha256_state *md, unsigned char *in,
while (inlen > 0) {
if (md->curlen == 0 && inlen >= block_size) {
if (sha256_compress(md, (unsigned char *) in) < 0)
if (rtw_sha256_compress(md, (unsigned char *) in) < 0)
return -1;
md->length += block_size * 8;
in += block_size;
@ -2225,7 +2225,7 @@ static int sha256_process(struct sha256_state *md, unsigned char *in,
in += n;
inlen -= n;
if (md->curlen == block_size) {
if (sha256_compress(md, md->buf) < 0)
if (rtw_sha256_compress(md, md->buf) < 0)
return -1;
md->length += 8 * block_size;
md->curlen = 0;
@ -2243,7 +2243,7 @@ static int sha256_process(struct sha256_state *md, unsigned char *in,
@param out [out] The destination of the hash (32 bytes)
@return CRYPT_OK if successful
*/
static int sha256_done(struct sha256_state *md, unsigned char *out)
static int rtw_sha256_done(struct rtw_sha256_state *md, unsigned char *out)
{
int i;
@ -2263,7 +2263,7 @@ static int sha256_done(struct sha256_state *md, unsigned char *out)
if (md->curlen > 56) {
while (md->curlen < 64)
md->buf[md->curlen++] = (unsigned char) 0;
sha256_compress(md, md->buf);
rtw_sha256_compress(md, md->buf);
md->curlen = 0;
}
@ -2273,7 +2273,7 @@ static int sha256_done(struct sha256_state *md, unsigned char *out)
/* store length */
WPA_PUT_BE64(md->buf + 56, md->length);
sha256_compress(md, md->buf);
rtw_sha256_compress(md, md->buf);
/* copy output */
for (i = 0; i < 8; i++)
@ -2290,17 +2290,17 @@ static int sha256_done(struct sha256_state *md, unsigned char *out)
* @mac: Buffer for the hash
* Returns: 0 on success, -1 of failure
*/
static int sha256_vector(size_t num_elem, u8 *addr[], size_t *len,
static int rtw_sha256_vector(size_t num_elem, u8 *addr[], size_t *len,
u8 *mac)
{
struct sha256_state ctx;
struct rtw_sha256_state ctx;
size_t i;
sha256_init(&ctx);
rtw_sha256_init(&ctx);
for (i = 0; i < num_elem; i++)
if (sha256_process(&ctx, addr[i], len[i]))
if (rtw_sha256_process(&ctx, addr[i], len[i]))
return -1;
if (sha256_done(&ctx, mac))
if (rtw_sha256_done(&ctx, mac))
return -1;
return 0;
}
@ -2362,7 +2362,7 @@ static void hmac_sha256_vector(u8 *key, size_t key_len, size_t num_elem,
/* if key is longer than 64 bytes reset it to key = SHA256(key) */
if (key_len > 64) {
sha256_vector(1, &key, &key_len, tk);
rtw_sha256_vector(1, &key, &key_len, tk);
key = tk;
key_len = 32;
}
@ -2390,7 +2390,7 @@ static void hmac_sha256_vector(u8 *key, size_t key_len, size_t num_elem,
_addr[i + 1] = addr[i];
_len[i + 1] = len[i];
}
sha256_vector(1 + num_elem, _addr, _len, mac);
rtw_sha256_vector(1 + num_elem, _addr, _len, mac);
_rtw_memset(k_pad, 0, sizeof(k_pad));
_rtw_memcpy(k_pad, key, key_len);
@ -2403,7 +2403,7 @@ static void hmac_sha256_vector(u8 *key, size_t key_len, size_t num_elem,
_len[0] = 64;
_addr[1] = mac;
_len[1] = 32;
sha256_vector(2, _addr, _len, mac);
rtw_sha256_vector(2, _addr, _len, mac);
}
#endif /* CONFIG_TDLS */
#endif /* PLATFORM_FREEBSD */
@ -2422,7 +2422,7 @@ static void hmac_sha256_vector(u8 *key, size_t key_len, size_t num_elem,
*/
#ifndef PLATFORM_FREEBSD /* Baron */
#if defined(CONFIG_TDLS)
static void sha256_prf(u8 *key, size_t key_len, char *label,
static void rtw_sha256_prf(u8 *key, size_t key_len, char *label,
u8 *data, size_t data_len, u8 *buf, size_t buf_len)
{
u16 counter = 1;
@ -2446,10 +2446,10 @@ static void sha256_prf(u8 *key, size_t key_len, char *label,
while (pos < buf_len) {
plen = buf_len - pos;
WPA_PUT_LE16(counter_le, counter);
if (plen >= SHA256_MAC_LEN) {
if (plen >= RTW_SHA256_MAC_LEN) {
hmac_sha256_vector(key, key_len, 4, addr, len,
&buf[pos]);
pos += SHA256_MAC_LEN;
pos += RTW_SHA256_MAC_LEN;
} else {
hmac_sha256_vector(key, key_len, 4, addr, len, hash);
_rtw_memcpy(&buf[pos], hash, plen);
@ -3108,7 +3108,7 @@ void wpa_tdls_generate_tpk(_adapter *padapter, void *sta)
nonce[1] = SNonce;
}
sha256_vector(2, nonce, len, key_input);
rtw_sha256_vector(2, nonce, len, key_input);
/*
* TPK-Key-Data = KDF-N_KEY(TPK-Key-Input, "TDLS PMK",
@ -3127,7 +3127,7 @@ void wpa_tdls_generate_tpk(_adapter *padapter, void *sta)
}
_rtw_memcpy(data + 2 * ETH_ALEN, get_bssid(pmlmepriv), ETH_ALEN);
sha256_prf(key_input, SHA256_MAC_LEN, "TDLS PMK", data, sizeof(data), (u8 *) &psta->tpk, sizeof(psta->tpk));
rtw_sha256_prf(key_input, RTW_SHA256_MAC_LEN, "TDLS PMK", data, sizeof(data), (u8 *) &psta->tpk, sizeof(psta->tpk));
}

View File

@ -41,7 +41,7 @@ const char *security_type_str(u8 value);
#define _WPA_IE_ID_ 0xdd
#define _WPA2_IE_ID_ 0x30
#define SHA256_MAC_LEN 32
#define RTW_SHA256_MAC_LEN 32
#define AES_BLOCK_SIZE 16
#define AES_PRIV_SIZE (4 * 44)
@ -249,7 +249,7 @@ struct security_priv {
#define SEC_IS_BIP_KEY_INSTALLED(sec) _FALSE
#endif
struct sha256_state {
struct rtw_sha256_state {
u64 length;
u32 state[8], curlen;
u8 buf[64];