[ipxe-devel] [ipxe/ipxe] successful wpa handshake (memcmp polarity) (#103)
Fix memcmp() to return proper standard positive/negative values for unequal comparisons. Similar to commit 3946aa9. The current implementation is backwards (i.e. the functions are returning negative when they should be positive and vice-versa). Currently all other consumers of these functions only check the return value for ==0 or !=0 and so we can safely change the implementation without breaking things. However, there is one call that checks the polarity of `memcmp()`, and that is [wpa_derive_ptk()](https://github.com/ipxe/ipxe/blob/8f1514a00450119b04b08642c55aa674bdf5a4ef/src/net/80211/wpa.c#L290-L305) during the wireless WPA 4-way handshake. Due to the incorrect memcmp polarity, the WPA handshake creates an incorrect PTK, and the handshake would fail after step 2. Undoubtedly, the AP noticed the supplicant failed the mic check. This commit fixes that issue. Signed-off-by: Michael BazzinottiP.S. This wpa handshake bug is believed to have been longstanding for several years, and based on my current understanding, it possibly dates back to the release of the ipxe wpa feature itself. That makes no sense, but let's look at what I have uncovered. It seems a user encountered the exact same issue in [iPXE forums in 2016](https://forum.ipxe.org/showthread.php?tid=7943): a mic check failure. I realize net booting wirelessly is not popular nor well supported, and in that way bugs can live for a long time without being addressed. HOWEVER! `wpa_derive_ptk()` would never run successfully unless with a different `memcmp()` function, due to the reversed polarity. How could a single person have ever successfully joined a WPA network using ipxe's `memcmp()`? I assume the code was ran successfully in the past, right? In those cases, was some other `memcmp()` somehow being used? For example, could the system's native memcmp() accidently have been superceding ipxe's? In any case, it seems a properly built ipxe that uses its internal `memcmp` could never generate a correct wpa ptk using `wpa_derive_ptk()` ? If you have any additional information to explain why, please by all means. Or join me in a state of wonder. Thanks You can view, comment on, or merge this pull request online at: https://github.com/ipxe/ipxe/pull/103 -- Commit Summary -- * [libc] Fix memcmp() to return proper values * [wpa] fix erroneous dbg printout in wpa_derive_ptk -- File Changes -- M src/core/string.c (2) M src/net/80211/wpa.c (9) -- Patch Links -- https://github.com/ipxe/ipxe/pull/103.patch https://github.com/ipxe/ipxe/pull/103.diff -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/ipxe/ipxe/pull/103 ___ ipxe-devel mailing list ipxe-devel@lists.ipxe.org https://lists.ipxe.org/mailman/listinfo/ipxe-devel
[ipxe-devel] [PATCH 2/2] [config] Support platforms which do not process the CTRL key
This maintains backwards-support for the CTRL key functions, but also adds regular key functions for the platforms that do not process the CTRL key. These new keys are ESC and DELETE, and are meaningful. Signed-off-by: Michael J. Bazzinotti --- src/hci/tui/settings_ui.c | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/hci/tui/settings_ui.c b/src/hci/tui/settings_ui.c index be421cc..6cb2756 100644 --- a/src/hci/tui/settings_ui.c +++ b/src/hci/tui/settings_ui.c @@ -384,12 +384,12 @@ static void draw_instruction_row ( struct settings_ui *ui ) { if ( ui->row.editing ) { msg ( INSTRUCTION_ROW, "Enter - accept changes" INSTRUCTION_PAD - "Ctrl-C - discard changes" ); + "ESC - discard changes" ); } else { msg ( INSTRUCTION_ROW, - "%sCtrl-X - exit configuration utility", + "%sESC - exit configuration utility", ( ( ui->row.origin == ui->settings ) ? - "Ctrl-D - delete setting" INSTRUCTION_PAD : "" ) ); + "BACKSPACE - delete setting" INSTRUCTION_PAD : "" ) ); } } @@ -486,6 +486,7 @@ static int main_loop ( struct settings *settings ) { if ( ( rc = save_setting ( &ui ) ) != 0 ) alert ( " %s ", strerror ( rc ) ); /* Fall through */ + case ESC: case CTRL_C: select_setting_row ( &ui, ui.scroll.current ); redraw = 1; @@ -516,6 +517,7 @@ static int main_loop ( struct settings *settings ) { /* Handle non-navigation keys */ switch ( key ) { + case BACKSPACE: case CTRL_D: if ( ! ui.row.setting.name ) break; @@ -526,6 +528,7 @@ static int main_loop ( struct settings *settings ) { select_setting_row ( &ui, ui.scroll.current ); redraw = 1; break; + case ESC: case CTRL_X: return 0; case CR: -- 2.3.6 ___ ipxe-devel mailing list ipxe-devel@lists.ipxe.org https://lists.ipxe.org/mailman/listinfo.cgi/ipxe-devel
[ipxe-devel] [PATCH 1/2] [autoboot] Support platforms which don't process the CTRL key
The user can now press the ESC key to abort the autoboot process and gain access to the shell. Signed-off-by: Michael J. Bazzinotti --- src/usr/autoboot.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/usr/autoboot.c b/src/usr/autoboot.c index ccafeae..fa4b719 100644 --- a/src/usr/autoboot.c +++ b/src/usr/autoboot.c @@ -532,10 +532,10 @@ static int shell_banner ( void ) { /* Prompt user */ printf ( "\n" ); - return ( prompt ( "Press Ctrl-B for the " PRODUCT_SHORT_NAME + return ( prompt ( "Press ESC for the " PRODUCT_SHORT_NAME " command line...", ( ( BANNER_TIMEOUT * TICKS_PER_SEC ) / 10 ), - CTRL_B ) == 0 ); + ESC ) == 0 ); } /** -- 2.3.6 ___ ipxe-devel mailing list ipxe-devel@lists.ipxe.org https://lists.ipxe.org/mailman/listinfo.cgi/ipxe-devel
[ipxe-devel] [PATCH 0/2] Support platforms that do not process the CTRL key
iPXE does not function properly on platforms that do not support the CTRL key. An example of such a platform is the Apple Macbook Pro (2009). This patchset provides core functionality on these unsupported platforms. Issues Solved: * When booting into iPXE, CTRL-B does not cancel autoboot and spawn a shell. * When in the 'config' command menu, cannot exit the menu (CTRL-X) or clear and delete entries. This patch series solves these problems. In the 'config' menu, it provides backwards support to the old keys. There may exist other unpatched sections of iPXE that use the CTRL keys. Michael J. Bazzinotti (2): [autoboot] Support platforms which don't process the CTRL key [config] Support platforms which do not process the CTRL key src/hci/tui/settings_ui.c | 9 ++--- src/usr/autoboot.c| 4 ++-- 2 files changed, 8 insertions(+), 5 deletions(-) -- 2.3.6 ___ ipxe-devel mailing list ipxe-devel@lists.ipxe.org https://lists.ipxe.org/mailman/listinfo.cgi/ipxe-devel