diff options
-rw-r--r-- | doc/manual/deprecated.rst | 2 | ||||
-rw-r--r-- | doc/os.rst | 12 | ||||
-rw-r--r-- | news.rst | 3 | ||||
-rw-r--r-- | src/build-data/os/uwp.txt (renamed from src/build-data/os/winphone.txt) | 5 | ||||
-rw-r--r-- | src/lib/rng/system_rng/info.txt | 5 | ||||
-rw-r--r-- | src/lib/rng/system_rng/system_rng.cpp | 44 |
6 files changed, 64 insertions, 7 deletions
diff --git a/doc/manual/deprecated.rst b/doc/manual/deprecated.rst index 4170a0c30..30c26d503 100644 --- a/doc/manual/deprecated.rst +++ b/doc/manual/deprecated.rst @@ -38,8 +38,6 @@ in the source. - Platform support for Google Native Client -- Platform support for Windows Phone - - Support for PathScale and HP compilers - TLS: 3DES and SEED ciphersuites diff --git a/doc/os.rst b/doc/os.rst index a4edd564b..ad7b5a894 100644 --- a/doc/os.rst +++ b/doc/os.rst @@ -27,28 +27,30 @@ A summary of OS features as defined in ``src/build-data/os``. o: openbsd q: qnx s: solaris + u: uwp w: windows - w: winphone .. csv-table:: - :header: "Feature", "a", "a", "c", "d", "d", "f", "h", "h", "h", "i", "i", "l", "l", "m", "n", "n", "o", "q", "s", "w", "w" + :header: "Feature", "a", "a", "c", "d", "d", "f", "h", "h", "h", "i", "i", "l", "l", "m", "n", "n", "o", "q", "s", "u", "w" "arc4random", " ", " ", " ", "X", "X", "X", " ", " ", " ", " ", "X", " ", " ", " ", " ", "X", "X", " ", " ", " ", " " "clock_gettime", "X", "X", " ", " ", "X", "X", "X", "X", "X", " ", " ", "X", " ", " ", " ", "X", "X", "X", "X", " ", " " + "crypto_ng", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", "X", " " "dev_random", "X", "X", "X", "X", "X", "X", "X", "X", "X", "X", " ", "X", " ", " ", " ", "X", "X", "X", "X", " ", " " "explicit_bzero", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", "X", " ", " ", " ", " " "filesystem", "X", "X", "X", "X", "X", "X", "X", "X", "X", " ", "X", "X", "X", "X", " ", "X", "X", "X", "X", "X", "X" "getauxval", " ", "X", " ", " ", " ", " ", " ", " ", " ", " ", " ", "X", " ", " ", " ", " ", " ", " ", " ", " ", " " "getentropy", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", "X", " ", " ", " ", " " "posix1", "X", "X", "X", "X", "X", "X", "X", "X", "X", "X", "X", "X", " ", " ", " ", "X", "X", "X", "X", " ", " " + "posix_mlock", "X", "X", " ", "X", "X", "X", " ", "X", "X", " ", "X", "X", " ", " ", " ", "X", "X", "X", "X", " ", " " "proc_fs", "X", " ", " ", " ", "X", " ", " ", " ", " ", " ", " ", "X", " ", " ", " ", " ", " ", " ", "X", " ", " " - "rtlgenrandom", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", "X", " ", " ", " ", " ", " ", "X", " " + "rtlgenrandom", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", "X", " ", " ", " ", " ", " ", " ", "X" "rtlsecurezeromemory", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", "X", "X" "security_framework", " ", " ", " ", "X", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " " "sockets", "X", "X", "X", "X", "X", "X", "X", "X", "X", " ", "X", "X", " ", " ", " ", "X", "X", "X", "X", " ", " " - "stl_filesystem_msvc", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", "X", " " + "stl_filesystem_msvc", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", "X" "threads", "X", "X", "X", "X", "X", "X", "X", "X", "X", " ", "X", "X", " ", "X", "X", "X", "X", "X", "X", "X", "X" - "virtual_lock", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", "X", " ", " ", " ", " ", " ", "X", " " + "virtual_lock", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", "X", " ", " ", " ", " ", " ", " ", "X" "win32", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", "X", " ", " ", " ", " ", " ", "X", "X" "winsock2", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", "X", "X" @@ -47,6 +47,9 @@ Version 2.7.0, Not Yet Released * The ``factor`` command runs much faster on larger inputs now. +* Support for Windows Phone/UWP was deprecated starting in 2.5. This + deprecation has been reversed as it seems UWP is still actively used. + * Support for Visual C++ 2013 is deprecated, and will be removed in Jan 2019. Version 2.6.0, 2018-04-10 diff --git a/src/build-data/os/winphone.txt b/src/build-data/os/uwp.txt index fdeae6783..df156f0a0 100644 --- a/src/build-data/os/winphone.txt +++ b/src/build-data/os/uwp.txt @@ -10,9 +10,14 @@ doc_dir docs <target_features> win32 winsock2 +crypto_ng rtlsecurezeromemory threads filesystem </target_features> + +<aliases> +winphone +</aliases> diff --git a/src/lib/rng/system_rng/info.txt b/src/lib/rng/system_rng/info.txt index 4dc5be758..da4fce4e3 100644 --- a/src/lib/rng/system_rng/info.txt +++ b/src/lib/rng/system_rng/info.txt @@ -6,8 +6,13 @@ SYSTEM_RNG -> 20141202 dev_random,posix1 arc4random rtlgenrandom +crypto_ng </os_features> +<libs> +uwp -> bcrypt.lib +</libs> + <requires> rtlgenrandom?dyn_load </requires> diff --git a/src/lib/rng/system_rng/system_rng.cpp b/src/lib/rng/system_rng/system_rng.cpp index 3c2e98661..c3b37ea9c 100644 --- a/src/lib/rng/system_rng/system_rng.cpp +++ b/src/lib/rng/system_rng/system_rng.cpp @@ -13,6 +13,9 @@ #define _WINSOCKAPI_ // stop windows.h including winsock.h #include <windows.h> +#elif defined(BOTAN_TARGET_OS_HAS_CRYPTO_NG) + #include <bcrypt.h> + #elif defined(BOTAN_TARGET_OS_HAS_ARC4RANDOM) #include <stdlib.h> @@ -60,6 +63,47 @@ class System_RNG_Impl final : public RandomNumberGenerator RtlGenRandom_fptr m_rtlgenrandom; }; +#elif defined(BOTAN_TARGET_OS_HAS_CRYPTO_NG) + +class System_RNG_Impl final : public RandomNumberGenerator + { + public: + System_RNG_Impl() + { + NTSTATUS ret = ::BCryptOpenAlgorithmProvider(&m_prov, + BCRYPT_RNG_ALGORITHM, + MS_PRIMITIVE_PROVIDER, 0); + if(ret != STATUS_SUCCESS) + throw Exception("System_RNG failed to acquire crypto provider"); + } + + ~System_RNG_Impl() + { + ::BCryptCloseAlgorithmProvider(m_prov, 0); + } + + void randomize(uint8_t buf[], size_t len) override + { + NTSTATUS ret = ::BCryptGenRandom(m_prov, static_cast<PUCHAR>(buf), static_cast<ULONG>(len), 0); + if(ret != STATUS_SUCCESS) + throw Exception("System_RNG call to BCryptGenRandom failed"); + } + + void add_entropy(const uint8_t in[], size_t length) override + { + /* + There is a flag BCRYPT_RNG_USE_ENTROPY_IN_BUFFER to provide + entropy inputs, but it is ignored in Windows 8 and later. + */ + } + + bool is_seeded() const override { return true; } + void clear() override { /* not possible */ } + std::string name() const override { return "crypto_ng"; } + private: + BCRYPT_ALG_HANDLE m_handle; + }; + #elif defined(BOTAN_TARGET_OS_HAS_ARC4RANDOM) class System_RNG_Impl final : public RandomNumberGenerator |