svn commit: r351364 - in head/sys: crypto/blowfish crypto/chacha20 crypto/des opencrypto

John Baldwin jhb at FreeBSD.org
Thu Aug 22 16:46:36 UTC 2019


On 8/22/19 2:39 AM, Bjoern A. Zeeb wrote:
> On 22 Aug 2019, at 0:02, John Baldwin wrote:
> 
> Hi,
> 
>> Author: jhb
>> Date: Thu Aug 22 00:02:08 2019
>> New Revision: 351364
>> URL: https://svnweb.freebsd.org/changeset/base/351364
>>
>> Log:
>>   Use 'const' for keys and IVs passed to software encryption 
>> algorithms.
>>
>>   Specifically, use 'const' for the key passed to the 'setkey' method
>>   and 'const' for the 'iv' passed to the 'reinit' method.
>>
>>   Reviewed by:	cem
>>   Sponsored by:	Chelsio Communications
>>   Differential Revision:	https://reviews.freebsd.org/D21347
> 
> can you please review and commit this one to make gcc platforms a bit 
> more happy again (I tested a sparc64 GENERIC kernel build):

I will get tinderbox happy.

> Index: sys/opencrypto/xform_des3.c
> ===================================================================
> --- sys/opencrypto/xform_des3.c	(revision 351384)
> +++ sys/opencrypto/xform_des3.c	(working copy)
> @@ -100,9 +100,9 @@ des3_setkey(u_int8_t **sched, const u_int8_t *key,
>   	p = KMALLOC(3*sizeof (des_key_schedule),
>   		M_CRYPTO_DATA, M_NOWAIT|M_ZERO);
>   	if (p != NULL) {
> -		des_set_key((const des_cblock *)(key +  0), p[0]);
> -		des_set_key((const des_cblock *)(key +  8), p[1]);
> -		des_set_key((const des_cblock *)(key + 16), p[2]);
> +		des_set_key(__DEQUALIFY(const des_cblock *,(key +  0)), p[0]);
> +		des_set_key(__DEQUALIFY(const des_cblock *,(key +  8)), p[1]);
> +		des_set_key(__DEQUALIFY(const des_cblock *,(key +  16)), p[2]);

This makes no sense.  Why are you removing const only to add it back again?

-- 
John Baldwin


More information about the svn-src-all mailing list