Re: [PATCH 5/8] linux: drop __bitwise__ everywhere

2016-12-15 Thread Stefan Schmidt
_bitwise__ itt_t;
+typedef uint32_t __bitwise itt_t;
 /* below makes sense only for initiator that created this tag */
 #define build_itt(itt, age) ((__force itt_t)\
((itt) | ((age) << ISCSI_AGE_SHIFT)))
diff --git a/include/target/target_core_base.h 
b/include/target/target_core_base.h
index c211900..0055828 100644
--- a/include/target/target_core_base.h
+++ b/include/target/target_core_base.h
@@ -149,7 +149,7 @@ enum se_cmd_flags_table {
  * Used by transport_send_check_condition_and_sense()
  * to signal which ASC/ASCQ sense payload should be built.
  */
-typedef unsigned __bitwise__ sense_reason_t;
+typedef unsigned __bitwise sense_reason_t;

 enum tcm_sense_reason_table {
 #define R(x)   (__force sense_reason_t )(x)
diff --git a/include/uapi/linux/virtio_types.h 
b/include/uapi/linux/virtio_types.h
index e845e8c..55c3b73 100644
--- a/include/uapi/linux/virtio_types.h
+++ b/include/uapi/linux/virtio_types.h
@@ -39,8 +39,8 @@
  * - __le{16,32,64} for standard-compliant virtio devices
  */

-typedef __u16 __bitwise__ __virtio16;
-typedef __u32 __bitwise__ __virtio32;
-typedef __u64 __bitwise__ __virtio64;
+typedef __u16 __bitwise __virtio16;
+typedef __u32 __bitwise __virtio32;
+typedef __u64 __bitwise __virtio64;

 #endif /* _UAPI_LINUX_VIRTIO_TYPES_H */
diff --git a/net/ieee802154/6lowpan/6lowpan_i.h 
b/net/ieee802154/6lowpan/6lowpan_i.h
index 5ac7789..ac7c96b 100644
--- a/net/ieee802154/6lowpan/6lowpan_i.h
+++ b/net/ieee802154/6lowpan/6lowpan_i.h
@@ -7,7 +7,7 @@
 #include 
 #include 

-typedef unsigned __bitwise__ lowpan_rx_result;
+typedef unsigned __bitwise lowpan_rx_result;
 #define RX_CONTINUE((__force lowpan_rx_result) 0u)
 #define RX_DROP_UNUSABLE   ((__force lowpan_rx_result) 1u)
 #define RX_DROP((__force lowpan_rx_result) 2u)
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index d37a577..b2069fb 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -159,7 +159,7 @@ enum ieee80211_bss_valid_data_flags {
IEEE80211_BSS_VALID_ERP = BIT(3)
 };

-typedef unsigned __bitwise__ ieee80211_tx_result;
+typedef unsigned __bitwise ieee80211_tx_result;
 #define TX_CONTINUE((__force ieee80211_tx_result) 0u)
 #define TX_DROP((__force ieee80211_tx_result) 1u)
 #define TX_QUEUED  ((__force ieee80211_tx_result) 2u)
@@ -180,7 +180,7 @@ struct ieee80211_tx_data {
 };


-typedef unsigned __bitwise__ ieee80211_rx_result;
+typedef unsigned __bitwise ieee80211_rx_result;
 #define RX_CONTINUE((__force ieee80211_rx_result) 0u)
 #define RX_DROP_UNUSABLE   ((__force ieee80211_rx_result) 1u)
 #define RX_DROP_MONITOR((__force ieee80211_rx_result) 2u)



For net/ieee802154/6lowpan/6lowpan_i.h

Acked-by: Stefan Schmidt <ste...@osg.samsung.com>

regards
Stefan Schmidt


Re: [PATCH 17/26] mac802154: Use skcipher

2016-01-26 Thread Stefan Schmidt

Hello.

On 24/01/16 14:18, Herbert Xu wrote:

This patch replaces uses of blkcipher with skcipher.

Signed-off-by: Herbert Xu <herb...@gondor.apana.org.au>

---

  net/mac802154/llsec.c |   41 +++--
  net/mac802154/llsec.h |3 +--
  2 files changed, 24 insertions(+), 20 deletions(-)

diff --git a/net/mac802154/llsec.c b/net/mac802154/llsec.c
index a13d02b..6a3e1c2 100644
--- a/net/mac802154/llsec.c
+++ b/net/mac802154/llsec.c
@@ -17,9 +17,9 @@
  #include 
  #include 
  #include 
-#include 
  #include 
  #include 
+#include 
  
  #include "ieee802154_i.h"

  #include "llsec.h"
@@ -144,18 +144,18 @@ llsec_key_alloc(const struct ieee802154_llsec_key 
*template)
goto err_tfm;
}
  
-	key->tfm0 = crypto_alloc_blkcipher("ctr(aes)", 0, CRYPTO_ALG_ASYNC);

+   key->tfm0 = crypto_alloc_skcipher("ctr(aes)", 0, CRYPTO_ALG_ASYNC);
if (IS_ERR(key->tfm0))
goto err_tfm;
  
-	if (crypto_blkcipher_setkey(key->tfm0, template->key,

-   IEEE802154_LLSEC_KEY_SIZE))
+   if (crypto_skcipher_setkey(key->tfm0, template->key,
+  IEEE802154_LLSEC_KEY_SIZE))
goto err_tfm0;
  
  	return key;
  
  err_tfm0:

-   crypto_free_blkcipher(key->tfm0);
+   crypto_free_skcipher(key->tfm0);
  err_tfm:
for (i = 0; i < ARRAY_SIZE(key->tfm); i++)
if (key->tfm[i])
@@ -175,7 +175,7 @@ static void llsec_key_release(struct kref *ref)
for (i = 0; i < ARRAY_SIZE(key->tfm); i++)
crypto_free_aead(key->tfm[i]);
  
-	crypto_free_blkcipher(key->tfm0);

+   crypto_free_skcipher(key->tfm0);
kzfree(key);
  }
  
@@ -620,15 +620,17 @@ llsec_do_encrypt_unauth(struct sk_buff *skb, const struct mac802154_llsec *sec,

  {
u8 iv[16];
struct scatterlist src;
-   struct blkcipher_desc req = {
-   .tfm = key->tfm0,
-   .info = iv,
-   .flags = 0,
-   };
+   SKCIPHER_REQUEST_ON_STACK(req, key->tfm0);
+   int err;
  
  	llsec_geniv(iv, sec->params.hwaddr, >sec);

sg_init_one(, skb->data, skb->len);
-   return crypto_blkcipher_encrypt_iv(, , , skb->len);
+   skcipher_request_set_tfm(req, key->tfm0);
+   skcipher_request_set_callback(req, 0, NULL, NULL);
+   skcipher_request_set_crypt(req, , , skb->len, iv);
+   err = crypto_skcipher_encrypt(req);
+   skcipher_request_zero(req);
+   return err;
  }
  
  static struct crypto_aead*

@@ -830,11 +832,8 @@ llsec_do_decrypt_unauth(struct sk_buff *skb, const struct 
mac802154_llsec *sec,
unsigned char *data;
int datalen;
struct scatterlist src;
-   struct blkcipher_desc req = {
-   .tfm = key->tfm0,
-   .info = iv,
-   .flags = 0,
-   };
+   SKCIPHER_REQUEST_ON_STACK(req, key->tfm0);
+   int err;
  
  	llsec_geniv(iv, dev_addr, >sec);

data = skb_mac_header(skb) + skb->mac_len;
@@ -842,7 +841,13 @@ llsec_do_decrypt_unauth(struct sk_buff *skb, const struct 
mac802154_llsec *sec,
  
  	sg_init_one(, data, datalen);
  
-	return crypto_blkcipher_decrypt_iv(, , , datalen);

+   skcipher_request_set_tfm(req, key->tfm0);
+   skcipher_request_set_callback(req, 0, NULL, NULL);
+   skcipher_request_set_crypt(req, , , datalen, iv);
+
+   err = crypto_skcipher_decrypt(req);
+   skcipher_request_zero(req);
+   return err;
  }
  
  static int

diff --git a/net/mac802154/llsec.h b/net/mac802154/llsec.h
index 950578e..6f3b658 100644
--- a/net/mac802154/llsec.h
+++ b/net/mac802154/llsec.h
@@ -19,7 +19,6 @@
  
  #include 

  #include 
-#include 
  #include 
  #include 
  #include 
@@ -30,7 +29,7 @@ struct mac802154_llsec_key {
  
  	/* one tfm for each authsize (4/8/16) */

struct crypto_aead *tfm[3];
-   struct crypto_blkcipher *tfm0;
+   struct crypto_skcipher *tfm0;
  
  	struct kref ref;

  };


Reviewed-by: Stefan Schmidt <ste...@osg.samsung.com>

regards
Stefan Schmidt
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html