On 10 Nov 2014, at 16:10, Bjoern A. Zeeb <b...@freebsd.org> wrote:
> 
> On 10 Nov 2014, at 09:44 , Dag-Erling Smørgrav <d...@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: signature.asc
Description: Message signed with OpenPGP using GPGMail

Reply via email to