Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 11 Jun 2010 18:21:18 +0200
From:      Ulrich =?utf-8?B?U3DDtnJsZWlu?= <uqs@spoerlein.net>
To:        current@freebsd.org
Subject:   Cleanup for cryptographic algorithms vs. compiler optimizations
Message-ID:  <20100611162118.GR39829@acme.spoerlein.net>

next in thread | raw e-mail | index | archive | help
Hello,

optimizing compilers have a tendency to remove assignments that have no
side effects. The code in sys/crypto/sha2/sha2.c is doing a lot of
zeroing variables, which is however optimized away. I haven't looked
close enough to see if all these vars happen to fit into the registers,
but a nice overview can be had here:

https://www.spoerlein.net/scan-build/freebsd-head/sbin.gbde/2010-06-05-1/

Compiling the code with/without those assignment results in the same
object code. Is there a canonical way to zero those variables and should
we use them (memset perhaps? what are the performance implications?)

Regards,
Uli



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20100611162118.GR39829>