Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 10 Nov 2014 20:55:46 +0100
From:      Dimitry Andric <dim@FreeBSD.org>
To:        "Bjoern A. Zeeb" <bz@FreeBSD.org>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= <des@FreeBSD.org>
Subject:   Re: svn commit: r274340 - in head/sys: crypto/rijndael dev/random geom/bde
Message-ID:  <A4F3E6DC-13F9-4DCE-BA76-50A93EEB7D2E@FreeBSD.org>
In-Reply-To: <3C962D07-3AAF-42EA-9D3E-D8F6D9A812B0@FreeBSD.org>
References:  <201411100944.sAA9icnN061962@svn.freebsd.org> <3C962D07-3AAF-42EA-9D3E-D8F6D9A812B0@FreeBSD.org>

index | next in thread | previous in thread | raw e-mail

[-- Attachment #1 --]
On 10 Nov 2014, at 16:10, Bjoern A. Zeeb <bz@FreeBSD.org> wrote:
> 
> On 10 Nov 2014, at 09:44 , Dag-Erling Smørgrav <des@FreeBSD.org> wrote:
> 
>> Author: des
>> Date: Mon Nov 10 09:44:38 2014
>> New Revision: 274340
>> URL: https://svnweb.freebsd.org/changeset/base/274340
>> 
>> Log:
>> Constify the AES code and propagate to consumers.  This allows us to
>> update the Fortuna code to use SHAd-256 as defined in FS&K.
>> 
>> Approved by:	so (self)
> 
> This fails to compile on all gcc platforms.
> 
> cc1: warnings being treated as errors
> /scratch/tmp/bz/head.svn/sys/modules/geom/geom_bde/../../../crypto/rijndael/rijndael-api-fst.c: In function 'rijndael_padEncrypt':
> /scratch/tmp/bz/head.svn/sys/modules/geom/geom_bde/../../../crypto/rijndael/rijndael-api-fst.c:236: warning: cast discards qualifiers from pointer target type
> /scratch/tmp/bz/head.svn/sys/modules/geom/geom_bde/../../../crypto/rijndael/rijndael-api-fst.c:237: warning: cast discards qualifiers from pointer target type
> /scratch/tmp/bz/head.svn/sys/modules/geom/geom_bde/../../../crypto/rijndael/rijndael-api-fst.c:238: warning: cast discards qualifiers from pointer target type
> /scratch/tmp/bz/head.svn/sys/modules/geom/geom_bde/../../../crypto/rijndael/rijndael-api-fst.c:239: warning: cast discards qualifiers from pointer target type
> --- rijndael-api-fst.o ---
> *** [rijndael-api-fst.o] Error code 1

Proposed fix (the lines were too long anyway, so I didn't see reason to change that):

Index: sys/crypto/rijndael/rijndael-api-fst.c
===================================================================
--- sys/crypto/rijndael/rijndael-api-fst.c      (revision 274350)
+++ sys/crypto/rijndael/rijndael-api-fst.c      (working copy)
@@ -233,10 +233,10 @@
        case MODE_CBC:
                iv = cipher->IV;
                for (i = numBlocks; i > 0; i--) {
-                       ((u_int32_t*)block)[0] = ((u_int32_t*)input)[0] ^ ((u_int32_t*)iv)[0];
-                       ((u_int32_t*)block)[1] = ((u_int32_t*)input)[1] ^ ((u_int32_t*)iv)[1];
-                       ((u_int32_t*)block)[2] = ((u_int32_t*)input)[2] ^ ((u_int32_t*)iv)[2];
-                       ((u_int32_t*)block)[3] = ((u_int32_t*)input)[3] ^ ((u_int32_t*)iv)[3];
+                       ((u_int32_t*)block)[0] = ((const u_int32_t*)input)[0] ^ ((u_int32_t*)iv)[0];
+                       ((u_int32_t*)block)[1] = ((const u_int32_t*)input)[1] ^ ((u_int32_t*)iv)[1];
+                       ((u_int32_t*)block)[2] = ((const u_int32_t*)input)[2] ^ ((u_int32_t*)iv)[2];
+                       ((u_int32_t*)block)[3] = ((const u_int32_t*)input)[3] ^ ((u_int32_t*)iv)[3];
                        rijndaelEncrypt(key->rk, key->Nr, block, outBuffer);
                        iv = outBuffer;
                        input += 16;

-Dimitry


[-- Attachment #2 --]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.26

iEYEARECAAYFAlRhGFAACgkQsF6jCi4glqOidACgmCde+diAOGfa+D3zLdIbSusP
UBAAn2++W5nL4Qg988Dnhz17VB2LV7om
=MUKa
-----END PGP SIGNATURE-----
help

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?A4F3E6DC-13F9-4DCE-BA76-50A93EEB7D2E>