]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
rc4: mark key as const
authorJohn Keeping <john@metanate.com>
Fri, 18 Nov 2022 16:13:17 +0000 (16:13 +0000)
committerKever Yang <kever.yang@rock-chips.com>
Mon, 16 Jan 2023 10:01:10 +0000 (18:01 +0800)
Key data is never written so the parameter can be const, which allows
putting fixed keys in .rodata.

Signed-off-by: John Keeping <john@metanate.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@vrull.eu>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
include/rc4.h
lib/rc4.c

index c1ff1349d4b8c1eaad1fb5621712fa0affeac873..d1257f20a44c27944a7a965c7a6d47641bc19826 100644 (file)
@@ -15,6 +15,6 @@
  * @len:       Length of buffer in bytes
  * @key:       16-byte key to use
  */
-void rc4_encode(unsigned char *buf, unsigned int len, unsigned char key[16]);
+void rc4_encode(unsigned char *buf, unsigned int len, const unsigned char key[16]);
 
 #endif
index 0c00439843618e7b5cf69daed27a1110bab1cc27..720112d1fd8e90c312d721999b34697fbb68f1b1 100644 (file)
--- a/lib/rc4.c
+++ b/lib/rc4.c
@@ -12,7 +12,7 @@
 #endif
 #include <rc4.h>
 
-void rc4_encode(unsigned char *buf, unsigned int len, unsigned char key[16])
+void rc4_encode(unsigned char *buf, unsigned int len, const unsigned char key[16])
 {
        unsigned char s[256], k[256], temp;
        unsigned short i, j, t;