Datenzugriffsgeschwindigkeit in LUKS-verschlüsselter Partition

Datenzugriffsgeschwindigkeit in LUKS-verschlüsselter Partition

Unter Linux (Fedora 28) habe ich mein Home-Verzeichnis LUKS verschlüsselt. Wenn ich Gnome Disk verwende (Screenshot), kann ich die zugrunde liegende LUKS-Partition (oberes blaues Rechteck) und die entschlüsselte Home-Partition (unteres weißes Rechteck) separat vergleichen.

Die LUKS-Partition bietet eine Zugriffszeit von 500 MB/s, der entschlüsselte Zugriff jedoch 350 MB/s. Um es klarzustellen: Dies ist dieselbe Partition wie eine 500 GB große SSD.

Ist es fair zu folgern, dassVerschlüsselungverlangsamt den Datenzugriff um 30 % (= 150/500)?

Ist diese Art von Nummer dokumentiert oder mache ich etwas falsch? Das ist eine viel größere Verlangsamung, als ich erwartet hatte.

Screenshotdisks


BEARBEITEN:Dies ist meine Ausgabe für

$ cryptsetup benchmark
# Tests are approximate using memory only (no storage IO).
PBKDF2-sha1       384375 iterations per second for 256-bit key
PBKDF2-sha256     494611 iterations per second for 256-bit key
PBKDF2-sha512     323634 iterations per second for 256-bit key
PBKDF2-ripemd160  293225 iterations per second for 256-bit key
PBKDF2-whirlpool  185917 iterations per second for 256-bit key
argon2i       4 iterations, 748334 memory, 4 parallel threads (CPUs) for 256-bit key (requested 2000 ms time)
argon2id      4 iterations, 745443 memory, 4 parallel threads (CPUs) for 256-bit key (requested 2000 ms time)
#     Algorithm |       Key |      Encryption |      Decryption
        aes-cbc        128b       195.0 MiB/s       664.0 MiB/s
    serpent-cbc        128b        28.8 MiB/s        94.7 MiB/s
    twofish-cbc        128b        58.8 MiB/s       111.6 MiB/s
        aes-cbc        256b       146.5 MiB/s       507.3 MiB/s
    serpent-cbc        256b        33.3 MiB/s       110.2 MiB/s
    twofish-cbc        256b        59.3 MiB/s       123.6 MiB/s
        aes-xts        256b       433.7 MiB/s       416.8 MiB/s
    serpent-xts        256b       101.0 MiB/s        94.7 MiB/s
    twofish-xts        256b       111.8 MiB/s       110.3 MiB/s
        aes-xts        512b       349.5 MiB/s       356.6 MiB/s
    serpent-xts        512b       101.6 MiB/s        96.0 MiB/s
    twofish-xts        512b       111.2 MiB/s       108.1 MiB/s

$ lscpu | grep aes
Flags:               fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge 
mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall
 nx rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology
 nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx est 
tm2 ssse3 cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer
 aes xsave avx f16c rdrand lahf_lm cpuid_fault epb pti ssbd ibrs ibpb stibp
 tpr_shadow vnmi flexpriority ept vpid fsgsbase smep erms xsaveopt dtherm 
ida arat pln pts flush_l1d

BEARBEITEN 2020:Ich habe meinen Computer gewechselt und erhalte beim Krypto-Benchmark völlig andere Ergebnisse, die weit über das hinausgehen, was durch einen schnelleren Prozessor erklärt werden kann. Ich denke also, dass meine alte Hardware nicht über den dedizierten Verschlüsselungschip verfügte:

$ cryptsetup benchmark
# Tests are approximate using memory only (no storage IO).
PBKDF2-sha1      1756408 iterations per second for 256-bit key
PBKDF2-sha256    2264742 iterations per second for 256-bit key
PBKDF2-sha512    1653905 iterations per second for 256-bit key
PBKDF2-ripemd160  949797 iterations per second for 256-bit key
PBKDF2-whirlpool  711381 iterations per second for 256-bit key
argon2i       8 iterations, 1048576 memory, 4 parallel threads (CPUs) for 256-bit key (requested 2000 ms time)
argon2id      8 iterations, 1048576 memory, 4 parallel threads (CPUs) for 256-bit key (requested 2000 ms time)
#     Algorithm |       Key |      Encryption |      Decryption
        aes-cbc        128b      1256.4 MiB/s      3669.2 MiB/s
    serpent-cbc        128b       101.6 MiB/s       771.8 MiB/s
    twofish-cbc        128b       230.0 MiB/s       418.4 MiB/s
        aes-cbc        256b       947.9 MiB/s      2961.6 MiB/s
    serpent-cbc        256b       105.1 MiB/s       785.0 MiB/s
    twofish-cbc        256b       235.7 MiB/s       424.5 MiB/s
        aes-xts        256b      2209.9 MiB/s      2218.9 MiB/s
    serpent-xts        256b       762.0 MiB/s       776.6 MiB/s
    twofish-xts        256b       415.7 MiB/s       384.0 MiB/s
        aes-xts        512b      1701.8 MiB/s      1677.2 MiB/s
    serpent-xts        512b       713.7 MiB/s       769.6 MiB/s
    twofish-xts        512b       407.9 MiB/s       414.2 MiB/s

Antwort1

Die Verschlüsselung verursacht zusätzliche CPU-Last, da jeder Festplattenblock beim Zugriff vom Betriebssystem entschlüsselt werden muss. Ihre Testergebnisse (~600 MB/s Entschlüsselung) sind für die generische AES-Verarbeitung auf einem i7 ziemlich durchschnittlich.

Um dieses Problem zu vermeiden, verfügen moderne CPUs im Allgemeinen über eine integrierte hardwarebasierte AES-Unterstützung. Intel nennt diese Funktion „AES-NI“ (dargestellt als lscpu„aes“) und sie ermöglicht Geschwindigkeiten von 2–3 GB/s für dieselbe AES-Entschlüsselung.

Führen Sie es zunächst aus lscpuund prüfen Sie, ob "aes" unter den Feature-Flags erwähnt wird.Intel ARKzeigt an, dass es in Ihrem CPU-Modell vorhanden ist, aber es kann durch die Firmware-Einstellungen (BIOS) deaktiviert sein. (Die ARK hat eine Fußnote:„Einige Produkte können AES New Instructions mit einem Update der Prozessorkonfiguration unterstützen … Wenden Sie sich für das BIOS mit dem neuesten Update der Prozessorkonfiguration bitte an den OEM.“)

Linux verwendet das Modul „aesni_intel“, um die Hardwarebeschleunigung zu aktivieren. Überprüfen Sie, ob es in Ihrem Kernel überhaupt aktiviert ist, indem Sie ausführen zgrep AES_NI_INTEL /proc/config.gz. Wenn „ “ angezeigt wird =y, ist es Teil des Haupt-Kernel-Images und sollte verfügbar sein.

Wenn die Ausgabe " =m" anzeigt, wurde es als Modul kompiliert. Versuchen Sie, das Modul manuell zu laden, indem Sie ausführen sudo modprobe -v aesni_intel. Wenn der Befehl das Modul nicht finden kann, müssen Sie wahrscheinlich neu starten. (Stellen Sie nach dem Neustart sicher, dass uname -rdieselbe Kernelversion wie in angezeigt wird ls /lib/modules.)

verwandte Informationen