2
Copyright (C) 2000-2007 MySQL AB
4
This program is free software; you can redistribute it and/or modify
5
it under the terms of the GNU General Public License as published by
6
the Free Software Foundation; version 2 of the License.
8
This program is distributed in the hope that it will be useful,
9
but WITHOUT ANY WARRANTY; without even the implied warranty of
10
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
GNU General Public License for more details.
13
You should have received a copy of the GNU General Public License
14
along with this program; see the file COPYING. If not, write to the
15
Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
19
/* random.hpp provides a crypto secure Random Number Generator using an OS
24
#ifndef TAO_CRYPT_RANDOM_HPP
25
#define TAO_CRYPT_RANDOM_HPP
39
void GenerateSeed(byte*, word32 sz);
40
Error GetError() const { return error_; }
44
typedef unsigned __int64 ProviderHandle;
45
// type HCRYPTPROV, avoid #include <windows.h>
47
typedef unsigned long ProviderHandle;
49
ProviderHandle handle_;
55
OS_Seed(const OS_Seed&); // hide copy
56
OS_Seed& operator=(const OS_Seed&); // hide assign
60
// secure Random Nnumber Generator
61
class RandomNumberGenerator {
63
RandomNumberGenerator();
64
~RandomNumberGenerator() {}
66
void GenerateBlock(byte*, word32 sz);
69
ErrorNumber GetError() const { return seed_.GetError().What(); }
74
RandomNumberGenerator(const RandomNumberGenerator&); // hide copy
75
RandomNumberGenerator operator=(const RandomNumberGenerator&); // && assign
83
#endif // TAO_CRYPT_RANDOM_HPP