Page MenuHomeFreeBSD

net80211: add initial AES-GCMP crypto support
Needs ReviewPublic

Authored by adrian on Fri, Feb 28, 3:23 AM.
Referenced Files
Unknown Object (File)
Sat, Mar 8, 2:27 AM
Unknown Object (File)
Wed, Mar 5, 3:24 AM
Unknown Object (File)
Mon, Mar 3, 8:48 PM
Unknown Object (File)
Mon, Mar 3, 5:40 AM
Unknown Object (File)
Mon, Mar 3, 3:43 AM
Unknown Object (File)
Sun, Mar 2, 7:52 PM
Unknown Object (File)
Sun, Mar 2, 8:21 AM
Unknown Object (File)
Sun, Mar 2, 4:24 AM

Details

Reviewers
bz
Group Reviewers
wireless
Summary

This adds initial AES-GCMP crypto support. It registers for both
128 and 256 bit support, although the 256 bit support will not work
without extending the net80211/ioctl keylength.

This is not yet enabled by default; drivers will need to opt-in
to supporting it in either hardware or software.

The AES-GCMP code is BSD licenced code from hostapd.git .

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 62837
Build 59721: arc lint + arc unit

Event Timeline

bz requested changes to this revision.Sat, Mar 1, 10:51 PM
bz added a subscriber: bz.

So for one this is missing similar changes as went into CCMP recently.

For the other it has all the MMIC and other bits "copied" from CCMP. Before we duplicate them we should fix them, really.

sys/net80211/ieee80211_crypto_gcmp.c
394

Well I know this is what CCMP is doing though a bit more verbose back then.
We do not have the README as part of this codebase and general git repo name without full URl and revision in the commit message does not help.
Also this ends at some point again and normal code continues.

I would suggest marking this with some kind-of delimiters at least but also in theory the copyright should be at the top of the file. I'll add @imp.

This revision now requires changes to proceed.Sat, Mar 1, 10:51 PM

oh yeah I agree that it can do with some refactoring, and I need to update with other changes in CCMP. I just wanted a self-contained stack that's /just/ this to start with :-)

I still have some clean-up to do.

feedback from bz; add missing updates to CCMP since I started this; more counters

sys/net80211/ieee80211_crypto_gcmp.c
394

Yeah I'm not entirely pleased with the current layout. I'm tempted to create a second source file JUST for the AES-GCM code. That'll at least keep it contained.

What do you two think about that?

sys/net80211/ieee80211_crypto_gcmp.c
6

Nit, please consider adding this line after All Rights Reserved. I'd also change the date to 2025.

sys/net80211/ieee80211_crypto_gcmp.c
244

stupid nit: no space after !

395

stupid nit" use 'for (int i = 0;... )' here

sys/net80211/ieee80211_crypto_gcmp.c
394

I like the end marker; am I right that only the last two functions are called from the net80211 code? I was contemplating a /h file with just inline functions but that's likely not great either. If it's just two functions calls we could prefix them with __net80211_ or something so they stay distinct here and will not interfere with TLS or any other crypto and then keep them otherwise private.
I wanted to look how it shows on the CCMP file; if it's the same there we could probably do the same there...

Sorry I know it's not helpful to get this landed but it'll save us. Alternatively we get it in and factor it out if it's inconvenient in the review.

1005

This will be MIC with D49219

split out the hostapd code from the gcmp 802.11 code

I've split the crypto code out into its own source file. This now cleanly separates out what I wrote / copied from ccmp.c versus what I lifted from hostapd.

I've updated the tree; could I please get a re-review with updated locations on all the nits? :-)

thanks!

sys/net80211/ieee80211_crypto_gcmp.c
394

ok, wanna go see if that's any better? I can go prefix them too; they're in their own source file now so it's easy to hide the details.

I've updated the tree; could I please get a re-review with updated locations on all the nits? :-)

I will try tonight when back; sorry fixing the panic was more important yesterday and I would love to see this and CCMP bits in so I'll try my best. Please be patient.

more cleanups from bz/imp, rebase against crypto changes in -head

Love the fixed copyright and the movement of the crypto functions to their own file.

sys/net80211/ieee80211_crypto_gcmp.c
6

Looks good to me! Thanks for the shuffle.

adrian added inline comments.
sys/net80211/ieee80211_crypto_gcmp.c
395

stupid nit" use 'for (int i = 0;... )' here

It's no longer relevant for this file; the relevant code moved to ieee80211_aes_gcm.c

I'll need more time for this.

I love the split out parts!

sys/modules/wlan_gcmp/Makefile
1

Empty line?

sys/net80211/ieee80211_crypto_gcm.c
8

extra blank line? Is that from upstream?

31

Do you still need this?

33

Doubt this file needs this one.

40

Also not sure about that one? If rijndael needs it it should take care of it itself?

sys/net80211/ieee80211_crypto_gcm.h
45

Indentations look weird here and for the next one. Could be Phabricator, can you check?

sys/net80211/ieee80211_crypto_gcmp.c
29

Do you need this?

33

I assume this is gone into its own file here?

57

How does this compile? It's a re-define from crypto_gcm.h

86

Indent looks weird.

89

I need to sort my head around what ic_trailer and ic_miclen (or enmimc()) means in net80211 and implies.

161

In theory this and the above coul go into std. ieee80211_crypto.h and be called ieee80211_crypto_get_XXX_len()

181

I still think there should be one internal implementation which takes two arguments and these two can be one-line-wrappers.

206

I wonder why we don't name them PN5,4 and PN3/2/1/0 like gcmp_init_iv does. I wonder if ccmp got this the other way before as well?

209

Indent looks weird.

241

And no () either. Should be a bool anyway...

272

extra empty line

302

if ((rxs != NULL) && (rxs->c_pktflags & IEEE80211_RX_F_IV_STRIP) != 0)

350

if ((rxs == NULL) || (rxs->c_pktflags & IEEE80211_RX_F_IV_STRIP) == 0) {

356

if ((rxs == NULL) || (rxs->c_pktflags & IEEE80211_RX_F_MIC_STRIP) == 0)

362

if ((rxs == NULL) || (rxs->c_pktflags & IEEE80211_RX_F_IV_STRIP) == 0) {