Browse Source

crypto: Change the qcrypto_random_bytes buffer type to void*

Using uint8_t* merely requires useless casts for use with
other types to be filled with randomness.

Reviewed-by: Laurent Vivier <lvivier@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
pull/81/head
Richard Henderson 7 years ago
parent
commit
d049b1f2af
  1. 2
      crypto/random-gcrypt.c
  2. 2
      crypto/random-gnutls.c
  3. 4
      crypto/random-platform.c
  4. 2
      include/crypto/random.h

2
crypto/random-gcrypt.c

@ -24,7 +24,7 @@
#include <gcrypt.h>
int qcrypto_random_bytes(uint8_t *buf,
int qcrypto_random_bytes(void *buf,
size_t buflen,
Error **errp G_GNUC_UNUSED)
{

2
crypto/random-gnutls.c

@ -26,7 +26,7 @@
#include <gnutls/gnutls.h>
#include <gnutls/crypto.h>
int qcrypto_random_bytes(uint8_t *buf,
int qcrypto_random_bytes(void *buf,
size_t buflen,
Error **errp)
{

4
crypto/random-platform.c

@ -64,8 +64,8 @@ int qcrypto_random_init(Error **errp)
return 0;
}
int qcrypto_random_bytes(uint8_t *buf G_GNUC_UNUSED,
size_t buflen G_GNUC_UNUSED,
int qcrypto_random_bytes(void *buf,
size_t buflen,
Error **errp)
{
#ifdef _WIN32

2
include/crypto/random.h

@ -34,7 +34,7 @@
*
* Returns 0 on success, -1 on error
*/
int qcrypto_random_bytes(uint8_t *buf,
int qcrypto_random_bytes(void *buf,
size_t buflen,
Error **errp);

Loading…
Cancel
Save