Allow swappable memory
Most OSes and/or ulimits do not allow allocating such large amounts of unswappable memory. FossilOrigin-Name: 007bd9985ecb5164a06dddc9aab2d18dbc34cc5bd7914abdea0ff1cd84dfdf51
This commit is contained in:
parent
3470477a7f
commit
6df046ff50
3 changed files with 7 additions and 7 deletions
|
@ -155,7 +155,7 @@ showHelp(OFStream *output, bool verbose)
|
||||||
passphraseLength = strlen(passphraseCString);
|
passphraseLength = strlen(passphraseCString);
|
||||||
@try {
|
@try {
|
||||||
passphrase = [OFSecureData dataWithCount: passphraseLength + 1
|
passphrase = [OFSecureData dataWithCount: passphraseLength + 1
|
||||||
allowsSwappableMemory: false];
|
allowsSwappableMemory: true];
|
||||||
memcpy(passphrase.mutableItems, passphraseCString,
|
memcpy(passphrase.mutableItems, passphraseCString,
|
||||||
passphraseLength + 1);
|
passphraseLength + 1);
|
||||||
} @finally {
|
} @finally {
|
||||||
|
|
|
@ -68,7 +68,7 @@
|
||||||
[_output release];
|
[_output release];
|
||||||
_output = nil;
|
_output = nil;
|
||||||
_output = [[OFSecureData alloc] initWithCount: _length + 1
|
_output = [[OFSecureData alloc] initWithCount: _length + 1
|
||||||
allowsSwappableMemory: false];
|
allowsSwappableMemory: true];
|
||||||
|
|
||||||
passphraseLength = combinedPassphraseLength = _passphrase.count - 1;
|
passphraseLength = combinedPassphraseLength = _passphrase.count - 1;
|
||||||
if (_keyFile != nil) {
|
if (_keyFile != nil) {
|
||||||
|
@ -80,7 +80,7 @@
|
||||||
|
|
||||||
combinedPassphrase = [OFSecureData
|
combinedPassphrase = [OFSecureData
|
||||||
dataWithCount: combinedPassphraseLength
|
dataWithCount: combinedPassphraseLength
|
||||||
allowsSwappableMemory: false];
|
allowsSwappableMemory: true];
|
||||||
combinedPassphraseItems = combinedPassphrase.mutableItems;
|
combinedPassphraseItems = combinedPassphrase.mutableItems;
|
||||||
memcpy(combinedPassphraseItems, _passphrase.items, passphraseLength);
|
memcpy(combinedPassphraseItems, _passphrase.items, passphraseLength);
|
||||||
|
|
||||||
|
@ -99,7 +99,7 @@
|
||||||
.passwordLength = combinedPassphraseLength,
|
.passwordLength = combinedPassphraseLength,
|
||||||
.key = outputItems,
|
.key = outputItems,
|
||||||
.keyLength = _length,
|
.keyLength = _length,
|
||||||
.allowsSwappableMemory = false
|
.allowsSwappableMemory = true
|
||||||
});
|
});
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -55,7 +55,7 @@
|
||||||
[_output release];
|
[_output release];
|
||||||
_output = nil;
|
_output = nil;
|
||||||
_output = [[OFSecureData alloc] initWithCount: _length + 1
|
_output = [[OFSecureData alloc] initWithCount: _length + 1
|
||||||
allowsSwappableMemory: false];
|
allowsSwappableMemory: true];
|
||||||
|
|
||||||
passphraseLength = combinedPassphraseLength = _passphrase.count - 1;
|
passphraseLength = combinedPassphraseLength = _passphrase.count - 1;
|
||||||
if (_keyFile != nil) {
|
if (_keyFile != nil) {
|
||||||
|
@ -67,7 +67,7 @@
|
||||||
|
|
||||||
combinedPassphrase = [OFSecureData
|
combinedPassphrase = [OFSecureData
|
||||||
dataWithCount: combinedPassphraseLength
|
dataWithCount: combinedPassphraseLength
|
||||||
allowsSwappableMemory: false];
|
allowsSwappableMemory: true];
|
||||||
combinedPassphraseItems = combinedPassphrase.mutableItems;
|
combinedPassphraseItems = combinedPassphrase.mutableItems;
|
||||||
memcpy(combinedPassphraseItems, _passphrase.items, passphraseLength);
|
memcpy(combinedPassphraseItems, _passphrase.items, passphraseLength);
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@
|
||||||
.passwordLength = combinedPassphraseLength,
|
.passwordLength = combinedPassphraseLength,
|
||||||
.key = outputItems,
|
.key = outputItems,
|
||||||
.keyLength = _length,
|
.keyLength = _length,
|
||||||
.allowsSwappableMemory = false
|
.allowsSwappableMemory = true
|
||||||
});
|
});
|
||||||
|
|
||||||
for (size_t i = 0; i < _length; i++)
|
for (size_t i = 0; i < _length; i++)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue