]>
Commit | Line | Data |
---|---|---|
b32b8144 FG |
1 | /* |
2 | * Copyright 2017 James E. King, III | |
3 | * | |
4 | * Distributed under the Boost Software License, Version 1.0. | |
5 | * See http://www.boost.org/LICENSE_1_0.txt | |
6 | */ | |
7 | ||
8 | #ifndef BOOST_WINAPI_BCRYPT_HPP_INCLUDED_ | |
9 | #define BOOST_WINAPI_BCRYPT_HPP_INCLUDED_ | |
10 | ||
11 | #include <boost/winapi/basic_types.hpp> | |
12 | ||
13 | #ifdef BOOST_HAS_PRAGMA_ONCE | |
14 | #pragma once | |
15 | #endif | |
16 | ||
92f5a8d4 | 17 | #if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN6 |
b32b8144 FG |
18 | |
19 | #if BOOST_WINAPI_PARTITION_APP_SYSTEM | |
20 | ||
21 | #if defined(BOOST_USE_WINDOWS_H) | |
22 | ||
23 | #include <bcrypt.h> | |
24 | ||
25 | namespace boost { namespace winapi { | |
26 | typedef ::BCRYPT_ALG_HANDLE BCRYPT_ALG_HANDLE_; | |
27 | }} | |
28 | ||
29 | #else // defined(BOOST_USE_WINDOWS_H) | |
30 | ||
31 | namespace boost { namespace winapi { | |
32 | typedef PVOID_ BCRYPT_ALG_HANDLE_; | |
33 | }} | |
34 | ||
35 | extern "C" { | |
36 | ||
92f5a8d4 | 37 | boost::winapi::NTSTATUS_ BOOST_WINAPI_WINAPI_CC |
b32b8144 FG |
38 | BCryptCloseAlgorithmProvider( |
39 | boost::winapi::BCRYPT_ALG_HANDLE_ hAlgorithm, | |
40 | boost::winapi::ULONG_ dwFlags | |
41 | ); | |
42 | ||
92f5a8d4 | 43 | boost::winapi::NTSTATUS_ BOOST_WINAPI_WINAPI_CC |
b32b8144 FG |
44 | BCryptGenRandom( |
45 | boost::winapi::BCRYPT_ALG_HANDLE_ hAlgorithm, | |
46 | boost::winapi::PUCHAR_ pbBuffer, | |
47 | boost::winapi::ULONG_ cbBuffer, | |
48 | boost::winapi::ULONG_ dwFlags | |
49 | ); | |
50 | ||
92f5a8d4 | 51 | boost::winapi::NTSTATUS_ BOOST_WINAPI_WINAPI_CC |
b32b8144 FG |
52 | BCryptOpenAlgorithmProvider( |
53 | boost::winapi::BCRYPT_ALG_HANDLE_ *phAlgorithm, | |
54 | boost::winapi::LPCWSTR_ pszAlgId, | |
55 | boost::winapi::LPCWSTR_ pszImplementation, | |
56 | boost::winapi::DWORD_ dwFlags | |
57 | ); | |
58 | ||
59 | } // extern "C" | |
60 | ||
61 | #endif // defined(BOOST_USE_WINDOWS_H) | |
62 | ||
63 | namespace boost { | |
64 | namespace winapi { | |
65 | ||
66 | #if defined(BOOST_USE_WINDOWS_H) | |
67 | const WCHAR_ BCRYPT_RNG_ALGORITHM_[] = BCRYPT_RNG_ALGORITHM; | |
68 | #else | |
69 | const WCHAR_ BCRYPT_RNG_ALGORITHM_[] = L"RNG"; | |
70 | #endif | |
71 | ||
72 | using ::BCryptCloseAlgorithmProvider; | |
73 | using ::BCryptGenRandom; | |
74 | using ::BCryptOpenAlgorithmProvider; | |
75 | ||
76 | } // winapi | |
77 | } // boost | |
78 | ||
79 | #endif // BOOST_WINAPI_PARTITION_APP_SYSTEM | |
80 | ||
92f5a8d4 | 81 | #endif // BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN6 |
b32b8144 FG |
82 | |
83 | #endif // BOOST_WINAPI_BCRYPT_HPP_INCLUDED_ |