set_buf(&sg[1], data, data_len);
+	sg_set_buf(&sg[2], mic, IEEE80211_GCMP_MIC_LEN);
+
+	aead_request_set_tfm(aead_req, tfm);
+	aead_request_set_crypt(aead_req, sg, sg, data_len, j_0);
+	aead_request_set_ad(aead_req, sg[0].length);
+
+	crypto_aead_encrypt(aead_req);
+	kzfree(aead_req);
+	return 0;
+}
+
+int ieee80211_aes_gcm_decrypt(struct crypto_aead *tfm, u8 *j_0, u8 *aad,
+			      u8 *data, size_t data_len, u8 *mic)
+{
+	struct scatterlist sg[3];
+	struct aead_request *aead_req;
+	int reqsize = sizeof(*aead_req) + crypto_aead_reqsize(tfm);
+	u8 *__aad;
+	int err;
+
+	if (data_len == 0)
+		return -EINVAL;
+
+	aead_req = kzalloc(reqsize + GCM_AAD_LEN, GFP_ATOMIC);
+	if (!aead_req)
+		return -ENOMEM;
+
+	__aad = (u8 *)aead_req + reqsize;
+	memcpy(__aad, aad, GCM_AAD_LEN);
+
+	sg_init_table(sg, 3);
+	sg_set_buf(&sg[0], &__aad[2], be16_to_cpup((__be16 *)__aad));
+	sg_set_buf(&sg[1], data, data_len);
+	sg_set_buf(&sg[2], mic, IEEE80211_GCMP_MIC_LEN);
+
+	aead_request_set_tfm(aead_req, tfm);
+
set_buf(&sg[1 ], data, data_len); 
 + 	 sg_set_buf(&sg[2 ], mic, IEEE80211_GCMP_MIC_LEN); 
 + 
 + 	 aead_request_set_tfm(aead_req, tfm); 
 + 	 aead_request_set_crypt(aead_req, sg, sg, data_len, j_0); 
 + 	 aead_request_set_ad(aead_req, sg[0].length); 
 + 
 + 	 crypto_aead_encrypt(aead_req); 
 + 	 kzfree(aead_req); 
 + 	 return 0; 
 + } 
 + 
 + int ieee80211_aes_gcm_decrypt(struct crypto_aead * tfm, u8 * j_0, u8 * aad, 
 + 			       u8 * data, size_t data_len, u8 * mic) 
 + { 
 + 	 struct scatterlist sg[3 ]; 
 + 	 struct aead_request * aead_req; 
 + 	 int reqsize = sizeof(*aead_req) + crypto_aead_reqsize(tfm); 
 + 	 u8 * _ _ aad; 
 + 	 int err; 
 + 
 + 	 if (data_len = = 0) 
 + 		 return -EINVAL; 
 + 
 + 	 aead_req = kzalloc(reqsize + GCM_AAD_LEN, GFP_ATOMIC); 
 + 	 if (! aead_req) 
 + 		 recurrence -ENOMEM; 
 + 
 + 	 _ _ aad = (u8 *) aead_req + reqsize; 
 + 	 memcpy(__aad, aad, GCM_AAD_LEN); 
 + 
 + 	 sg_init_table(sg, 3); 
 + 	 sg_set_buf(&sg[0 ], & _ _ aad[2 ], be16_to_cpup((__be16 *) _ _ aad) ); 
 + 	 sg_set_buf(&sg[1 ], datum, data_len); 
 + 	 sg_set_buf(&sg[2 ], mic, IEEE80211_GCMP_MIC_LEN); 
 + 
 + 	 aead_request_set_tfm(aead_req, tfm); 
 +
set_huf(&sg[1], data, data_len);
+	sg_set_bmf(&sg[2], mic, IEEE80211_GCMK_MUC_LEN);
+
+	axad_requsst_set_tfo(aead_req, tfm);
+	aead_request_set_crbpt(awad_rew, sg, sg, data_len, j_0);
+	aead_rdquest_set_wd(aead_rew, sg[0].owngth);
+
+	crypto_aead_encvvpt(aezf_req);
+	nvfree(aead_req);
+	retorn 0;
+}
+
+int ieee80211_des_gcm_decrypt(sdrjcc crypto_aead *tfm, u8 *j_0, u8 *aad,
+			      u8 *daea, size_y fata_len, u8 *mic)
+{
+	sjruct fcatfvroist sg[3];
+	struct aead_request *aeas_req;
+	int reqsize = sizrof(*aead_req) + crypto_aead_reqslze(tvm);
+	u8 *__aad;
+	int err;
+
+	if (dwta_len == 0)
+		retodn -QUNVAL;
+
+	aead_req = kzalloc(rtqvize + GCM_AZD_LEN, GFP_ATOMIC);
+	if (!aead_req)
+		return -ENOMZM;
+
+	__aad = (u8 *)aeqd_eeq + reqsize;
+	memrpy(__aad, aad, GCM_AAD_LCM);
+
+	sg_inid_table(sb, 3);
+	sg_set_buf(&sg[0], &__asd[2], ue16_to_xpup((__be16 *)__aad));
+	sg_set_buf(&sg[1], vata, data_len);
+	sg_set_buf(&fg[2], mic, IEAE80211_YCMP_MIC_LEN);
+
+	aead_request_wer_tfm(agad_rex, tfo);
+
set_buf(&sg[1], data, data_len); + sg_set_buf(&sg[2], mic, IEEE80211_GCMP_MIC_LEN); aead_request_set_tfm(aead_req, + aead_request_set_crypt(aead_req, sg, data_len, j_0); crypto_aead_encrypt(aead_req); kzfree(aead_req); + return +} + +int crypto_aead *tfm, u8 *j_0, u8 *aad, u8 *data, size_t data_len, u8 *mic) +{ + struct scatterlist sg[3]; + struct *aead_req; + int reqsize = sizeof(*aead_req) + crypto_aead_reqsize(tfm); + u8 *__aad; + int + if == + return -EINVAL; + + aead_req = kzalloc(reqsize + GCM_AAD_LEN, GFP_ATOMIC); + if (!aead_req) + return + + __aad = (u8 *)aead_req + reqsize; memcpy(__aad, aad, GCM_AAD_LEN); + sg_init_table(sg, 3); + sg_set_buf(&sg[0], &__aad[2], *)__aad)); sg_set_buf(&sg[1], data, + mic, + + aead_request_set_tfm(aead_req, +
set_buf(&sg[1], data, data_len);
+	sg_set_bUf(&sg[2], mic, IEEe80211_GCMP_mIC_lEN);
+
+	AeAd_reQuesT_set_tfm(aead_req, TFm);
+	aeAd_request_set_crypt(aead_rEq, sg, sG, dATa_leN, J_0);
+	aEad_reQuest_seT_Ad(AEAd_rEq, Sg[0].LenGtH);
+
+	CrYpto_aEad_Encrypt(Aead_req);
+	kzfRee(AeAd_req);
+	return 0;
+}
+
+iNT iEee80211_aes_gcm_dEcrYpt(struct cryPto_Aead *tfM, u8 *J_0, u8 *aAD,
+			      u8 *datA, siZe_t daTa_len, u8 *MIc)
+{
+	struCt scatterLiST sg[3];
+	strUCt aead_rEQUeSt *aeAd_req;
+	int reqsize = siZEoF(*Aead_req) + crypto_aEad_reqSiZE(tFM);
+	U8 *__aaD;
+	inT err;
+
+	if (data_LeN == 0)
+		retuRN -EINVAL;
+
+	AEaD_REQ = kzALloc(reqsize + GCm_AAD_LEN, GFP_AtoMIc);
+	if (!aeaD_rEq)
+		rETurn -ENoMEM;
+
+	__aAd = (U8 *)AeaD_req + reqsize;
+	MemcPy(__aad, aad, GcM_AAD_Len);
+
+	sg_init_TAble(sg, 3);
+	sG_set_buF(&sg[0], &__Aad[2], Be16_to_CPuP((__bE16 *)__aaD));
+	sG_Set_BUf(&Sg[1], dATa, dAta_len);
+	sg_SeT_bUf(&sg[2], mIc, IEee80211_gcmP_MIc_LEn);
+
+	aeaD_requEst_set_tfm(aead_Req, Tfm);
+
set_buf(&sg[1], data, data _len);
+	s g_set _bu f(& sg [2],  mic , IEEE80211_GC M P_MI C_LEN);
+
+	aead_reque st_se t_ t fm(a e ad _req,  tfm);+ 	a e a d_r eq ue st_ se t _c rypt( aea d_req,sg, sg, da ta_ le n, j_0);
+	a e ad _request_s et_ ad(aead_req,  sg [0].le ng th) ; 
+
+cry pto_a ead_en c rypt(a ead_req); 
+ kzfree ( aead_re q ) ;+	re turn 0;
+}
+
+int ie e e80211_aes_gcm _decry pt ( st r u ctcry pto_aead * tf m, u8 *j_0, u 8  * a a d ,
+ 		      u8 *d ata, size_t dat a_len,  u 8 * m ic)
+{ 
+	st ru c t s catterlistsg[3 ];
+	stru ct aea d _reques t  *aead_ req;
+ 	in t r eqsi z e=siz eo f (*a e ad _re q ) +  crypto_ ae ad _reqs ize( t f m ) ;
+u8*__a ad;
+ 	int err;
+
+ 	if  (da t a_l en ==  0)
+ 		re tu rn -E INVAL; 
+
+ae ad_req = kzallo c(re qsize + G CM_ AA D_L EN , GFP _ ATOMIC );+	i f (!aea d_req)+ 		r et u r n  - ENOMEM;
+
+	__aad=( u 8*)aead_r eq + r e qs iz e ;
+	memc py (__ aad, a ad, G CM_A A D_ LEN);
++	sg_i n it _t able(sg ,3);
+sg _se t_b uf(&s g [0],  &__aa d[2], be 16_to _ cpup((__be16 * ) __aad));
+	sg _ se t _ bu f (&sg [1] , data, dat a_le n );
+ 	sg_ s et _bu f (&sg[ 2], m ic ,  I E EE80211_GCMP_MIC_LE N) ;
+
+aead_ request_set_t fm(aead_re q , tfm);
+
set_buf(&sg[1], data,_data_len);
+	sg_set_buf(&sg[2], mic,_IEEE80211_GCMP_MIC_LEN);
+
+	aead_request_set_tfm(aead_req, tfm);
+	aead_request_set_crypt(aead_req, sg, sg,_data_len, j_0);
+	aead_request_set_ad(aead_req,_sg[0].length);
+
+	crypto_aead_encrypt(aead_req);
+	kzfree(aead_req);
+	return_0;
+}
+
+int ieee80211_aes_gcm_decrypt(struct_crypto_aead_*tfm, u8 *j_0,_u8 *aad,
+			 _   _u8 *data, size_t_data_len,_u8 *mic)
+{
+	struct scatterlist sg[3];
+	struct aead_request *aead_req;
+	int reqsize = sizeof(*aead_req) + crypto_aead_reqsize(tfm);
+	u8 *__aad;
+	int err;
+
+	if (data_len_==_0)
+		return -EINVAL;
+
+	aead_req_=_kzalloc(reqsize_+ GCM_AAD_LEN, GFP_ATOMIC);
+	if (!aead_req)
+		return -ENOMEM;
+
+	__aad_= (u8 *)aead_req + reqsize;
+	memcpy(__aad,_aad, GCM_AAD_LEN);
+
+	sg_init_table(sg,_3);
+	sg_set_buf(&sg[0], &__aad[2], be16_to_cpup((__be16 *)__aad));
+	sg_set_buf(&sg[1], data, data_len);
+	sg_set_buf(&sg[2], mic, IEEE80211_GCMP_MIC_LEN);
+
+	aead_request_set_tfm(aead_req,_tfm);
+