[ipxe-devel] [PATCH 1/2] [crypto] Fix wrong setup in function aes_wrap

Stefan Weil sw at weilnetz.de
Wed Apr 4 16:16:00 UTC 2012


sizeof(A) is 8 on 64 bit hosts, but only 4 on 32 bit hosts.

Use explicit size in memset because 8 bytes must be set always.

This problem was reported by cppcheck.

Signed-off-by: Stefan Weil <sw at weilnetz.de>
---
 src/crypto/aes_wrap.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/crypto/aes_wrap.c b/src/crypto/aes_wrap.c
index 46ef016..f59fbf9 100644
--- a/src/crypto/aes_wrap.c
+++ b/src/crypto/aes_wrap.c
@@ -48,7 +48,7 @@ int aes_wrap ( const void *kek, const void *src, void *dest, int nblk )
 	cipher_setkey ( &aes_algorithm, aes_ctx, kek, 16 );
 
 	/* Set up */
-	memset ( A, 0xA6, sizeof ( A ) );
+	memset ( A, 0xA6, 8 );
 	memmove ( dest + 8, src, nblk * 8 );
 
 	/* Wrap */
-- 
1.7.9




More information about the ipxe-devel mailing list