Return-Path: MIME-Version: 1.0 In-Reply-To: References: <20160622004214.GA27134@gondor.apana.org.au> From: Andy Lutomirski Date: Wed, 22 Jun 2016 14:48:24 -0700 Message-ID: Subject: Re: Doing crypto in small stack buffers (bluetooth vs vmalloc-stack crash, etc) To: Herbert Xu Cc: Andy Lutomirski , linux-bluetooth@vger.kernel.org, Johan Hedberg , Gustavo Padovan , Marcel Holtmann , linux-crypto@vger.kernel.org, "David S. Miller" , "linux-kernel@vger.kernel.org" , Linus Torvalds Content-Type: text/plain; charset=UTF-8 List-ID: On Tue, Jun 21, 2016 at 5:52 PM, Andy Lutomirski wrote: > On Tue, Jun 21, 2016 at 5:42 PM, Herbert Xu wrote: >> On Tue, Jun 21, 2016 at 10:43:40AM -0700, Andy Lutomirski wrote: >>> >>> Is there a straightforward way that bluetooth and, potentially, other >>> drivers can just do synchronous crypto in a small buffer specified by >>> its virtual address? The actual cryptography part of the crypto code >>> already works this way, but I can't find an API for it. >> >> Yes, single block users should use crypto_cipher_encrypt_one, an >> example would be drivers/md/dm-crypt.c. >> > > Aha! I expected something like that to exist, but I couldn't find it. > I'll change the two offenders I've found so far to use it. > Before I do this, can you explain what the difference is between crypto_cipher and crypto_skcipher? net/bluetooth/smp.c currently uses crypto_alloc_skcipher, which you added in: commit 71af2f6bb22a4bf42663e10f1d8913d4967ed07f Author: Herbert Xu Date: Sun Jan 24 21:18:30 2016 +0800 Bluetooth: Use skcipher and hash Am I just supposed to replace "skcipher" with "cipher" everywhere? --Andy