On 4/20/12 11:55 AM, Stefan Arentz wrote:
>
> Do these parameters have to stay consistent between all devices that
> use scrypt for a specific account or key. Asking because mobile
> devices have limited RAM. Allocating 100MB could be an issue on some
> phones.
Yes, all devices which want to decrypt that wrapped key must use the
same parameters. Basically the security level will be limited by the
slowest/smallest device that a particular user has.
Guessing what that device will be should be an interesting exercise :).
My vague idea is either 1: pick a least-common-denominator, something
that all supported devices can handle (maybe 10MB) and hope that it
still provides enough protection against attackers, or 2: measure the
user's first device to choose parameters, use that for the rest of their
devices, and hope that they started with their slowest device.
We could store the parameters next to the wrapped key, but that opens up
an attack where the server (or someone impersonating it) tells the
client to use unreasonably low parameters, so it can learn a
less-protected value and access a cheaper attack path. The client has no
way to validate the stored parameters until it finishes acting on them.
Although.. now that I think about it, we could store a MAC of the
parameters using the derived key, and not check it until after finishing
the scrypt step (but before we reveal anything about the output of the
KDF). I'll have to think about that.
> The idea of offloading it to servers is very interesting. But I am
> wondering how that scales. If this is designed to specifically make
> scaling difficult then that will also not help us to build a well
> performing scrypt service cluster.
Yup. Measuring how fast various EC2 flavors can run scrypt is on my TODO
list, but it's probably going to require 1.0s of dedicated server time
for each act of offloaded scrypt. There's tuning that can be done: the
attacker's cost is a linear function of the client/helper's cost, and we
might be comfortable with lower margins. The constraints are how long
users are willing to wait during that setup step, and how much CPU
(well, memory bandwidth) we can afford to burn for them during that
time. Then the attacker's cost is basically some constant times that.
Ideally, this only happens once per non-native browser per user account
setup (native code should do the scrypt locally, and all clients should
cache the scrypt output forever). Each server can provide 86400
operations per day. I'm hoping someone has estimated how many users
we're going to have and sort of rate that represents, so we can guess
how much this part will cost to operate.
cheers,
-Brian