[PATCH 1/2] rc4: mark key as const

Kever Yang kever.yang at rock-chips.com
Sun Dec 18 11:09:17 CET 2022


On 2022/11/19 00:13, John Keeping wrote:
> Key data is never written so the parameter can be const, which allows
> putting fixed keys in .rodata.
>
> Signed-off-by: John Keeping <john at metanate.com>
Reviewed-by: Kever Yang <kever.yang at rock-chips.com>

Thanks,
- Kever
> ---
>   include/rc4.h | 2 +-
>   lib/rc4.c     | 2 +-
>   2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/include/rc4.h b/include/rc4.h
> index c1ff1349d4..d1257f20a4 100644
> --- a/include/rc4.h
> +++ b/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
> diff --git a/lib/rc4.c b/lib/rc4.c
> index 0c00439843..720112d1fd 100644
> --- 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;


More information about the U-Boot mailing list