Re: [PATCH] sha: prevent removal of memset as dead store in sha1_update()
From: Pekka Enberg
Date: Thu Feb 25 2010 - 11:17:11 EST
On Thu, Feb 25, 2010 at 5:56 PM, Mikael Pettersson <mikpe@xxxxxxxx> wrote:
> I fear that the only portable (across compiler versions) and safe
> solution is to invoke an assembly-coded dummy function with prototype
>
> void use(void *p);
>
> and rewrite the code above as
>
> {
> u32 temp[...];
> ...
> memset(temp, 0, sizeof temp);
> use(temp);
> }
>
> This forces the compiler to consider the buffer live after the
> memset, so the memset cannot be eliminated.
So is there some "do not optimize" GCC magic that we could use for a
memzero_secret() helper function?
Pekka
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/