Re: [PATCH net-next] net: sctp: remove unused multiple cookie keys

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
> Signed-off-by: Daniel Borkmann <dborkman@xxxxxxxxxx>
>  
>  	/* 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

--
To unsubscribe from this list: send the line "unsubscribe linux-sctp" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Networking Development]     [Linux OMAP]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux