Differences From Artifact [95a7f2dfcf]:
- File LegacyPasswordGenerator.m — part of check-in [a703cf8d62] at 2021-03-14 00:17:32 on branch trunk — Update copyright (user: js, size: 3724) [annotate] [blame] [check-ins using]
To Artifact [3c0f69dc95]:
- File
LegacyPasswordGenerator.m
— part of check-in
[007bd9985e]
at
2021-03-21 11:03:01
on branch trunk
— Allow swappable memory
Most OSes and/or ulimits do not allow allocating such large amounts of
unswappable memory. (user: js, size: 3721) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
64 65 66 67 68 69 70 | [siteHash updateWithBuffer: _site.UTF8String length: _site.UTF8StringLength]; [_output release]; _output = nil; _output = [[OFSecureData alloc] initWithCount: _length + 1 | | | | | 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 | [siteHash updateWithBuffer: _site.UTF8String length: _site.UTF8StringLength]; [_output release]; _output = nil; _output = [[OFSecureData alloc] initWithCount: _length + 1 allowsSwappableMemory: true]; passphraseLength = combinedPassphraseLength = _passphrase.count - 1; if (_keyFile != nil) { if (SIZE_MAX - combinedPassphraseLength < _keyFile.count) @throw [OFOutOfRangeException exception]; combinedPassphraseLength += _keyFile.count; } combinedPassphrase = [OFSecureData dataWithCount: combinedPassphraseLength allowsSwappableMemory: true]; combinedPassphraseItems = combinedPassphrase.mutableItems; memcpy(combinedPassphraseItems, _passphrase.items, passphraseLength); if (_keyFile != nil) memcpy(combinedPassphraseItems + passphraseLength, _keyFile.items, _keyFile.count); outputItems = _output.mutableItems; of_scrypt((of_scrypt_parameters_t){ .blockSize = 8, .costFactor = 524288, .parallelization = 2, .salt = siteHash.digest, .saltLength = [siteHash.class digestSize], .password = combinedPassphraseItems, .passwordLength = combinedPassphraseLength, .key = outputItems, .keyLength = _length, .allowsSwappableMemory = true }); /* * This has a bias, however, this is what scrypt-genpass does and the * legacy mode wants to be compatible to scrypt-genpass. */ outputItems[0] = "abcdefghijklmnopqrstuvwxyz"[outputItems[0] % 26]; |
︙ | ︙ |