Skip to contentSkip to conversation

linux-next: manual merge of the crypto tree with the net-next tree

DISCUSSION Stephen Rothwell 2 participants 5 messages Mar 7, 2016 – Mar 8, 2016

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

Hi Herbert,

Today's linux-next merge of the crypto tree got a conflict in:

net/rxrpc/rxkad.c

between commit:

0d12f8a4027d ("rxrpc: Keep the skb private record of the Rx header in host byte order")

from the net-next tree and commit:

1afe593b4239 ("rxrpc: Use skcipher")

from the crypto tree.

I fixed it up (see below) and can carry the fix as necessary (no action is required).

Signature · 117 lines
Cheers,
Stephen Rothwell

diff --cc net/rxrpc/rxkad.c
index 3106a0c4960b,0d96b48a6492..000000000000
--- a/net/rxrpc/rxkad.c
+++ b/net/rxrpc/rxkad.c
@@@ -128,21 -128,23 +128,23 @@@ static void rxkad_prime_packet_security
  	token = conn->key->payload.data[0];
  	memcpy(&iv, token->kad->session_key, sizeof(iv));
  
- 	desc.tfm = conn->cipher;
- 	desc.info = iv.x;
- 	desc.flags = 0;
- 
 -	tmpbuf.x[0] = conn->epoch;
 -	tmpbuf.x[1] = conn->cid;
 +	tmpbuf.x[0] = htonl(conn->epoch);
 +	tmpbuf.x[1] = htonl(conn->cid);
  	tmpbuf.x[2] = 0;
  	tmpbuf.x[3] = htonl(conn->security_ix);
  
  	sg_init_one(&sg[0], &tmpbuf, sizeof(tmpbuf));
  	sg_init_one(&sg[1], &tmpbuf, sizeof(tmpbuf));
- 	crypto_blkcipher_encrypt_iv(&desc, &sg[0], &sg[1], sizeof(tmpbuf));
+ 
+ 	skcipher_request_set_tfm(req, conn->cipher);
+ 	skcipher_request_set_callback(req, 0, NULL, NULL);
+ 	skcipher_request_set_crypt(req, &sg[1], &sg[0], sizeof(tmpbuf), iv.x);
+ 
+ 	crypto_skcipher_encrypt(req);
+ 	skcipher_request_zero(req);
  
  	memcpy(&conn->csum_iv, &tmpbuf.x[2], sizeof(conn->csum_iv));
 -	ASSERTCMP(conn->csum_iv.n[0], ==, tmpbuf.x[2]);
 +	ASSERTCMP((u32 __force)conn->csum_iv.n[0], ==, (u32 __force)tmpbuf.x[2]);
  
  	_leave("");
  }
@@@ -251,12 -267,12 +267,12 @@@ out
   * checksum an RxRPC packet header
   */
  static int rxkad_secure_packet(const struct rxrpc_call *call,
 -				struct sk_buff *skb,
 -				size_t data_size,
 -				void *sechdr)
 +			       struct sk_buff *skb,
 +			       size_t data_size,
 +			       void *sechdr)
  {
  	struct rxrpc_skb_priv *sp;
- 	struct blkcipher_desc desc;
+ 	SKCIPHER_REQUEST_ON_STACK(req, call->conn->cipher);
  	struct rxrpc_crypt iv;
  	struct scatterlist sg[2];
  	struct {
@@@ -280,15 -297,12 +296,12 @@@
  
  	/* continue encrypting from where we left off */
  	memcpy(&iv, call->conn->csum_iv.x, sizeof(iv));
- 	desc.tfm = call->conn->cipher;
- 	desc.info = iv.x;
- 	desc.flags = 0;
  
  	/* calculate the security checksum */
 -	x = htonl(call->channel << (32 - RXRPC_CIDSHIFT));
 -	x |= sp->hdr.seq & cpu_to_be32(0x3fffffff);
 -	tmpbuf.x[0] = sp->hdr.callNumber;
 -	tmpbuf.x[1] = x;
 +	x = call->channel << (32 - RXRPC_CIDSHIFT);
 +	x |= sp->hdr.seq & 0x3fffffff;
 +	tmpbuf.x[0] = htonl(sp->hdr.callNumber);
 +	tmpbuf.x[1] = htonl(x);
  
  	sg_init_one(&sg[0], &tmpbuf, sizeof(tmpbuf));
  	sg_init_one(&sg[1], &tmpbuf, sizeof(tmpbuf));
@@@ -513,25 -539,29 +536,28 @@@ static int rxkad_verify_packet(const st
  
  	/* continue encrypting from where we left off */
  	memcpy(&iv, call->conn->csum_iv.x, sizeof(iv));
- 	desc.tfm = call->conn->cipher;
- 	desc.info = iv.x;
- 	desc.flags = 0;
  
  	/* validate the security checksum */
 -	x = htonl(call->channel << (32 - RXRPC_CIDSHIFT));
 -	x |= sp->hdr.seq & cpu_to_be32(0x3fffffff);
 -	tmpbuf.x[0] = call->call_id;
 -	tmpbuf.x[1] = x;
 +	x = call->channel << (32 - RXRPC_CIDSHIFT);
 +	x |= sp->hdr.seq & 0x3fffffff;
 +	tmpbuf.x[0] = htonl(call->call_id);
 +	tmpbuf.x[1] = htonl(x);
  
  	sg_init_one(&sg[0], &tmpbuf, sizeof(tmpbuf));
  	sg_init_one(&sg[1], &tmpbuf, sizeof(tmpbuf));
- 	crypto_blkcipher_encrypt_iv(&desc, &sg[0], &sg[1], sizeof(tmpbuf));
+ 
+ 	skcipher_request_set_tfm(req, call->conn->cipher);
+ 	skcipher_request_set_callback(req, 0, NULL, NULL);
+ 	skcipher_request_set_crypt(req, &sg[1], &sg[0], sizeof(tmpbuf), iv.x);
+ 
+ 	crypto_skcipher_encrypt(req);
+ 	skcipher_request_zero(req);
  
  	y = ntohl(tmpbuf.x[1]);
 -	y = (y >> 16) & 0xffff;
 -	if (y == 0)
 -		y = 1; /* zero checksums are not permitted */
 +	cksum = (y >> 16) & 0xffff;
 +	if (cksum == 0)
 +		cksum = 1; /* zero checksums are not permitted */
  
 -	cksum = htons(y);
  	if (sp->hdr.cksum != cksum) {
  		*_abort_code = RXKADSEALEDINCON;
  		_leave(" = -EPROTO [csum failed]");
#1 lore raw
Quoted 6 lines · Stephen Rothwell

Today's linux-next merge of the crypto tree got a conflict in:

net/rxrpc/rxkad.c

between commit:

Quoted 7 lines

0d12f8a4027d ("rxrpc: Keep the skb private record of the Rx header in host byte order")

from the net-next tree and commit:

1afe593b4239 ("rxrpc: Use skcipher")

from the crypto tree.

What's the best way to deal with this? Should I take Herbert's

[PATCH 18/26] rxrpc: Use skcipher

patch into my rxrpc tree also and pass it on to Dave?

David

#2 lore raw

Hi David,

Quoted 15 lines · On Mon, 07 Mar 2016 11:08:25 +0000 David Howells <[email protected]> wrote:
Quoted 12 lines · Stephen Rothwell

Today's linux-next merge of the crypto tree got a conflict in:

net/rxrpc/rxkad.c

between commit:

0d12f8a4027d ("rxrpc: Keep the skb private record of the Rx header in host byte order")

from the net-next tree and commit:

1afe593b4239 ("rxrpc: Use skcipher")

Quoted 7 lines
Quoted 1 line

from the crypto tree.

What's the best way to deal with this? Should I take Herbert's

[PATCH 18/26] rxrpc: Use skcipher

patch into my rxrpc tree also and pass it on to Dave?

Linus can deal with it when he merges the latter of the crypto or net-next trees. It might be worth a mention in the respective pull requests.

Signature · 2 lines
Cheers,
Stephen Rothwell
#3 lore raw
Quoted 9 lines · Stephen Rothwell
Quoted 5 lines

What's the best way to deal with this? Should I take Herbert's

[PATCH 18/26] rxrpc: Use skcipher

patch into my rxrpc tree also and pass it on to Dave?

Linus can deal with it when he merges the latter of the crypto or net-next trees. It might be worth a mention in the respective pull requests.

Do you mean I should take it - or just let Linus merge it?

I tried to apply the rxrpc skcipher patch to net-next, but skcipher_request_zero() isn't available there or in any of the patches in the series.

David

#4 lore raw

Hi David,

Quoted 7 lines · On Tue, 08 Mar 2016 16:48:07 +0000 David Howells <[email protected]> wrote:
Quoted 4 lines · Stephen Rothwell
Quoted 4 lines

What's the best way to deal with this? Should I take Herbert's

[PATCH 18/26] rxrpc: Use skcipher

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

patch into my rxrpc tree also and pass it on to Dave?

Linus can deal with it when he merges the latter of the crypto or net-next trees. It might be worth a mention in the respective pull requests.

Do you mean I should take it - or just let Linus merge it?

Just leave it to Linus.

Signature · 2 lines
Cheers,
Stephen Rothwell