Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1300282

Re: [PATCH v2] crypto: algif_skcipher - Require setkey before accept(2)

From Milan Broz <gmazyland@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH v2] crypto: algif_skcipher - Require setkey before accept(2)
Date 2016-01-03 10:50 +0100
Message-ID <qMNsu-3DD-3@gated-at.bofh.it> (permalink)
References (1 earlier) <qMt0L-7Eq-19@gated-at.bofh.it> <qMvFg-RW-7@gated-at.bofh.it> <qMAEW-4bL-17@gated-at.bofh.it> <qMAOC-4f6-15@gated-at.bofh.it> <qMFOi-7gt-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 01/03/2016 02:31 AM, Herbert Xu wrote:
> On Sat, Jan 02, 2016 at 09:18:30PM +0100, Milan Broz wrote:
>>
>> But I cannot change thousands of cryptsetup installations that are actively using that code.
>> This is clear userspace breakage which should not happen this way.
> 
> I'll try to add some compatibility code for your case, assuming
> your modus operandi is accept(2) followed by a single setkey before
> proceeding to encryption/decryption.

Hi,

yes, basically it prepares socket()/bind()/accept() and then it calls setkey once.
(I'll try to fix in next releases to call setkey first though.)

I am doing exactly the same for AF_ALG HMAC (hmac(<hash>) key,
does this requirement for order if accept/setkey applies there as well?
(It is not enforced yet.)

Anyway, you can easily simulate that skcipher API call just with running "cryptsetup benchmark"
(with accept() patch it will print N/A for all ciphers while without patch it measures some
more-or-less magic performance numbers :)

> 
>> (Moreover it still doesn't work for cipher_null that has min/max key size 0.)
> 
> Setkey works just fine on cipher_null.

Yes, it works if ALG_SET_KEY is set to zero-length key.
I just re-introduced old bug to code, sorry.

Thanks!
Milan
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

GPF in lrw_crypt Dmitry Vyukov <dvyukov@google.com> - 2015-12-17 14:00 +0100
  Re: GPF in lrw_crypt Stephan Mueller <smueller@chronox.de> - 2015-12-22 00:00 +0100
  Re: GPF in lrw_crypt Herbert Xu <herbert@gondor.apana.org.au> - 2015-12-24 10:40 +0100
    Re: GPF in lrw_crypt Dmitry Vyukov <dvyukov@google.com> - 2015-12-24 12:10 +0100
      [PATCH v2] crypto: algif_skcipher - Require setkey before accept(2) Herbert Xu <herbert@gondor.apana.org.au> - 2015-12-25 08:50 +0100
        Re: [PATCH v2] crypto: algif_skcipher - Require setkey before accept(2) Dmitry Vyukov <dvyukov@google.com> - 2015-12-28 14:50 +0100
          Re: [PATCH v2] crypto: algif_skcipher - Require setkey before  accept(2) Herbert Xu <herbert@gondor.apana.org.au> - 2015-12-29 14:30 +0100
        Re: [PATCH v2] crypto: algif_skcipher - Require setkey before  accept(2) Milan Broz <gmazyland@gmail.com> - 2016-01-02 13:00 +0100
          Re: [PATCH v2] crypto: algif_skcipher - Require setkey before  accept(2) Milan Broz <gmazyland@gmail.com> - 2016-01-02 15:50 +0100
            Re: [PATCH v2] crypto: algif_skcipher - Require setkey before accept(2) Stephan Mueller <smueller@chronox.de> - 2016-01-02 21:10 +0100
              Re: [PATCH v2] crypto: algif_skcipher - Require setkey before  accept(2) Milan Broz <gmazyland@gmail.com> - 2016-01-02 21:20 +0100
                Re: [PATCH v2] crypto: algif_skcipher - Require setkey before  accept(2) Herbert Xu <herbert@gondor.apana.org.au> - 2016-01-03 02:40 +0100
                Re: [PATCH v2] crypto: algif_skcipher - Require setkey before  accept(2) Milan Broz <gmazyland@gmail.com> - 2016-01-03 10:50 +0100
                [PATCH 1/2] crypto: af_alg - Add nokey compatibility path Herbert Xu <herbert@gondor.apana.org.au> - 2016-01-04 05:40 +0100
                [PATCH 2/2] crypto: algif_skcipher - Add nokey compatibility path Herbert Xu <herbert@gondor.apana.org.au> - 2016-01-04 05:40 +0100
                Re: [PATCH 1/2] crypto: af_alg - Add nokey compatibility path Milan Broz <gmazyland@gmail.com> - 2016-01-04 13:40 +0100
                Re: [PATCH 1/2] crypto: af_alg - Add nokey compatibility path Herbert Xu <herbert@gondor.apana.org.au> - 2016-01-08 13:50 +0100
                Re: [PATCH 1/2] crypto: af_alg - Add nokey compatibility path Milan Broz <gmazyland@gmail.com> - 2016-01-08 19:30 +0100
                Re: [PATCH 1/2] crypto: af_alg - Add nokey compatibility path Herbert Xu <herbert@gondor.apana.org.au> - 2016-01-09 06:50 +0100
                Re: [PATCH 1/2] crypto: af_alg - Add nokey compatibility path Milan Broz <gmazyland@gmail.com> - 2016-01-09 11:20 +0100
                [PATCH 1/2] crypto: skcipher - Add crypto_skcipher_has_setkey Herbert Xu <herbert@gondor.apana.org.au> - 2016-01-11 14:30 +0100
                [PATCH 2/2] crypto: algif_skcipher - Add key check exception for  cipher_null Herbert Xu <herbert@gondor.apana.org.au> - 2016-01-11 14:40 +0100
                Re: [PATCH 2/2] crypto: algif_skcipher - Add key check exception for  cipher_null Milan Broz <gmazyland@gmail.com> - 2016-01-11 16:00 +0100
                [PATCH 1/2] crypto: hash - Add crypto_ahash_has_setkey Herbert Xu <herbert@gondor.apana.org.au> - 2016-01-08 14:30 +0100
                [PATCH 2/2] crypto: algif_hash - Require setkey before accept(2) Herbert Xu <herbert@gondor.apana.org.au> - 2016-01-08 14:40 +0100
                Re: [PATCH 2/2] crypto: algif_hash - Require setkey before accept(2) kbuild test robot <lkp@intel.com> - 2016-01-08 15:00 +0100
                Re: [PATCH 2/2] crypto: algif_hash - Require setkey before accept(2) Milan Broz <gmazyland@gmail.com> - 2016-01-09 11:20 +0100

csiph-web