diff options
Diffstat (limited to 'include/net/ah.h')
-rw-r--r-- | include/net/ah.h | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/include/net/ah.h b/include/net/ah.h index 8e27c9ba8b84..8f257c159902 100644 --- a/include/net/ah.h +++ b/include/net/ah.h | |||
@@ -15,22 +15,29 @@ struct ah_data | |||
15 | int icv_full_len; | 15 | int icv_full_len; |
16 | int icv_trunc_len; | 16 | int icv_trunc_len; |
17 | 17 | ||
18 | void (*icv)(struct ah_data*, | 18 | struct crypto_hash *tfm; |
19 | struct sk_buff *skb, u8 *icv); | ||
20 | |||
21 | struct crypto_tfm *tfm; | ||
22 | }; | 19 | }; |
23 | 20 | ||
24 | static inline void | 21 | static inline int ah_mac_digest(struct ah_data *ahp, struct sk_buff *skb, |
25 | ah_hmac_digest(struct ah_data *ahp, struct sk_buff *skb, u8 *auth_data) | 22 | u8 *auth_data) |
26 | { | 23 | { |
27 | struct crypto_tfm *tfm = ahp->tfm; | 24 | struct hash_desc desc; |
25 | int err; | ||
26 | |||
27 | desc.tfm = ahp->tfm; | ||
28 | desc.flags = 0; | ||
28 | 29 | ||
29 | memset(auth_data, 0, ahp->icv_trunc_len); | 30 | memset(auth_data, 0, ahp->icv_trunc_len); |
30 | crypto_hmac_init(tfm, ahp->key, &ahp->key_len); | 31 | err = crypto_hash_init(&desc); |
31 | skb_icv_walk(skb, tfm, 0, skb->len, crypto_hmac_update); | 32 | if (unlikely(err)) |
32 | crypto_hmac_final(tfm, ahp->key, &ahp->key_len, ahp->work_icv); | 33 | goto out; |
33 | memcpy(auth_data, ahp->work_icv, ahp->icv_trunc_len); | 34 | err = skb_icv_walk(skb, &desc, 0, skb->len, crypto_hash_update); |
35 | if (unlikely(err)) | ||
36 | goto out; | ||
37 | err = crypto_hash_final(&desc, ahp->work_icv); | ||
38 | |||
39 | out: | ||
40 | return err; | ||
34 | } | 41 | } |
35 | 42 | ||
36 | #endif | 43 | #endif |