[Bug 17097] libfoundation: Add MCMemoryClearSecure()#5338
Conversation
Add a new function, `MCMemoryClearSecure()`, that's equivalent to
`MCMemoryClear()` but with the guarantee that it will never be
optimised out.
On Windows, this uses the standard `SecureZeroMemory()` library
function.
On other platforms, this uses `MCMemoryClear()` (i.e. `memset()`), but
with an additional memory barrier that prevents the call to `memset()`
from being optimised out. Typical assembly generated in `Release`
mode:
push rbx
mov rdx, rsi
xor esi, esi
mov rbx, rdi
call memset
pop rbx
ret
Add templates for securely zeroing single objects and object spans.
|
@peter-b, thanks for your PR! By analyzing the history of the files in this pull request, we identified @livecodeian, @runrevmark and @livecodesebastien to be potential reviewers. |
|
@livecode-vulcan review ok 8ceb1c6 |
|
💙 review by @runrevmark ok 8ceb1c6 |
|
😞 test failure 8ceb1c6
|
|
@runrevmark I've now tweaked this PR to include |
|
@livecode-vulcan review ok 5fc6212 |
|
@runrevmark I think you had the wrong SHA-1...! @livecode-vulcan review by @runrevmark fc21e2b |
|
@livecode-vulcan review ok fc21e2b |
|
💙 review by @runrevmark ok fc21e2b |
[Bug 17097] libfoundation: Add MCMemoryClearSecure() Add a new function, `MCMemoryClearSecure()`, that's equivalent to `MCMemoryClear()` but with the guarantee that it will never be optimised out. On Windows, this uses the standard `SecureZeroMemory()` library function. On other platforms, this uses `MCMemoryClear()` (i.e. `memset()`), but with an additional memory barrier that prevents the call to `memset()` from being optimised out. Typical assembly generated in `Release` mode: ```asm push rbx mov rdx, rsi xor esi, esi mov rbx, rdi call memset pop rbx ret ```
|
😞 test failure fc21e2b
|
|
@runrevmark Fixed think-o misspelling of @livecode-vulcan review by @runrevmark ok 9d132a2 |
|
💙 review by @runrevmark ok 9d132a2 |
[Bug 17097] libfoundation: Add MCMemoryClearSecure() Add a new function, `MCMemoryClearSecure()`, that's equivalent to `MCMemoryClear()` but with the guarantee that it will never be optimised out. On Windows, this uses the standard `SecureZeroMemory()` library function. On other platforms, this uses `MCMemoryClear()` (i.e. `memset()`), but with an additional memory barrier that prevents the call to `memset()` from being optimised out. Typical assembly generated in `Release` mode: ```asm push rbx mov rdx, rsi xor esi, esi mov rbx, rdi call memset pop rbx ret ```
|
😎 test success 9d132a2
|
Add a new function,
MCMemoryClearSecure(), that's equivalent toMCMemoryClear()but with the guarantee that it will never beoptimised out.
On Windows, this uses the standard
SecureZeroMemory()libraryfunction.
On other platforms, this uses
MCMemoryClear()(i.e.memset()), butwith an additional memory barrier that prevents the call to
memset()from being optimised out. Typical assembly generated in
Releasemode: