You've already forked wifi-rtl8852bs
mirror of
https://github.com/armbian/wifi-rtl8852bs.git
synced 2026-01-06 11:09:01 -08:00
Fix aes_encrypt() redefinition errors
This fixes function definition conflicts with aes kernel module as defined in include/crypto/aes.h Change-Id: I4e5d62364a04a190c3dac474e595bcb36882519c Signed-off-by: UtsavBalar1231 <utsavbalar1231@gmail.com>
This commit is contained in:
committed by
ColorfulRhino
parent
6f1a2eeb91
commit
56420ff22f
@@ -40,7 +40,7 @@ static void aes_ccm_auth_start(void *aes, size_t M, size_t L, const u8 *nonce,
|
||||
WPA_PUT_BE16(&b[AES_BLOCK_SIZE - L], plain_len);
|
||||
|
||||
wpa_hexdump_key(_MSG_EXCESSIVE_, "CCM B_0", b, AES_BLOCK_SIZE);
|
||||
aes_encrypt(aes, b, x); /* X_1 = E(K, B_0) */
|
||||
aes_rtl8852bs_encrypt(aes, b, x); /* X_1 = E(K, B_0) */
|
||||
|
||||
if (!aad_len)
|
||||
return;
|
||||
@@ -50,12 +50,12 @@ static void aes_ccm_auth_start(void *aes, size_t M, size_t L, const u8 *nonce,
|
||||
os_memset(aad_buf + 2 + aad_len, 0, sizeof(aad_buf) - 2 - aad_len);
|
||||
|
||||
xor_aes_block(aad_buf, x);
|
||||
aes_encrypt(aes, aad_buf, x); /* X_2 = E(K, X_1 XOR B_1) */
|
||||
aes_rtl8852bs_encrypt(aes, aad_buf, x); /* X_2 = E(K, X_1 XOR B_1) */
|
||||
|
||||
if (aad_len > AES_BLOCK_SIZE - 2) {
|
||||
xor_aes_block(&aad_buf[AES_BLOCK_SIZE], x);
|
||||
/* X_3 = E(K, X_2 XOR B_2) */
|
||||
aes_encrypt(aes, &aad_buf[AES_BLOCK_SIZE], x);
|
||||
aes_rtl8852bs_encrypt(aes, &aad_buf[AES_BLOCK_SIZE], x);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,13 +69,13 @@ static void aes_ccm_auth(void *aes, const u8 *data, size_t len, u8 *x)
|
||||
/* X_i+1 = E(K, X_i XOR B_i) */
|
||||
xor_aes_block(x, data);
|
||||
data += AES_BLOCK_SIZE;
|
||||
aes_encrypt(aes, x, x);
|
||||
aes_rtl8852bs_encrypt(aes, x, x);
|
||||
}
|
||||
if (last) {
|
||||
/* XOR zero-padded last block */
|
||||
for (i = 0; i < last; i++)
|
||||
x[i] ^= *data++;
|
||||
aes_encrypt(aes, x, x);
|
||||
aes_rtl8852bs_encrypt(aes, x, x);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,14 +98,14 @@ static void aes_ccm_encr(void *aes, size_t L, const u8 *in, size_t len, u8 *out,
|
||||
for (i = 1; i <= len / AES_BLOCK_SIZE; i++) {
|
||||
WPA_PUT_BE16(&a[AES_BLOCK_SIZE - 2], i);
|
||||
/* S_i = E(K, A_i) */
|
||||
aes_encrypt(aes, a, out);
|
||||
aes_rtl8852bs_encrypt(aes, a, out);
|
||||
xor_aes_block(out, in);
|
||||
out += AES_BLOCK_SIZE;
|
||||
in += AES_BLOCK_SIZE;
|
||||
}
|
||||
if (last) {
|
||||
WPA_PUT_BE16(&a[AES_BLOCK_SIZE - 2], i);
|
||||
aes_encrypt(aes, a, out);
|
||||
aes_rtl8852bs_encrypt(aes, a, out);
|
||||
/* XOR zero-padded last block */
|
||||
for (i = 0; i < last; i++)
|
||||
*out++ ^= *in++;
|
||||
@@ -121,7 +121,7 @@ static void aes_ccm_encr_auth(void *aes, size_t M, u8 *x, u8 *a, u8 *auth)
|
||||
wpa_hexdump_key(_MSG_EXCESSIVE_, "CCM T", x, M);
|
||||
/* U = T XOR S_0; S_0 = E(K, A_0) */
|
||||
WPA_PUT_BE16(&a[AES_BLOCK_SIZE - 2], 0);
|
||||
aes_encrypt(aes, a, tmp);
|
||||
aes_rtl8852bs_encrypt(aes, a, tmp);
|
||||
for (i = 0; i < M; i++)
|
||||
auth[i] = x[i] ^ tmp[i];
|
||||
wpa_hexdump_key(_MSG_EXCESSIVE_, "CCM U", auth, M);
|
||||
@@ -136,7 +136,7 @@ static void aes_ccm_decr_auth(void *aes, size_t M, u8 *a, const u8 *auth, u8 *t)
|
||||
wpa_hexdump_key(_MSG_EXCESSIVE_, "CCM U", auth, M);
|
||||
/* U = T XOR S_0; S_0 = E(K, A_0) */
|
||||
WPA_PUT_BE16(&a[AES_BLOCK_SIZE - 2], 0);
|
||||
aes_encrypt(aes, a, tmp);
|
||||
aes_rtl8852bs_encrypt(aes, a, tmp);
|
||||
for (i = 0; i < M; i++)
|
||||
t[i] = auth[i] ^ tmp[i];
|
||||
wpa_hexdump_key(_MSG_EXCESSIVE_, "CCM T", t, M);
|
||||
@@ -155,7 +155,7 @@ int aes_ccm_ae(const u8 *key, size_t key_len, const u8 *nonce,
|
||||
if (aad_len > 30 || M > AES_BLOCK_SIZE)
|
||||
return -1;
|
||||
|
||||
aes = aes_encrypt_init(key, key_len);
|
||||
aes = aes_rtl8852bs_encrypt_init(key, key_len);
|
||||
if (aes == NULL)
|
||||
return -1;
|
||||
|
||||
@@ -167,7 +167,7 @@ int aes_ccm_ae(const u8 *key, size_t key_len, const u8 *nonce,
|
||||
aes_ccm_encr(aes, L, plain, plain_len, crypt, a);
|
||||
aes_ccm_encr_auth(aes, M, x, a, auth);
|
||||
|
||||
aes_encrypt_deinit(aes);
|
||||
aes_rtl8852bs_encrypt_deinit(aes);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -186,7 +186,7 @@ int aes_ccm_ad(const u8 *key, size_t key_len, const u8 *nonce,
|
||||
if (aad_len > 30 || M > AES_BLOCK_SIZE)
|
||||
return -1;
|
||||
|
||||
aes = aes_encrypt_init(key, key_len);
|
||||
aes = aes_rtl8852bs_encrypt_init(key, key_len);
|
||||
if (aes == NULL)
|
||||
return -1;
|
||||
|
||||
@@ -200,7 +200,7 @@ int aes_ccm_ad(const u8 *key, size_t key_len, const u8 *nonce,
|
||||
aes_ccm_auth_start(aes, M, L, nonce, aad, aad_len, crypt_len, x);
|
||||
aes_ccm_auth(aes, plain, crypt_len, x);
|
||||
|
||||
aes_encrypt_deinit(aes);
|
||||
aes_rtl8852bs_encrypt_deinit(aes);
|
||||
|
||||
if (os_memcmp_const(x, t, M) != 0) {
|
||||
wpa_printf(_MSG_EXCESSIVE_, "CCM: Auth mismatch");
|
||||
|
||||
@@ -30,13 +30,13 @@ int aes_ctr_encrypt(const u8 *key, size_t key_len, const u8 *nonce,
|
||||
u8 *pos = data;
|
||||
u8 counter[AES_BLOCK_SIZE], buf[AES_BLOCK_SIZE];
|
||||
|
||||
ctx = aes_encrypt_init(key, key_len);
|
||||
ctx = aes_rtl8852bs_encrypt_init(key, key_len);
|
||||
if (ctx == NULL)
|
||||
return -1;
|
||||
os_memcpy(counter, nonce, AES_BLOCK_SIZE);
|
||||
|
||||
while (left > 0) {
|
||||
aes_encrypt(ctx, counter, buf);
|
||||
aes_rtl8852bs_encrypt(ctx, counter, buf);
|
||||
|
||||
len = (left < AES_BLOCK_SIZE) ? left : AES_BLOCK_SIZE;
|
||||
for (j = 0; j < len; j++)
|
||||
@@ -50,7 +50,7 @@ int aes_ctr_encrypt(const u8 *key, size_t key_len, const u8 *nonce,
|
||||
break;
|
||||
}
|
||||
}
|
||||
aes_encrypt_deinit(ctx);
|
||||
aes_rtl8852bs_encrypt_deinit(ctx);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -154,7 +154,7 @@ static void aes_gctr(void *aes, const u8 *icb, const u8 *x, size_t xlen, u8 *y)
|
||||
os_memcpy(cb, icb, AES_BLOCK_SIZE);
|
||||
/* Full blocks */
|
||||
for (i = 0; i < n; i++) {
|
||||
aes_encrypt(aes, cb, ypos);
|
||||
aes_rtl8852bs_encrypt(aes, cb, ypos);
|
||||
xor_block(ypos, xpos);
|
||||
xpos += AES_BLOCK_SIZE;
|
||||
ypos += AES_BLOCK_SIZE;
|
||||
@@ -164,7 +164,7 @@ static void aes_gctr(void *aes, const u8 *icb, const u8 *x, size_t xlen, u8 *y)
|
||||
last = x + xlen - xpos;
|
||||
if (last) {
|
||||
/* Last, partial block */
|
||||
aes_encrypt(aes, cb, tmp);
|
||||
aes_rtl8852bs_encrypt(aes, cb, tmp);
|
||||
for (i = 0; i < last; i++)
|
||||
*ypos++ = *xpos++ ^ tmp[i];
|
||||
}
|
||||
@@ -175,13 +175,13 @@ static void * aes_gcm_init_hash_subkey(const u8 *key, size_t key_len, u8 *H)
|
||||
{
|
||||
void *aes;
|
||||
|
||||
aes = aes_encrypt_init(key, key_len);
|
||||
aes = aes_rtl8852bs_encrypt_init(key, key_len);
|
||||
if (aes == NULL)
|
||||
return NULL;
|
||||
|
||||
/* Generate hash subkey H = AES_K(0^128) */
|
||||
os_memset(H, 0, AES_BLOCK_SIZE);
|
||||
aes_encrypt(aes, H, H);
|
||||
aes_rtl8852bs_encrypt(aes, H, H);
|
||||
wpa_hexdump_key(_MSG_EXCESSIVE_, "Hash subkey H for GHASH",
|
||||
H, AES_BLOCK_SIZE);
|
||||
return aes;
|
||||
@@ -275,7 +275,7 @@ int aes_gcm_ae(const u8 *key, size_t key_len, const u8 *iv, size_t iv_len,
|
||||
|
||||
/* Return (C, T) */
|
||||
|
||||
aes_encrypt_deinit(aes);
|
||||
aes_rtl8852bs_encrypt_deinit(aes);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -307,7 +307,7 @@ int aes_gcm_ad(const u8 *key, size_t key_len, const u8 *iv, size_t iv_len,
|
||||
/* T' = MSB_t(GCTR_K(J_0, S)) */
|
||||
aes_gctr(aes, J0, S, sizeof(S), T);
|
||||
|
||||
aes_encrypt_deinit(aes);
|
||||
aes_rtl8852bs_encrypt_deinit(aes);
|
||||
|
||||
if (os_memcmp_const(tag, T, 16) != 0) {
|
||||
wpa_printf(_MSG_EXCESSIVE_, "GCM: Tag mismatch");
|
||||
|
||||
@@ -93,7 +93,7 @@ d##3 = TE0(s##3) ^ TE1(s##0) ^ TE2(s##1) ^ TE3(s##2) ^ rk[4 * i + 3]
|
||||
}
|
||||
|
||||
|
||||
void * aes_encrypt_init(const u8 *key, size_t len)
|
||||
void * aes_rtl8852bs_encrypt_init(const u8 *key, size_t len)
|
||||
{
|
||||
u32 *rk;
|
||||
int res;
|
||||
@@ -114,7 +114,7 @@ void * aes_encrypt_init(const u8 *key, size_t len)
|
||||
}
|
||||
|
||||
|
||||
int aes_encrypt(void *ctx, const u8 *plain, u8 *crypt)
|
||||
int aes_rtl8852bs_encrypt(void *ctx, const u8 *plain, u8 *crypt)
|
||||
{
|
||||
u32 *rk = ctx;
|
||||
rijndaelEncrypt(ctx, rk[AES_PRIV_NR_POS], plain, crypt);
|
||||
@@ -122,7 +122,7 @@ int aes_encrypt(void *ctx, const u8 *plain, u8 *crypt)
|
||||
}
|
||||
|
||||
|
||||
void aes_encrypt_deinit(void *ctx)
|
||||
void aes_rtl8852bs_encrypt_deinit(void *ctx)
|
||||
{
|
||||
os_memset(ctx, 0, AES_PRIV_SIZE);
|
||||
rtw_mfree(ctx, AES_PRIV_SIZE);
|
||||
|
||||
@@ -50,7 +50,7 @@ int omac1_aes_vector(const u8 *key, size_t key_len, size_t num_elem,
|
||||
if (TEST_FAIL())
|
||||
return -1;
|
||||
|
||||
ctx = aes_encrypt_init(key, key_len);
|
||||
ctx = aes_rtl8852bs_encrypt_init(key, key_len);
|
||||
if (ctx == NULL)
|
||||
return -1;
|
||||
os_memset(cbc, 0, AES_BLOCK_SIZE);
|
||||
@@ -81,12 +81,12 @@ int omac1_aes_vector(const u8 *key, size_t key_len, size_t num_elem,
|
||||
}
|
||||
}
|
||||
if (left > AES_BLOCK_SIZE)
|
||||
aes_encrypt(ctx, cbc, cbc);
|
||||
aes_rtl8852bs_encrypt(ctx, cbc, cbc);
|
||||
left -= AES_BLOCK_SIZE;
|
||||
}
|
||||
|
||||
os_memset(pad, 0, AES_BLOCK_SIZE);
|
||||
aes_encrypt(ctx, pad, pad);
|
||||
aes_rtl8852bs_encrypt(ctx, pad, pad);
|
||||
gf_mulx(pad);
|
||||
|
||||
if (left || total_len == 0) {
|
||||
@@ -110,8 +110,8 @@ int omac1_aes_vector(const u8 *key, size_t key_len, size_t num_elem,
|
||||
|
||||
for (i = 0; i < AES_BLOCK_SIZE; i++)
|
||||
pad[i] ^= cbc[i];
|
||||
aes_encrypt(ctx, pad, mac);
|
||||
aes_encrypt_deinit(ctx);
|
||||
aes_rtl8852bs_encrypt(ctx, pad, mac);
|
||||
aes_rtl8852bs_encrypt_deinit(ctx);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -11,9 +11,9 @@
|
||||
|
||||
#define AES_BLOCK_SIZE 16
|
||||
|
||||
void * aes_encrypt_init(const u8 *key, size_t len);
|
||||
int aes_encrypt(void *ctx, const u8 *plain, u8 *crypt);
|
||||
void aes_encrypt_deinit(void *ctx);
|
||||
void * aes_rtl8852bs_encrypt_init(const u8 *key, size_t len);
|
||||
int aes_rtl8852bs_encrypt(void *ctx, const u8 *plain, u8 *crypt);
|
||||
void aes_rtl8852bs_encrypt_deinit(void *ctx);
|
||||
void * aes_decrypt_init(const u8 *key, size_t len);
|
||||
int aes_decrypt(void *ctx, const u8 *crypt, u8 *plain);
|
||||
void aes_decrypt_deinit(void *ctx);
|
||||
|
||||
Reference in New Issue
Block a user