Browse Source

rc4: mark key as const

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>
John Keeping 1 year ago
parent
commit
93a6e60e49
2 changed files with 2 additions and 2 deletions
  1. 1 1
      include/rc4.h
  2. 1 1
      lib/rc4.c

+ 1 - 1
include/rc4.h

@@ -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

+ 1 - 1
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;