]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sd-boot: Fix assert failure in random-seed.c
authorJan Janssen <medhefgo@web.de>
Mon, 29 Nov 2021 14:42:26 +0000 (15:42 +0100)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 29 Nov 2021 18:10:03 +0000 (03:10 +0900)
Fixes: #21556
src/boot/efi/random-seed.c

index e829cf98b1d88020006fb38da3672a4e340f71f0..1da9ebc822987d48a889f38653730967a1973c8d 100644 (file)
@@ -66,8 +66,7 @@ static void hash_once(
         struct sha256_ctx hash;
 
         assert(old_seed);
-        assert(rng);
-        assert(system_token);
+        assert(system_token_size == 0 || system_token);
 
         sha256_init_ctx(&hash);
         sha256_process_bytes(old_seed, size, &hash);
@@ -92,8 +91,7 @@ static EFI_STATUS hash_many(
         _cleanup_freepool_ void *output = NULL;
 
         assert(old_seed);
-        assert(rng);
-        assert(system_token);
+        assert(system_token_size == 0 || system_token);
         assert(ret);
 
         /* Hashes the specified parameters in counter mode, generating n hash values, with the counter in the
@@ -127,8 +125,7 @@ static EFI_STATUS mangle_random_seed(
         UINTN n;
 
         assert(old_seed);
-        assert(rng);
-        assert(system_token);
+        assert(system_token_size == 0 || system_token);
         assert(ret_new_seed);
         assert(ret_for_kernel);