lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20080701154905.5226863f@extreme>
Date:	Tue, 1 Jul 2008 15:49:05 -0700
From:	Stephen Hemminger <shemminger@...tta.com>
To:	"Adam Langley" <agl@...erialviolet.org>
Cc:	netdev@...r.kernel.org
Subject: Re: MD5 SG fix

On Tue, 1 Jul 2008 15:38:14 -0700
"Adam Langley" <agl@...erialviolet.org> wrote:

>  static int tcp_v6_do_calc_md5_hash(char *md5_hash, struct tcp_md5sig_key *key,
>  				   struct in6_addr *saddr,
>  				   struct in6_addr *daddr,
> -				   struct tcphdr *th, int protocol,
> -				   unsigned int tcplen)
> +				   int protocol,
> +				   struct tcphdr *th, int data_off, int tcplen,
> +				   struct skb_shared_info *frags)
>  {
> -	struct scatterlist sg[4];
> -	__u16 data_len;
> +	struct scatterlist sg[MAX_SKB_FRAGS + 3];
> +	const int head_data_len = tcplen - data_off;
>  	int block = 0;
>  	__sum16 cksum;
>  	struct tcp_md5sig_pool *hp;
>  	struct tcp6_pseudohdr *bp;
>  	struct hash_desc *desc;
> -	int err;
> -	unsigned int nbytes = 0;
> +	int err, i;
> +	unsigned int nbytes = tcplen;
>  
>  	hp = tcp_get_md5sig_pool();
>  	if (!hp) {
> @@ -760,10 +761,15 @@ static int tcp_v6_do_calc_md5_hash(char *md5_hash, struct tcp_md5sig_key *key,
>  	/* 1. TCP pseudo-header (RFC2460) */
>  	ipv6_addr_copy(&bp->saddr, saddr);
>  	ipv6_addr_copy(&bp->daddr, daddr);
> -	bp->len = htonl(tcplen);
>  	bp->protocol = htonl(protocol);
> +	if (frags)
> +		for (i = 0; i < frags->nr_frags; ++i)
> +			nbytes += frags->frags[i].size;
> +	bp->len = htonl(nbytes);
> +	nbytes = 0;

Just pass the skb in and not tcplen, frags, ...
avoid all this nonsense.  tcplen == skb->len, and you have the correct size info.

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ