svn commit: r274340 - in head/sys: crypto/rijndael dev/random geom/bde

Dimitry Andric dim at FreeBSD.org
Mon Nov 10 19:56:13 UTC 2014


On 10 Nov 2014, at 16:10, Bjoern A. Zeeb <bz at FreeBSD.org> wrote:
> 
> On 10 Nov 2014, at 09:44 , Dag-Erling Smørgrav <des at 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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 194 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://lists.freebsd.org/pipermail/svn-src-head/attachments/20141110/a88de7f5/attachment.sig>


More information about the svn-src-head mailing list