aboutsummaryrefslogtreecommitdiffstats
path: root/net/ieee80211
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2006-08-24 05:10:20 -0400
committerHerbert Xu <herbert@gondor.apana.org.au>2006-09-20 21:46:21 -0400
commit35058687912aa2f0b4554383cc10be4e0683b9a4 (patch)
tree3e18d13aef6682553887076c1e9872e91e6fc5c4 /net/ieee80211
parentdc64ddf4918f0da52df10d83c2a5941a547c2035 (diff)
[CRYPTO] users: Use crypto_hash interface instead of crypto_digest
This patch converts all remaining crypto_digest users to use the new crypto_hash interface. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'net/ieee80211')
-rw-r--r--net/ieee80211/ieee80211_crypt_tkip.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/net/ieee80211/ieee80211_crypt_tkip.c b/net/ieee80211/ieee80211_crypt_tkip.c
index d60ce9b49b4f..407a17495b61 100644
--- a/net/ieee80211/ieee80211_crypt_tkip.c
+++ b/net/ieee80211/ieee80211_crypt_tkip.c
@@ -54,7 +54,7 @@ struct ieee80211_tkip_data {
54 int key_idx; 54 int key_idx;
55 55
56 struct crypto_blkcipher *tfm_arc4; 56 struct crypto_blkcipher *tfm_arc4;
57 struct crypto_tfm *tfm_michael; 57 struct crypto_hash *tfm_michael;
58 58
59 /* scratch buffers for virt_to_page() (crypto API) */ 59 /* scratch buffers for virt_to_page() (crypto API) */
60 u8 rx_hdr[16], tx_hdr[16]; 60 u8 rx_hdr[16], tx_hdr[16];
@@ -95,10 +95,12 @@ static void *ieee80211_tkip_init(int key_idx)
95 goto fail; 95 goto fail;
96 } 96 }
97 97
98 priv->tfm_michael = crypto_alloc_tfm("michael_mic", 0); 98 priv->tfm_michael = crypto_alloc_hash("michael_mic", 0,
99 if (priv->tfm_michael == NULL) { 99 CRYPTO_ALG_ASYNC);
100 if (IS_ERR(priv->tfm_michael)) {
100 printk(KERN_DEBUG "ieee80211_crypt_tkip: could not allocate " 101 printk(KERN_DEBUG "ieee80211_crypt_tkip: could not allocate "
101 "crypto API michael_mic\n"); 102 "crypto API michael_mic\n");
103 priv->tfm_michael = NULL;
102 goto fail; 104 goto fail;
103 } 105 }
104 106
@@ -107,7 +109,7 @@ static void *ieee80211_tkip_init(int key_idx)
107 fail: 109 fail:
108 if (priv) { 110 if (priv) {
109 if (priv->tfm_michael) 111 if (priv->tfm_michael)
110 crypto_free_tfm(priv->tfm_michael); 112 crypto_free_hash(priv->tfm_michael);
111 if (priv->tfm_arc4) 113 if (priv->tfm_arc4)
112 crypto_free_blkcipher(priv->tfm_arc4); 114 crypto_free_blkcipher(priv->tfm_arc4);
113 kfree(priv); 115 kfree(priv);
@@ -120,7 +122,7 @@ static void ieee80211_tkip_deinit(void *priv)
120{ 122{
121 struct ieee80211_tkip_data *_priv = priv; 123 struct ieee80211_tkip_data *_priv = priv;
122 if (_priv && _priv->tfm_michael) 124 if (_priv && _priv->tfm_michael)
123 crypto_free_tfm(_priv->tfm_michael); 125 crypto_free_hash(_priv->tfm_michael);
124 if (_priv && _priv->tfm_arc4) 126 if (_priv && _priv->tfm_arc4)
125 crypto_free_blkcipher(_priv->tfm_arc4); 127 crypto_free_blkcipher(_priv->tfm_arc4);
126 kfree(priv); 128 kfree(priv);
@@ -485,6 +487,7 @@ static int ieee80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
485static int michael_mic(struct ieee80211_tkip_data *tkey, u8 * key, u8 * hdr, 487static int michael_mic(struct ieee80211_tkip_data *tkey, u8 * key, u8 * hdr,
486 u8 * data, size_t data_len, u8 * mic) 488 u8 * data, size_t data_len, u8 * mic)
487{ 489{
490 struct hash_desc desc;
488 struct scatterlist sg[2]; 491 struct scatterlist sg[2];
489 492
490 if (tkey->tfm_michael == NULL) { 493 if (tkey->tfm_michael == NULL) {
@@ -499,12 +502,12 @@ static int michael_mic(struct ieee80211_tkip_data *tkey, u8 * key, u8 * hdr,
499 sg[1].offset = offset_in_page(data); 502 sg[1].offset = offset_in_page(data);
500 sg[1].length = data_len; 503 sg[1].length = data_len;
501 504
502 crypto_digest_init(tkey->tfm_michael); 505 if (crypto_hash_setkey(tkey->tfm_michael, key, 8))
503 crypto_digest_setkey(tkey->tfm_michael, key, 8); 506 return -1;
504 crypto_digest_update(tkey->tfm_michael, sg, 2);
505 crypto_digest_final(tkey->tfm_michael, mic);
506 507
507 return 0; 508 desc.tfm = tkey->tfm_michael;
509 desc.flags = 0;
510 return crypto_hash_digest(&desc, sg, data_len + 16, mic);
508} 511}
509 512
510static void michael_mic_hdr(struct sk_buff *skb, u8 * hdr) 513static void michael_mic_hdr(struct sk_buff *skb, u8 * hdr)
@@ -628,7 +631,7 @@ static int ieee80211_tkip_set_key(void *key, int len, u8 * seq, void *priv)
628{ 631{
629 struct ieee80211_tkip_data *tkey = priv; 632 struct ieee80211_tkip_data *tkey = priv;
630 int keyidx; 633 int keyidx;
631 struct crypto_tfm *tfm = tkey->tfm_michael; 634 struct crypto_hash *tfm = tkey->tfm_michael;
632 struct crypto_blkcipher *tfm2 = tkey->tfm_arc4; 635 struct crypto_blkcipher *tfm2 = tkey->tfm_arc4;
633 636
634 keyidx = tkey->key_idx; 637 keyidx = tkey->key_idx;