random.c (0d8730f07c822a351a624462918c7109cdc7f402) | random.c (261e224d6a5c43e2bb8a07b7662f9b4ec425cfec) |
---|---|
1// SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause) 2/* 3 * Copyright (C) 2017-2022 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved. 4 * Copyright Matt Mackall <mpm@selenic.com>, 2003, 2004, 2005 5 * Copyright Theodore Ts'o, 1994, 1995, 1996, 1997, 1998, 1999. All rights reserved. 6 * 7 * This driver produces cryptographically secure pseudorandom data. It is divided 8 * into roughly six sections, each with a section header: --- 741 unchanged lines hidden (view full) --- 750 751 spin_lock_irqsave(&input_pool.lock, flags); 752 _mix_pool_bytes(&action, sizeof(action)); 753 _mix_pool_bytes(stamps, sizeof(stamps)); 754 _mix_pool_bytes(&entropy, sizeof(entropy)); 755 spin_unlock_irqrestore(&input_pool.lock, flags); 756 757 if (crng_ready() && (action == PM_RESTORE_PREPARE || | 1// SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause) 2/* 3 * Copyright (C) 2017-2022 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved. 4 * Copyright Matt Mackall <mpm@selenic.com>, 2003, 2004, 2005 5 * Copyright Theodore Ts'o, 1994, 1995, 1996, 1997, 1998, 1999. All rights reserved. 6 * 7 * This driver produces cryptographically secure pseudorandom data. It is divided 8 * into roughly six sections, each with a section header: --- 741 unchanged lines hidden (view full) --- 750 751 spin_lock_irqsave(&input_pool.lock, flags); 752 _mix_pool_bytes(&action, sizeof(action)); 753 _mix_pool_bytes(stamps, sizeof(stamps)); 754 _mix_pool_bytes(&entropy, sizeof(entropy)); 755 spin_unlock_irqrestore(&input_pool.lock, flags); 756 757 if (crng_ready() && (action == PM_RESTORE_PREPARE || |
758 (action == PM_POST_SUSPEND && 759 !IS_ENABLED(CONFIG_PM_AUTOSLEEP) && !IS_ENABLED(CONFIG_ANDROID)))) { | 758 (action == PM_POST_SUSPEND && !IS_ENABLED(CONFIG_PM_AUTOSLEEP) && 759 !IS_ENABLED(CONFIG_PM_USERSPACE_AUTOSLEEP)))) { |
760 crng_reseed(); 761 pr_notice("crng reseeded on system resumption\n"); 762 } 763 return 0; 764} 765 766static struct notifier_block pm_notifier = { .notifier_call = random_pm_notification }; 767 --- 799 unchanged lines hidden --- | 760 crng_reseed(); 761 pr_notice("crng reseeded on system resumption\n"); 762 } 763 return 0; 764} 765 766static struct notifier_block pm_notifier = { .notifier_call = random_pm_notification }; 767 --- 799 unchanged lines hidden --- |