xref: /qemu/crypto/random-none.c (revision a81df1b6)
1 /*
2  * QEMU Crypto "none" random number provider
3  *
4  * Copyright (c) 2020 Marek Marczykowski-Górecki
5  *                      <marmarek@invisiblethingslab.com>
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #include "qemu/osdep.h"
23 
24 #include "crypto/random.h"
25 #include "qapi/error.h"
26 
27 int qcrypto_random_init(Error **errp)
28 {
29     return 0;
30 }
31 
32 int qcrypto_random_bytes(void *buf,
33                          size_t buflen,
34                          Error **errp)
35 {
36     error_setg(errp, "Random bytes not available with \"none\" rng");
37     return -1;
38 }
39