[PATCH 3/26] staging: rtl8192e: Replace uses of obsolete blkcipher and hash

2016-01-24 Thread Herbert Xu
The interfaces blkcipher and hash are obsolete.  This patch replaces
them with skcipher and ahash respectively.

Signed-off-by: Herbert Xu 
---

 drivers/staging/rtl8192e/rtllib_crypt_tkip.c |   99 ++-
 drivers/staging/rtl8192e/rtllib_crypt_wep.c  |   48 +++--
 2 files changed, 82 insertions(+), 65 deletions(-)

diff --git a/drivers/staging/rtl8192e/rtllib_crypt_tkip.c 
b/drivers/staging/rtl8192e/rtllib_crypt_tkip.c
index 2096d78..8eac7cd 100644
--- a/drivers/staging/rtl8192e/rtllib_crypt_tkip.c
+++ b/drivers/staging/rtl8192e/rtllib_crypt_tkip.c
@@ -9,6 +9,8 @@
  * more details.
  */
 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -18,7 +20,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -48,10 +49,10 @@ struct rtllib_tkip_data {
u32 dot11RSNAStatsTKIPLocalMICFailures;
 
int key_idx;
-   struct crypto_blkcipher *rx_tfm_arc4;
-   struct crypto_hash *rx_tfm_michael;
-   struct crypto_blkcipher *tx_tfm_arc4;
-   struct crypto_hash *tx_tfm_michael;
+   struct crypto_skcipher *rx_tfm_arc4;
+   struct crypto_ahash *rx_tfm_michael;
+   struct crypto_skcipher *tx_tfm_arc4;
+   struct crypto_ahash *tx_tfm_michael;
/* scratch buffers for virt_to_page() (crypto API) */
u8 rx_hdr[16];
u8 tx_hdr[16];
@@ -65,32 +66,32 @@ static void *rtllib_tkip_init(int key_idx)
if (priv == NULL)
goto fail;
priv->key_idx = key_idx;
-   priv->tx_tfm_arc4 = crypto_alloc_blkcipher("ecb(arc4)", 0,
-   CRYPTO_ALG_ASYNC);
+   priv->tx_tfm_arc4 = crypto_alloc_skcipher("ecb(arc4)", 0,
+ CRYPTO_ALG_ASYNC);
if (IS_ERR(priv->tx_tfm_arc4)) {
pr_debug("Could not allocate crypto API arc4\n");
priv->tx_tfm_arc4 = NULL;
goto fail;
}
 
-   priv->tx_tfm_michael = crypto_alloc_hash("michael_mic", 0,
-   CRYPTO_ALG_ASYNC);
+   priv->tx_tfm_michael = crypto_alloc_ahash("michael_mic", 0,
+ CRYPTO_ALG_ASYNC);
if (IS_ERR(priv->tx_tfm_michael)) {
pr_debug("Could not allocate crypto API michael_mic\n");
priv->tx_tfm_michael = NULL;
goto fail;
}
 
-   priv->rx_tfm_arc4 = crypto_alloc_blkcipher("ecb(arc4)", 0,
-   CRYPTO_ALG_ASYNC);
+   priv->rx_tfm_arc4 = crypto_alloc_skcipher("ecb(arc4)", 0,
+ CRYPTO_ALG_ASYNC);
if (IS_ERR(priv->rx_tfm_arc4)) {
pr_debug("Could not allocate crypto API arc4\n");
priv->rx_tfm_arc4 = NULL;
goto fail;
}
 
-   priv->rx_tfm_michael = crypto_alloc_hash("michael_mic", 0,
-   CRYPTO_ALG_ASYNC);
+   priv->rx_tfm_michael = crypto_alloc_ahash("michael_mic", 0,
+ CRYPTO_ALG_ASYNC);
if (IS_ERR(priv->rx_tfm_michael)) {
pr_debug("Could not allocate crypto API michael_mic\n");
priv->rx_tfm_michael = NULL;
@@ -100,14 +101,10 @@ static void *rtllib_tkip_init(int key_idx)
 
 fail:
if (priv) {
-   if (priv->tx_tfm_michael)
-   crypto_free_hash(priv->tx_tfm_michael);
-   if (priv->tx_tfm_arc4)
-   crypto_free_blkcipher(priv->tx_tfm_arc4);
-   if (priv->rx_tfm_michael)
-   crypto_free_hash(priv->rx_tfm_michael);
-   if (priv->rx_tfm_arc4)
-   crypto_free_blkcipher(priv->rx_tfm_arc4);
+   crypto_free_ahash(priv->tx_tfm_michael);
+   crypto_free_skcipher(priv->tx_tfm_arc4);
+   crypto_free_ahash(priv->rx_tfm_michael);
+   crypto_free_skcipher(priv->rx_tfm_arc4);
kfree(priv);
}
 
@@ -120,14 +117,10 @@ static void rtllib_tkip_deinit(void *priv)
struct rtllib_tkip_data *_priv = priv;
 
if (_priv) {
-   if (_priv->tx_tfm_michael)
-   crypto_free_hash(_priv->tx_tfm_michael);
-   if (_priv->tx_tfm_arc4)
-   crypto_free_blkcipher(_priv->tx_tfm_arc4);
-   if (_priv->rx_tfm_michael)
-   crypto_free_hash(_priv->rx_tfm_michael);
-   if (_priv->rx_tfm_arc4)
-   crypto_free_blkcipher(_priv->rx_tfm_arc4);
+   crypto_free_ahash(_priv->tx_tfm_michael);
+   crypto_free_skcipher(_priv->tx_tfm_arc4);
+   crypto_free_ahash(_priv->rx_tfm_michael);
+   crypto_free_skcipher(_priv->rx_tfm_arc4);
}
kfree(priv);
 }
@@ -301,7 +294,6 @@ static int rtllib_tkip_encrypt(struct sk_buff *skb, int 
hdr_len, void *priv)
struct 

Re: [PATCH 3/26] staging: rtl8192e: Replace uses of obsolete blkcipher and hash

2016-01-24 Thread Greg KH
On Sun, Jan 24, 2016 at 09:16:26PM +0800, Herbert Xu wrote:
> The interfaces blkcipher and hash are obsolete.  This patch replaces
> them with skcipher and ahash respectively.
> 
> Signed-off-by: Herbert Xu 
> ---
> 
>  drivers/staging/rtl8192e/rtllib_crypt_tkip.c |   99 
> ++-
>  drivers/staging/rtl8192e/rtllib_crypt_wep.c  |   48 +++--
>  2 files changed, 82 insertions(+), 65 deletions(-)

Acked-by: Greg Kroah-Hartman 
--
To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html