Browse Source

hostapd_driver_ops reduction

send_eapol, set_key, read_sta_data, sta_clear_stats,
set_radius_acl_auth, set_radius_acl_expire, and set_beacon
to use inline functions instead of extra abstraction.
Jouni Malinen 14 years ago
parent
commit
3acdf771b8
10 changed files with 126 additions and 148 deletions
  1. 3 2
      src/ap/accounting.c
  2. 0 83
      src/ap/ap_drv_ops.c
  3. 73 0
      src/ap/ap_drv_ops.h
  4. 3 3
      src/ap/beacon.c
  5. 18 17
      src/ap/hostapd.c
  6. 0 19
      src/ap/hostapd.h
  7. 4 5
      src/ap/ieee802_11_auth.c
  8. 16 13
      src/ap/ieee802_1x.c
  9. 5 3
      src/ap/vlan_init.c
  10. 4 3
      src/ap/wpa_auth_glue.c

+ 3 - 2
src/ap/accounting.c

@@ -23,6 +23,7 @@
 #include "ieee802_1x.h"
 #include "ap_config.h"
 #include "sta_info.h"
+#include "ap_drv_ops.h"
 #include "accounting.h"
 
 
@@ -186,7 +187,7 @@ static int accounting_sta_update_stats(struct hostapd_data *hapd,
 				       struct sta_info *sta,
 				       struct hostap_sta_driver_data *data)
 {
-	if (hapd->drv.read_sta_data(hapd, data, sta->addr))
+	if (hostapd_drv_read_sta_data(hapd, data, sta->addr))
 		return -1;
 
 	if (sta->last_rx_bytes > data->rx_bytes)
@@ -249,7 +250,7 @@ void accounting_sta_start(struct hostapd_data *hapd, struct sta_info *sta)
 	time(&sta->acct_session_start);
 	sta->last_rx_bytes = sta->last_tx_bytes = 0;
 	sta->acct_input_gigawords = sta->acct_output_gigawords = 0;
-	hapd->drv.sta_clear_stats(hapd, sta->addr);
+	hostapd_drv_sta_clear_stats(hapd, sta->addr);
 
 	if (!hapd->conf->radius->acct_server)
 		return;

+ 0 - 83
src/ap/ap_drv_ops.c

@@ -157,17 +157,6 @@ static int hostapd_set_ap_wps_ie(struct hostapd_data *hapd)
 }
 
 
-static int hostapd_send_eapol(struct hostapd_data *hapd, const u8 *addr,
-			      const u8 *data, size_t data_len, int encrypt)
-{
-	if (hapd->driver == NULL || hapd->driver->hapd_send_eapol == NULL)
-		return 0;
-	return hapd->driver->hapd_send_eapol(hapd->drv_priv, addr, data,
-					     data_len, encrypt,
-					     hapd->own_addr);
-}
-
-
 static int hostapd_set_authorized(struct hostapd_data *hapd,
 				  struct sta_info *sta, int authorized)
 {
@@ -184,37 +173,6 @@ static int hostapd_set_authorized(struct hostapd_data *hapd,
 }
 
 
-static int hostapd_set_key(const char *ifname, struct hostapd_data *hapd,
-			   enum wpa_alg alg, const u8 *addr, int key_idx,
-			   int set_tx, const u8 *seq, size_t seq_len,
-			   const u8 *key, size_t key_len)
-{
-	if (hapd->driver == NULL || hapd->driver->set_key == NULL)
-		return 0;
-	return hapd->driver->set_key(ifname, hapd->drv_priv, alg, addr,
-				     key_idx, set_tx, seq, seq_len, key,
-				     key_len);
-}
-
-
-static int hostapd_read_sta_data(struct hostapd_data *hapd,
-				 struct hostap_sta_driver_data *data,
-				 const u8 *addr)
-{
-	if (hapd->driver == NULL || hapd->driver->read_sta_data == NULL)
-		return -1;
-	return hapd->driver->read_sta_data(hapd->drv_priv, data, addr);
-}
-
-
-static int hostapd_sta_clear_stats(struct hostapd_data *hapd, const u8 *addr)
-{
-	if (hapd->driver == NULL || hapd->driver->sta_clear_stats == NULL)
-		return 0;
-	return hapd->driver->sta_clear_stats(hapd->drv_priv, addr);
-}
-
-
 static int hostapd_set_sta_flags(struct hostapd_data *hapd,
 				 struct sta_info *sta)
 {
@@ -251,27 +209,6 @@ static int hostapd_set_drv_ieee8021x(struct hostapd_data *hapd,
 }
 
 
-static int hostapd_set_radius_acl_auth(struct hostapd_data *hapd,
-				       const u8 *mac, int accepted,
-				       u32 session_timeout)
-{
-	if (hapd->driver == NULL || hapd->driver->set_radius_acl_auth == NULL)
-		return 0;
-	return hapd->driver->set_radius_acl_auth(hapd->drv_priv, mac, accepted,
-						 session_timeout);
-}
-
-
-static int hostapd_set_radius_acl_expire(struct hostapd_data *hapd,
-					 const u8 *mac)
-{
-	if (hapd->driver == NULL ||
-	    hapd->driver->set_radius_acl_expire == NULL)
-		return 0;
-	return hapd->driver->set_radius_acl_expire(hapd->drv_priv, mac);
-}
-
-
 static int hostapd_set_ap_isolate(struct hostapd_data *hapd, int value)
 {
 	if (hapd->driver == NULL || hapd->driver->set_intra_bss == NULL)
@@ -341,19 +278,6 @@ static int hostapd_set_bss_params(struct hostapd_data *hapd,
 }
 
 
-static int hostapd_set_beacon(struct hostapd_data *hapd,
-			      const u8 *head, size_t head_len,
-			      const u8 *tail, size_t tail_len, int dtim_period,
-			      int beacon_int)
-{
-	if (hapd->driver == NULL || hapd->driver->set_beacon == NULL)
-		return 0;
-	return hapd->driver->set_beacon(hapd->drv_priv,
-					head, head_len, tail, tail_len,
-					dtim_period, beacon_int);
-}
-
-
 static int hostapd_vlan_if_add(struct hostapd_data *hapd, const char *ifname)
 {
 	char force_ifname[IFNAMSIZ];
@@ -412,17 +336,10 @@ static int hostapd_sta_add(struct hostapd_data *hapd,
 void hostapd_set_driver_ops(struct hostapd_driver_ops *ops)
 {
 	ops->set_ap_wps_ie = hostapd_set_ap_wps_ie;
-	ops->send_eapol = hostapd_send_eapol;
 	ops->set_authorized = hostapd_set_authorized;
-	ops->set_key = hostapd_set_key;
-	ops->read_sta_data = hostapd_read_sta_data;
-	ops->sta_clear_stats = hostapd_sta_clear_stats;
 	ops->set_sta_flags = hostapd_set_sta_flags;
 	ops->set_drv_ieee8021x = hostapd_set_drv_ieee8021x;
-	ops->set_radius_acl_auth = hostapd_set_radius_acl_auth;
-	ops->set_radius_acl_expire = hostapd_set_radius_acl_expire;
 	ops->set_bss_params = hostapd_set_bss_params;
-	ops->set_beacon = hostapd_set_beacon;
 	ops->vlan_if_add = hostapd_vlan_if_add;
 	ops->vlan_if_remove = hostapd_vlan_if_remove;
 	ops->set_wds_sta = hostapd_set_wds_sta;

+ 73 - 0
src/ap/ap_drv_ops.h

@@ -130,4 +130,77 @@ static inline int hostapd_drv_sta_remove(struct hostapd_data *hapd,
 	return hapd->driver->sta_remove(hapd->drv_priv, addr);
 }
 
+static inline int hostapd_drv_hapd_send_eapol(struct hostapd_data *hapd,
+					      const u8 *addr, const u8 *data,
+					      size_t data_len, int encrypt)
+{
+	if (hapd->driver == NULL || hapd->driver->hapd_send_eapol == NULL)
+		return 0;
+	return hapd->driver->hapd_send_eapol(hapd->drv_priv, addr, data,
+					     data_len, encrypt,
+					     hapd->own_addr);
+}
+
+static inline int hostapd_drv_set_key(const char *ifname,
+				      struct hostapd_data *hapd,
+				      enum wpa_alg alg, const u8 *addr,
+				      int key_idx, int set_tx,
+				      const u8 *seq, size_t seq_len,
+				      const u8 *key, size_t key_len)
+{
+	if (hapd->driver == NULL || hapd->driver->set_key == NULL)
+		return 0;
+	return hapd->driver->set_key(ifname, hapd->drv_priv, alg, addr,
+				     key_idx, set_tx, seq, seq_len, key,
+				     key_len);
+}
+
+static inline int hostapd_drv_read_sta_data(
+	struct hostapd_data *hapd, struct hostap_sta_driver_data *data,
+	const u8 *addr)
+{
+	if (hapd->driver == NULL || hapd->driver->read_sta_data == NULL)
+		return -1;
+	return hapd->driver->read_sta_data(hapd->drv_priv, data, addr);
+}
+
+static inline int hostapd_drv_sta_clear_stats(struct hostapd_data *hapd,
+					      const u8 *addr)
+{
+	if (hapd->driver == NULL || hapd->driver->sta_clear_stats == NULL)
+		return 0;
+	return hapd->driver->sta_clear_stats(hapd->drv_priv, addr);
+}
+
+static inline int hostapd_drv_set_beacon(struct hostapd_data *hapd,
+					 const u8 *head, size_t head_len,
+					 const u8 *tail, size_t tail_len,
+					 int dtim_period, int beacon_int)
+{
+	if (hapd->driver == NULL || hapd->driver->set_beacon == NULL)
+		return 0;
+	return hapd->driver->set_beacon(hapd->drv_priv,
+					head, head_len, tail, tail_len,
+					dtim_period, beacon_int);
+}
+
+static inline int hostapd_drv_set_radius_acl_auth(struct hostapd_data *hapd,
+						  const u8 *mac, int accepted,
+						  u32 session_timeout)
+{
+	if (hapd->driver == NULL || hapd->driver->set_radius_acl_auth == NULL)
+		return 0;
+	return hapd->driver->set_radius_acl_auth(hapd->drv_priv, mac, accepted,
+						 session_timeout);
+}
+
+static inline int hostapd_drv_set_radius_acl_expire(struct hostapd_data *hapd,
+						    const u8 *mac)
+{
+	if (hapd->driver == NULL ||
+	    hapd->driver->set_radius_acl_expire == NULL)
+		return 0;
+	return hapd->driver->set_radius_acl_expire(hapd->drv_priv, mac);
+}
+
 #endif /* AP_DRV_OPS */

+ 3 - 3
src/ap/beacon.c

@@ -502,9 +502,9 @@ void ieee802_11_set_beacon(struct hostapd_data *hapd)
 
 	tail_len = tailpos > tail ? tailpos - tail : 0;
 
-	if (hapd->drv.set_beacon(hapd, (u8 *) head, head_len,
-				 tail, tail_len, hapd->conf->dtim_period,
-				 hapd->iconf->beacon_int))
+	if (hostapd_drv_set_beacon(hapd, (u8 *) head, head_len,
+				   tail, tail_len, hapd->conf->dtim_period,
+				   hapd->iconf->beacon_int))
 		wpa_printf(MSG_ERROR, "Failed to set beacon head/tail or DTIM "
 			   "period");
 

+ 18 - 17
src/ap/hostapd.c

@@ -135,8 +135,8 @@ static void hostapd_broadcast_key_clear_iface(struct hostapd_data *hapd,
 	int i;
 
 	for (i = 0; i < NUM_WEP_KEYS; i++) {
-		if (hapd->drv.set_key(ifname, hapd, WPA_ALG_NONE, NULL, i,
-				      i == 0 ? 1 : 0, NULL, 0, NULL, 0)) {
+		if (hostapd_drv_set_key(ifname, hapd, WPA_ALG_NONE, NULL, i,
+					i == 0 ? 1 : 0, NULL, 0, NULL, 0)) {
 			wpa_printf(MSG_DEBUG, "Failed to clear default "
 				   "encryption keys (ifname=%s keyidx=%d)",
 				   ifname, i);
@@ -145,9 +145,9 @@ static void hostapd_broadcast_key_clear_iface(struct hostapd_data *hapd,
 #ifdef CONFIG_IEEE80211W
 	if (hapd->conf->ieee80211w) {
 		for (i = NUM_WEP_KEYS; i < NUM_WEP_KEYS + 2; i++) {
-			if (hapd->drv.set_key(ifname, hapd, WPA_ALG_NONE, NULL,
-					      i, i == 0 ? 1 : 0, NULL, 0,
-					      NULL, 0)) {
+			if (hostapd_drv_set_key(ifname, hapd, WPA_ALG_NONE,
+						NULL, i, i == 0 ? 1 : 0, NULL,
+						0, NULL, 0)) {
 				wpa_printf(MSG_DEBUG, "Failed to clear "
 					   "default mgmt encryption keys "
 					   "(ifname=%s keyidx=%d)", ifname, i);
@@ -172,11 +172,11 @@ static int hostapd_broadcast_wep_set(struct hostapd_data *hapd)
 
 	idx = ssid->wep.idx;
 	if (ssid->wep.default_len &&
-	    hapd->drv.set_key(hapd->conf->iface,
-			      hapd, WPA_ALG_WEP, NULL, idx,
-			      idx == ssid->wep.idx,
-			      NULL, 0, ssid->wep.key[idx],
-			      ssid->wep.len[idx])) {
+	    hostapd_drv_set_key(hapd->conf->iface,
+				hapd, WPA_ALG_WEP, NULL, idx,
+				idx == ssid->wep.idx,
+				NULL, 0, ssid->wep.key[idx],
+				ssid->wep.len[idx])) {
 		wpa_printf(MSG_WARNING, "Could not set WEP encryption.");
 		errors++;
 	}
@@ -194,9 +194,10 @@ static int hostapd_broadcast_wep_set(struct hostapd_data *hapd)
 				continue;
 
 			idx = key->idx;
-			if (hapd->drv.set_key(ifname, hapd, WPA_ALG_WEP, NULL,
-					      idx, idx == key->idx, NULL, 0,
-					      key->key[idx], key->len[idx])) {
+			if (hostapd_drv_set_key(ifname, hapd, WPA_ALG_WEP,
+						NULL, idx, idx == key->idx,
+						NULL, 0, key->key[idx],
+						key->len[idx])) {
 				wpa_printf(MSG_WARNING, "Could not set "
 					   "dynamic VLAN WEP encryption.");
 				errors++;
@@ -303,10 +304,10 @@ static int hostapd_setup_encryption(char *iface, struct hostapd_data *hapd)
 
 	for (i = 0; i < 4; i++) {
 		if (hapd->conf->ssid.wep.key[i] &&
-		    hapd->drv.set_key(iface, hapd, WPA_ALG_WEP, NULL, i,
-				      i == hapd->conf->ssid.wep.idx, NULL, 0,
-				      hapd->conf->ssid.wep.key[i],
-				      hapd->conf->ssid.wep.len[i])) {
+		    hostapd_drv_set_key(iface, hapd, WPA_ALG_WEP, NULL, i,
+					i == hapd->conf->ssid.wep.idx, NULL, 0,
+					hapd->conf->ssid.wep.key[i],
+					hapd->conf->ssid.wep.len[i])) {
 			wpa_printf(MSG_WARNING, "Could not set WEP "
 				   "encryption.");
 			return -1;

+ 0 - 19
src/ap/hostapd.h

@@ -51,31 +51,12 @@ struct hostapd_frame_info {
 
 struct hostapd_driver_ops {
 	int (*set_ap_wps_ie)(struct hostapd_data *hapd);
-	int (*send_eapol)(struct hostapd_data *hapd, const u8 *addr,
-			  const u8 *data, size_t data_len, int encrypt);
 	int (*set_authorized)(struct hostapd_data *hapd, struct sta_info *sta,
 			      int authorized);
-	int (*set_key)(const char *ifname, struct hostapd_data *hapd,
-		       enum wpa_alg alg, const u8 *addr, int key_idx,
-		       int set_tx, const u8 *seq, size_t seq_len,
-		       const u8 *key, size_t key_len);
-	int (*read_sta_data)(struct hostapd_data *hapd,
-			     struct hostap_sta_driver_data *data,
-			     const u8 *addr);
-	int (*sta_clear_stats)(struct hostapd_data *hapd, const u8 *addr);
 	int (*set_sta_flags)(struct hostapd_data *hapd, struct sta_info *sta);
 	int (*set_drv_ieee8021x)(struct hostapd_data *hapd, const char *ifname,
 				 int enabled);
-	int (*set_radius_acl_auth)(struct hostapd_data *hapd,
-				   const u8 *mac, int accepted,
-				   u32 session_timeout);
-	int (*set_radius_acl_expire)(struct hostapd_data *hapd,
-				     const u8 *mac);
 	int (*set_bss_params)(struct hostapd_data *hapd, int use_protection);
-	int (*set_beacon)(struct hostapd_data *hapd,
-			  const u8 *head, size_t head_len,
-			  const u8 *tail, size_t tail_len, int dtim_period,
-			  int beacon_int);
 	int (*vlan_if_add)(struct hostapd_data *hapd, const char *ifname);
 	int (*vlan_if_remove)(struct hostapd_data *hapd, const char *ifname);
 	int (*set_wds_sta)(struct hostapd_data *hapd, const u8 *addr, int aid,

+ 4 - 5
src/ap/ieee802_11_auth.c

@@ -25,6 +25,7 @@
 #include "radius/radius_client.h"
 #include "hostapd.h"
 #include "ap_config.h"
+#include "ap_drv_ops.h"
 #include "ieee802_11.h"
 #include "ieee802_11_auth.h"
 
@@ -317,9 +318,7 @@ static void hostapd_acl_expire_cache(struct hostapd_data *hapd, time_t now)
 				prev->next = entry->next;
 			else
 				hapd->acl_cache = entry->next;
-#ifdef CONFIG_DRIVER_RADIUS_ACL
-			hapd->drv.set_radius_acl_expire(hapd, entry->addr);
-#endif /* CONFIG_DRIVER_RADIUS_ACL */
+			hostapd_drv_set_radius_acl_expire(hapd, entry->addr);
 			tmp = entry;
 			entry = entry->next;
 			os_free(tmp);
@@ -458,8 +457,8 @@ hostapd_acl_recv_radius(struct radius_msg *msg, struct radius_msg *req,
 	hapd->acl_cache = cache;
 
 #ifdef CONFIG_DRIVER_RADIUS_ACL
-	hapd->drv.set_radius_acl_auth(hapd, query->addr, cache->accepted,
-				      cache->session_timeout);
+	hostapd_drv_set_radius_acl_auth(hapd, query->addr, cache->accepted,
+					cache->session_timeout);
 #else /* CONFIG_DRIVER_RADIUS_ACL */
 #ifdef NEED_AP_MLME
 	/* Re-send original authentication frame for 802.11 processing */

+ 16 - 13
src/ap/ieee802_1x.c

@@ -34,6 +34,7 @@
 #include "preauth_auth.h"
 #include "pmksa_cache_auth.h"
 #include "ap_config.h"
+#include "ap_drv_ops.h"
 #include "ieee802_1x.h"
 
 
@@ -71,7 +72,8 @@ static void ieee802_1x_send(struct hostapd_data *hapd, struct sta_info *sta,
 	if (sta->flags & WLAN_STA_PREAUTH) {
 		rsn_preauth_send(hapd, sta, buf, len);
 	} else {
-		hapd->drv.send_eapol(hapd, sta->addr, buf, len, encrypt);
+		hostapd_drv_hapd_send_eapol(hapd, sta->addr, buf, len,
+					    encrypt);
 	}
 
 	os_free(buf);
@@ -230,8 +232,9 @@ ieee802_1x_group_alloc(struct hostapd_data *hapd, const char *ifname)
 	wpa_hexdump_key(MSG_DEBUG, "Default WEP key (dynamic VLAN)",
 			key->key[key->idx], key->len[key->idx]);
 
-	if (hapd->drv.set_key(ifname, hapd, WPA_ALG_WEP, NULL, key->idx, 1,
-			      NULL, 0, key->key[key->idx], key->len[key->idx]))
+	if (hostapd_drv_set_key(ifname, hapd, WPA_ALG_WEP, NULL, key->idx, 1,
+				NULL, 0, key->key[key->idx],
+				key->len[key->idx]))
 		printf("Could not set dynamic VLAN WEP encryption key.\n");
 
 	hapd->drv.set_drv_ieee8021x(hapd, ifname, 1);
@@ -347,9 +350,9 @@ void ieee802_1x_tx_key(struct hostapd_data *hapd, struct sta_info *sta)
 
 		/* TODO: set encryption in TX callback, i.e., only after STA
 		 * has ACKed EAPOL-Key frame */
-		if (hapd->drv.set_key(hapd->conf->iface, hapd, WPA_ALG_WEP,
-				      sta->addr, 0, 1, NULL, 0, ikey,
-				      hapd->conf->individual_wep_key_len)) {
+		if (hostapd_drv_set_key(hapd->conf->iface, hapd, WPA_ALG_WEP,
+					sta->addr, 0, 1, NULL, 0, ikey,
+					hapd->conf->individual_wep_key_len)) {
 			wpa_printf(MSG_ERROR, "Could not set individual WEP "
 				   "encryption.");
 		}
@@ -1438,10 +1441,10 @@ static void ieee802_1x_rekey(void *eloop_ctx, void *timeout_ctx)
 
 	/* TODO: Could setup key for RX here, but change default TX keyid only
 	 * after new broadcast key has been sent to all stations. */
-	if (hapd->drv.set_key(hapd->conf->iface, hapd, WPA_ALG_WEP, NULL,
-			      eapol->default_wep_key_idx, 1, NULL, 0,
-			      eapol->default_wep_key,
-			      hapd->conf->default_wep_key_len)) {
+	if (hostapd_drv_set_key(hapd->conf->iface, hapd, WPA_ALG_WEP, NULL,
+				eapol->default_wep_key_idx, 1, NULL, 0,
+				eapol->default_wep_key,
+				hapd->conf->default_wep_key_len)) {
 		hostapd_logger(hapd, NULL, HOSTAPD_MODULE_IEEE8021X,
 			       HOSTAPD_LEVEL_WARNING, "failed to configure a "
 			       "new broadcast key");
@@ -1688,9 +1691,9 @@ int ieee802_1x_init(struct hostapd_data *hapd)
 
 	if (hapd->conf->default_wep_key_len) {
 		for (i = 0; i < 4; i++)
-			hapd->drv.set_key(hapd->conf->iface, hapd,
-					  WPA_ALG_NONE, NULL, i, 0, NULL, 0,
-					  NULL, 0);
+			hostapd_drv_set_key(hapd->conf->iface, hapd,
+					    WPA_ALG_NONE, NULL, i, 0, NULL, 0,
+					    NULL, 0);
 
 		ieee802_1x_rekey(hapd, NULL);
 

+ 5 - 3
src/ap/vlan_init.c

@@ -19,6 +19,7 @@
 #include "utils/common.h"
 #include "hostapd.h"
 #include "ap_config.h"
+#include "ap_drv_ops.h"
 #include "vlan_init.h"
 
 
@@ -737,9 +738,10 @@ int vlan_setup_encryption_dyn(struct hostapd_data *hapd,
 	 * functions for setting up dynamic broadcast keys. */
 	for (i = 0; i < 4; i++) {
 		if (mssid->wep.key[i] &&
-		    hapd->drv.set_key(dyn_vlan, hapd, WPA_ALG_WEP, NULL, i,
-				      i == mssid->wep.idx, NULL, 0,
-				      mssid->wep.key[i], mssid->wep.len[i])) {
+		    hostapd_drv_set_key(dyn_vlan, hapd, WPA_ALG_WEP, NULL, i,
+					i == mssid->wep.idx, NULL, 0,
+					mssid->wep.key[i], mssid->wep.len[i]))
+		{
 			wpa_printf(MSG_ERROR, "VLAN: Could not set WEP "
 				   "encryption for dynamic VLAN");
 			return -1;

+ 4 - 3
src/ap/wpa_auth_glue.c

@@ -230,8 +230,8 @@ static int hostapd_wpa_auth_set_key(void *ctx, int vlan_id, enum wpa_alg alg,
 			return -1;
 	}
 
-	return hapd->drv.set_key(ifname, hapd, alg, addr, idx, 1, NULL, 0,
-				 key, key_len);
+	return hostapd_drv_set_key(ifname, hapd, alg, addr, idx, 1, NULL, 0,
+				   key, key_len);
 }
 
 
@@ -248,7 +248,8 @@ static int hostapd_wpa_auth_send_eapol(void *ctx, const u8 *addr,
 				       int encrypt)
 {
 	struct hostapd_data *hapd = ctx;
-	return hapd->drv.send_eapol(hapd, addr, data, data_len, encrypt);
+	return hostapd_drv_hapd_send_eapol(hapd, addr, data, data_len,
+					   encrypt);
 }