#include <net/xfrm.h>
+/* This is the maximum truncated ICV length that we know of. */
+#define MAX_AH_AUTH_LEN 12
+
struct ah_data
{
u8 *key;
goto out;
}
{
- u8 auth_data[ahp->icv_trunc_len];
+ u8 auth_data[MAX_AH_AUTH_LEN];
memcpy(auth_data, ah->auth_data, ahp->icv_trunc_len);
skb_push(skb, skb->data - skb->nh.raw);
ahp->icv_full_len = aalg_desc->uinfo.auth.icv_fullbits/8;
ahp->icv_trunc_len = aalg_desc->uinfo.auth.icv_truncbits/8;
+ BUG_ON(ahp->icv_trunc_len > MAX_AH_AUTH_LEN);
+
ahp->work_icv = kmalloc(ahp->icv_full_len, GFP_KERNEL);
if (!ahp->work_icv)
goto error;
skb->nh.ipv6h->hop_limit = 0;
{
- u8 auth_data[ahp->icv_trunc_len];
+ u8 auth_data[MAX_AH_AUTH_LEN];
memcpy(auth_data, ah->auth_data, ahp->icv_trunc_len);
memset(ah->auth_data, 0, ahp->icv_trunc_len);
ahp->icv_full_len = aalg_desc->uinfo.auth.icv_fullbits/8;
ahp->icv_trunc_len = aalg_desc->uinfo.auth.icv_truncbits/8;
+ BUG_ON(ahp->icv_trunc_len > MAX_AH_AUTH_LEN);
+
ahp->work_icv = kmalloc(ahp->icv_full_len, GFP_KERNEL);
if (!ahp->work_icv)
goto error;