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>
master
Richard Henderson 3 months ago
parent
commit
d049b1f2af
4 changed files with 5 additions and 5 deletions
  1. 1
    1
      crypto/random-gcrypt.c
  2. 1
    1
      crypto/random-gnutls.c
  3. 2
    2
      crypto/random-platform.c
  4. 1
    1
      include/crypto/random.h

+ 1
- 1
crypto/random-gcrypt.c View File

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

+ 1
- 1
crypto/random-gnutls.c View File

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

+ 2
- 2
crypto/random-platform.c View File

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

+ 1
- 1
include/crypto/random.h View File

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

Loading…
Cancel
Save