[Buildroot] [PATCH 1/1] package/rtl8821au: fix build against 5.8.x kernel

Christian Stewart christian at paral.in
Wed Sep 9 03:32:27 UTC 2020


sha256_state collides with symbols in the kernel, rename it to rtl_sha256_state.

Signed-off-by: Christian Stewart <christian at paral.in>
---
 ...ate-to-rtl_sha256_state-to-avoid-nam.patch | 79 +++++++++++++++++++
 1 file changed, 79 insertions(+)
 create mode 100644 package/rtl8821au/0004-rename-sha256_state-to-rtl_sha256_state-to-avoid-nam.patch

diff --git a/package/rtl8821au/0004-rename-sha256_state-to-rtl_sha256_state-to-avoid-nam.patch b/package/rtl8821au/0004-rename-sha256_state-to-rtl_sha256_state-to-avoid-nam.patch
new file mode 100644
index 0000000000..41cee2b247
--- /dev/null
+++ b/package/rtl8821au/0004-rename-sha256_state-to-rtl_sha256_state-to-avoid-nam.patch
@@ -0,0 +1,79 @@
+From 19aee91e45788d594615a9be58fa5d0879ec816a Mon Sep 17 00:00:00 2001
+From: youcai <omegacoleman at gmail.com>
+Date: Tue, 18 Aug 2020 00:43:16 +0800
+Subject: [PATCH] rename sha256_state to rtl_sha256_state to avoid name
+ conflict with crypto
+
+[Upstream: https://github.com/abperiasamy/rtl8812AU_8821AU_linux/pull/338/commits/af6f6c1578f16145478326a939bb7593bbcdb4e7.patch]
+Signed-off-by: Coleman <omegacoleman at gmail.com>
+Signed-off-by: Christian Stewart <christian at paral.in>
+---
+ core/rtw_security.c    | 10 +++++-----
+ include/rtw_security.h |  2 +-
+ 2 files changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/core/rtw_security.c b/core/rtw_security.c
+index d54e6af..de2d91f 100644
+--- a/core/rtw_security.c
++++ b/core/rtw_security.c
+@@ -2200,7 +2200,7 @@ BIP_exit:
+ 
+ #ifndef PLATFORM_FREEBSD
+ /* compress 512-bits */
+-static int sha256_compress(struct sha256_state *md, unsigned char *buf)
++static int sha256_compress(struct rtl_sha256_state *md, unsigned char *buf)
+ {
+ 	u32 S[8], W[64], t0, t1;
+ 	u32 t;
+@@ -2249,7 +2249,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 sha256_init(struct rtl_sha256_state *md)
+ {
+ 	md->curlen = 0;
+ 	md->length = 0;
+@@ -2270,7 +2270,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 sha256_process(struct rtl_sha256_state *md, unsigned char *in,
+                           unsigned long inlen)
+ {
+ 	unsigned long n;
+@@ -2311,7 +2311,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 sha256_done(struct rtl_sha256_state *md, unsigned char *out)
+ {
+ 	int i;
+ 
+@@ -2363,7 +2363,7 @@ static int sha256_done(struct sha256_state *md, unsigned char *out)
+ static int sha256_vector(size_t num_elem, u8 *addr[], size_t *len,
+                          u8 *mac)
+ {
+-	struct sha256_state ctx;
++	struct rtl_sha256_state ctx;
+ 	size_t i;
+ 
+ 	sha256_init(&ctx);
+diff --git a/include/rtw_security.h b/include/rtw_security.h
+index d41014e..98feb69 100644
+--- a/include/rtw_security.h
++++ b/include/rtw_security.h
+@@ -233,7 +233,7 @@ struct security_priv {
+ #endif /* DBG_SW_SEC_CNT */
+ };
+ 
+-struct sha256_state {
++struct rtl_sha256_state {
+ 	u64 length;
+ 	u32 state[8], curlen;
+ 	u8 buf[64];
+-- 
+2.28.0
+
-- 
2.28.0



More information about the buildroot mailing list