Re: [PATCH RESEND v2 00/14] lib/mpi: bug fixes and cleanup

2016-03-21 Thread Tadeusz Struk
Hi Nicolai, On 03/21/2016 06:26 AM, Nicolai Stange wrote: > This is a resend of v2 with the crypto people properly CC'd. > > The original v1 can be found here: > > > http://lkml.kernel.org/g/1458237606-4954-1-git-send-email-nicsta...@gmail.com > > > While v1 (hopefully) fixed some issues in

Re: [PATCH] x86: Avoid undefined behavior in macro expansion

2016-03-21 Thread Vinicius Tinti
On Fri, Mar 18, 2016 at 11:15 PM, Al Viro wrote: > On Wed, Mar 16, 2016 at 11:48:49PM -0300, Vinicius Tinti wrote: >> C11 standard (at 6.10.3.3) says that ## operator (paste) has undefined >> behavior when one of the result operands is not a valid preprocessing >> token. >> >> Therefore the macro

[PATCH v3 3/3] crypto: s5p-sss - Sort the headers to improve readability

2016-03-21 Thread Krzysztof Kozlowski
Sort the headers alphabetically to improve readability and to spot duplications easier. Suggested-by: Vladimir Zapolskiy Signed-off-by: Krzysztof Kozlowski Acked-by: Vladimir Zapolskiy --- Changes since v2: 1. Add Vladimir's acked-by. Changes since v1: 1. New patch. My email differs from on

[PATCH v3 1/3] crypto: s5p-sss - Minor coding cleanups

2016-03-21 Thread Krzysztof Kozlowski
From: Krzysztof Kozlowski Remove unneeded inclusion of delay.h and get rid of indentation from labels. Signed-off-by: Krzysztof Kozlowski Acked-by: Vladimir Zapolskiy --- Changes since v2: 1. None. Changes since v1: 1. Add Vladimir's acked-by. --- drivers/crypto/s5p-sss.c | 15 +++-

[PATCH v3 2/3] crypto: s5p-sss - Handle unaligned buffers

2016-03-21 Thread Krzysztof Kozlowski
From: Krzysztof Kozlowski During crypto selftests on Odroid XU3 (Exynos5422) some of the algorithms failed because of passing AES-block unaligned source and destination buffers: alg: skcipher: encryption failed on chunk test 1 for ecb-aes-s5p: ret=22 Handle such case by copying the buffers to a

Re: [PATCH 02/10] crypto: rsa_helper - add raw integer parser actions

2016-03-21 Thread Stephan Mueller
Am Montag, 21. März 2016, 15:17:20 schrieb Tudor-Dan Ambarus: Hi Tudor, > Hi Stephan, > > > -Original Message- > > From: Stephan Mueller [mailto:smuel...@chronox.de] > > Sent: Friday, March 18, 2016 9:47 PM > > To: Tudor-Dan Ambarus > > Cc: herb...@gondor.apana.org.au; tadeusz.st...@inte

FOR YOUR INFORMATION DEAR BENEFICIARY,

2016-03-21 Thread David Kedogo
FOR YOUR INFORMATION DEAR BENEFICIARY, Your Over-due ATM Card payment of $1.5MUSD by the UN Office have deposited to the ATM MASTER CARD OFFICE. All you have to do now is to contact the Office Manager Dr. peter Akupa Boni at: (peterakupa...@gmail.com) and Phone number: +229 61 31 07 78 , he will

[PATCH] MAINTAINERS: Add a new maintainer for the CCP driver

2016-03-21 Thread Tom Lendacky
Gary will be taking over future development of the CCP driver, so add him as a co-maintainer of the driver. Signed-off-by: Tom Lendacky --- MAINTAINERS |1 + 1 file changed, 1 insertion(+) diff --git a/MAINTAINERS b/MAINTAINERS index 30aca4a..8c42c07 100644 --- a/MAINTAINERS +++ b/MAINTAINE

Re: [PATCH 01/10] crypto: rsa - generalize ASN.1 sequences

2016-03-21 Thread Tadeusz Struk
On 03/21/2016 03:11 AM, Tudor-Dan Ambarus wrote: > [ta] we can do this once, when initializing the tfm object. > > I agree with all your suggestions, I will implement them. > > Thank you for the review, Great. Thank you Tudor. -- TS -- To unsubscribe from this list: send the line "unsubscribe l

RE: [PATCH 02/10] crypto: rsa_helper - add raw integer parser actions

2016-03-21 Thread Tudor-Dan Ambarus
Hi Stephan, > -Original Message- > From: Stephan Mueller [mailto:smuel...@chronox.de] > Sent: Friday, March 18, 2016 9:47 PM > To: Tudor-Dan Ambarus > Cc: herb...@gondor.apana.org.au; tadeusz.st...@intel.com; linux- > cry...@vger.kernel.org; Horia Ioan Geanta Neag > Subject: Re: [PATCH 02

[PATCH RESEND v2 04/14] lib/mpi: mpi_write_sgl(): fix out-of-bounds stack access

2016-03-21 Thread Nicolai Stange
Within the copying loop in mpi_write_sgl(), we have if (lzeros) { mpi_limb_t *limb1 = (void *)p - sizeof(alimb); mpi_limb_t *limb2 = (void *)p - sizeof(alimb) + lzeros; *limb1 = *limb2; ... } where p points past the end of alimb2 which lives on t

[PATCH RESEND v2 01/14] lib/mpi: mpi_write_sgl(): fix skipping of leading zero limbs

2016-03-21 Thread Nicolai Stange
Currently, if the number of leading zeros is greater than fits into a complete limb, mpi_write_sgl() skips them by iterating over them limb-wise. However, it fails to adjust its internal leading zeros tracking variable, lzeros, accordingly: it does a p -= sizeof(alimb); continue; which shoul

[PATCH RESEND v2 02/14] lib/mpi: mpi_write_sgl(): fix style issue with lzero decrement

2016-03-21 Thread Nicolai Stange
Within the copying loop in mpi_write_sgl(), we have if (lzeros > 0) { ... lzeros -= sizeof(alimb); } However, at this point, lzeros < sizeof(alimb) holds. Make this fact explicit by rewriting the above to if (lzeros) { ... lzeros = 0; } Signed-off-by: Nicolai Stange ---

[PATCH RESEND v2 03/14] lib/mpi: mpi_write_sgl(): purge redundant pointer arithmetic

2016-03-21 Thread Nicolai Stange
Within the copying loop in mpi_write_sgl(), we have if (lzeros) { ... p -= lzeros; y = lzeros; } p = p - (sizeof(alimb) - y); If lzeros == 0, then y == 0, too. Thus, lzeros gets subtracted and added back again to p. Purge this redundancy. Signed-off-by: Nicolai Stange --- li

[PATCH RESEND v2 07/14] lib/mpi: mpi_read_buffer(): replace open coded endian conversion

2016-03-21 Thread Nicolai Stange
Currently, the endian conversion from CPU order to BE is open coded in mpi_read_buffer(). Replace this by the centrally provided cpu_to_be*() macros. Copy from the temporary storage on stack to the destination buffer by means of memcpy(). Signed-off-by: Nicolai Stange --- lib/mpi/mpicoder.c | 2

[PATCH RESEND v2 14/14] lib/mpi: mpi_read_raw_from_sgl(): fix out-of-bounds buffer access

2016-03-21 Thread Nicolai Stange
Within the copying loop in mpi_read_raw_from_sgl(), the last input SGE's byte count gets artificially extended as follows: if (sg_is_last(sg) && (len % BYTES_PER_MPI_LIMB)) len += BYTES_PER_MPI_LIMB - (len % BYTES_PER_MPI_LIMB); Within the following byte copying loop, this causes reads beyo

[PATCH RESEND v2 11/14] lib/mpi: mpi_read_raw_from_sgl(): purge redundant clearing of nbits

2016-03-21 Thread Nicolai Stange
In mpi_read_raw_from_sgl(), unsigned nbits is calculated as follows: nbits = nbytes * 8; and redundantly cleared later on if nbytes == 0: if (nbytes > 0) ... else nbits = 0; Purge this redundant clearing for the sake of clarity. Signed-off-by: Nicolai Stange --- lib/mpi/mpicode

[PATCH RESEND v2 05/14] lib/mpi: mpi_write_sgl(): replace open coded endian conversion

2016-03-21 Thread Nicolai Stange
Currently, the endian conversion from CPU order to BE is open coded in mpi_write_sgl(). Replace this by the centrally provided cpu_to_be*() macros. Signed-off-by: Nicolai Stange --- lib/mpi/mpicoder.c | 27 +++ 1 file changed, 11 insertions(+), 16 deletions(-) diff --gi

[PATCH RESEND v2 13/14] lib/mpi: mpi_read_raw_from_sgl(): sanitize meaning of indices

2016-03-21 Thread Nicolai Stange
Within the byte reading loop in mpi_read_raw_sgl(), there are two housekeeping indices used, z and x. At all times, the index z represents the number of output bytes covered by the input SGEs for which processing has completed so far. This includes any leading zero bytes within the most significan

[PATCH RESEND v2 10/14] lib/mpi: mpi_read_raw_from_sgl(): don't include leading zero SGEs in nbytes

2016-03-21 Thread Nicolai Stange
At the very beginning of mpi_read_raw_from_sgl(), the leading zeros of the input scatterlist are counted: lzeros = 0; for_each_sg(sgl, sg, ents, i) { ... if (/* sg contains nonzero bytes */) break; /* sg contains nothing but zeros here */ ents--; lzeros = 0; } Lat

[PATCH RESEND v2 08/14] lib/mpi: mpi_read_buffer(): fix buffer overflow

2016-03-21 Thread Nicolai Stange
Currently, mpi_read_buffer() writes full limbs to the output buffer and moves memory around to purge leading zero limbs afterwards. However, with commit 9cbe21d8f89d ("lib/mpi: only require buffers as big as needed for the integer") the caller is only required to provid

[PATCH RESEND v2 09/14] lib/mpi: mpi_read_raw_from_sgl(): replace len argument by nbytes

2016-03-21 Thread Nicolai Stange
Currently, the nbytes local variable is calculated from the len argument as follows: ... mpi_read_raw_from_sgl(..., unsigned int len) { unsigned nbytes; ... if (!ents) nbytes = 0; else nbytes = len - lzeros; ... } Given that nbytes is derived from len in a tr

[PATCH RESEND v2 12/14] lib/mpi: mpi_read_raw_from_sgl(): fix nbits calculation

2016-03-21 Thread Nicolai Stange
The number of bits, nbits, is calculated in mpi_read_raw_from_sgl() as follows: nbits = nbytes * 8; Afterwards, the number of leading zero bits of the first byte get subtracted: nbits -= count_leading_zeros(*(u8 *)(sg_virt(sgl) + lzeros)); However, count_leading_zeros() takes an unsigned lo

[PATCH RESEND v2 06/14] lib/mpi: mpi_read_buffer(): optimize skipping of leading zero limbs

2016-03-21 Thread Nicolai Stange
Currently, if the number of leading zeros is greater than fits into a complete limb, mpi_read_buffer() skips them by iterating over them limb-wise. Instead of skipping the high order zero limbs within the loop as shown above, adjust the copying loop's bounds. Signed-off-by: Nicolai Stange --- l

[PATCH RESEND v2 00/14] lib/mpi: bug fixes and cleanup

2016-03-21 Thread Nicolai Stange
This is a resend of v2 with the crypto people properly CC'd. The original v1 can be found here: http://lkml.kernel.org/g/1458237606-4954-1-git-send-email-nicsta...@gmail.com While v1 (hopefully) fixed some issues in mpi_write_sgl() and mpi_read_buffer() introduced by commit 2d4d1eea540b ("l

RE: [PATCH 10/10] crypto: caam - add support for RSA algorithm

2016-03-21 Thread Tudor-Dan Ambarus
Hi Stephan, > -Original Message- > From: Stephan Mueller [mailto:smuel...@chronox.de] > Sent: Saturday, March 19, 2016 6:59 PM > To: Tudor-Dan Ambarus > Cc: herb...@gondor.apana.org.au; tadeusz.st...@intel.com; linux- > cry...@vger.kernel.org; Horia Ioan Geanta Neag > Subject: Re: [PATCH 1

RE: [PATCH 07/10] crypto: qat - remove duplicate ASN.1 parser

2016-03-21 Thread Tudor-Dan Ambarus
> -Original Message- > From: Tadeusz Struk [mailto:tadeusz.st...@intel.com] > Sent: Sunday, March 20, 2016 4:56 PM > To: Tudor-Dan Ambarus; herb...@gondor.apana.org.au > Cc: linux-crypto@vger.kernel.org; smuel...@chronox.de; Horia Ioan Geanta > Neag > Subject: Re: [PATCH 07/10] crypto: qa

RE: [PATCH 01/10] crypto: rsa - generalize ASN.1 sequences

2016-03-21 Thread Tudor-Dan Ambarus
Hi Tadeusz, > -Original Message- > From: Tadeusz Struk [mailto:tadeusz.st...@intel.com] > Sent: Sunday, March 20, 2016 4:54 PM > To: Tudor-Dan Ambarus; herb...@gondor.apana.org.au > Cc: linux-crypto@vger.kernel.org; smuel...@chronox.de; Horia Ioan Geanta > Neag > Subject: Re: [PATCH 01/10]

Re: [patch] crypto: marvell/cesa - remove unneeded condition

2016-03-21 Thread Boris Brezillon
On Mon, 21 Mar 2016 12:03:43 +0300 Dan Carpenter wrote: > creq->cache[] is an array inside the struct, it's not a pointer and it > can't be NULL. > > Signed-off-by: Dan Carpenter Acked-by: Boris Brezillon > > diff --git a/drivers/crypto/marvell/hash.c b/drivers/crypto/marvell/hash.c > index

[patch] crypto: marvell/cesa - remove unneeded condition

2016-03-21 Thread Dan Carpenter
creq->cache[] is an array inside the struct, it's not a pointer and it can't be NULL. Signed-off-by: Dan Carpenter diff --git a/drivers/crypto/marvell/hash.c b/drivers/crypto/marvell/hash.c index 7ca2e0f..7a5058d 100644 --- a/drivers/crypto/marvell/hash.c +++ b/drivers/crypto/marvell/hash.c @@ -