Re: storing crypto key in CPU registers
Michal Zalewski <[email protected]>
| Newsgroups | gmane.comp.security.programming |
|---|---|
| Message-ID | <[email protected]> |
On Sun, 11 Jan 2004, lsi wrote:
> Some of these registers are used internally. But maybe at least one of
> them is available to store up to 80 bits of crypto key, in a location
> that is not coredumped or swapfiled?
If you use user-accessible registers that are kept separate for every
process, there is absolutely no guarantee they will be not swapped out
when the task is not active.
Using certain ring 0 accessible registers (such as MSRs) to store portions
of the key is perhaps a good idea, although if you use registers that do
affect CPU operations in some way, the attacker may be able to determine
some of this information by carefully observing the system (its
performance, etc); you need to stick with ones that are documented as
unused and reserved - but then, there is no guarantee it will be the same
in the next version of a given CPU. Also, remember you need to store
something in the registers in the first place, and read it back on some
occassions, and the path there leads through userspace, which may be
swapped out, may segfault, etc.
There is still a slight risk the information gets stored somewhere, should
the system or the administrator read back some of the registers for some
purposes (or if you are running within an emulator), but it's less of an
issue.
In short, it's probably not a bad idea, practically speaking, but not
really a perfect solution.
--
------------------------- bash$ :(){ :|:&};: --
Michal Zalewski * [http://lcamtuf.coredump.cx]
Did you know that clones never use mirrors?
--------------------------- 2004-01-12 19:53 --
http://lcamtuf.coredump.cx/photo/current/