[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-bugs] #7419 [Tor]: Choose a faster memwipe implementation
#7419: Choose a faster memwipe implementation
-------------------------+--------------------------------------------------
Reporter: nickm | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Tor: unspecified
Component: Tor | Version:
Keywords: tor-relay | Parent:
Points: | Actualpoints:
-------------------------+--------------------------------------------------
Our current memwipe implementation (see #7352) was chosen for being very-
likely-to-be-safe, not for its speed. We could get much faster, probably:
All we really need is a memwipe, plus some way to tell the compiler that
the memwipe shouldn't be eliminated.
One GCC-only option is
{{{
void memwipe(void *p, uint8_t b, size_t sz) __attribtue__((noinline));
void memwipe(void *p, uint8_t b, size_t sz)
{
memset(p, b, sz);
}
}}}
Another, crazier GCC-only option is
{{{
inline void
memwipe(void *p, uint8_t b, size_t sz)
{
memset(p, b, sz);
asm("" ::: "memory");
}
}}}
And on windows, one could probably say
{{{
void
memwipe(void *p, uint8_t b, size_t sz)
{
SecureZeroMemory(p, sz);
}
}}}
if b == 0.
Probably, we shouldn't bother to do any of these unless it turns out that
OPENSSL_cleanse() is showing up in our profiles.
--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/7419>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
_______________________________________________
tor-bugs mailing list
tor-bugs@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs