blob: 8efabd3e17f6aeae51315f44c94470509ac7c4f7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
/**
@file rexmpp_random.c
@brief Random generation
@author defanor <defanor@uberspace.net>
@date 2023
@copyright MIT license.
*/
#include "config.h"
#ifdef HAVE_GCRYPT
#include <gcrypt.h>
#else
#define _GNU_SOURCE
#include <stdlib.h>
#endif
void rexmpp_random_buf (void *buf, size_t len) {
#ifdef HAVE_GCRYPT
gcry_create_nonce(buf, len);
#else
arc4random_buf(buf, len);
#endif
}
|