]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
homework: Use minimal pbkdf2 parameters without benchmark.
authorOndrej Kozina <okozina@redhat.com>
Wed, 31 Jan 2024 15:12:58 +0000 (16:12 +0100)
committerLuca Boccassi <luca.boccassi@gmail.com>
Thu, 1 Feb 2024 12:32:31 +0000 (12:32 +0000)
src/home/homework-luks.c

index e9c1933dfe9ec1813e5fe0f6c94bc468267ec829..d901841eae40da10589f36b47388d9a4ca412ffd 100644 (file)
@@ -1699,12 +1699,13 @@ static struct crypt_pbkdf_type* build_minimal_pbkdf(struct crypt_pbkdf_type *buf
         assert(hr);
 
         /* For PKCS#11 derived keys (which are generated randomly and are of high quality already) we use a
-         * minimal PBKDF */
+         * minimal PBKDF and CRYPT_PBKDF_NO_BENCHMARK flag to skip benchmark. */
         *buffer = (struct crypt_pbkdf_type) {
                 .hash = user_record_luks_pbkdf_hash_algorithm(hr),
                 .type = CRYPT_KDF_PBKDF2,
-                .iterations = 1,
-                .time_ms = 1,
+                .iterations = 1000, /* recommended minimum count for pbkdf2
+                                     * according to NIST SP 800-132, ch. 5.2 */
+                .flags = CRYPT_PBKDF_NO_BENCHMARK
         };
 
         return buffer;