1b917da4cSDaniel P. Berrange /*
2b917da4cSDaniel P. Berrange * QEMU Crypto random number provider
3b917da4cSDaniel P. Berrange *
4b917da4cSDaniel P. Berrange * Copyright (c) 2015-2016 Red Hat, Inc.
5b917da4cSDaniel P. Berrange *
6b917da4cSDaniel P. Berrange * This library is free software; you can redistribute it and/or
7b917da4cSDaniel P. Berrange * modify it under the terms of the GNU Lesser General Public
8b917da4cSDaniel P. Berrange * License as published by the Free Software Foundation; either
9*b7cbb874SThomas Huth * version 2.1 of the License, or (at your option) any later version.
10b917da4cSDaniel P. Berrange *
11b917da4cSDaniel P. Berrange * This library is distributed in the hope that it will be useful,
12b917da4cSDaniel P. Berrange * but WITHOUT ANY WARRANTY; without even the implied warranty of
13b917da4cSDaniel P. Berrange * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14b917da4cSDaniel P. Berrange * Lesser General Public License for more details.
15b917da4cSDaniel P. Berrange *
16b917da4cSDaniel P. Berrange * You should have received a copy of the GNU Lesser General Public
17b917da4cSDaniel P. Berrange * License along with this library; if not, see <http://www.gnu.org/licenses/>.
18b917da4cSDaniel P. Berrange *
19b917da4cSDaniel P. Berrange */
20b917da4cSDaniel P. Berrange
21b917da4cSDaniel P. Berrange #include "qemu/osdep.h"
22b917da4cSDaniel P. Berrange
23b917da4cSDaniel P. Berrange #include "crypto/random.h"
24b917da4cSDaniel P. Berrange
25b917da4cSDaniel P. Berrange #include <gcrypt.h>
26b917da4cSDaniel P. Berrange
qcrypto_random_bytes(void * buf,size_t buflen,Error ** errp G_GNUC_UNUSED)27d049b1f2SRichard Henderson int qcrypto_random_bytes(void *buf,
28b917da4cSDaniel P. Berrange size_t buflen,
29b917da4cSDaniel P. Berrange Error **errp G_GNUC_UNUSED)
30b917da4cSDaniel P. Berrange {
31b917da4cSDaniel P. Berrange gcry_randomize(buf, buflen, GCRY_STRONG_RANDOM);
32b917da4cSDaniel P. Berrange return 0;
33b917da4cSDaniel P. Berrange }
34a3727816SGeert Martin Ijewski
qcrypto_random_init(Error ** errp G_GNUC_UNUSED)35a3727816SGeert Martin Ijewski int qcrypto_random_init(Error **errp G_GNUC_UNUSED) { return 0; }
36