diff mbox series

Crypto internal: Make MD4 PADDING array const

Message ID 20180619115229.3654-1-mikael.kanstrup@sony.com
State Accepted
Headers show
Series Crypto internal: Make MD4 PADDING array const | expand

Commit Message

Mikael Kanstrup June 19, 2018, 11:52 a.m. UTC
The PADDING array used when adding padding bits in MD4 never change
so can be made const. Making it const puts the array in .rodata
section and can save a few bytes of RAM for systems running without
virtual memory.

Signed-off-by: Mikael Kanstrup <mikael.kanstrup@sony.com>
---
 src/crypto/md4-internal.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jouni Malinen Jan. 2, 2019, 5:17 p.m. UTC | #1
On Tue, Jun 19, 2018 at 01:52:29PM +0200, Mikael Kanstrup wrote:
> The PADDING array used when adding padding bits in MD4 never change
> so can be made const. Making it const puts the array in .rodata
> section and can save a few bytes of RAM for systems running without
> virtual memory.

Thanks, applied.
diff mbox series

Patch

diff --git a/src/crypto/md4-internal.c b/src/crypto/md4-internal.c
index d9c737a..cf408e8 100644
--- a/src/crypto/md4-internal.c
+++ b/src/crypto/md4-internal.c
@@ -85,7 +85,7 @@  MD4Transform(u32 state[4], const u8 block[MD4_BLOCK_LENGTH]);
 	(cp)[1] = (value) >> 8;						\
 	(cp)[0] = (value); } while (0)
 
-static u8 PADDING[MD4_BLOCK_LENGTH] = {
+static const u8 PADDING[MD4_BLOCK_LENGTH] = {
 	0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
 	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
 	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0