-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bring opaque_ke back to 2.x, with argon2's parameters fixed to the 0.…
…4.1 defaults Some background: * opaque_ke 2.x depends on voprf 0.4, which broke with a recent version of Rust due to a lifetime annotation issue. * opaque_ke 3.x is not compatible with existing auth data from 2.x since it uses voprf 0.5 * The lifetime fix was backported from voprf 0.5 to voprf 0.4, but it also picked up a bunch of unrelated version bumps including argon2 * argon2's default parameters changed from 0.4.1 to 0.5.3 I plan to stick to opaque_ke 2.x throughout the 0.0.x series of Perovskite, and then upgrade at the next major release (probably 0.1)
- Loading branch information
Showing
5 changed files
with
47 additions
and
38 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,37 @@ | ||
use generic_array::{ArrayLength, GenericArray}; | ||
use opaque_ke::errors::InternalError; | ||
use opaque_ke::ksf::Ksf; | ||
use opaque_ke::CipherSuite; | ||
|
||
pub struct PerovskiteOpaqueAuth; | ||
impl CipherSuite for PerovskiteOpaqueAuth { | ||
type OprfCs = opaque_ke::Ristretto255; | ||
type KeGroup = opaque_ke::Ristretto255; | ||
type KeyExchange = opaque_ke::key_exchange::tripledh::TripleDh; | ||
type Ksf = argon2::Argon2<'static>; | ||
type Ksf = Argon2_4096_3_1; | ||
} | ||
|
||
#[doc(hidden)] | ||
pub struct Argon2_4096_3_1 { | ||
inner: argon2::Argon2<'static>, | ||
} | ||
impl Default for Argon2_4096_3_1 { | ||
fn default() -> Self { | ||
Self { | ||
inner: argon2::Argon2::new( | ||
argon2::Algorithm::default(), | ||
argon2::Version::default(), | ||
argon2::Params::new(4096, 3, 1, None).unwrap(), | ||
), | ||
} | ||
} | ||
} | ||
|
||
impl opaque_ke::ksf::Ksf for Argon2_4096_3_1 { | ||
fn hash<L: ArrayLength<u8>>( | ||
&self, | ||
input: GenericArray<u8, L>, | ||
) -> Result<GenericArray<u8, L>, InternalError> { | ||
dbg!(self.inner.hash(input)) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters