[PATCH] random-drbg: use bufhelp function for big-endian store

Jussi Kivilinna jussi.kivilinna at iki.fi
Mon Dec 5 15:14:11 CET 2016


* random/random-drbg.c (drbg_cpu_to_be32): Use 'buf_put_be32' instead
of 'be_bswap32'.
--

Signed-off-by: Jussi Kivilinna <jussi.kivilinna at iki.fi>
---
 random/random-drbg.c |   11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/random/random-drbg.c b/random/random-drbg.c
index f9d11a3..535c446 100644
--- a/random/random-drbg.c
+++ b/random/random-drbg.c
@@ -155,7 +155,7 @@
 #include "g10lib.h"
 #include "random.h"
 #include "rand-internal.h"
-#include "../cipher/bithelp.h"
+#include "../cipher/bufhelp.h"
 
 
 

@@ -544,14 +544,7 @@ drbg_sec_strength (u32 flags)
 static inline void
 drbg_cpu_to_be32 (u32 val, unsigned char *buf)
 {
-  /* FIXME: This may raise a bus error.  */
-  struct s
-  {
-    u32 conv;
-  };
-  struct s *conversion = (struct s *) buf;
-
-  conversion->conv = be_bswap32 (val);
+  buf_put_be32 (buf, val);
 }
 
 static void




More information about the Gcrypt-devel mailing list