fix(hytera): consume keystream as a 49-bit bitstream, not byte-aligne… #60
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
| name: Build | |
| on: | |
| push: | |
| branches: ['**'] | |
| pull_request: | |
| branches: [master] | |
| permissions: | |
| contents: read | |
| jobs: | |
| build: | |
| name: Compile dmrcrack.exe | |
| # Pinned to windows-2022 (ships VS2022). The windows-latest image moved to a | |
| # newer Visual Studio (v18/2026) that CUDA 12.9's nvcc rejects | |
| # (host_config.h: "Only versions between 2017 and 2022 are supported"). Local | |
| # builds work because they use CUDA 13.x. Revisit when CI bumps to CUDA 13.x. | |
| runs-on: windows-2022 | |
| timeout-minutes: 45 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| # ── CUDA ───────────────────────────────────────────────────────────────── | |
| # The cache stores the full CUDA Toolkit tree. On a cache hit we re-export | |
| # the env vars that the Jimver action would normally set, so that build.bat | |
| # can find nvcc and cuda_runtime.h after vcvarsall resets PATH. | |
| - name: Cache CUDA Toolkit | |
| id: cache-cuda | |
| uses: actions/cache@v4 | |
| with: | |
| path: C:\Program Files\NVIDIA GPU Computing Toolkit | |
| key: cuda-12.9.0-windows | |
| - name: Install CUDA Toolkit | |
| if: steps.cache-cuda.outputs.cache-hit != 'true' | |
| uses: Jimver/cuda-toolkit@v0.2.35 | |
| with: | |
| cuda: '12.9.0' | |
| method: 'network' | |
| sub-packages: '["nvcc", "cudart"]' | |
| use-github-env: true | |
| - name: Set CUDA environment after cache restore | |
| if: steps.cache-cuda.outputs.cache-hit == 'true' | |
| shell: pwsh | |
| run: | | |
| $cuda = "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.9" | |
| echo "CUDA_PATH=$cuda" >> $env:GITHUB_ENV | |
| echo "$cuda\bin" >> $env:GITHUB_PATH | |
| - name: Verify CUDA installation | |
| run: nvcc --version | |
| # ── DSD-FME runtime ─────────────────────────────────────────────────────── | |
| # tools/*.dll and tools/dsd-fme.exe are gitignored; they must be downloaded | |
| # from the official portable release. We cache them in .github/dsd-fme-cache | |
| # (separate from tools/) so that git-tracked scripts in tools/ are never | |
| # overwritten by stale cache content. | |
| - name: Cache DSD-FME runtime | |
| id: cache-dsd | |
| uses: actions/cache@v4 | |
| with: | |
| path: .github/dsd-fme-cache | |
| key: dsd-fme-portable-20251214-v2 | |
| - name: Download DSD-FME runtime | |
| if: steps.cache-dsd.outputs.cache-hit != 'true' | |
| shell: pwsh | |
| run: | | |
| $url = "https://github.com/lwvmobile/dsd-fme/releases/download/20251214/dsd-fme-x86-64-cygwin-portable.zip" | |
| $tmp = "$env:RUNNER_TEMP\dsd-fme.zip" | |
| New-Item -ItemType Directory -Force -Path .github/dsd-fme-cache | Out-Null | |
| Write-Host "Downloading DSD-FME portable..." | |
| Invoke-WebRequest -Uri $url -OutFile $tmp -UseBasicParsing | |
| Write-Host "Extracting..." | |
| Add-Type -AssemblyName System.IO.Compression.FileSystem | |
| $z = [IO.Compression.ZipFile]::OpenRead($tmp) | |
| foreach ($e in $z.Entries) { | |
| if ($e.FullName -match '^dsd-fme-portable/dsd-fme/[^/]+$') { | |
| if ($e.Name -match '\.dll$' -or $e.Name -eq 'dsd-fme.exe') { | |
| [IO.Compression.ZipFileExtensions]::ExtractToFile($e, ".github/dsd-fme-cache/$($e.Name)", $true) | |
| } | |
| } | |
| } | |
| $z.Dispose() | |
| Remove-Item $tmp | |
| Copy-Item .github/dsd-fme-cache/* tools/ | |
| Write-Host "Done: $((Get-ChildItem tools/cyg*.dll | Measure-Object).Count) DLLs + dsd-fme.exe" | |
| - name: Restore DSD-FME from cache | |
| if: steps.cache-dsd.outputs.cache-hit == 'true' | |
| shell: pwsh | |
| run: Copy-Item .github/dsd-fme-cache/* tools/ -Force | |
| - name: Verify DSD-FME files | |
| shell: pwsh | |
| run: | | |
| $exe = Test-Path "tools/dsd-fme.exe" | |
| $dlls = (Get-ChildItem tools/cyg*.dll -ErrorAction SilentlyContinue | Measure-Object).Count | |
| Write-Host "dsd-fme.exe present: $exe | Cygwin DLLs: $dlls" | |
| if (-not $exe -or $dlls -lt 10) { Write-Error "DSD-FME runtime incomplete"; exit 1 } | |
| # ── Build ───────────────────────────────────────────────────────────────── | |
| - name: Create bin directory | |
| run: New-Item -ItemType Directory -Force -Path bin | |
| - name: Build dmrcrack.exe | |
| shell: cmd | |
| run: | | |
| call build.bat | |
| if errorlevel 1 exit /b 1 | |
| if not exist bin\dmrcrack.exe ( | |
| echo ERROR: dmrcrack.exe not produced | |
| exit /b 1 | |
| ) | |
| - name: Upload build artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: dmrcrack-${{ github.sha }} | |
| path: bin\dmrcrack.exe | |
| retention-days: 7 | |
| build-linux: | |
| name: Compile dmrcrack (Linux CLI) | |
| runs-on: ubuntu-24.04 | |
| timeout-minutes: 45 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| # ── CUDA ───────────────────────────────────────────────────────────────── | |
| - name: Cache CUDA Toolkit | |
| id: cache-cuda | |
| uses: actions/cache@v4 | |
| with: | |
| path: /usr/local/cuda-12.9 | |
| key: cuda-12.9.0-linux | |
| - name: Install CUDA Toolkit | |
| if: steps.cache-cuda.outputs.cache-hit != 'true' | |
| uses: Jimver/cuda-toolkit@v0.2.35 | |
| with: | |
| cuda: '12.9.0' | |
| method: 'network' | |
| sub-packages: '["nvcc", "cudart"]' | |
| use-github-env: true | |
| - name: Set CUDA environment after cache restore | |
| if: steps.cache-cuda.outputs.cache-hit == 'true' | |
| run: | | |
| echo "CUDA_PATH=/usr/local/cuda-12.9" >> "$GITHUB_ENV" | |
| echo "/usr/local/cuda-12.9/bin" >> "$GITHUB_PATH" | |
| - name: Verify CUDA installation | |
| run: nvcc --version | |
| # ── Build ───────────────────────────────────────────────────────────────── | |
| - name: Configure | |
| run: cmake -S . -B build -DNO_GUI=ON -DCMAKE_BUILD_TYPE=Release | |
| - name: Build | |
| run: cmake --build build --parallel | |
| - name: Verify binary | |
| run: | | |
| test -f bin/dmrcrack | |
| file bin/dmrcrack | grep -q "ELF 64-bit" | |
| echo "Binary OK: $(file bin/dmrcrack)" | |
| - name: Upload build artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: dmrcrack-linux-${{ github.sha }} | |
| path: bin/dmrcrack | |
| retention-days: 7 | |
| build-rocm: | |
| name: Compile dmrcrack (AMD ROCm/HIP) | |
| runs-on: ubuntu-24.04 | |
| timeout-minutes: 45 | |
| # Compile-only smoke test of the HIP back-end. No AMD GPU is present on the | |
| # runner, so the binary is built but never executed — this verifies that the | |
| # single-source kernel (src/bruteforce.cu) and gpu_compat.h shim compile | |
| # cleanly with the ROCm toolchain. | |
| container: | |
| image: rocm/dev-ubuntu-24.04:6.2 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Install build tools | |
| run: | | |
| apt-get update | |
| apt-get install -y --no-install-recommends cmake build-essential file | |
| - name: Verify HIP installation | |
| run: hipcc --version | |
| - name: Configure | |
| run: | | |
| cmake -S . -B build \ | |
| -DUSE_HIP=ON -DNO_GUI=ON -DCMAKE_BUILD_TYPE=Release \ | |
| -DCMAKE_HIP_COMPILER=/opt/rocm/bin/amdclang++ \ | |
| -DCMAKE_PREFIX_PATH=/opt/rocm | |
| - name: Build | |
| run: cmake --build build --parallel | |
| - name: Verify binary | |
| run: | | |
| test -f bin/dmrcrack | |
| file bin/dmrcrack | grep -q "ELF 64-bit" | |
| echo "HIP binary OK: $(file bin/dmrcrack)" | |
| - name: Upload build artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: dmrcrack-rocm-${{ github.sha }} | |
| path: bin/dmrcrack | |
| retention-days: 7 | |
| build-opencl: | |
| name: Compile dmrcrack (OpenCL) | |
| runs-on: ubuntu-24.04 | |
| timeout-minutes: 30 | |
| # Compile + smoke-run of the portable OpenCL back-end — this is the exact | |
| # configuration the Debian/Kali package builds (-DUSE_OPENCL=ON). Build deps | |
| # are free (opencl-headers + the ICD loader). No GPU is present on the runner, | |
| # so the binary falls back to its multi-threaded CPU scorer when run; we only | |
| # assert it links and starts (--help), which exercises the OpenCL host code path. | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Install build tools and OpenCL headers | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y --no-install-recommends \ | |
| cmake build-essential file opencl-headers ocl-icd-opencl-dev | |
| - name: Configure | |
| run: cmake -S . -B build -DUSE_OPENCL=ON -DNO_GUI=ON -DCMAKE_BUILD_TYPE=Release | |
| - name: Build | |
| run: cmake --build build --parallel | |
| - name: Verify binary | |
| run: | | |
| test -f bin/dmrcrack | |
| file bin/dmrcrack | grep -q "ELF 64-bit" | |
| echo "OpenCL binary OK: $(file bin/dmrcrack)" | |
| - name: Smoke test (--help) | |
| run: ./bin/dmrcrack --help || true | |
| - name: Upload build artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: dmrcrack-opencl-${{ github.sha }} | |
| path: bin/dmrcrack | |
| retention-days: 7 | |
| tests: | |
| name: Unit tests (host) | |
| runs-on: ubuntu-24.04 | |
| timeout-minutes: 15 | |
| # Builds the host test tools (no GPU toolkit) and runs the data-free | |
| # known-answer tests via ctest. Data-dependent tests (test_strict_score, | |
| # test_score_canonical, test_silence_guard) compile here for coverage but | |
| # are not executed -- their .bin captures live under the gitignored test/. | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Install build tools | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y --no-install-recommends cmake build-essential | |
| - name: Configure | |
| run: cmake -S . -B build -DUSE_CUDA=OFF -DNO_GUI=ON -DBUILD_TESTS=ON -DCMAKE_BUILD_TYPE=Release | |
| - name: Build tests | |
| run: cmake --build build --parallel | |
| - name: Run unit tests | |
| run: ctest --test-dir build --output-on-failure |