From: Neil Horman <nhorman@tuxdriver.com>
To: Daniel Borkmann <dborkman@redhat.com>
Cc: davem@davemloft.net, linux-sctp@vger.kernel.org,
netdev@vger.kernel.org, Vlad Yasevich <vyasevic@redhat.com>
Subject: Re: [PATCH net-next] net: sctp: remove unused multiple cookie keys
Date: Tue, 12 Feb 2013 09:36:27 -0500 [thread overview]
Message-ID: <20130212143627.GA7849@hmsreliant.think-freely.org> (raw)
In-Reply-To: <c1d3c108e6dc72f14e6251543b9ff826f56f5f78.1360593589.git.dborkman@redhat.com>
On Mon, Feb 11, 2013 at 03:50:07PM +0100, Daniel Borkmann wrote:
> Vlad says: The whole multiple cookie keys code is completely unused
> and has been all this time. Noone uses anything other then the
> secret_key[0] since there is no changeover support anywhere.
>
> Thus, for now clean up its left-over fragments.
>
> Cc: Vlad Yasevich <vyasevic@redhat.com>
> Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
>
> /* Remove and free the port */
> if (sctp_sk(ep->base.sk)->bind_hash)
> diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c
> index e1c5fc2..1063b83 100644
> --- a/net/sctp/sm_make_chunk.c
> +++ b/net/sctp/sm_make_chunk.c
> @@ -1650,8 +1650,8 @@ static sctp_cookie_param_t *sctp_pack_cookie(const struct sctp_endpoint *ep,
>
> /* Sign the message. */
> sg_init_one(&sg, &cookie->c, bodysize);
> - keylen = SCTP_SECRET_SIZE;
> - key = (char *)ep->secret_key[ep->current_key];
> + keylen = sizeof(ep->secret_key);
> + key = (char *) ep->secret_key;
You can drop the use of they local key variable entirely here.
crypto_hash_setkey takes a u8 * as a key parameter, so you can pass
ep->secret_key directly.
> desc.tfm = sctp_sk(ep->base.sk)->hmac;
> desc.flags = 0;
>
> @@ -1718,9 +1718,9 @@ struct sctp_association *sctp_unpack_cookie(
> goto no_hmac;
>
> /* Check the signature. */
> - keylen = SCTP_SECRET_SIZE;
> sg_init_one(&sg, bear_cookie, bodysize);
> - key = (char *)ep->secret_key[ep->current_key];
> + keylen = sizeof(ep->secret_key);
> + key = (char *) ep->secret_key;
Ditto the above.
Otherwise it looks good.
Neil
prev parent reply other threads:[~2013-02-12 14:36 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <cover.1360593589.git.dborkman@redhat.com>
2013-02-11 14:50 ` [PATCH net-next] net: sctp: remove unused multiple cookie keys Daniel Borkmann
2013-02-12 14:36 ` Neil Horman [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=20130212143627.GA7849@hmsreliant.think-freely.org \
--to=nhorman@tuxdriver.com \
--cc=davem@davemloft.net \
--cc=dborkman@redhat.com \
--cc=linux-sctp@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=vyasevic@redhat.com \
/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