diff options
Diffstat (limited to 'net/rxrpc/rxkad.c')
-rw-r--r-- | net/rxrpc/rxkad.c | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/net/rxrpc/rxkad.c b/net/rxrpc/rxkad.c index f48434adb7c2..d1c296f2d617 100644 --- a/net/rxrpc/rxkad.c +++ b/net/rxrpc/rxkad.c | |||
@@ -261,6 +261,7 @@ static int rxkad_secure_packet(const struct rxrpc_call *call, | |||
261 | __be32 x[2]; | 261 | __be32 x[2]; |
262 | } tmpbuf __attribute__((aligned(8))); /* must all be in same page */ | 262 | } tmpbuf __attribute__((aligned(8))); /* must all be in same page */ |
263 | __be32 x; | 263 | __be32 x; |
264 | u32 y; | ||
264 | int ret; | 265 | int ret; |
265 | 266 | ||
266 | sp = rxrpc_skb(skb); | 267 | sp = rxrpc_skb(skb); |
@@ -292,11 +293,11 @@ static int rxkad_secure_packet(const struct rxrpc_call *call, | |||
292 | sg_init_one(&sg[1], &tmpbuf, sizeof(tmpbuf)); | 293 | sg_init_one(&sg[1], &tmpbuf, sizeof(tmpbuf)); |
293 | crypto_blkcipher_encrypt_iv(&desc, &sg[0], &sg[1], sizeof(tmpbuf)); | 294 | crypto_blkcipher_encrypt_iv(&desc, &sg[0], &sg[1], sizeof(tmpbuf)); |
294 | 295 | ||
295 | x = ntohl(tmpbuf.x[1]); | 296 | y = ntohl(tmpbuf.x[1]); |
296 | x = (x >> 16) & 0xffff; | 297 | y = (y >> 16) & 0xffff; |
297 | if (x == 0) | 298 | if (y == 0) |
298 | x = 1; /* zero checksums are not permitted */ | 299 | y = 1; /* zero checksums are not permitted */ |
299 | sp->hdr.cksum = htons(x); | 300 | sp->hdr.cksum = htons(y); |
300 | 301 | ||
301 | switch (call->conn->security_level) { | 302 | switch (call->conn->security_level) { |
302 | case RXRPC_SECURITY_PLAIN: | 303 | case RXRPC_SECURITY_PLAIN: |
@@ -314,7 +315,7 @@ static int rxkad_secure_packet(const struct rxrpc_call *call, | |||
314 | break; | 315 | break; |
315 | } | 316 | } |
316 | 317 | ||
317 | _leave(" = %d [set %hx]", ret, x); | 318 | _leave(" = %d [set %hx]", ret, y); |
318 | return ret; | 319 | return ret; |
319 | } | 320 | } |
320 | 321 | ||
@@ -492,6 +493,7 @@ static int rxkad_verify_packet(const struct rxrpc_call *call, | |||
492 | __be32 x[2]; | 493 | __be32 x[2]; |
493 | } tmpbuf __attribute__((aligned(8))); /* must all be in same page */ | 494 | } tmpbuf __attribute__((aligned(8))); /* must all be in same page */ |
494 | __be32 x; | 495 | __be32 x; |
496 | u16 y; | ||
495 | __be16 cksum; | 497 | __be16 cksum; |
496 | int ret; | 498 | int ret; |
497 | 499 | ||
@@ -526,12 +528,12 @@ static int rxkad_verify_packet(const struct rxrpc_call *call, | |||
526 | sg_init_one(&sg[1], &tmpbuf, sizeof(tmpbuf)); | 528 | sg_init_one(&sg[1], &tmpbuf, sizeof(tmpbuf)); |
527 | crypto_blkcipher_encrypt_iv(&desc, &sg[0], &sg[1], sizeof(tmpbuf)); | 529 | crypto_blkcipher_encrypt_iv(&desc, &sg[0], &sg[1], sizeof(tmpbuf)); |
528 | 530 | ||
529 | x = ntohl(tmpbuf.x[1]); | 531 | y = ntohl(tmpbuf.x[1]); |
530 | x = (x >> 16) & 0xffff; | 532 | y = (y >> 16) & 0xffff; |
531 | if (x == 0) | 533 | if (y == 0) |
532 | x = 1; /* zero checksums are not permitted */ | 534 | y = 1; /* zero checksums are not permitted */ |
533 | 535 | ||
534 | cksum = htons(x); | 536 | cksum = htons(y); |
535 | if (sp->hdr.cksum != cksum) { | 537 | if (sp->hdr.cksum != cksum) { |
536 | *_abort_code = RXKADSEALEDINCON; | 538 | *_abort_code = RXKADSEALEDINCON; |
537 | _leave(" = -EPROTO [csum failed]"); | 539 | _leave(" = -EPROTO [csum failed]"); |
@@ -1001,7 +1003,8 @@ static int rxkad_verify_response(struct rxrpc_connection *conn, | |||
1001 | struct rxrpc_crypt session_key; | 1003 | struct rxrpc_crypt session_key; |
1002 | time_t expiry; | 1004 | time_t expiry; |
1003 | void *ticket; | 1005 | void *ticket; |
1004 | u32 abort_code, version, kvno, ticket_len, csum, level; | 1006 | u32 abort_code, version, kvno, ticket_len, level; |
1007 | __be32 csum; | ||
1005 | int ret; | 1008 | int ret; |
1006 | 1009 | ||
1007 | _enter("{%d,%x}", conn->debug_id, key_serial(conn->server_key)); | 1010 | _enter("{%d,%x}", conn->debug_id, key_serial(conn->server_key)); |