Index: CryptoPassphrase.m ================================================================== --- CryptoPassphrase.m +++ CryptoPassphrase.m @@ -48,21 +48,21 @@ @implementation CryptoPassphrase - (void)applicationDidFinishLaunching { OFString *keyFilePath, *lengthString; - const of_options_parser_option_t options[] = { + const OFOptionsParserOption options[] = { { 'h', @"help", 0, NULL, NULL }, { 'k', @"keyfile", 1, NULL, &keyFilePath }, { 'l', @"length", 1, NULL, &lengthString }, { 'L', @"legacy", 0, &_legacy, NULL }, { 'r', @"repeat", 0, &_repeat, NULL }, { '\0', nil, 0, NULL, NULL } }; OFOptionsParser *optionsParser = [OFOptionsParser parserWithOptions: options]; - of_unichar_t option; + OFUnichar option; OFMutableData *keyFile = nil; OFString *prompt; const char *promptCString; char *passphraseCString; size_t passphraseLength; @@ -69,37 +69,37 @@ OFSecureData *passphrase; while ((option = [optionsParser nextOption]) != '\0') { switch (option) { case 'h': - showHelp(of_stdout, true); + showHelp(OFStdOut, true); [OFApplication terminate]; break; case ':': if (optionsParser.lastLongOption != nil) - [of_stderr writeFormat: + [OFStdErr writeFormat: @"%@: Argument for option --%@ missing\n", [OFApplication programName], optionsParser.lastLongOption]; else - [of_stderr writeFormat: + [OFStdErr writeFormat: @"%@: Argument for option -%C missing\n", [OFApplication programName], optionsParser.lastOption]; [OFApplication terminateWithStatus: 1]; break; case '?': if (optionsParser.lastLongOption != nil) - [of_stderr writeFormat: + [OFStdErr writeFormat: @"%@: Unknown option: --%@\n", [OFApplication programName], optionsParser.lastLongOption]; else - [of_stderr writeFormat: + [OFStdErr writeFormat: @"%@: Unknown option: -%C\n", [OFApplication programName], optionsParser.lastOption]; [OFApplication terminateWithStatus: 1]; @@ -106,11 +106,11 @@ break; } } if (optionsParser.remainingArguments.count != 1) { - showHelp(of_stderr, false); + showHelp(OFStdErr, false); [OFApplication terminateWithStatus: 1]; } id generator = (_legacy @@ -134,11 +134,11 @@ } @catch (OFOutOfRangeException *e) { invalid = true; } if (invalid) { - [of_stderr writeFormat: + [OFStdErr writeFormat: @"%@: Invalid length: %@\n", [OFApplication programName], lengthString]; [OFApplication terminateWithStatus: 1]; } @@ -157,37 +157,34 @@ passphrase = [OFSecureData dataWithCount: passphraseLength + 1 allowsSwappableMemory: true]; memcpy(passphrase.mutableItems, passphraseCString, passphraseLength + 1); } @finally { - of_explicit_memset(passphraseCString, '\0', passphraseLength); + OFZeroMemory(passphraseCString, passphraseLength); } if (_repeat) { - of_string_encoding_t encoding = [OFLocale encoding]; + OFStringEncoding encoding = [OFLocale encoding]; prompt = [OFString stringWithFormat: @"Repeat passphrase for site \"%@\": ", generator.site]; passphraseCString = getpass([prompt cStringWithEncoding: encoding]); if (strcmp(passphraseCString, passphrase.items) != 0) { - [of_stderr writeString: @"Passphrases do not match!\n"]; + [OFStdErr writeString: @"Passphrases do not match!\n"]; [OFApplication terminateWithStatus: 1]; } - of_explicit_memset(passphraseCString, '\0', - strlen(passphraseCString)); + OFZeroMemory(passphraseCString, strlen(passphraseCString)); } generator.keyFile = keyFile; generator.passphrase = passphrase; [generator derivePassword]; - [of_stdout writeBuffer: generator.output.items - length: generator.length]; - [of_stdout writeBuffer: "\n" - length: 1]; + [OFStdOut writeBuffer: generator.output.items length: generator.length]; + [OFStdOut writeBuffer: "\n" length: 1]; [OFApplication terminate]; } @end Index: LegacyPasswordGenerator.m ================================================================== --- LegacyPasswordGenerator.m +++ LegacyPasswordGenerator.m @@ -54,11 +54,11 @@ } - (void)derivePassword { OFSHA256Hash *siteHash = [OFSHA256Hash - cryptoHashWithAllowsSwappableMemory: true]; + hashWithAllowsSwappableMemory: true]; size_t passphraseLength, combinedPassphraseLength; OFSecureData *combinedPassphrase; char *combinedPassphraseItems; unsigned char *outputItems; @@ -87,11 +87,11 @@ if (_keyFile != nil) memcpy(combinedPassphraseItems + passphraseLength, _keyFile.items, _keyFile.count); outputItems = _output.mutableItems; - of_scrypt((of_scrypt_parameters_t){ + OFScrypt((OFScryptParameters){ .blockSize = 8, .costFactor = 524288, .parallelization = 2, .salt = siteHash.digest, .saltLength = [siteHash.class digestSize], Index: NewPasswordGenerator.m ================================================================== --- NewPasswordGenerator.m +++ NewPasswordGenerator.m @@ -41,11 +41,11 @@ } - (void)derivePassword { OFSHA384Hash *siteHash = [OFSHA384Hash - cryptoHashWithAllowsSwappableMemory: true]; + hashWithAllowsSwappableMemory: true]; size_t passphraseLength, combinedPassphraseLength; OFSecureData *combinedPassphrase; char *combinedPassphraseItems; unsigned char *outputItems; @@ -74,11 +74,11 @@ if (_keyFile != nil) memcpy(combinedPassphraseItems + passphraseLength, _keyFile.items, _keyFile.count); outputItems = _output.mutableItems; - of_scrypt((of_scrypt_parameters_t){ + OFScrypt((OFScryptParameters){ .blockSize = 8, .costFactor = 524288, .parallelization = 2, .salt = siteHash.digest, .saltLength = [siteHash.class digestSize],