From: Fan Du <fan.du@windriver.com>
To: "Marksteiner, Stefan" <stefan.marksteiner@joanneum.at>
Cc: <netdev@vger.kernel.org>
Subject: Re: Possible bit/byte conversion mistake in xfrm_state.c
Date: Sun, 24 Nov 2013 19:54:55 +0800 [thread overview]
Message-ID: <5291E90F.2060902@windriver.com> (raw)
In-Reply-To: <528F7009.4080303@joanneum.at>
Please wrap the line in shorter length ;)
On 2013年11月22日 22:54, Marksteiner, Stefan wrote:
> Hi folks,
>
> I might have found a little bit/byte mistake in xfrm_state.c of iproute2-3.11.0 (and also lower versions).
>
> In line 169 the algorithm length is set correctly ("alg->alg_key_len = len * 8;") in bits (as it is supposed by /usr/include/linux/xfrm.h, line 101), but later in line 496 the same value is read and added to a length value in bytes ("len += alg.u.alg.alg_key_len;").
>
> I'm not completetly sure, but I'm wondering if this might lead to errors for algorithms with big key sizes (>2048 bits) for the key buffer ("char buf[RTA_BUF_SIZE]" in line 274) reserves only 2048 bytes of memory (RTA_BUF_SIZE=2048). So taking bits for bytes, the following memcopy operation may overwrite adjacent memory areas.
>
> Can somebody verify if this is in fact an issue? Maybe I'm reading this whole stuff wrong.
You are totally right about this bit/byte mistake here.
Normally the aes key len is 128bits, and 160bits for sha1, and
the key buf defined here is XFRM_ALGO_KEY_BUF_SIZE 512 bytes,
so there are stale data append after each key content, although
is not used by key interface anyway, which means the IPsec
communication goes well after all.
--
浮沉随浪只记今朝笑
--fan fan
prev parent reply other threads:[~2013-11-24 11:52 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-22 14:54 Possible bit/byte conversion mistake in xfrm_state.c Marksteiner, Stefan
2013-11-24 11:54 ` Fan Du [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=5291E90F.2060902@windriver.com \
--to=fan.du@windriver.com \
--cc=netdev@vger.kernel.org \
--cc=stefan.marksteiner@joanneum.at \
/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).