Re: [PATCH 5/6] crypto: set the flag CRYPTO_ALG_ALLOCATES_MEMORY

2020-07-14 Thread Mikulas Patocka
On Mon, 13 Jul 2020, Horia Geantă wrote: > On 7/13/2020 7:01 PM, Eric Biggers wrote: > > On Mon, Jul 13, 2020 at 06:49:00PM +0300, Horia Geantă wrote: > >> On 7/1/2020 7:52 AM, Eric Biggers wrote: > >>> From: Mikulas Patocka > >>> > >>>

Re: [PATCH 0/6] crypto: add CRYPTO_ALG_ALLOCATES_MEMORY

2020-07-07 Thread Mikulas Patocka
On Mon, 6 Jul 2020, Eric Biggers wrote: > On Wed, Jul 01, 2020 at 03:59:10AM -0400, Mikulas Patocka wrote: > > Thanks for cleaning this up. > > > > Mikulas > > Do you have any real comments on this? > > Are the usage restrictions okay for dm-crypt? >

Re: [PATCH 0/6] crypto: add CRYPTO_ALG_ALLOCATES_MEMORY

2020-07-01 Thread Mikulas Patocka
nts from aead_geniv_alloc() > crypto: algapi - use common mechanism for inheriting flags > crypto: algapi - introduce the flag CRYPTO_ALG_ALLOCATES_MEMORY > crypto: algapi - remove crypto_check_attr_type() > > Mikulas Patocka (2): > crypto: set the flag CRYPTO_ALG_A

[PATCH 1/3 v6] crypto: introduce the flag CRYPTO_ALG_ALLOCATES_MEMORY

2020-06-30 Thread Mikulas Patocka
GFP_KERNEL allocation can recurse into the block layer, causing a deadlock. Pass the flag CRYPTO_ALG_ALLOCATES_MEMORY down through the crypto API. Signed-off-by: Mikulas Patocka --- crypto/adiantum.c |8 +--- crypto/authenc.c |7 --- crypto/authencesn.c

Re: [dm-devel] [PATCH 1/3 v4] crypto: introduce the flag CRYPTO_ALG_ALLOCATES_MEMORY

2020-06-30 Thread Mikulas Patocka
On Tue, 30 Jun 2020, Eric Biggers wrote: > On Tue, Jun 30, 2020 at 01:01:16PM -0400, Mikulas Patocka wrote: > > > diff --git a/crypto/pcrypt.c b/crypto/pcrypt.c > > > index 7240e8bbdebb..643f7f1cc91c 100644 > > > --- a/crypto/pcrypt.c > > > +++ b/c

[PATCH 1/3 v5] crypto: introduce the flag CRYPTO_ALG_ALLOCATES_MEMORY

2020-06-30 Thread Mikulas Patocka
GFP_KERNEL allocation can recurse into the block layer, causing a deadlock. Pass the flag CRYPTO_ALG_ALLOCATES_MEMORY down through the crypto API. Signed-off-by: Mikulas Patocka --- crypto/adiantum.c |8 +--- crypto/authenc.c |7 --- crypto/authencesn.c

Re: [dm-devel] [PATCH 1/3 v4] crypto: introduce the flag CRYPTO_ALG_ALLOCATES_MEMORY

2020-06-30 Thread Mikulas Patocka
On Tue, 30 Jun 2020, Eric Biggers wrote: > On Tue, Jun 30, 2020 at 09:56:22AM -0400, Mikulas Patocka wrote: > > Index: linux-2.6/crypto/cryptd.c > > === > > --- linux-2.6.orig/crypto/cryptd.c 2020-06-29 16:

Re: [dm-devel] [PATCH 1/3 v2] crypto: introduce the flag CRYPTO_ALG_ALLOCATES_MEMORY

2020-06-30 Thread Mikulas Patocka
On Sun, 28 Jun 2020, Eric Biggers wrote: > On Sun, Jun 28, 2020 at 03:07:49PM -0400, Mikulas Patocka wrote: > > > > > Also, "seqiv" instances can be created without > > > CRYPTO_ALG_ALLOCATES_MEMORY set, > > > despite seqiv_aead_encrypt() allo

[PATCH 1/3 v4] crypto: introduce the flag CRYPTO_ALG_ALLOCATES_MEMORY

2020-06-30 Thread Mikulas Patocka
GFP_KERNEL allocation can recurse into the block layer, causing a deadlock. Pass the flag CRYPTO_ALG_ALLOCATES_MEMORY down through the crypto API. Signed-off-by: Mikulas Patocka --- crypto/adiantum.c |2 +- crypto/authenc.c |7 --- crypto/authencesn.c |7

Re: [dm-devel] [PATCH 1/3 v2] crypto: introduce the flag CRYPTO_ALG_ALLOCATES_MEMORY

2020-06-30 Thread Mikulas Patocka
On Mon, 29 Jun 2020, Mikulas Patocka wrote: > On Sun, 28 Jun 2020, Eric Biggers wrote: > > > On Sun, Jun 28, 2020 at 03:07:49PM -0400, Mikulas Patocka wrote: > > > > > > > > cryptd_create_skcipher(), cryptd_create_hash(), cryptd_create_aead(), > > &

Re: [dm-devel] [PATCH 1/3 v2] crypto: introduce the flag CRYPTO_ALG_ALLOCATES_MEMORY

2020-06-29 Thread Mikulas Patocka
On Sun, 28 Jun 2020, Eric Biggers wrote: > On Sun, Jun 28, 2020 at 03:07:49PM -0400, Mikulas Patocka wrote: > > > > > > cryptd_create_skcipher(), cryptd_create_hash(), cryptd_create_aead(), and > > > crypto_rfc4309_create() are also missing setting the mask. &

Re: [dm-devel] [PATCH 1/3 v2] crypto: introduce the flag CRYPTO_ALG_ALLOCATES_MEMORY

2020-06-28 Thread Mikulas Patocka
On Fri, 26 Jun 2020, Eric Biggers wrote: > On Fri, Jun 26, 2020 at 09:46:17AM -0700, Eric Biggers wrote: > > On Fri, Jun 26, 2020 at 12:16:33PM -0400, Mikulas Patocka wrote: > > > +/* > > > + * Pass these flags down through the crypto API. > > > + */ >

[PATCH 1/3 v3] crypto: introduce the flag CRYPTO_ALG_ALLOCATES_MEMORY

2020-06-28 Thread Mikulas Patocka
GFP_KERNEL allocation can recurse into the block layer, causing a deadlock. Pass the flag CRYPTO_ALG_ALLOCATES_MEMORY down through the crypto API. Signed-off-by: Mikulas Patocka --- crypto/adiantum.c |2 +- crypto/authenc.c |4 ++-- crypto/authencesn.c |4

Re: [PATCH 1/3 v2] crypto: introduce the flag CRYPTO_ALG_ALLOCATES_MEMORY

2020-06-28 Thread Mikulas Patocka
On Fri, 26 Jun 2020, Eric Biggers wrote: > On Fri, Jun 26, 2020 at 12:16:33PM -0400, Mikulas Patocka wrote: > > +/* > > + * Pass these flags down through the crypto API. > > + */ > > +#define CRYPTO_ALG_INHERITED_FLAGS (CRYPTO_ALG_ASYNC | > > CRYPTO_ALG_ALLOC

[PATCH 1/3 v2] crypto: introduce the flag CRYPTO_ALG_ALLOCATES_MEMORY

2020-06-26 Thread Mikulas Patocka
GFP_KERNEL allocation can recurse into the block layer, causing a deadlock. Pass the flag CRYPTO_ALG_ALLOCATES_MEMORY down through the crypto API. Signed-off-by: Mikulas Patocka --- crypto/adiantum.c |3 ++- crypto/authenc.c |5 +++-- crypto/authencesn.c |5

Re: [PATCH 1/3] crypto: pass the flag CRYPTO_ALG_ALLOCATES_MEMORY

2020-06-26 Thread Mikulas Patocka
On Fri, 26 Jun 2020, Herbert Xu wrote: > On Wed, Jun 17, 2020 at 11:09:28AM -0400, Mikulas Patocka wrote: > > > > Index: linux-2.6/include/linux/crypto.h > > === > > --- linux-2.6.orig/include/linux

[PATCH 3/3] dm-crypt: don't use drivers that have CRYPTO_ALG_ALLOCATES_MEMORY

2020-06-17 Thread Mikulas Patocka
Don't use crypto drivers that have the flag CRYPTO_ALG_ALLOCATES_MEMORY set. These drivers allocate memory and thus they are unsuitable for block I/O processing. Signed-off-by: Mikulas Patocka --- drivers/md/dm-crypt.c | 17 +++-- 1 file changed, 11 insertions(+), 6 dele

[PATCH 2/3] crypto: set the flag CRYPTO_ALG_ALLOCATES_MEMORY

2020-06-17 Thread Mikulas Patocka
drivers/crypto/xilinx/zynqmp-aes-gcm.c: zynqmp_aes_aead_cipher Signed-off-by: Mikulas Patocka --- drivers/crypto/allwinner/sun8i-ce/sun8i-ce-core.c |8 +- drivers/crypto/allwinner/sun8i-ss/sun8i-ss-core.c |8 +- drivers/crypto/amlogic/amlogic-gxl-core.c |4 - drivers/crypto/axis

[PATCH 1/3] crypto: pass the flag CRYPTO_ALG_ALLOCATES_MEMORY

2020-06-17 Thread Mikulas Patocka
GFP_KERNEL allocation can recurse into the block layer, causing a deadlock. Signed-off-by: Mikulas Patocka --- crypto/adiantum.c |3 ++- crypto/authenc.c |5 +++-- crypto/authencesn.c |5 +++-- crypto/ccm.c |7 --- crypto/chacha20poly1305.c

Re: [dm-devel] [PATCH 1/4] crypto: introduce CRYPTO_ALG_ALLOCATES_MEMORY

2020-06-17 Thread Mikulas Patocka
I'm resending the patches with your comments resolved... Mikulas On Tue, 16 Jun 2020, Eric Biggers wrote: > On Tue, Jun 16, 2020 at 11:01:31AM -0400, Mikulas Patocka wrote: > > Introduce a new flag CRYPTO_ALG_ALLOCATES_MEMORY and modify dm-crypt, so > > that it uses only

[PATCH 2/2] hisilicon-crypto: don't sleep of CRYPTO_TFM_REQ_MAY_SLEEP was not specified

2020-06-17 Thread Mikulas Patocka
There is this call chain: sec_alg_skcipher_encrypt -> sec_alg_skcipher_crypto -> sec_alg_alloc_and_calc_split_sizes -> kcalloc where we call sleeping allocator function even if CRYPTO_TFM_REQ_MAY_SLEEP was not specified. Signed-off-by: Mikulas Patocka Cc: sta...@vger.kernel.org

[PATCH 1/2] cpt-crypto: don't sleep of CRYPTO_TFM_REQ_MAY_SLEEP was not specified

2020-06-17 Thread Mikulas Patocka
There is this call chain: cvm_encrypt -> cvm_enc_dec -> cptvf_do_request -> process_request -> kzalloc where we call sleeping allocator function even if CRYPTO_TFM_REQ_MAY_SLEEP was not specified. Signed-off-by: Mikulas Patocka Cc: sta...@vger.kernel.org # v4.11+ Fixes:

Re: [dm-devel] [PATCH 4/4] crypto: fix the drivers that don't respect CRYPTO_TFM_REQ_MAY_SLEEP

2020-06-17 Thread Mikulas Patocka
On Tue, 16 Jun 2020, Eric Biggers wrote: > On Tue, Jun 16, 2020 at 02:18:17PM -0400, Mikulas Patocka wrote: > > > > > > On Tue, 16 Jun 2020, Eric Biggers wrote: > > > > > On Tue, Jun 16, 2020 at 11:02:50AM -0400, Mikulas Patocka wrote: > > >

Re: [dm-devel] [PATCH 4/4] crypto: fix the drivers that don't respect CRYPTO_TFM_REQ_MAY_SLEEP

2020-06-16 Thread Mikulas Patocka
On Tue, 16 Jun 2020, Eric Biggers wrote: > On Tue, Jun 16, 2020 at 11:02:50AM -0400, Mikulas Patocka wrote: > > Fix the crypto drivers that don't respect CRYPTO_TFM_REQ_MAY_SLEEP. If > > CRYPTO_TFM_REQ_MAY_SLEEP is not set, the driver must not do allocation > > that s

[PATCH 3/4] crypto: set the flag CRYPTO_ALG_ALLOCATES_MEMORY

2020-06-16 Thread Mikulas Patocka
Set the flag CRYPTO_ALG_ALLOCATES_MEMORY in the crypto drivers that allocate memory. Signed-off-by: Mikulas Patocka --- drivers/crypto/allwinner/sun8i-ce/sun8i-ce-core.c |8 +- drivers/crypto/allwinner/sun8i-ss/sun8i-ss-core.c |8 +- drivers/crypto/amlogic/amlogic-gxl-core.c

[PATCH 4/4] crypto: fix the drivers that don't respect CRYPTO_TFM_REQ_MAY_SLEEP

2020-06-16 Thread Mikulas Patocka
Fix the crypto drivers that don't respect CRYPTO_TFM_REQ_MAY_SLEEP. If CRYPTO_TFM_REQ_MAY_SLEEP is not set, the driver must not do allocation that sleeps. Signed-off-by: Mikulas Patocka --- drivers/crypto/amlogic/amlogic-gxl-cipher.c |5 ++- drivers/crypto/cavium/cpt/cptvf_a

[PATCH 2/4] crypto: pass the flag CRYPTO_ALG_ALLOCATES_MEMORY

2020-06-16 Thread Mikulas Patocka
Pass the flag CRYPTO_ALG_ALLOCATES_MEMORY down through the crypto API. Signed-off-by: Mikulas Patocka --- crypto/adiantum.c |3 ++- crypto/authenc.c |5 +++-- crypto/authencesn.c |5 +++-- crypto/ccm.c |7 --- crypto/chacha20poly1305.c

[PATCH 1/4] crypto: introduce CRYPTO_ALG_ALLOCATES_MEMORY

2020-06-16 Thread Mikulas Patocka
anytime (causing random I/O errors) and GFP_KERNEL allocation can recurse into the block layer, causing a deadlock. Signed-off-by: Mikulas Patocka Index: linux-2.6/include/linux/crypto.h === --- linux-2.6.orig/include/linux/crypto.h

Re: crypto API and GFP_ATOMIC

2020-06-16 Thread Mikulas Patocka
On Wed, 10 Jun 2020, Herbert Xu wrote: > On Wed, Jun 10, 2020 at 08:02:23AM -0400, Mikulas Patocka wrote: > > > > Yes, fixing the drivers would be the best - but you can hardly find any > > person who has all the crypto hardware and who is willing to rewrite all &

Re: crypto API and GFP_ATOMIC

2020-06-10 Thread Mikulas Patocka
On Wed, 10 Jun 2020, Herbert Xu wrote: > On Tue, Jun 09, 2020 at 01:11:05PM -0400, Mikulas Patocka wrote: > > > > Do you have another idea how to solve this problem? > > I think the better approach would be to modify the drivers to not > allocate any memory. In gener

crypto API and GFP_ATOMIC

2020-06-09 Thread Mikulas Patocka
Hi I've found out that a lot of hardware crypto drivers use GFP_ATOMIC. Some of them switch between GFP_ATOMIC and GFP_KERNEL based on the flag CRYPTO_TFM_REQ_MAY_SLEEP. dm-crypt and dm-integrity don't use CRYPTO_TFM_REQ_MAY_SLEEP (because GFP_KERNEL allocation requests can recurse back to the

Re: [PATCH 1/4] qat: fix misunderstood -EBUSY return code

2020-06-03 Thread Mikulas Patocka
On Wed, 3 Jun 2020, Giovanni Cabiddu wrote: > > > > +bool adf_should_back_off(struct adf_etr_ring_data *ring) > > > > +{ > > > > + return atomic_read(ring->inflights) > > > > > ADF_MAX_INFLIGHTS(ring->ring_size, ring->msg_size) * 15 / 16; > > > How did you came up with 15/16? > > > > I

Re: [PATCH 1/4] qat: fix misunderstood -EBUSY return code

2020-06-03 Thread Mikulas Patocka
On Tue, 2 Jun 2020, Giovanni Cabiddu wrote: > Hi Mikulas, > > thanks for your patch. See below. > > > + qat_req->backed_off = backed_off = > > adf_should_back_off(ctx->inst->sym_tx); > > +again: > > + ret = adf_send_message(ctx->inst->sym_tx, (uint32_t *)msg); > > if (ret == -EAGAIN)

[PATCH 5/4] dm-integrity: sleep and retry on allocation errors

2020-06-02 Thread Mikulas Patocka
cause I/O errors. So, we sleep and retry. Signed-off-by: Mikulas Patocka Cc: sta...@vger.kernel.org --- drivers/md/dm-integrity.c |5 + 1 file changed, 5 insertions(+) Index: linux-2.6/drivers/md/dm-integrity.c === --- linux

[PATCH 3/4] qat: use GFP_KERNEL allocations

2020-06-01 Thread Mikulas Patocka
Use GFP_KERNEL when the flag CRYPTO_TFM_REQ_MAY_SLEEP is present. Also, use GFP_KERNEL when setting a key. Signed-off-by: Mikulas Patocka Cc: sta...@vger.kernel.org Index: linux-2.6/drivers/crypto/qat/qat_common/qat_algs.c

[PATCH 1/4] qat: fix misunderstood -EBUSY return code

2020-06-01 Thread Mikulas Patocka
iable backed_off) and if we finish the request, we return -EINPROGRESS to indicate that the user can send more requests. Signed-off-by: Mikulas Patocka Cc: sta...@vger.kernel.org Index: linux-2.6/drivers/crypto/qat/qat_common/qat_a

[PATCH 0/4] Intel QAT fixes

2020-06-01 Thread Mikulas Patocka
Hi These patches fix bugs in the Intel QAT driver. https://bugzilla.redhat.com/show_bug.cgi?id=1813394 Mikulas

[PATCH 4/4] dm-crypt: sleep and retry on allocation errors

2020-06-01 Thread Mikulas Patocka
retry. Signed-off-by: Mikulas Patocka Cc: sta...@vger.kernel.org Index: linux-2.6/drivers/md/dm-crypt.c === --- linux-2.6.orig/drivers/md/dm-crypt.c +++ linux-2.6/drivers/md/dm-crypt.c @@ -1534,6 +1534,7 @@ static blk_status_t

[PATCH 2/4] qat: fix misunderstood -EBUSY return code in asym algorithms

2020-06-01 Thread Mikulas Patocka
the caller should stop sending more requests. When the request is returned with -EINPROGRESS, the caller can send more requests. Signed-off-by: Mikulas Patocka Cc: sta...@vger.kernel.org Index: linux-2.6/drivers/crypto/qat/qat_common/qat_asym_algs.c

[PATCH] gcmaes_crypt_by_sg: don't use GFP_ATOMIC allocation if the request doesn't cross a page

2018-09-05 Thread Mikulas Patocka
t_by_sg is using GFP_ATOMIC allocation that can fail anytime. This patch fixes the logic so that it won't attempt the failing allocation if the data doesn't cross a page boundary. Signed-off-by: Mikulas Patocka Cc: sta...@vger.kernel.org --- arch/x86/crypto/aesni-intel_glue.c |2 +

[PATCH] dm-crypt and dm-integrity: disable CRYPTO_TFM_REQ_MAY_SLEEP to fix a deadlock

2018-09-05 Thread Mikulas Patocka
m/archives/dm-devel/2018-August/msg00195.html ) Signed-off-by: Mikulas Patocka Cc: sta...@vger.kernel.org --- drivers/md/dm-crypt.c | 10 +- drivers/md/dm-integrity.c |4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) Index: linux-2.6/drivers/md/

Re: Deadlock when using crypto API for block devices

2018-08-24 Thread Mikulas Patocka
On Fri, 24 Aug 2018, Mikulas Patocka wrote: > > > On Fri, 24 Aug 2018, Herbert Xu wrote: > > > On Fri, Aug 24, 2018 at 07:06:32AM -0400, Mikulas Patocka wrote: > > > > > > A quick search through the crypto code shows that ahash_save_req and >

Re: Deadlock when using crypto API for block devices

2018-08-24 Thread Mikulas Patocka
On Fri, 24 Aug 2018, Herbert Xu wrote: > On Fri, Aug 24, 2018 at 07:06:32AM -0400, Mikulas Patocka wrote: > > > > A quick search through the crypto code shows that ahash_save_req and > > seqiv_aead_encrypt return -ENOMEM. > > > > Will you fix them? >

Re: Deadlock when using crypto API for block devices

2018-08-24 Thread Mikulas Patocka
On Fri, 24 Aug 2018, Mikulas Patocka wrote: > > > On Fri, 24 Aug 2018, Herbert Xu wrote: > > > On Thu, Aug 23, 2018 at 04:39:23PM -0400, Mikulas Patocka wrote: > > > > > > 1. don't set CRYPTO_TFM_REQ_MAY_SLEEP in dm-crypt > > > ===

Re: Deadlock when using crypto API for block devices

2018-08-24 Thread Mikulas Patocka
On Fri, 24 Aug 2018, Herbert Xu wrote: > On Thu, Aug 23, 2018 at 04:39:23PM -0400, Mikulas Patocka wrote: > > > > 1. don't set CRYPTO_TFM_REQ_MAY_SLEEP in dm-crypt > > = > > If we don't set it, dm-crypt will u

Deadlock when using crypto API for block devices

2018-08-23 Thread Mikulas Patocka
Hi There's a deadlock reported here: https://bugzilla.kernel.org/show_bug.cgi?id=200835 * dm-crypt calls crypt_convert in xts mode * init_crypt from xts.c calls kmalloc(GFP_KERNEL) * kmalloc(GFP_KERNEL) recurses into the XFS filesystem, the filesystem tries to submit some bios and wait

[PATCH] dm-integrity: don't store cipher request on the stack (was: [QUESTION] hash import and request initialization)

2018-01-10 Thread Mikulas Patocka
QUEST_ON_STACK is only meant for > sync algorithms and this code needs to be changed to either do the > proper request allocation or switch over to allocating sync > algorithms. > > Cheers, Hi Here I send a patch that moves those allocations to the heap. Mikulas From: Mikula

[PATCH] crc32-pclmul: remove useless relative addressing

2017-09-06 Thread Mikulas Patocka
. If we use a call instruction and pop the return address, it desynchronizes the return stack and causes branch prediction misses. This patch also moves the data to the .rodata section. Signed-off-by: Mikulas Patocka --- arch/x86/crypto/crc32-pclmul_asm.S | 17 ++--- 1 file

Re: [dm-devel] [PATCH v5 12/19] dm: move dm-verity to generic async completion

2017-08-19 Thread Mikulas Patocka
On Mon, 14 Aug 2017, Gilad Ben-Yossef wrote: > dm-verity is starting async. crypto ops and waiting for them to complete. > Move it over to generic code doing the same. > > This also fixes a possible data coruption bug created by the > use of wait_for_completion_interruptible() without dealing >

Re: [PATCH v2] crypto/mcryptd: Check mcryptd algorithm compatibility

2016-12-06 Thread Mikulas Patocka
ng an algorithm. > > Link: http://marc.info/?l=linux-crypto-vger&m=148063683310477&w=2 > Cc: sta...@vger.kernel.org > Reported-by: Mikulas Patocka > Signed-off-by: Tim Chen > --- > crypto/mcryptd.c | 19 --- > 1 file changed, 12 insertions(+), 7 del

Crash in crypto mcryptd

2016-12-01 Thread Mikulas Patocka
Hi There is a bug in mcryptd initialization. This is a test module that tries various hash algorithms. When you load the module with "insmod test.ko 'alg=mcryptd(md5)'", the machine crashes. Mikulas #include #include #include static char *alg = "md5"; module_param_named(alg, alg, charp,

Re: [PATCH 1/2] arm64 aes: fix encryption of unaligned data

2014-07-26 Thread Mikulas Patocka
On Sat, 26 Jul 2014, Ard Biesheuvel wrote: > On 26 July 2014 15:13, Ard Biesheuvel wrote: > > On 26 July 2014 01:40, Mikulas Patocka wrote: > >> cryptsetup fails on arm64 when using kernel encryption via AF_ALG socket. > >> See https://bugzilla.redhat.com/show_bug.c

[PATCH 2/2] arm aes: fix encryption of unaligned data

2014-07-25 Thread Mikulas Patocka
Fix the same alignment bug as in arm64 - we need to pass residue unprocessed bytes as the last argument to blkcipher_walk_done. Signed-off-by: Mikulas Patocka Cc: sta...@vger.kernel.org # 3.13+ Index: linux-3.16.0-0.rc6.git1.1.fc21.aarch64/arch/arm/crypto/aesbs-glue.c

[PATCH 1/2] arm64 aes: fix encryption of unaligned data

2014-07-25 Thread Mikulas Patocka
-off-by: Mikulas Patocka Index: linux-3.16.0-0.rc6.git1.1.fc21.aarch64/arch/arm64/crypto/aes-glue.c === --- linux-3.16.0-0.rc6.git1.1.fc21.aarch64.orig/arch/arm64/crypto/aes-glue.c +++ linux-3.16.0-0.rc6.git1.1.fc21.aarch64/arch/arm64

Re: [PATCH] crypto/arc4: convert this stream cipher into a block cipher

2010-02-22 Thread Mikulas Patocka
On Tue, 16 Feb 2010, Herbert Xu wrote: > On Fri, Feb 12, 2010 at 09:42:28AM +0100, Sebastian Andrzej Siewior wrote: > > > > -static void arc4_crypt(struct crypto_tfm *tfm, u8 *out, const u8 *in) > > +static void arc4_ivsetup(struct arc4_ctx *ctx, u8 *iv) > > { > > - struct arc4_ctx *ctx = cry

Re: [PATCH] dm-crypt: disable block encryption with arc4

2010-02-09 Thread Mikulas Patocka
On Tue, 9 Feb 2010, Herbert Xu wrote: > Mikulas Patocka wrote: > > > > You should rather add a flag CRYPTO_ALG_CHANGES_STATE to determine that a > > cipher can't be used to encrypt disks. > > No, please see my reply in the previous thread. What we should >

Re: [PATCH] dm-crypt: disable block encryption with arc4

2010-01-26 Thread Mikulas Patocka
On Tue, 26 Jan 2010, Sebastian Andrzej Siewior wrote: > * Mikulas Patocka | 2010-01-26 07:27:18 [-0500]: > > >> yes, I think it is better. > >> (...and I just forgot to add that test to dm-crypt after that suggestion.) > >> > >> Milan > > > &

Re: [PATCH] dm-crypt: disable block encryption with arc4

2010-01-26 Thread Mikulas Patocka
> >>> This patch disables the use of arc4 on block devices. > >> > >> arc4 again. it is simply not a block cipher:-) > >> > >> This should be solved inside cryptoAPI and not blacklist it in dm-crypt, > >> see that thread > >> http://article.gmane.org/gmane.linux.kernel.cryptoapi/3441 > > > > I som

Re: [PATCH] dm-crypt: disable block encryption with arc4

2010-01-25 Thread Mikulas Patocka
BTW. I created a script that tests all possible ciphers, keysizes, chaining modes and iv modes for dm-crypt. arc4 is the only one that fails. You can add it your regression testsuite if you want. Mikulas#!/bin/sh dmsetup remove cr0 set -e cipher="$@" cryptsetup -d key $cipher create cr0 /dev/ram

[PATCH] dm-crypt: disable block encryption with arc4

2010-01-25 Thread Mikulas Patocka
liminating the cipher and getting two xored plaintexts. Signed-off-by: Mikulas Patocka --- drivers/md/dm-crypt.c |5 + 1 file changed, 5 insertions(+) Index: linux-2.6.32-devel/drivers/md/dm-crypt.c === --- linux-2.6.32-devel.o

Re: [dm-devel] Desynchronizing dm-raid1

2008-05-24 Thread Mikulas Patocka
If you want to negate the meaning of the flag, then you have to write it yourself. I, as non-developer of crypto code, can prove that on given path the input data are read only once --- but I can't prove that on all paths and all possible chaining modes of algorithms the data are read once, becaus

Re: [dm-devel] Desynchronizing dm-raid1

2008-05-23 Thread Mikulas Patocka
On Thu, May 22, 2008 at 08:32:45AM -0400, Mikulas Patocka wrote: There may be external modules. Sorry but we don't support external modules. They should be merged upstream rather than distributed in the wild. Cheers, If you want to negate the meaning of the flag, then you have to wri

Re: [dm-devel] Desynchronizing dm-raid1

2008-05-22 Thread Mikulas Patocka
All the ciphers comply, so the bug is only a theroretical issue (but I didn't check assembler versions --- they should be checked by the person who wrote them, assembler is write-only language). Since every current algorithm sets the flag could you invert its sense? Sorry to have to do this to y

Re: [dm-devel] Desynchronizing dm-raid1

2008-05-21 Thread Mikulas Patocka
On Wed, 14 May 2008, Herbert Xu wrote: On Tue, May 13, 2008 at 04:35:03PM -0400, Mikulas Patocka wrote: And where would you propose to place this bit? One possibility would be struct crypto_tfm->crt_flags Another possibility is struct crypto_alg->cra_flags The latter definitely b

Re: [dm-devel] Desynchronizing dm-raid1

2008-05-13 Thread Mikulas Patocka
On Tue, 13 May 2008, Herbert Xu wrote: On Mon, May 12, 2008 at 11:28:44PM -0400, Mikulas Patocka wrote: Or do you thint it would be useless (all major disk-encryption algorithms read input buffer more times?) or it would create too much code complexity? I'm open to this approach. As

Re: [dm-devel] Desynchronizing dm-raid1

2008-05-12 Thread Mikulas Patocka
On Tue, 6 May 2008, Mikulas Patocka wrote: On Tue, 6 May 2008, Herbert Xu wrote: Mikulas Patocka <[EMAIL PROTECTED]> wrote: BTW: is it guaranteed for crypto functions that they read the source data only once? There is no such guarantee. Cheers, So we'll have to copy th

Re: [dm-devel] Desynchronizing dm-raid1

2008-05-06 Thread Mikulas Patocka
On Tue, 6 May 2008, Herbert Xu wrote: Mikulas Patocka <[EMAIL PROTECTED]> wrote: BTW: is it guaranteed for crypto functions that they read the source data only once? There is no such guarantee. Cheers, So we'll have to copy the sector to temporary space before encrypting it.

Re: [dm-devel] Desynchronizing dm-raid1

2008-05-05 Thread Mikulas Patocka
On Mon, 7 Apr 2008, Martin K. Petersen wrote: "Malahal" == malahal <[EMAIL PROTECTED]> writes: [I sent this last week but it never made it to the list] Malahal> Very few drivers require it, so how about an interface to Malahal> lock the pages of an I/O available to drivers. Only needed Mal