mangosone-server/.github/workflows/core_windows_build.yml
H0zen 5c87487ca1 RC4 comes into the tree, and the legacy provider goes out of the deployment
Thirty lines of cipher were costing a DLL.

OpenSSL 3 moved RC4 to the legacy provider, which is not compiled into
libcrypto -- it is a separate module discovered on disk at run time. So a
256-byte permutation dragged in ossl-modules/legacy.dll beside the executable,
an OPENSSL_MODULES search path, CMake that hunted for the file and copied it,
CI that pointed an environment variable at it, an installer obliged to ship it,
and a start-up check in both daemons that REFUSED TO BOOT without it.

It was also a loaded gun. The legacy provider is deprecated; the release that
finally drops it would have stopped this emulator starting, for want of a
cipher any competent programmer can write from the specification. And the
protocol needs RC4 forever, because the 2.4.3 client is never going to be
updated -- a cipher the wire mandates in perpetuity belongs in the tree, not
behind a compatibility shim someone else maintains for our convenience.

So: ARCFOUR, written out. A key schedule, a permutation, a stream that XORs.
The class keeps its interface, so no caller changed -- AuthCrypt and Warden
were not touched. CryptoStressTest was not touched either, and that is the
point: `Crypto_arc4_matches_the_published_vector` passes against the same
published vector it always checked, so the equivalence is demonstrated rather
than claimed.

Two details worth keeping. Init rebuilds the permutation from the identity
every time, because it is a RE-key as often as a first key and keying on top of
a used state would make the stream depend on how much traffic preceded it; and
it rewinds the stream position, forgetting which is the classic way to build a
cipher that decrypts the first session and nothing after it.

OpenSSLProvider and its test are deleted outright. RC4 was the only thing this
tree ever asked the legacy provider for; SHA-1, SHA-256, AES and the bignum
work all live in the DEFAULT provider, which is inside libcrypto and needs
nothing on the side. The mangosd binary now contains no reference to
ossl-modules, to OSSL_PROVIDER, or to a legacy provider at all.

Linking is unchanged and still dynamic. This removes a module that had to be
FOUND at run time, which is a different problem from where libcrypto itself
comes from.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-13 23:34:27 +01:00

147 lines
4.8 KiB
YAML

name: Windows Build (MSVC)
on:
push:
branches: [ master, united, devel ]
pull_request:
branches: [ master, united ]
permissions:
contents: read
concurrency:
group: windows-${{ github.ref }}
cancel-in-progress: true
env:
OPENSSL_VERSION: 3.6.3
OPENSSL_SHA512: 120A2E9A3E8B961484CB94D52F85D48DC2C8AF777B5B3B9E26BF49B4408797281F7C0FB2D543FD7796B3C3232ADFAA0F675E7122C0E5C4225B3B02E767197AC6
jobs:
build:
runs-on: windows-2022
env:
BUILD_DIR: ${{ github.workspace }}\..\build-msvc
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 1
# Bump the -vN suffix to force a re-install of OpenSSL.
- name: Cache OpenSSL
id: cache-openssl
uses: actions/cache@v4
with:
path: C:\Program Files\OpenSSL-Win64
key: ${{ runner.os }}-openssl-${{ env.OPENSSL_VERSION }}-v1
- name: Install full OpenSSL (developer)
if: steps.cache-openssl.outputs.cache-hit != 'true'
shell: powershell
run: |
$versionSlug = $env:OPENSSL_VERSION.Replace('.', '_')
$installer = Join-Path $env:RUNNER_TEMP "Win64OpenSSL-$versionSlug.exe"
$url = "https://slproweb.com/download/Win64OpenSSL-$versionSlug.exe"
Write-Host "Downloading OpenSSL $env:OPENSSL_VERSION for development..."
curl.exe --fail --location --retry 3 --output $installer $url
if ($LASTEXITCODE -ne 0) {
throw "OpenSSL download failed with exit code $LASTEXITCODE"
}
$actualHash = (Get-FileHash -Algorithm SHA512 $installer).Hash
if ($actualHash -ne $env:OPENSSL_SHA512) {
throw "OpenSSL installer checksum mismatch: $actualHash"
}
$installArgs = '/VERYSILENT /SUPPRESSMSGBOXES /NORESTART /SP- /DIR="C:\Program Files\OpenSSL-Win64"'
$process = Start-Process -FilePath $installer -ArgumentList $installArgs -Wait -PassThru
if ($process.ExitCode -ne 0) {
throw "OpenSSL installer failed with exit code $($process.ExitCode)"
}
- name: Verify OpenSSL major version
shell: powershell
run: |
$openssl = "C:\Program Files\OpenSSL-Win64\bin\openssl.exe"
if (-not (Test-Path $openssl)) {
throw "OpenSSL executable not found at $openssl"
}
$version = & $openssl version
Write-Host "Installed OpenSSL version: $version"
if ($version -notmatch '^OpenSSL 3\.') {
throw "Windows CI requires OpenSSL 3.x, found: $version"
}
- name: Configure OpenSSL environment
shell: bash
run: |
root="C:/Program Files/OpenSSL-Win64"
if [ -d "$root/lib/VC" ]; then
echo "OPENSSL_ROOT_DIR=$root" >> "$GITHUB_ENV"
echo "OPENSSL_INCLUDE_DIR=$root/include" >> "$GITHUB_ENV"
echo "OPENSSL_CRYPTO_LIBRARY=$root/lib/VC/libcrypto64MT.lib" >> "$GITHUB_ENV"
echo "OPENSSL_SSL_LIBRARY=$root/lib/VC/libssl64MT.lib" >> "$GITHUB_ENV"
echo "$root/bin" >> "$GITHUB_PATH"
else
echo "::error::OpenSSL developer libraries not found"
exit 1
fi
# Supplies the toolchain and the Windows SDK together, which is why there
# is no separate setup-windows10-sdk step.
- name: Setup MSVC environment
uses: ilammy/msvc-dev-cmd@v1
with:
arch: x64
- name: Compiler cache
uses: hendrikmuhs/ccache-action@v1.2
with:
variant: sccache
key: windows-msvc
max-size: 500M
# Never the socket tests: they bind real listeners and dominate the
# suite's wall-clock. A human asks for them, CI does not.
- name: Configure
shell: bash
run: >
cmake -S . -B "$BUILD_DIR" -G Ninja
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_INSTALL_PREFIX="$BUILD_DIR/install"
-DCMAKE_C_COMPILER_LAUNCHER=sccache
-DCMAKE_CXX_COMPILER_LAUNCHER=sccache
-DOPENSSL_ROOT_DIR="$OPENSSL_ROOT_DIR"
-DBUILD_TOOLS=1
-DBUILD_MANGOSD=1
-DBUILD_REALMD=1
-DWITH_TESTS=1
-DWITH_NET_TESTS=0
-DSOAP=1
-DSCRIPT_LIB_ELUNA=1
-DSCRIPT_LIB_SD3=1
-DPLAYERBOTS=1
-DPCH=1
- name: Build
shell: bash
run: cmake --build "$BUILD_DIR" --parallel
- name: Test
shell: bash
run: ctest --test-dir "$BUILD_DIR" --output-on-failure
- name: Verify the working tree is clean
shell: bash
run: |
if [ -n "$(git status --porcelain)" ]; then
echo "::error::the build modified the source tree"
git status --porcelain
exit 1
fi