}
 }
 
-static __le32 getcrc32(u8 *buf, int len)
-{
-       u8 *p;
-       u32  crc;
-
-       if (bcrc32initialized == 0)
-               crc32_init();
-
-       crc = 0xffffffff;       /* preload shift register, per CRC-32 spec */
-
-       for (p = buf; len > 0; ++p, --len)
-               crc = crc32_table[(crc ^ *p) & 0xff] ^ (crc >> 8);
-
-       return cpu_to_le32(~crc);    /* transmit complement, per CRC-32 spec */
-}
-
 /*
        Need to consider the fragment  situation
 */
 void rtw_wep_encrypt(struct adapter *padapter, u8 *pxmitframe)
 {      /*  exclude ICV */
-
-       unsigned char   crc[4];
+       union {
+               __le32 f0;
+               u8 f1[4];
+       } crc;
        struct arc4context       mycontext;
 
        int     curfragnum, length;
                        if ((curfragnum+1) == pattrib->nr_frags) {      /* the last fragment */
                                length = pattrib->last_txcmdsz-pattrib->hdrlen-pattrib->iv_len-pattrib->icv_len;
 
-                               *((__le32 *)crc) = getcrc32(payload, length);
+                               crc.f0 = cpu_to_le32(~crc32_le(~0, payload, length));
 
                                arcfour_init(&mycontext, wepkey, 3+keylength);
                                arcfour_encrypt(&mycontext, payload, payload, length);
-                               arcfour_encrypt(&mycontext, payload+length, crc, 4);
+                               arcfour_encrypt(&mycontext, payload+length, crc.f1, 4);
                        } else {
                                length = pxmitpriv->frag_len-pattrib->hdrlen-pattrib->iv_len-pattrib->icv_len;
-                               *((__le32 *)crc) = getcrc32(payload, length);
+                               crc.f0 = cpu_to_le32(~crc32_le(~0, payload, length));
                                arcfour_init(&mycontext, wepkey, 3+keylength);
                                arcfour_encrypt(&mycontext, payload, payload, length);
-                               arcfour_encrypt(&mycontext, payload+length, crc, 4);
+                               arcfour_encrypt(&mycontext, payload+length, crc.f1, 4);
 
                                pframe += pxmitpriv->frag_len;
                                pframe = (u8 *)RND4((size_t)(pframe));
 void rtw_wep_decrypt(struct adapter  *padapter, u8 *precvframe)
 {
        /*  exclude ICV */
-       u8      crc[4];
+       union {
+               __le32 f0;
+               u8 f1[4];
+       } crc;
        struct arc4context       mycontext;
        int     length;
        u32     keylength;
                arcfour_encrypt(&mycontext, payload, payload,  length);
 
                /* calculate icv and compare the icv */
-               *((__le32 *)crc) = getcrc32(payload, length - 4);
+               crc.f0 = cpu_to_le32(~crc32_le(~0, payload, length));
 
-               if (crc[3] != payload[length-1] ||
-                   crc[2] != payload[length-2] ||
-                   crc[1] != payload[length-3] ||
-                   crc[0] != payload[length-4]) {
+               if (crc.f1[3] != payload[length-1] ||
+                   crc.f1[2] != payload[length-2] ||
+                   crc.f1[1] != payload[length-3] ||
+                   crc.f1[0] != payload[length-4]) {
                        RT_TRACE(_module_rtl871x_security_c_, _drv_err_,
                                 ("rtw_wep_decrypt:icv error crc (%4ph)!=payload (%4ph)\n",
                                 &crc, &payload[length-4]));
        u32     pnh;
        u8      rc4key[16];
        u8   ttkey[16];
-       u8      crc[4];
+       union {
+               __le32 f0;
+               u8 f1[4];
+       } crc;
        u8   hw_hdr_offset = 0;
        struct arc4context mycontext;
        int                     curfragnum, length;
                                        RT_TRACE(_module_rtl871x_security_c_, _drv_info_,
                                                 ("pattrib->iv_len=%x, pattrib->icv_len=%x\n",
                                                 pattrib->iv_len, pattrib->icv_len));
-                                       *((__le32 *)crc) = getcrc32(payload, length);/* modified by Amy*/
+                                       crc.f0 = cpu_to_le32(~crc32_le(~0, payload, length));
 
                                        arcfour_init(&mycontext, rc4key, 16);
                                        arcfour_encrypt(&mycontext, payload, payload, length);
-                                       arcfour_encrypt(&mycontext, payload+length, crc, 4);
+                                       arcfour_encrypt(&mycontext, payload+length, crc.f1, 4);
                                } else {
                                        length = pxmitpriv->frag_len-pattrib->hdrlen-pattrib->iv_len-pattrib->icv_len ;
-                                       *((__le32 *)crc) = getcrc32(payload, length);/* modified by Amy*/
+                                       crc.f0 = cpu_to_le32(~crc32_le(~0, payload, length));
+
                                        arcfour_init(&mycontext, rc4key, 16);
                                        arcfour_encrypt(&mycontext, payload, payload, length);
-                                       arcfour_encrypt(&mycontext, payload+length, crc, 4);
+                                       arcfour_encrypt(&mycontext, payload+length, crc.f1, 4);
 
                                        pframe += pxmitpriv->frag_len;
                                        pframe = (u8 *)RND4((size_t)(pframe));
        u32 pnh;
        u8   rc4key[16];
        u8   ttkey[16];
-       u8      crc[4];
+       union {
+               __le32 f0;
+               u8 f1[4];
+       } crc;
        struct arc4context mycontext;
        int                     length;
 
                        arcfour_init(&mycontext, rc4key, 16);
                        arcfour_encrypt(&mycontext, payload, payload, length);
 
-                       *((__le32 *)crc) = getcrc32(payload, length-4);
+                       crc.f0 = cpu_to_le32(~crc32_le(~0, payload, length));
 
-                       if (crc[3] != payload[length-1] ||
-                           crc[2] != payload[length-2] ||
-                           crc[1] != payload[length-3] ||
-                           crc[0] != payload[length-4]) {
+                       if (crc.f1[3] != payload[length-1] ||
+                           crc.f1[2] != payload[length-2] ||
+                           crc.f1[1] != payload[length-3] ||
+                           crc.f1[0] != payload[length-4]) {
                                RT_TRACE(_module_rtl871x_security_c_, _drv_err_,
                                         ("rtw_wep_decrypt:icv error crc (%4ph)!=payload (%4ph)\n",
                                         &crc, &payload[length-4]));