Repository navigation
Conversation
A worker holding a lock while waiting in RunOnMainThread deadlocked with the main thread spinning in a Sleep loop (CDlgProgressFactorisation::OnInitDialog), freezing the factorisation dialog. Sleep() now processes pending events on the main thread.
SetControlText called SetValue in both branches, so setting an edit to its current text still fired a change event. Handlers that update sibling edits (e.g. the stereotyped-message dialog) then recursed until the stack overflowed when a long modulus was pasted.
Win32 group boxes are transparent to the mouse, but rc files often declare them after the controls they enclose. A wxStaticBox created later sat on top and swallowed clicks, making edits such as the ciphertext field of the stereotyped-message dialog unclickable.
…mmand The AUI tab control and notebook get wx ids that fall into the command id range, so UpdateCommandUI treated them as menu commands without a handler and disabled them (MFC auto-menu-enable), leaving document tabs unclickable and not closable.
…programmatic updates checkStartButton updates the bit length and delta edits, whose change handlers clear N, e and d (meant for user edits). With change notifications on programmatic updates this erased the modulus as soon as a digit was typed. Skip those handlers while the dialog updates the fields itself.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
While using the macOS build for a cryptanalysis course (lab on brute force and RSA lattice attacks) I ran the
Factorization, Prime Number Generation, Factoring Knowing a Fraction of p, Attack on Stereotyped Messages,
Attack on Small Secret Exponents (Bloemer/May) and Brute-Force Analysis dialogs and hit several problems.
This PR fixes them; each fix is a separate commit.
Fixes
kernel.cpp,wnd.cpp,internal.h).CDlgProgressFactorisation::OnInitDialogspins inSleep(2)on the main thread until all worker threads haveregistered, but a worker that already holds the dialog lock waits in
RunOnMainThread(viaSetTimer->IsWindow) for the main thread.Sleep()now processes pending events when called on the main thread."Complete factorization into primes" froze the whole app before.
controls.cpp,SetControlText).Both branches called
SetValue, so setting an edit to its current text still fired a change event. Handlers thatupdate sibling edits (stereotyped-message dialog) recursed until the stack overflowed (SIGSEGV in
OnChangeEditplainfull). Only notify when the text really changes.controls.cpp).Win32 group boxes are transparent to the mouse, but the rc files often declare them after the controls they
enclose. A
wxStaticBoxcreated later sat on top, making edits and radio buttons (e.g. the ciphertext field of thestereotyped-message dialog) unclickable. Group boxes are now kept at the bottom of the z-order.
docview.cpp).The
wxAuiTabCtrlid falls into the command id range, soUpdateCommandUItreated it as a menu command without ahandler and disabled it (MFC auto menu enable). The tab control and notebook are now skipped.
RSABloemerMayDlg.cpp).checkStartButtonupdates the bit length and delta edits, whose change handlers clear N, e and d (meant for useredits). With change notifications on programmatic updates, typing a digit in N wiped it. The handlers now ignore
updates made by the dialog itself.
Testing
Built on macOS (arm64, Homebrew
wxwidgets@3.2 openssl@3 gmp ninja cmake) and exercised manually:factorisation of an 18-digit number, prime generation up to 10^700, all three lattice-attack dialogs (results
cross-checked against an independent implementation), AES/IDEA brute-force analysis with unknown key bits, and
opening, switching and closing several document tabs. No automated tests were added.
Known issue (not fixed here)
Generating two random primes of about 1200 digits in "Prime Number Generation" crashes with a segfault in
GeneratePrimes::MillerRabinTest(nullBigincompare, worker thread). Ranges up to 10^700 work. I did not findthe cause and do not know whether it is port-specific.