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>
This commit is contained in:
John Keeping 2022-11-18 16:13:17 +00:00 committed by Kever Yang
parent ccaa55fb6e
commit 93a6e60e49
2 changed files with 2 additions and 2 deletions

View file

@ -15,6 +15,6 @@
* @len: Length of buffer in bytes * @len: Length of buffer in bytes
* @key: 16-byte key to use * @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 #endif

View file

@ -12,7 +12,7 @@
#endif #endif
#include <rc4.h> #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 char s[256], k[256], temp;
unsigned short i, j, t; unsigned short i, j, t;