Subject: Re: IPsec replay sequence number overflow behavior? (RFC4303 section 3.3.3)

From: Paul Moore <[email-masked]>
Date: Sun, 9 Dec 2007 09:37:56 -0500

On Saturday 08 December 2007 9:13:48 pm Herbert Xu wrote:
> Paul Moore <[email-masked]> wrote:
> > If it is a bug, I think the basic fix should be pretty simple, changing
> > the above xfrm_output() code to the following:
> >
> >   if (x->type->flags & XFRM_TYPE_REPLAY_PROT) {
> >           XFRM_SKB_CB(skb)->seq = ++x->replay.oseq;
> > +          if (x->replay.oseq == 0)
> > +                  goto error;
>
> Yes we need this check.
>
> However please add an unlikely around it since it's a 1-in-4
> billion event :)

 :)

Thanks for clearing that up, I'll send a patch this week; complete with an 
unlikely (similar to the RFC quality IPsec audit patch I sent on Friday) and 
a decrement to the sequence counter in case of rollover.

-- 
paul moore
linux security @ hp