|
@@ -6,7 +6,7 @@
|
|
|
#include <linux/string.h>
|
|
|
#include <linux/if_ether.h>
|
|
|
#include <linux/scatterlist.h>
|
|
|
-#include <linux/crypto.h>
|
|
|
+#include <crypto/hash.h>
|
|
|
|
|
|
#include "orinoco.h"
|
|
|
#include "mic.h"
|
|
@@ -16,7 +16,8 @@
|
|
|
/********************************************************************/
|
|
|
int orinoco_mic_init(struct orinoco_private *priv)
|
|
|
{
|
|
|
- priv->tx_tfm_mic = crypto_alloc_hash("michael_mic", 0, 0);
|
|
|
+ priv->tx_tfm_mic = crypto_alloc_ahash("michael_mic", 0,
|
|
|
+ CRYPTO_ALG_ASYNC);
|
|
|
if (IS_ERR(priv->tx_tfm_mic)) {
|
|
|
printk(KERN_DEBUG "orinoco_mic_init: could not allocate "
|
|
|
"crypto API michael_mic\n");
|
|
@@ -24,7 +25,8 @@ int orinoco_mic_init(struct orinoco_private *priv)
|
|
|
return -ENOMEM;
|
|
|
}
|
|
|
|
|
|
- priv->rx_tfm_mic = crypto_alloc_hash("michael_mic", 0, 0);
|
|
|
+ priv->rx_tfm_mic = crypto_alloc_ahash("michael_mic", 0,
|
|
|
+ CRYPTO_ALG_ASYNC);
|
|
|
if (IS_ERR(priv->rx_tfm_mic)) {
|
|
|
printk(KERN_DEBUG "orinoco_mic_init: could not allocate "
|
|
|
"crypto API michael_mic\n");
|
|
@@ -38,18 +40,19 @@ int orinoco_mic_init(struct orinoco_private *priv)
|
|
|
void orinoco_mic_free(struct orinoco_private *priv)
|
|
|
{
|
|
|
if (priv->tx_tfm_mic)
|
|
|
- crypto_free_hash(priv->tx_tfm_mic);
|
|
|
+ crypto_free_ahash(priv->tx_tfm_mic);
|
|
|
if (priv->rx_tfm_mic)
|
|
|
- crypto_free_hash(priv->rx_tfm_mic);
|
|
|
+ crypto_free_ahash(priv->rx_tfm_mic);
|
|
|
}
|
|
|
|
|
|
-int orinoco_mic(struct crypto_hash *tfm_michael, u8 *key,
|
|
|
+int orinoco_mic(struct crypto_ahash *tfm_michael, u8 *key,
|
|
|
u8 *da, u8 *sa, u8 priority,
|
|
|
u8 *data, size_t data_len, u8 *mic)
|
|
|
{
|
|
|
- struct hash_desc desc;
|
|
|
+ AHASH_REQUEST_ON_STACK(req, tfm_michael);
|
|
|
struct scatterlist sg[2];
|
|
|
u8 hdr[ETH_HLEN + 2]; /* size of header + padding */
|
|
|
+ int err;
|
|
|
|
|
|
if (tfm_michael == NULL) {
|
|
|
printk(KERN_WARNING "orinoco_mic: tfm_michael == NULL\n");
|
|
@@ -69,11 +72,13 @@ int orinoco_mic(struct crypto_hash *tfm_michael, u8 *key,
|
|
|
sg_set_buf(&sg[0], hdr, sizeof(hdr));
|
|
|
sg_set_buf(&sg[1], data, data_len);
|
|
|
|
|
|
- if (crypto_hash_setkey(tfm_michael, key, MIC_KEYLEN))
|
|
|
+ if (crypto_ahash_setkey(tfm_michael, key, MIC_KEYLEN))
|
|
|
return -1;
|
|
|
|
|
|
- desc.tfm = tfm_michael;
|
|
|
- desc.flags = 0;
|
|
|
- return crypto_hash_digest(&desc, sg, data_len + sizeof(hdr),
|
|
|
- mic);
|
|
|
+ ahash_request_set_tfm(req, tfm_michael);
|
|
|
+ ahash_request_set_callback(req, 0, NULL, NULL);
|
|
|
+ ahash_request_set_crypt(req, sg, mic, data_len + sizeof(hdr));
|
|
|
+ err = crypto_ahash_digest(req);
|
|
|
+ ahash_request_zero(req);
|
|
|
+ return err;
|
|
|
}
|