summaryrefslogtreecommitdiffstats
path: root/CryptoPkg/Library/OpensslLib/rand_pool_noise.h
diff options
context:
space:
mode:
authorXiaoyuX Lu <xiaoyux.lu@intel.com>2019-05-29 18:40:36 +0000
committerJian J Wang <jian.j.wang@intel.com>2019-06-03 08:28:02 +0800
commitb739678918240d118f7be72ecf5098e729596e42 (patch)
treea86633512ef1ca1e60df2a6a7a6fb3a1bbef8bfe /CryptoPkg/Library/OpensslLib/rand_pool_noise.h
parentc51f8bae7cabe749ce5fad91b34f3e74256ae4db (diff)
downloadedk2-b739678918240d118f7be72ecf5098e729596e42.tar.gz
edk2-b739678918240d118f7be72ecf5098e729596e42.tar.bz2
edk2-b739678918240d118f7be72ecf5098e729596e42.zip
CryptoPkg/OpensslLib: Add functions for upgrading OpenSSL1_1_1b
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1089 * From OpenSSL_1_1_0i(97c0959f27b294fe1eb10b547145ebef2524b896) to OpenSSL_1_1_1b(50eaac9f3337667259de725451f201e784599687), OpenSSL updated DRBG / RAND to request nonce and additional low entropy randomness from system(line 229 openssl/CHANGES). Since OpenSSL_1_1_1b doesn't fully implement rand pool functions for UEFI. We must provide a method to implenet these method. TSC is used as first entropy source if it's availabe otherwise fallback to TimerLib. But we are not sure the amount of randomness they provide. If you really care about the security, one choice is overrided it with hardware generator. Add rand_pool.c to implement these functions required by OpenSSL rand_pool_acquire_entropy rand_pool_add_nonce_data rand_pool_add_additional_data rand_pool_init rand_pool_cleanup rand_pool_keep_random_devices_open And add rand_pool_noise.* for getting entropy noise from different architecture. * We don't need ossl_store functions. We exclude relative files through process_files.pl. And ossl_store_cleanup_int was first added in crypto/init.c OpenSSL_1_1_1(71a5516d). So add a new file(ossl_store.c) to implement ossl_store_cleanup_int function. Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Ting Ye <ting.ye@intel.com> Signed-off-by: Xiaoyu Lu <xiaoyux.lu@intel.com> Tested-by: Gary Lin <glin@suse.com> Reviewed-by: Jian J Wang <jian.j.wang@intel.com>
Diffstat (limited to 'CryptoPkg/Library/OpensslLib/rand_pool_noise.h')
-rw-r--r--CryptoPkg/Library/OpensslLib/rand_pool_noise.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/CryptoPkg/Library/OpensslLib/rand_pool_noise.h b/CryptoPkg/Library/OpensslLib/rand_pool_noise.h
new file mode 100644
index 0000000000..75acc686a9
--- /dev/null
+++ b/CryptoPkg/Library/OpensslLib/rand_pool_noise.h
@@ -0,0 +1,29 @@
+/** @file
+ Provide rand noise source.
+
+Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef __RAND_POOL_NOISE_H__
+#define __RAND_POOL_NOISE_H__
+
+#include <Uefi/UefiBaseType.h>
+
+/**
+ Get 64-bit noise source.
+
+ @param[out] Rand Buffer pointer to store 64-bit noise source
+
+ @retval TRUE Get randomness successfully.
+ @retval FALSE Failed to generate
+**/
+BOOLEAN
+EFIAPI
+GetRandomNoise64 (
+ OUT UINT64 *Rand
+ );
+
+
+#endif // __RAND_POOL_NOISE_H__