Bitcoin ABC
0.31.0
P2P Digital Currency
Toggle main menu visibility
Main Page
Modules
Namespaces
Namespace List
Namespace Members
All
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
z
Functions
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
u
v
w
Variables
a
b
c
d
f
g
h
i
k
m
n
o
p
s
t
u
v
w
Typedefs
Enumerations
Enumerator
a
b
c
d
e
h
i
l
m
n
p
q
r
s
t
u
v
w
z
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
!
:
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
~
Variables
!
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
a
b
c
d
e
f
i
k
l
m
n
o
p
q
r
s
t
u
v
w
Enumerations
a
b
c
d
e
f
m
n
o
r
s
t
u
v
w
Enumerator
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
Properties
Related Functions
:
a
b
c
d
e
f
g
i
o
p
r
s
t
u
v
w
Files
File List
File Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
z
Variables
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
Typedefs
b
c
d
e
h
i
k
l
m
n
p
r
s
t
u
v
Enumerations
b
c
d
e
f
g
h
i
j
m
n
o
p
r
s
t
v
w
Enumerator
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
u
w
Macros
_
a
b
c
d
e
f
g
h
i
l
m
n
p
q
r
s
t
u
v
w
x
y
Examples
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Modules
Pages
src
support
cleanse.cpp
Go to the documentation of this file.
1
// Copyright (c) 2009-2010 Satoshi Nakamoto
2
// Copyright (c) 2009-2015 The Bitcoin Core developers
3
// Distributed under the MIT software license, see the accompanying
4
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
5
6
#include <
support/cleanse.h
>
7
8
#include <cstring>
9
10
#if defined(_MSC_VER)
11
#include <Windows.h>
// For SecureZeroMemory.
12
#endif
13
14
void
memory_cleanse
(
void
*ptr,
size_t
len) {
15
#if defined(_MSC_VER)
16
/* SecureZeroMemory is guaranteed not to be optimized out by MSVC. */
17
SecureZeroMemory(ptr, len);
18
#else
19
std::memset(ptr, 0, len);
20
21
/*
22
* Memory barrier that scares the compiler away from optimizing out the
23
* memset.
24
*
25
* Quoting Adam Langley <agl@google.com> in commit
26
* ad1907fe73334d6c696c8539646c21b11178f20f in BoringSSL (ISC License):
27
* As best as we can tell, this is sufficient to break any optimisations
28
* that might try to eliminate "superfluous" memsets.
29
* This method is used in memzero_explicit() the Linux kernel, too. Its
30
* advantage is that it is pretty efficient because the compiler can still
31
* implement the memset() efficiently, just not remove it entirely. See
32
* "Dead Store Elimination (Still) Considered Harmful" by Yang et al.
33
* (USENIX Security 2017) for more background.
34
*/
35
__asm__ __volatile__(
""
: :
"r"
(ptr) :
"memory"
);
36
#endif
37
}
memory_cleanse
void memory_cleanse(void *ptr, size_t len)
Secure overwrite a buffer (possibly containing secret data) with zero-bytes.
Definition:
cleanse.cpp:14
cleanse.h
Generated on Mon Apr 7 2025 17:20:23 for Bitcoin ABC by
1.9.4