blob: e83b3692710dacbb5a0d7fdd6b168a21c52f621d [file] [log] [blame]
Alexandre Lisionddd731e2014-01-31 11:50:08 -05001// Copyright (C) 2010 David Sugar, Tycho Softworks.
2//
3// This file is part of GNU uCommon C++.
4//
5// GNU uCommon C++ is free software: you can redistribute it and/or modify
6// it under the terms of the GNU Lesser General Public License as published
7// by the Free Software Foundation, either version 3 of the License, or
8// (at your option) any later version.
9//
10// GNU uCommon C++ is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU Lesser General Public License for more details.
14//
15// You should have received a copy of the GNU Lesser General Public License
16// along with GNU uCommon C++. If not, see <http://www.gnu.org/licenses/>.
17
18#include "local.h"
19
20void Random::seed(void)
21{
22 secure::init();
23}
24
25bool Random::seed(const unsigned char *buf, size_t size)
26{
27 secure::init();
28 return true;
29}
30
31size_t Random::key(unsigned char *buf, size_t size)
32{
33 gnutls_rnd(GNUTLS_RND_KEY, buf, size);
34 return 0;
35}
36
37size_t Random::fill(unsigned char *buf, size_t size)
38{
39 gnutls_rnd(GNUTLS_RND_RANDOM, buf, size);
40 return 0;
41}
42
43bool Random::status(void)
44{
45 return true;
46}
47
48