8 #include <botan/internal/es_capi.h>     9 #include <botan/parsing.h>    20       CSP_Handle(
u64bit capi_provider)
    23          DWORD prov_type = (DWORD)capi_provider;
    25          if(CryptAcquireContext(&handle, 0, 0,
    26                                 prov_type, CRYPT_VERIFYCONTEXT))
    33             CryptReleaseContext(handle, 0);
    36       size_t gen_random(
byte out[], 
size_t n)
 const    38          if(is_valid() && CryptGenRandom(handle, static_cast<DWORD>(n), out))
    43       bool is_valid()
 const { 
return valid; }
    45       HCRYPTPROV get_handle()
 const { 
return handle; }
    60    for(
size_t i = 0; i != prov_types.size(); ++i)
    62       CSP_Handle csp(prov_types[i]);
    64       size_t got = csp.gen_random(&io_buffer[0], io_buffer.
size());
    68          accum.
add(&io_buffer[0], io_buffer.
size(), 6);
    79    std::vector<std::string> capi_provs = 
split_on(provs, 
':');
    81    for(
size_t i = 0; i != capi_provs.size(); ++i)
    83       if(capi_provs[i] == 
"RSA_FULL")  prov_types.push_back(PROV_RSA_FULL);
    84       if(capi_provs[i] == 
"INTEL_SEC") prov_types.push_back(PROV_INTEL_SEC);
    85       if(capi_provs[i] == 
"FORTEZZA")  prov_types.push_back(PROV_FORTEZZA);
    86       if(capi_provs[i] == 
"RNG")       prov_types.push_back(PROV_RNG);
    89    if(prov_types.size() == 0)
    90       prov_types.push_back(PROV_RSA_FULL);
 void poll(Entropy_Accumulator &accum)
MemoryRegion< byte > & get_io_buffer(size_t size)
void add(const void *bytes, size_t length, double entropy_bits_per_byte)
std::vector< std::string > split_on(const std::string &str, char delim)
unsigned long long u64bit
Win32_CAPI_EntropySource(const std::string &provs="")