Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6

Pull crypto fixes from Herbert Xu:
"This fixes the following issues:

- Regression in chacha20 handling of chunked input

- Crash in algif_skcipher when used with async io

- Potential bogus pointer dereference in lib/mpi"

* 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6:
crypto: algif_skcipher - only call put_page on referenced and used pages
crypto: testmgr - add chunked test cases for chacha20
crypto: chacha20 - fix handling of chunked input
lib/mpi: kunmap after finishing accessing buffer

+24 -5
+7 -2
crypto/algif_skcipher.c
··· 87 87 } 88 88 sgl = sreq->tsg; 89 89 n = sg_nents(sgl); 90 - for_each_sg(sgl, sg, n, i) 91 - put_page(sg_page(sg)); 90 + for_each_sg(sgl, sg, n, i) { 91 + struct page *page = sg_page(sg); 92 + 93 + /* some SGs may not have a page mapped */ 94 + if (page && page_ref_count(page)) 95 + put_page(page); 96 + } 92 97 93 98 kfree(sreq->tsg); 94 99 }
+7 -2
crypto/chacha20_generic.c
··· 91 91 crypto_chacha20_init(state, ctx, walk.iv); 92 92 93 93 while (walk.nbytes > 0) { 94 + unsigned int nbytes = walk.nbytes; 95 + 96 + if (nbytes < walk.total) 97 + nbytes = round_down(nbytes, walk.stride); 98 + 94 99 chacha20_docrypt(state, walk.dst.virt.addr, walk.src.virt.addr, 95 - walk.nbytes); 96 - err = skcipher_walk_done(&walk, 0); 100 + nbytes); 101 + err = skcipher_walk_done(&walk, walk.nbytes - nbytes); 97 102 } 98 103 99 104 return err;
+7
crypto/testmgr.h
··· 32675 32675 "\x5b\x86\x2f\x37\x30\xe3\x7c\xfd" 32676 32676 "\xc4\xfd\x80\x6c\x22\xf2\x21", 32677 32677 .rlen = 375, 32678 + .also_non_np = 1, 32679 + .np = 3, 32680 + .tap = { 375 - 20, 4, 16 }, 32681 + 32678 32682 }, { /* RFC7539 A.2. Test Vector #3 */ 32679 32683 .key = "\x1c\x92\x40\xa5\xeb\x55\xd3\x8a" 32680 32684 "\xf3\x33\x88\x86\x04\xf6\xb5\xf0" ··· 33053 33049 "\xa1\xed\xad\xd5\x76\xfa\x24\x8f" 33054 33050 "\x98", 33055 33051 .rlen = 1281, 33052 + .also_non_np = 1, 33053 + .np = 3, 33054 + .tap = { 1200, 1, 80 }, 33056 33055 }, 33057 33056 }; 33058 33057
+3 -1
lib/mpi/mpicoder.c
··· 364 364 } 365 365 366 366 miter.consumed = lzeros; 367 - sg_miter_stop(&miter); 368 367 369 368 nbytes -= lzeros; 370 369 nbits = nbytes * 8; 371 370 if (nbits > MAX_EXTERN_MPI_BITS) { 371 + sg_miter_stop(&miter); 372 372 pr_info("MPI: mpi too large (%u bits)\n", nbits); 373 373 return NULL; 374 374 } 375 375 376 376 if (nbytes > 0) 377 377 nbits -= count_leading_zeros(*buff) - (BITS_PER_LONG - 8); 378 + 379 + sg_miter_stop(&miter); 378 380 379 381 nlimbs = DIV_ROUND_UP(nbytes, BYTES_PER_MPI_LIMB); 380 382 val = mpi_alloc(nlimbs);