Re: [PATCH v3 1/5] crypto: Use memzero_explicit() for clearing state

2020-10-23 Thread Herbert Xu
On Fri, Oct 23, 2020 at 03:21:59PM -0400, Arvind Sankar wrote: > Without the barrier_data() inside memzero_explicit(), the compiler may > optimize away the state-clearing if it can tell that the state is not > used afterwards. At least in lib/crypto/sha256.c:__sha256_final(), the > function can

[PATCH v3 1/5] crypto: Use memzero_explicit() for clearing state

2020-10-23 Thread Arvind Sankar
Without the barrier_data() inside memzero_explicit(), the compiler may optimize away the state-clearing if it can tell that the state is not used afterwards. At least in lib/crypto/sha256.c:__sha256_final(), the function can get inlined into sha256(), in which case the memset is optimized away.