Re: [PATCH 6/6] Add support for AEAD algos.

2016-11-09 Thread Harsh Jain
On 08-11-2016 19:51, Harsh Jain wrote: > > On 08-11-2016 18:29, Stephan Mueller wrote: >> Am Dienstag, 8. November 2016, 17:16:38 CET schrieb Harsh Jain: >> >> Hi Harsh, >> >>> On 08-11-2016 16:45, Stephan Mueller wrote: Am Donnerstag, 27. Oktober 2016, 15:36:08 CET schrieb Harsh Jain:

[PATCH 3/3] crypto: AF_ALG - fix AEAD AIO handling of zero buffer

2016-11-09 Thread Stephan Mueller
Handle the case when the caller provided a zero buffer to sendmsg/sendpage. Such scenario is legal for AEAD ciphers when no plaintext / ciphertext and no AAD is provided and the caller only requests the generation of the tag value. Signed-off-by: Stephan Mueller --- crypto/algif_aead.c | 5 +++--

[PATCH 1/3] crypto: AF_ALG - fix AEAD tag memory handling

2016-11-09 Thread Stephan Mueller
For encryption, the AEAD ciphers require AAD || PT as input and generate AAD || CT || Tag as output and vice versa for decryption. Prior to this patch, the AF_ALG interface for AEAD ciphers requires the buffer to be present as input for encryption. Similarly, the output buffer for decryption requir

[PATCH 0/3] crypto: AF_ALG - AEAD memory handling fixes

2016-11-09 Thread Stephan Mueller
Hi Herbert, The first patch is unchanged compared to a previous submission to the mailing list. It is rolled into this patch set to have a common reference for the AEAD user space interface changes. Therefore, please disregard the old patch submission. The third patch should go into stable as thi

[PATCH 2/3] crypto: AF_ALG - disregard AAD buffer space for output

2016-11-09 Thread Stephan Mueller
The kernel crypto API AEAD cipher operation generates output such that space for the AAD is reserved in the output buffer without being touched. The processed ciphertext/plaintext is appended to the reserved AAD buffer. The user space interface followed that approach. However, this is a violation

Re: [PATCH] crypto: fix AEAD tag memory handling

2016-11-09 Thread Mat Martineau
Stephan, On Wed, 9 Nov 2016, Stephan Mueller wrote: Am Montag, 31. Oktober 2016, 16:18:32 CET schrieb Mat Martineau: Hi Mat, My main concern is getting the semantics correct and consistent in a single patch series. It would be a big problem to explain that AF_ALG AEAD read and write works o

Re: [PATCH 11/14] Revert "crypto: caam - get rid of tasklet"

2016-11-09 Thread Thomas Gleixner
On Thu, 10 Nov 2016, Thomas Gleixner wrote: > > > which corresponds to an 8% slowdown for the threaded IRQ case. So, > > > tasklets are indeed faster than threaded IRQs. Forgot to say, that this should be: So, tasklets are indeed faster than threaded IRQs for this particular use case. They a

Re: [PATCH 11/14] Revert "crypto: caam - get rid of tasklet"

2016-11-09 Thread Thomas Gleixner
On Wed, 9 Nov 2016, Russell King - ARM Linux wrote: > Please include Thomas in this. Thanks! > On Wed, Nov 09, 2016 at 10:46:21AM +0200, Horia Geantă wrote: > > This reverts commit 66d2e2028091a074aa1290d2eeda5ddb1a6c329c. > > > > Quoting from Russell's findings: > > https://www.mail-archive.co

Re: [PATCH] crypto: fix AEAD tag memory handling

2016-11-09 Thread Stephan Mueller
Am Montag, 31. Oktober 2016, 16:18:32 CET schrieb Mat Martineau: Hi Mat, > > My main concern is getting the semantics correct and consistent in a > single patch series. It would be a big problem to explain that AF_ALG AEAD > read and write works one way in 4.x, another way in 4.y, and some > diff

[PATCH 13/14] crypto: caam - constify pointer to descriptor buffer

2016-11-09 Thread Horia Geantă
The pointer to the descriptor buffer is not touched, it always points to start of the descriptor buffer. Thus, make it const. Signed-off-by: Horia Geantă --- drivers/crypto/caam/desc_constr.h | 72 +-- 1 file changed, 38 insertions(+), 34 deletions(-) diff --

[PATCH 09/14] crypto: caam - remove unreachable code in report_ccb_status()

2016-11-09 Thread Horia Geantă
ERRID is a 4-bit field. Since err_id values are in [0..15] and err_id_list array size is 16, the condition "err_id < ARRAY_SIZE(err_id_list)" is always true. Signed-off-by: Horia Geantă --- drivers/crypto/caam/error.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drive

[PATCH 14/14] crypto: caam - merge identical ahash_final/finup shared desc

2016-11-09 Thread Horia Geantă
Shared descriptors used by ahash_final() and ahash_finup() are identical, thus get rid of one of them (sh_desc_finup). Signed-off-by: Horia Geantă --- drivers/crypto/caam/caamhash.c | 26 +- 1 file changed, 1 insertion(+), 25 deletions(-) diff --git a/drivers/crypto/caam

[PATCH 08/14] crypto: caam - trivial code clean-up

2016-11-09 Thread Horia Geantă
-replace offsetof with container_of -remove unused "assoc_nents", "iv_dma" from aead_edesc and fix comments -remove unused CAAM_MAX_IV_LENGTH #define Signed-off-by: Horia Geantă --- drivers/crypto/caam/caamalg.c | 16 drivers/crypto/caam/caamhash.c | 12 drivers/cr

[PATCH 06/14] crypto: caam - remove unused may_sleep in dbg_dump_sg()

2016-11-09 Thread Horia Geantă
Fixes: 5ecf8ef9103cb "crypto: caam - fix sg dump" Signed-off-by: Horia Geantă --- drivers/crypto/caam/caamalg.c | 19 ++- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/drivers/crypto/caam/caamalg.c b/drivers/crypto/caam/caamalg.c index bc433edd34c4..cb26a57c5aaf 1

[PATCH 05/14] crypto: caam - fix smatch warnings

2016-11-09 Thread Horia Geantă
Fix the following smatch warnings: drivers/crypto/caam/caamalg.c:2350 aead_edesc_alloc() warn: we tested 'src_nents' before and it was 'true' drivers/crypto/caam/caamrng.c:351 caam_rng_init() error: no modifiers for allocation. Signed-off-by: Horia Geantă --- drivers/crypto/caam/caamalg.c | 4

[PATCH 07/14] crypto: caam - remove unused command from aead givencrypt

2016-11-09 Thread Horia Geantă
REG3 no longer needs to be updated, since it's not used after that. This shared descriptor command is a leftover of the conversion to AEAD interface. Fixes: 479bcc7c5b9e1 "crypto: caam - Convert authenc to new AEAD interface" Signed-off-by: Horia Geantă --- drivers/crypto/caam/caamalg.c | 5 +---

[PATCH 12/14] crypto: caam - move sec4_sg_entry to sg_sw_sec4.h

2016-11-09 Thread Horia Geantă
sec4_sg_entry structure is used only by helper functions in sg_sw_sec4.h. Since SEC HW S/G entries are to be manipulated only indirectly, via these functions, move sec4_sg_entry to the corresponding header. Signed-off-by: Horia Geantă --- drivers/crypto/caam/desc.h | 6 -- drivers/cryp

[PATCH 00/14] crypto: caam - fixes, clean-up

2016-11-09 Thread Horia Geantă
This is a batch of fixes and clean-up for caam driver. Only the fix for the givencrypt shared descriptors is high-impact and thus sent to -stable. Thanks, Horia Alex Porosanu (1): crypto: caam - fix AEAD givenc descriptors Horia Geantă (13): crypto: caam - completely remove error propagatio

[PATCH 02/14] crypto: caam - completely remove error propagation handling

2016-11-09 Thread Horia Geantă
Commit 4464a7d4f53d756101291da26563f37f7fce40f3 ("crypto: caam - remove error propagation handling") removed error propagation handling only from caamalg. Do this in all other places: caamhash, caamrng. Update descriptors' lengths appropriately. Signed-off-by: Horia Geantă --- drivers/crypto/ca

[PATCH 10/14] crypto: caam - fix DMA API mapping leak in ablkcipher code

2016-11-09 Thread Horia Geantă
alkcipher_edesc_alloc() and ablkcipher_giv_edesc_alloc() don't free / unmap resources on error path: - dmap_map_sg() could fail, thus make sure the return value is checked - unmap DMA mappings in case of error Signed-off-by: Horia Geantă --- drivers/crypto/caam/caamalg.c | 44 +++

[PATCH 03/14] crypto: caam - desc.h fixes

2016-11-09 Thread Horia Geantă
1. fix HDR_START_IDX_MASK, HDR_SD_SHARE_MASK, HDR_JD_SHARE_MASK Define HDR_START_IDX_MASK consistently with the other masks: mask = bitmask << offset 2. OP_ALG_TYPE_CLASS1 and OP_ALG_TYPE_CLASS2 must be shifted. 3. fix FIFO_STORE output data type value for AFHA S-Box 4. fix OPERATION pkha modula

[PATCH 11/14] Revert "crypto: caam - get rid of tasklet"

2016-11-09 Thread Horia Geantă
This reverts commit 66d2e2028091a074aa1290d2eeda5ddb1a6c329c. Quoting from Russell's findings: https://www.mail-archive.com/linux-crypto@vger.kernel.org/msg21136.html [quote] Okay, I've re-tested, using a different way of measuring, because using openssl speed is impractical for off-loaded engine

Re: [PATCH 11/14] Revert "crypto: caam - get rid of tasklet"

2016-11-09 Thread Russell King - ARM Linux
Please include Thomas in this. On Wed, Nov 09, 2016 at 10:46:21AM +0200, Horia Geantă wrote: > This reverts commit 66d2e2028091a074aa1290d2eeda5ddb1a6c329c. > > Quoting from Russell's findings: > https://www.mail-archive.com/linux-crypto@vger.kernel.org/msg21136.html > > [quote] > Okay, I've re-

[PATCH 01/14] crypto: caam - fix AEAD givenc descriptors

2016-11-09 Thread Horia Geantă
From: Alex Porosanu The AEAD givenc descriptor relies on moving the IV through the output FIFO and then back to the CTX2 for authentication. The SEQ FIFO STORE could be scheduled before the data can be read from OFIFO, especially since the SEQ FIFO LOAD needs to wait for the SEQ FIFO LOAD SKIP to

[PATCH 04/14] crypto: caam - fix sparse warnings

2016-11-09 Thread Horia Geantă
Fix the following sparse warning (note that endianness issues are not not addressed in current patch): drivers/crypto/caam/ctrl.c:388:24: warning: incorrect type in argument 1 (different address spaces) drivers/crypto/caam/ctrl.c:388:24:expected void [noderef] *reg drivers/crypto/caam/ctrl.c: