Message ID | CAKv+Gu9p_yng=_=sri8VtRpBCpvL-r1iZ=YgEqNhuQf55p1xBA@mail.gmail.com (mailing list archive) |
---|---|
State | RFC |
Delegated to: | Johannes Berg |
Headers | show |
On Sat, Feb 04, 2017 at 02:24:36PM +0000, Ard Biesheuvel wrote: > There is another issue I spotted: the skcipher you allocate may be of > the async variant, which may return from skcipher_encrypt() with > -EINPROGRESS as soon as it has queued the request. Since you don't > deal with that result, you should allocate a sync cipher explicitly: > diff --git a/net/mac80211/fils_aead.c b/net/mac80211/fils_aead.c > - tfm2 = crypto_alloc_skcipher("ctr(aes)", 0, 0); > + tfm2 = crypto_alloc_skcipher("ctr(aes)", 0, CRYPTO_ALG_ASYNC); > - tfm2 = crypto_alloc_skcipher("ctr(aes)", 0, 0); > + tfm2 = crypto_alloc_skcipher("ctr(aes)", 0, CRYPTO_ALG_ASYNC); Thanks! Can you send this as a full contribution or do you want me to do that? I did run this through all the FILS test cases with mac80211_hwsim. > Thanks for the instructions and thanks for testing. If I manage to run > this locally, I will follow up with an alternative patch #1 that > switches FILS to use cmac(aes) as well (which looks reasonably > feasible now that I understand the code) If you have any issues in getting the hwsim test setup working, please let me know. I'm trying to make it easy for anyone to run those tests in hopes of improving quality of Linux WLAN contributions and what gets applied into cfg80211 or mac80211 (or hostap.git for that matter). In particular the latest step-by-step guide I added for the VM version (*) was hoping to show how that can be done in 15 minutes from scratch.. (*) http://w1.fi/cgit/hostap/plain/tests/hwsim/vm/example-vm-setup.txt
On 4 February 2017 at 14:39, Malinen, Jouni <jouni@qca.qualcomm.com> wrote: > On Sat, Feb 04, 2017 at 02:24:36PM +0000, Ard Biesheuvel wrote: >> There is another issue I spotted: the skcipher you allocate may be of >> the async variant, which may return from skcipher_encrypt() with >> -EINPROGRESS as soon as it has queued the request. Since you don't >> deal with that result, you should allocate a sync cipher explicitly: > >> diff --git a/net/mac80211/fils_aead.c b/net/mac80211/fils_aead.c >> - tfm2 = crypto_alloc_skcipher("ctr(aes)", 0, 0); >> + tfm2 = crypto_alloc_skcipher("ctr(aes)", 0, CRYPTO_ALG_ASYNC); > >> - tfm2 = crypto_alloc_skcipher("ctr(aes)", 0, 0); >> + tfm2 = crypto_alloc_skcipher("ctr(aes)", 0, CRYPTO_ALG_ASYNC); > > Thanks! Can you send this as a full contribution or do you want me to > do that? Please go ahead if you don't mind doing it > I did run this through all the FILS test cases with > mac80211_hwsim. > Well, even async ciphers can act synchronously: the SIMD based async ciphers will only enqueue the request for deferred processing when called in interrupt context (on most architectures) but if you happen to run on a platform that has a h/w accelerator for ctr(aes), you are quite likely to see failures here. >> Thanks for the instructions and thanks for testing. If I manage to run >> this locally, I will follow up with an alternative patch #1 tha here >> switches FILS to use cmac(aes) as well (which looks reasonably >> feasible now that I understand the code) > > If you have any issues in getting the hwsim test setup working, please > let me know. I'm trying to make it easy for anyone to run those tests in > hopes of improving quality of Linux WLAN contributions and what gets > applied into cfg80211 or mac80211 (or hostap.git for that matter). In > particular the latest step-by-step guide I added for the VM version (*) > was hoping to show how that can be done in 15 minutes from scratch.. > > > (*) http://w1.fi/cgit/hostap/plain/tests/hwsim/vm/example-vm-setup.txt > I will take a look on Monday
diff --git a/net/mac80211/fils_aead.c b/net/mac80211/fils_aead.c index ecfdd97758a3..a31be5262283 100644 --- a/net/mac80211/fils_aead.c +++ b/net/mac80211/fils_aead.c @@ -124,7 +124,7 @@ static int aes_siv_encrypt(const u8 *key, size_t key_len, /* CTR */ - tfm2 = crypto_alloc_skcipher("ctr(aes)", 0, 0); + tfm2 = crypto_alloc_skcipher("ctr(aes)", 0, CRYPTO_ALG_ASYNC); if (IS_ERR(tfm2)) { kfree(tmp); return PTR_ERR(tfm2); @@ -183,7 +183,7 @@ static int aes_siv_decrypt(const u8 *key, size_t key_len, /* CTR */ - tfm2 = crypto_alloc_skcipher("ctr(aes)", 0, 0); + tfm2 = crypto_alloc_skcipher("ctr(aes)", 0, CRYPTO_ALG_ASYNC); if (IS_ERR(tfm2)) return PTR_ERR(tfm2); /* K2 for CTR */