Merge pull request #846 from ente-io/minor_fixes
This commit is contained in:
commit
7023c1bc7d
1 changed files with 7 additions and 3 deletions
|
@ -290,13 +290,17 @@ class CryptoUtil {
|
|||
int memLimit = Sodium.cryptoPwhashMemlimitSensitive;
|
||||
int opsLimit = Sodium.cryptoPwhashOpslimitSensitive;
|
||||
Uint8List key;
|
||||
while (memLimit > Sodium.cryptoPwhashMemlimitMin &&
|
||||
opsLimit < Sodium.cryptoPwhashOpslimitMax) {
|
||||
while (memLimit >= Sodium.cryptoPwhashMemlimitMin &&
|
||||
opsLimit <= Sodium.cryptoPwhashOpslimitMax) {
|
||||
try {
|
||||
key = await deriveKey(password, salt, memLimit, opsLimit);
|
||||
return DerivedKeyResult(key, memLimit, opsLimit);
|
||||
} catch (e, s) {
|
||||
logger.severe(e, s);
|
||||
logger.severe(
|
||||
"failed to derive memLimit: $memLimit and opsLimit: $opsLimit",
|
||||
e,
|
||||
s,
|
||||
);
|
||||
}
|
||||
memLimit = (memLimit / 2).round();
|
||||
opsLimit = opsLimit * 2;
|
||||
|
|
Loading…
Add table
Reference in a new issue