Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Status update for recommendations #4

Closed
WildCryptoFox opened this issue Oct 26, 2019 · 6 comments
Closed

Status update for recommendations #4

WildCryptoFox opened this issue Oct 26, 2019 · 6 comments

Comments

@WildCryptoFox
Copy link

Is BH still the preferred iMHF?

Given the attacks on Argon2i and BH, what are the current recommended parameters?

Thanks.

@henrycg
Copy link
Owner

henrycg commented Oct 26, 2019

There's not a one-size-fits-all answer to this question—it really depends on the specifics of your application. Feel free to email me if you want to discuss further.

@henrycg henrycg closed this as completed Oct 26, 2019
@WildCryptoFox
Copy link
Author

WildCryptoFox commented Oct 26, 2019

I'd rather keep this public. Towards Practical Attacks on Argon2i and Balloon Hashing recommends using Argon2i-B.

Edit: @eternaleye pointed me to newer papers: Sustained Space Complexity, Bandwidth-Hard Functions: Reductions and Lower Bounds, and Data-Independent Memory Hard Functions: New Attacks and Stronger Constructions.

I'd rather have the information to do this analysis myself. I could enumerate places where I'd want to use an iMHF but I wouldn't want an answer that doesn't apply to another person.

For what it is worth, I'll list where I'd like to use an iMHF. All client side without cooperation with an external computation service. (2), (3) and (4) may have system-specific parameters but (1) may need global "defaults" with an optional advanced manual configuration due to no client state and an obliviously derived client-secret salt.

  1. In a PAKE protocol such as OPAQUE (optionally extended with GenTFA).

  2. For full disk encryption; either early in boot when nothing is running; or on a live environment with not too many things running, for recovery.

  3. For an encrypted USB which needs to be mountable despite "low" memory available.

  4. To unlock a running system or an ssh or PGP key, even under high load on system resources.

@henrycg
Copy link
Owner

henrycg commented Oct 26, 2019

Great. It sounds like you have two independent questions:

Q1. Which hash function should I use?
Q2. Given a choice of hash function, what are the right parameters?


On Q1: My sense is that you would probably be safe using any of scrypt, Argon2id, or Balloon. If you care about interoperability, use scrypt or Argon2id, since there are well-maintained and widely used implementations of both of these hash functions.

The people I know who are using Balloon
(i) don't care about interoperability,
(ii) are happy to maintain their own implementation, and
(iii) like how simple the design is and that it works with any underlying cryptographic hash function.
Apparently, because of (iii), the code size of Balloon can be relatively small. This is important in some applications.

Assuming that you do care about interoperability, then you are left with Argon2id and scrypt. Argon2id gives you better protection against certain side-channel attacks. In particular, if an adversary can somehow—through timing or cache attacks—learn the memory-access pattern of the scrypt algorithm as it executes, it can essentially break the memory-hardness of the scrypt function. See Appendix G.2 of the Balloon paper for details. Argon2id does not have this problem.

If you use Argon2i (not Argon2id) then the amortization attacks you cite apply. Argon2id essentially composes Argon2i with an scrypt-like hash function to defeat both the cache and amortization attacks. I view Argon2id as a safe default for this reason. The only downside of Argon2id is that—in the absence of cache attacks—it is not quite as memory hard as pure scrypt. But this feels like a very low-order concern to me.

So, the bottom line is: unless you have a good reason to prefer one of the other designs, I would stick with Argon2id.

On Q2: The right way to set the parameters for any of these functions is to set the memory parameter to the largest value that you can tolerate (with the minimal time parameter). Then increase the time parameter to the largest value you can tolerate. Memory is the expensive resource, so this parameter setting will maximize the attacker's cost, subject to whatever resource constraints you (the defender) have.

You'll have to experiment a bit to find the right setting of the parameters for your application. Before you fix the parameters, make sure that they'll work on all of the different architectures on which your code will need to run.

The Argon2 RFC gives example parameter settings along with a strategy for choosing your own parameters.

@WildCryptoFox
Copy link
Author

WildCryptoFox commented Oct 26, 2019

Q1. I personally fit in that set, and would be willing to contribute implementations to help make it mainstream if there are no cryptographic reasons against BH.

Q2. Fair recommendation, though I guess I should have asked for the conservative lower bounds to avoid naive misuse by consumers?

Thanks for the quick replies!

@WildCryptoFox
Copy link
Author

(Added this to the previous comment with the link to the old paper) @eternaleye pointed me to newer papers: Sustained Space Complexity, Bandwidth-Hard Functions: Reductions and Lower Bounds, and Data-Independent Memory Hard Functions: New Attacks and Stronger Constructions.

@WildCryptoFox
Copy link
Author

Current verdict. Use Argon2i for now. Maybe accept the tweaks from the latest paper after further analysis is done on it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants