rc4: mark key as const
PATCH 1/2 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 <[email protected]>
--- include/rc4.h | 2 +- lib/rc4.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
include/rc4.h +1 -1
@@ -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
lib/rc4.c +1 -1
@@ -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;
Signature · 1 line
2.38.1
PATCH 2/2 rockchip: mkimage: make RC4 key const
This is read-only data, so mark it as such.
Signed-off-by John Keeping <[email protected]>
--- tools/rkcommon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/rkcommon.c +1 -1
@@ -154,7 +154,7 @@ struct spl_params {static struct spl_params spl_params = {0 }; -static unsigned char rc4_key[16 ] = { +static const unsigned char rc4_key[16 ] = {124 ,78 ,3 ,4 ,85 ,5 ,9 ,7 ,45 ,44 ,123 ,56 ,23 ,13 ,23 ,17 };
Signature · 1 line
2.38.1
Re: [PATCH 2/2] rockchip: mkimage: make RC4 key const
Quoted 4 lines · John Keeping
This is read-only data, so mark it as such.
Signed-off-by John Keeping <[email protected]>
Reviewed-by Philipp Tomsich <[email protected]>
Re: [PATCH 2/2] rockchip: mkimage: make RC4 key const
In reply to John KeepingQuoted 3 lines · John Keeping
This is read-only data, so mark it as such.
Signed-off-by John Keeping <[email protected]>
Reviewed-by Kever Yang <[email protected]>
Thanks,
- Kever
Quoted 17 lines
--- tools/rkcommon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/rkcommon.c +1
-1@@ -154,7 +154,7 @@ struct spl_params {static struct spl_params spl_params = {0 }; -static unsigned char rc4_key[16 ] = { +static const unsigned char rc4_key[16 ] = {124 ,78 ,3 ,4 ,85 ,5 ,9 ,7 ,45 ,44 ,123 ,56 ,23 ,13 ,23 ,17 };
Quoted 5 lines · John Keeping
Key data is never written so the parameter can be const, which allows putting fixed keys in .rodata.
Signed-off-by John Keeping <[email protected]>
Reviewed-by Philipp Tomsich <[email protected]>
Quoted 4 lines · John Keeping
Key data is never written so the parameter can be const, which allows putting fixed keys in .rodata.
Signed-off-by John Keeping <[email protected]>
Reviewed-by Kever Yang <[email protected]>
Thanks,
- Kever
Quoted 30 lines
--- include/rc4.h | 2 +- lib/rc4.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)include/rc4.h +1
-1@@ -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 lib/rc4.c +1
-1@@ -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;