Inhaltsverzeichnis

3.1 Windows x64 Build

Diese Anleitung führt Sie Schritt für Schritt durch den Build von OpenSSL für Windows 64-bit.


Voraussetzungen

Stellen Sie sicher, dass alle Tools installiert sind:

1. Vorbereitung2. Quellen


Option A: PowerShell-Skript (empfohlen)

Das Build-Skript automatisiert alle Schritte:

# Build starten (aus beliebigem Verzeichnis)
powershell.exe -ExecutionPolicy Bypass -File "D:\Projects\openssl-3.6.0\build_openssl.ps1"

Das Skript:

  1. Lädt die Visual Studio Umgebung
  2. Setzt PATH für Perl und NASM
  3. Konfiguriert OpenSSL
  4. Kompiliert den Code
  5. Installiert in D:\Projects\openssl-3.6.0\bin

→ Weiter zu 4. Testen


Option B: Manueller Build

Falls Sie jeden Schritt verstehen möchten:

Schritt 1: Visual Studio Umgebung laden

Öffnen Sie eine normale CMD (nicht PowerShell!) und führen Sie aus:

REM Pfad anpassen: Community, Professional oder Enterprise
call "%ProgramFiles%\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat"

Was passiert hier?

vcvars64.bat setzt wichtige Umgebungsvariablen:

  • PATH - Pfad zu cl.exe, link.exe, nmake.exe
  • INCLUDE - Pfad zu Header-Dateien
  • LIB - Pfad zu Libraries

Prüfung:

cl

Erwartete Ausgabe:

Microsoft (R) C/C++ Optimizing Compiler Version 19.xx.xxxxx for x64

Schritt 2: PATH für Perl und NASM setzen

set PATH=C:\Strawberry\perl\bin;%LOCALAPPDATA%\bin\NASM;%PATH%

Prüfung:

perl -v
nasm -v

Schritt 3: Zum Quellverzeichnis wechseln

cd /d D:\Projects\openssl-3.6.0\src

Schritt 4: OpenSSL konfigurieren

perl Configure VC-WIN64A --prefix=D:\Projects\openssl-3.6.0\bin --openssldir=D:\Projects\openssl-3.6.0\bin\ssl

Erklärung:

Parameter Bedeutung
———–———–
VC-WIN64A Visual C++, Windows 64-bit, AMD64-Architektur
–prefix=… Wo die fertigen Dateien installiert werden
–openssldir=… Wo Konfigurationsdateien gespeichert werden

Ausgabe (Beispiel):

Configuring OpenSSL version 3.6.0 for target VC-WIN64A
Using os-specific seed configuration
Creating configdata.pm
Running configdata.pm
Creating makefile

**********************************************************************
***                                                                ***
***   OpenSSL has been successfully configured                     ***
***                                                                ***
***   Configuration summary                                        ***
***                                                                ***
**********************************************************************

Schritt 5: Kompilieren

nmake

Dauer: 10-30 Minuten je nach Hardware. Geduld!

Was passiert?

  1. Perl generiert C-Code aus Templates
  2. Der C-Compiler kompiliert alle Quelldateien
  3. Der Linker erstellt die DLLs und EXEs

Fehler?Troubleshooting

Schritt 6: Installieren

nmake install_sw

install_sw installiert nur Software (ohne Dokumentation). Für alles: nmake install


Ergebnis

Nach erfolgreichem Build finden Sie in D:\Projects\openssl-3.6.0\bin:

bin\
├── bin\
│   ├── openssl.exe           # Kommandozeilen-Tool
│   ├── libcrypto-3-x64.dll   # Kryptographie-Bibliothek
│   └── libssl-3-x64.dll      # TLS-Bibliothek
├── include\
│   └── openssl\              # Header für C/C++ Entwicklung
├── lib\
│   ├── libcrypto.lib         # Import-Library für Linker
│   ├── libssl.lib
│   └── ossl-modules\         # Provider-Module (default, legacy)
└── ssl\
    └── openssl.cnf           # OpenSSL Konfiguration

Schnell-Prüfung

D:\Projects\openssl-3.6.0\bin\bin\openssl.exe version -a

Erwartete Ausgabe:

OpenSSL 3.6.0 11 Feb 2025 (Library: OpenSSL 3.6.0 11 Feb 2025)
built on: ...
platform: VC-WIN64A
options:  bn(64,64)
compiler: cl /Zi /Fdossl_static.pdb /Gs0 /GF /Gy /MD /W3 ...

Vollständiges PowerShell-Skript

Falls Sie das Build-Skript selbst erstellen möchten:

# build_openssl.ps1 - OpenSSL 3.6.0 Build Script
 
$ErrorActionPreference = "Stop"
 
Write-Host "========================================" -ForegroundColor Cyan
Write-Host "OpenSSL 3.6.0 Build Script" -ForegroundColor Cyan
Write-Host "========================================" -ForegroundColor Cyan
 
# Pfade
$projectRoot = "D:\Projects\openssl-3.6.0"
$srcDir = "$projectRoot\src"
$binDir = "$projectRoot\bin"
$vsPath = "C:\Program Files\Microsoft Visual Studio\2022\Community"
$vcvarsPath = "$vsPath\VC\Auxiliary\Build\vcvars64.bat"
 
# Visual Studio Umgebung laden
Write-Host "`n[1/5] Lade Visual Studio Umgebung..." -ForegroundColor Yellow
 
$pinfo = New-Object System.Diagnostics.ProcessStartInfo
$pinfo.FileName = "cmd.exe"
$pinfo.RedirectStandardOutput = $true
$pinfo.UseShellExecute = $false
$pinfo.Arguments = "/c `"`"$vcvarsPath`" && set`""
 
$p = New-Object System.Diagnostics.Process
$p.StartInfo = $pinfo
$p.Start() | Out-Null
$output = $p.StandardOutput.ReadToEnd()
$p.WaitForExit()
 
$output -split "`r`n" | ForEach-Object {
    if ($_ -match "^([^=]+)=(.*)$") {
        [Environment]::SetEnvironmentVariable($matches[1], $matches[2], "Process")
    }
}
 
# PATH setzen
Write-Host "[2/5] Setze PATH für Perl und NASM..." -ForegroundColor Yellow
$env:PATH = "C:\Strawberry\perl\bin;$env:LOCALAPPDATA\bin\NASM;$env:PATH"
 
# Zum Quellverzeichnis wechseln
Set-Location $srcDir
 
# Altes Makefile löschen
if (Test-Path "makefile") { Remove-Item "makefile" -Force }
 
# Konfigurieren
Write-Host "[3/5] Konfiguriere OpenSSL..." -ForegroundColor Yellow
& perl Configure VC-WIN64A --prefix=$binDir --openssldir=$binDir\ssl
if ($LASTEXITCODE -ne 0) { throw "Configure fehlgeschlagen!" }
 
# Kompilieren
Write-Host "[4/5] Kompiliere OpenSSL..." -ForegroundColor Yellow
& nmake
if ($LASTEXITCODE -ne 0) { throw "nmake fehlgeschlagen!" }
 
# Installieren
Write-Host "[5/5] Installiere..." -ForegroundColor Yellow
& nmake install_sw
if ($LASTEXITCODE -ne 0) { throw "Installation fehlgeschlagen!" }
 
Write-Host "`n========================================" -ForegroundColor Green
Write-Host "BUILD ERFOLGREICH!" -ForegroundColor Green
Write-Host "Binaries in: $binDir" -ForegroundColor Green
Write-Host "========================================" -ForegroundColor Green

Weiter zu


Wolfgang van der Stille @ EMSR DATA d.o.o. - Post-Quantum Cryptography Professional