Re: [PATCH 3/3] staging: rtl8712: Use existing arc4 implementation

From: kernel test robot
Date: Sat Apr 17 2021 - 08:57:54 EST


Hi Christophe,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on staging/staging-testing]

url: https://github.com/0day-ci/linux/commits/Christophe-JAILLET/staging-rtl8188eu-Use-existing-arc4-implementation/20210410-213656
base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git 32abcac8037da5dc570c22abf266cbb92eee9fc9
config: x86_64-randconfig-s021-20210416 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.3-280-g2cd6d34e-dirty
# https://github.com/0day-ci/linux/commit/ea2709e5f53370e588967f79d2eb847555ea9d3b
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Christophe-JAILLET/staging-rtl8188eu-Use-existing-arc4-implementation/20210410-213656
git checkout ea2709e5f53370e588967f79d2eb847555ea9d3b
# save the attached .config to linux build tree
make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' W=1 ARCH=x86_64

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All errors (new ones prefixed by >>):

ld: drivers/staging/rtl8712/rtl871x_security.o: in function `r8712_wep_encrypt':
>> drivers/staging/rtl8712/rtl871x_security.c:126: undefined reference to `arc4_setkey'
>> ld: drivers/staging/rtl8712/rtl871x_security.c:127: undefined reference to `arc4_crypt'
ld: drivers/staging/rtl8712/rtl871x_security.c:129: undefined reference to `arc4_crypt'
>> ld: drivers/staging/rtl8712/rtl871x_security.c:137: undefined reference to `arc4_setkey'
ld: drivers/staging/rtl8712/rtl871x_security.c:138: undefined reference to `arc4_crypt'
ld: drivers/staging/rtl8712/rtl871x_security.c:140: undefined reference to `arc4_crypt'
ld: drivers/staging/rtl8712/rtl871x_security.o: in function `r8712_wep_decrypt':
drivers/staging/rtl8712/rtl871x_security.c:177: undefined reference to `arc4_setkey'
ld: drivers/staging/rtl8712/rtl871x_security.c:178: undefined reference to `arc4_crypt'
ld: drivers/staging/rtl8712/rtl871x_security.o: in function `r8712_tkip_encrypt':
drivers/staging/rtl8712/rtl871x_security.c:550: undefined reference to `arc4_setkey'
ld: drivers/staging/rtl8712/rtl871x_security.c:551: undefined reference to `arc4_crypt'
ld: drivers/staging/rtl8712/rtl871x_security.c:553: undefined reference to `arc4_crypt'
ld: drivers/staging/rtl8712/rtl871x_security.c:562: undefined reference to `arc4_setkey'
ld: drivers/staging/rtl8712/rtl871x_security.c:563: undefined reference to `arc4_crypt'
ld: drivers/staging/rtl8712/rtl871x_security.c:565: undefined reference to `arc4_crypt'
ld: drivers/staging/rtl8712/rtl871x_security.o: in function `r8712_tkip_decrypt':
drivers/staging/rtl8712/rtl871x_security.c:625: undefined reference to `arc4_setkey'
ld: drivers/staging/rtl8712/rtl871x_security.c:626: undefined reference to `arc4_crypt'


vim +126 drivers/staging/rtl8712/rtl871x_security.c

88
89 /*
90 * Need to consider the fragment situation
91 */
92 void r8712_wep_encrypt(struct _adapter *padapter, u8 *pxmitframe)
93 { /* exclude ICV */
94 unsigned char crc[4];
95 struct arc4_ctx mycontext;
96 u32 curfragnum, length, keylength, pki;
97 u8 *pframe, *payload, *iv; /*,*wepkey*/
98 u8 wepkey[16];
99 struct pkt_attrib *pattrib = &((struct xmit_frame *)
100 pxmitframe)->attrib;
101 struct security_priv *psecuritypriv = &padapter->securitypriv;
102 struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
103
104 if (((struct xmit_frame *)pxmitframe)->buf_addr == NULL)
105 return;
106 pframe = ((struct xmit_frame *)pxmitframe)->buf_addr + TXDESC_OFFSET;
107 /*start to encrypt each fragment*/
108 if ((pattrib->encrypt == _WEP40_) || (pattrib->encrypt == _WEP104_)) {
109 pki = psecuritypriv->PrivacyKeyIndex;
110 keylength = psecuritypriv->DefKeylen[pki];
111 for (curfragnum = 0; curfragnum < pattrib->nr_frags;
112 curfragnum++) {
113 iv = pframe + pattrib->hdrlen;
114 memcpy(&wepkey[0], iv, 3);
115 memcpy(&wepkey[3], &psecuritypriv->DefKey[
116 psecuritypriv->PrivacyKeyIndex].skey[0],
117 keylength);
118 payload = pframe + pattrib->iv_len + pattrib->hdrlen;
119 if ((curfragnum + 1) == pattrib->nr_frags) {
120 length = pattrib->last_txcmdsz -
121 pattrib->hdrlen -
122 pattrib->iv_len -
123 pattrib->icv_len;
124 *((__le32 *)crc) = cpu_to_le32(getcrc32(
125 payload, length));
> 126 arc4_setkey(&mycontext, wepkey, 3 + keylength);
> 127 arc4_crypt(&mycontext, payload, payload,
128 length);
129 arc4_crypt(&mycontext, payload + length,
130 crc, 4);
131 } else {
132 length = pxmitpriv->frag_len -
133 pattrib->hdrlen - pattrib->iv_len -
134 pattrib->icv_len;
135 *((__le32 *)crc) = cpu_to_le32(getcrc32(
136 payload, length));
> 137 arc4_setkey(&mycontext, wepkey, 3 + keylength);
138 arc4_crypt(&mycontext, payload, payload,
139 length);
140 arc4_crypt(&mycontext, payload + length,
141 crc, 4);
142 pframe += pxmitpriv->frag_len;
143 pframe = (u8 *)RND4((addr_t)(pframe));
144 }
145 }
146 }
147 }
148

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip