From: David Miller <davem@davemloft.net>
To: herbert@gondor.apana.org.au
Cc: kaber@trash.net, eric.dumazet@gmail.com, netdev@vger.kernel.org
Subject: Re: ESP trailer_len calculation
Date: Sun, 26 Sep 2010 18:46:54 -0700 (PDT) [thread overview]
Message-ID: <20100926.184654.232737330.davem@davemloft.net> (raw)
In-Reply-To: <20100925062317.GA15565@gondor.apana.org.au>
From: Herbert Xu <herbert@gondor.apana.org.au>
Date: Sat, 25 Sep 2010 14:23:17 +0800
> The number 17 does look very strange, however, after going through
> the logic it does seem correct.
>
> To calculate the minimum safe trailer length we need to consider
> the worst-case scenario, and that is a packet where the payload
> just happens to be one byte less than the cipher block size.
>
> ESP always adds two bytes, then pads to at least the cipher
> block size, follwed by the authentication value. So in the
> worst case we need to add
>
> 2 + (blocksize - 1) + authlen =
> blocksize + 1 + authlen
>
> which is exactly what Patrick's patch does.
Thanks for explaining this Herbert, but I have to admit it's a bit
disappointing :-)
So what we have is that headerlen is actually a function f() which
depends upon the payload length and the size of any IP options, rather
than a fixed value that can be computed based upon the cipher
blocksize, encap mode, and device MTU.
I guess if we really cared about this we could make headerlen a method
rather than a value, but I doubt it's that much of an issue.
prev parent reply other threads:[~2010-09-27 1:46 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-24 21:40 ESP trailer_len calculation David Miller
2010-09-25 6:23 ` Herbert Xu
2010-09-27 1:46 ` David Miller [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100926.184654.232737330.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=eric.dumazet@gmail.com \
--cc=herbert@gondor.apana.org.au \
--cc=kaber@trash.net \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).