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 c1ff134..d1257f2 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 0c00439..720112d 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;