crypto: Change the qcrypto_random_bytes buffer type to void*
authorRichard Henderson <richard.henderson@linaro.org>
Thu, 14 Mar 2019 02:33:48 +0000 (19:33 -0700)
committerRichard Henderson <richard.henderson@linaro.org>
Wed, 22 May 2019 16:38:54 +0000 (12:38 -0400)
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>
crypto/random-gcrypt.c
crypto/random-gnutls.c
crypto/random-platform.c
include/crypto/random.h

index 9f1c9ee60ebbe8891e50c7f42675f28148487083..7aea4ac81f22ab5193f38cbd6f1d791c44f65fb2 100644 (file)
@@ -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)
 {
index 445fd6a30b840efe77e8958c50be263fdb495b17..ed6c9ca12f4ba8f65980ea328f3b76ec1785d6c6 100644 (file)
@@ -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)
 {
index cb3ca1bc09e59271b106bc0678cb89d6c403305f..66624106fe19b9f60d7b822d9511e9140fcfebd6 100644 (file)
@@ -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
index 8764ca0562ac8f253047b31f1a17f5bb007b75ff..fde592904e32d02173a346a7d39554025c3fdc59 100644 (file)
@@ -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);