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

add support for the hybrid mode of Argon2 for passphrases #287

Merged
merged 4 commits into from
Apr 29, 2024

Conversation

chrisccoulson
Copy link
Collaborator

Passphrase support currently hardcodes the use of argon2i, which is
the data-independent version of Argon2. Whilst this has better
side-channel resistance than data-dependent versions, it requires
more iterations to protect against time-memory tradeoff attacks.

Cryptsetup recently switch to argon2id by default for passphrase
hashing, which is the hybrid version that provides a good balance
between side-channel resistance and time-memory tradeoff.

This introduces support for selecting between the 2 versions for
passphrase support.

There are other versions of Argon2, such as the data-dependent version
which sacrifices side-channel resistance for better resistance against
time-memory tradeoff attacks, but this isn't supported by the argon2 go
package.

@chrisccoulson chrisccoulson force-pushed the add-hybrid-argon2-mode branch 6 times, most recently from 12e86c4 to 05fd1ba Compare March 13, 2024 23:37
We already allow the memory cost to be set to a value that is greater
than 4GiB - only capping the maximum here when benchmarking is used.
This handles the threads parameter in the same way.
@chrisccoulson chrisccoulson force-pushed the add-hybrid-argon2-mode branch 2 times, most recently from f88aa4f to b48505c Compare March 15, 2024 10:07
Passphrase support currently hardcodes the use of argon2i, which is
the data-independent version of Argon2. Whilst this has better
side-channel resistance than data-dependent versions, it requires
more iterations to protect against time-memory tradeoff attacks.

Cryptsetup recently switch to argon2id by default for passphrase
hashing, which is the hybrid version that provides a good balance
between side-channel resistance and time-memory tradeoff.

This introduces support for selecting between the 2 versions for
passphrase support.

There are other versions of Argon2, such as the data-dependent version
which sacrifices side-channel resistance for better resistance against
time-memory tradeoff attacks, but this isn't supported by the argon2 go
package.
@chrisccoulson chrisccoulson marked this pull request as ready for review March 15, 2024 10:10
Copy link
Collaborator

@pedronis pedronis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this has conflicts now

Copy link
Collaborator

@pedronis pedronis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks, the assumption around Mode values and using conversions is slightly odd. As one could have also declared type Argon2Mode = argon2.Mode perhaps?

argon2_test.go Outdated
Comment on lines 292 to 295
func (s *argon2Suite) TestModeConstants(c *C) {
c.Check(Argon2i, Equals, Argon2Mode(argon2.ModeI))
c.Check(Argon2id, Equals, Argon2Mode(argon2.ModeID))
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see we have this test that enforces the property but still a bit odd overall

@chrisccoulson
Copy link
Collaborator Author

thanks, the assumption around Mode values and using conversions is slightly odd. As one could have also declared type Argon2Mode = argon2.Mode perhaps?

I've just updated this to make Argon2Mode a type alias of argon2.Mode instead.

@chrisccoulson chrisccoulson merged commit 3b38f56 into canonical:master Apr 29, 2024
2 checks passed
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

Successfully merging this pull request may close these issues.

2 participants