Skip to content

feat: port CrypTool 1 to macOS and Linux - #1

Merged
qamarq merged 46 commits into
mainfrom
xplat-port
Oct 8, 2026
Merged

qamarq merged 46 commits into
mainfrom
xplat-port

Conversation

@qamarq

@qamarq qamarq commented Oct 6, 2026 •

Copy link
Copy Markdown
Member

macOS/Linux port

Native port of CrypTool 1 to macOS and Linux. The MFC sources compile almost unchanged against mfcwx, an MFC/Win32 compatibility layer on wxWidgets 3.2. Windows resources (.rc) are converted to C++ at build time, and SECUDE is replaced by an OpenSSL 3 implementation of the same API.

The badge is measured automatically on every push (port/tools/port_status.py, workflow Port status): 50% × CrypTool sources that compile + 20% if the app links + 30% × passing tests. Details: STATUS.md on the port-status branch; manual breakdown and next steps: port/PORTING_STATUS.md.

qamarq added 2 commits October 6, 2026 12:12
Adds the CMake build, the .rc to C++ resource compiler, portable builds of the
bundled libraries, an MFC/Win32 compatibility layer on wxWidgets (headers and
first part of the implementation) and a partial OpenSSL 3 replacement for
SECUDE. Application sources get portable includes and qualified message map
handlers. The app does not link yet; see port/PORTING_STATUS.md.
port/tools/port_status.py builds everything, syntax-checks every CrypTool source,
runs ctest and writes port/status/{status.json,badge.json,STATUS.md}. A GitHub
workflow runs it on every push to xplat-port and commits the result; the README
badge reads badge.json through shields.io.
@qamarq qamarq changed the title WIP: macOS and Linux port (~35%) WIP: macOS and Linux port Oct 6, 2026
The workflow no longer commits generated files to xplat-port; it pushes
badge.json, status.json and STATUS.md to the port-status branch with a
conventional commit message. README and PORTING_STATUS link there.
qamarq added 25 commits October 6, 2026 17:23
… API

wnd.cpp bridges wx events to Windows messages and implements CWnd;
controls.cpp creates controls from dialog templates and handles their
messages; winapi.cpp provides DefWindowProc and the HWND based Win32 API
(messages, geometry, dialog items, cursors, clipboard, file dialogs).
Dialog templates are instantiated with dialog units derived from the
dialog font; CDialog supports modal and modeless use, IsDialogMessage
keyboard handling and DLGINIT. Includes DDX/DDV, file, colour, font and
find/replace dialogs and a simple property sheet.
…3 implementation

secude_compat implements every function and data object CrypTool loads from
SECUDE.DLL: PSE key stores (AES-256-GCM, PBKDF2), CA database, X.509
certificates, PKCS#12, L_NUMBER arithmetic, legacy hashes and ciphers with
built-in fallbacks. SecudeLib.cpp and libec bind to it off Windows.
RC6 relied on x86 shift semantics (undefined behaviour) and produced wrong
ciphertext on arm64. The libec test now uses prime256v1 with independently
computed reference values.
CMDIFrameWnd hosts child frames as notebook tabs and switches the menu bar
per document template; includes CDocument, CView, CScrollView, document
templates, toolbar and status bar from resources, rich edit view and MRU list.
The data directory is MFCWX_DATA_DIR, the installed resources or a
development directory assembled in the build tree (bitmaps, help, template
files and freshly generated key stores). The language comes from
MFCWX_LANG, the saved setting or the system language. Paths are resolved
case-insensitively like on Windows.
Work in progress: CString passed through varargs gets explicit casts,
temporaries are no longer bound to non-const references, MSVC-only syntax
is replaced and Windows-only parts (OLE picture loading, ActiveX editor,
NVIDIA OpenGL extensions) are guarded.
… help layers

Work in progress from parallel efforts: kernel objects, files, threads and
registry emulation; CDC on wxDC; MFC control wrapper classes; the Scintilla
message proxy and the HTML Help replacement. Some parts are unfinished.
The app is built as CrypTool.app on macOS (Homebrew dylibs are copied in by
fixup_bundle) and installs to bin/ and share/CrypTool on Linux with a desktop
entry and icons. CPack produces a DMG on macOS and tar.gz/deb on Linux.
Also provides the MS CRT globals __argc/__argv.
Kernel objects and waits, threads and processes, files and directories,
INI files and registry emulation, CRT extensions, CObject/exceptions,
CFile/CArchive, sync classes and CWinThread, with 384 passing runtime
checks on macOS and Linux.
Shares one paint DC per window during a paint, routes client-DC drawing
outside a paint through a per-window overlay on macOS, and fixes text
metrics; the GDI test passes 162 checks.
Wraps the paint DC for WM_PAINT and draws the client-DC overlay, clears the
overlay on invalidation and resize, purges temporary GDI wrappers on idle
and answers WM_GETFONT with a shared font handle.
Adds CStatic/CButton/CEdit/CListBox/CComboBox/range control members,
CBitmapButton, CCheckListBox, CListCtrl on wxListCtrl with ListView messages
and notifications, CImageList, CTabCtrl, CToolTipCtrl and an RTF reader for
EM_STREAMIN. All custom control painting follows the paint-bridge contract.
Translates text and positions between the ANSI code page and the UTF-8
control, converts notifications and implements CrypTool's container lexer;
191 checks pass on macOS and Linux.
The proxy records the exact ANSI bytes of a copy and GetClipboardData
returns them while the system clipboard still holds that text, padded to
the selection length so CScintillaWnd::CopyCut never reads past the buffer.
qamarq added 16 commits October 6, 2026 23:42
Finishes the MSVC-ism cleanup (varargs CString casts, temporaries bound to
references, header qualification), fixes 64-bit pointer truncations and a
stack overflow in WinHelpInternal, and builds the homophonic substitution
sources again as the VS2008 project does.
…essors

Also includes the system GL header before wx/glcanvas.h, which GTK builds need.
CrypTool copies its key store below %APPDATA%\CrypTool and showed an error
at startup when the variable was missing.
MFCWX_SNAPSHOT_DIR saves PNGs of the shown top-level windows on a timer and
can dismiss modal dialogs between rounds. The dialog gallery now uses the
same helper, and mfcwx_add_rc keeps its settings in the cache so it works
from any directory.
… the screen

rc2cpp gains --replace (REPLACE in mfcwx_add_rc) to do what the Windows
pre-build script does for [CRYPTOOL_VERSION_FULL]; the project version is
1.4.43 as in that script. GetDesktopWindow now returns a pseudo window whose
rect is the display, which CrypTool uses to size its main window.
build_help_index.py turns the .hhp/.hhc/.hhk sources and the alias headers
into an index of context ids, ALinks and keywords and mirrors hlp_en/hlp_de
into the data directory. ::HtmlHelp, CWinApp::WinHelp and HtmlHelp open the
right page in a wxHtmlHelpController, also on top of modal dialogs.
… separator

Status bar panes now run UPDATE_COMMAND_UI through the frame as in MFC, so
the editor shows line/column/position and the key indicators reflect the
lock state. CDocument::SetPathName cuts the title at the last backslash,
slash or colon like MFC. Snapshots also capture the native macOS toolbar.
CTest 4 reports "100% tests passed out of N" without a failure count, which
the status script read as zero tests. The status files are no longer
tracked on xplat-port, and they are published from a separate clone so the
workspace never has to switch branches.
- Hide the executable's symbols: the zip code's global inflate replaced
  zlib's for FreeType, which crashed while fontconfig loaded fonts.
- Defer fonts created by static initializers (ChallengeResponse's global
  computers) until the toolkit runs; GTK cannot query fonts before that.
- Keep wx window and menu ids below 0x7fff: larger Windows ids such as
  AFX_IDW_PANE_FIRST and the 0x8000+ command range get compact ids.
Runs on pushes and pull requests: builds everything, runs the tests under
Xvfb, starts the app with window snapshots enabled and uploads them. Also
moves the status workflow to actions/checkout@v5 (Node 24).
fixup_bundle rewrites the copied dylibs, which invalidates their
signatures; the bundle is now signed ad hoc again so it starts on Apple
silicon. On Linux the data directory is looked up in ../share/CrypTool
relative to the executable, so relocated tar.gz installs work.
Pushing a v* tag (or running the workflow by hand with a tag) builds the
DMG on macOS arm64 and deb/tar.gz on Linux x86_64 and arm64, smoke-starts
the Linux build and attaches everything to a GitHub prerelease. Pull
requests that touch packaging build the packages without releasing.
Package file names now carry the OS and architecture.
@qamarq qamarq changed the title WIP: macOS and Linux port feat: port CrypTool 1 to macOS and Linux Oct 8, 2026
@qamarq
qamarq marked this pull request as ready for review October 8, 2026 12:13
qamarq added 2 commits October 8, 2026 14:14
The workflow no longer runs on pull requests or tags. Each push to main
builds the macOS and Linux packages and creates the release
v<project version>-build.<run number> with them.
@qamarq
qamarq merged commit 92af5c0 into main Oct 8, 2026
6 checks passed
@qamarq
qamarq deleted the xplat-port branch October 8, 2026 12:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant