Skip to content

Commit 5d67b5d

Browse files
author
Bill Abt
committed
Updates for the new swift-DEVELOPMENT-SNAPSHOT-2016-06-20-a builds.
1 parent a8e5845 commit 5d67b5d

File tree

6 files changed

+121
-46
lines changed

6 files changed

+121
-46
lines changed

Cryptor.xcodeproj/project.pbxproj

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@
178178
isa = PBXProject;
179179
attributes = {
180180
LastSwiftUpdateCheck = 0730;
181-
LastUpgradeCheck = 9999;
181+
LastUpgradeCheck = 0800;
182182
TargetAttributes = {
183183
8C95902A1CC80A2300A2C2B4 = {
184184
CreatedOnToolsVersion = 7.3;
@@ -362,6 +362,7 @@
362362
PRODUCT_BUNDLE_IDENTIFIER = com.ibm.oss.CryptorTests;
363363
PRODUCT_NAME = "$(TARGET_NAME)";
364364
SDKROOT = macosx;
365+
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
365366
USER_HEADER_SEARCH_PATHS = /usr/local/opt/openssl/include;
366367
};
367368
name = Release;
@@ -383,6 +384,7 @@
383384
PRODUCT_MODULE_NAME = Cryptor;
384385
PRODUCT_NAME = "lib$(TARGET_NAME)";
385386
SWIFT_INCLUDE_PATHS = "\"$SRCROOT/CommonCrypto\"";
387+
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
386388
USER_HEADER_SEARCH_PATHS = /usr/local/opt/openssl/include;
387389
};
388390
name = Release;
@@ -412,12 +414,44 @@
412414
"_____Release_" /* Release */ = {
413415
isa = XCBuildConfiguration;
414416
buildSettings = {
417+
CLANG_WARN_BOOL_CONVERSION = YES;
418+
CLANG_WARN_CONSTANT_CONVERSION = YES;
419+
CLANG_WARN_EMPTY_BODY = YES;
420+
CLANG_WARN_ENUM_CONVERSION = YES;
421+
CLANG_WARN_INT_CONVERSION = YES;
422+
CLANG_WARN_UNREACHABLE_CODE = YES;
423+
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
424+
ENABLE_STRICT_OBJC_MSGSEND = YES;
425+
GCC_NO_COMMON_BLOCKS = YES;
426+
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
427+
GCC_WARN_ABOUT_RETURN_TYPE = YES;
428+
GCC_WARN_UNDECLARED_SELECTOR = YES;
429+
GCC_WARN_UNINITIALIZED_AUTOS = YES;
430+
GCC_WARN_UNUSED_FUNCTION = YES;
431+
GCC_WARN_UNUSED_VARIABLE = YES;
415432
};
416433
name = Release;
417434
};
418435
"_______Debug_" /* Debug */ = {
419436
isa = XCBuildConfiguration;
420437
buildSettings = {
438+
CLANG_WARN_BOOL_CONVERSION = YES;
439+
CLANG_WARN_CONSTANT_CONVERSION = YES;
440+
CLANG_WARN_EMPTY_BODY = YES;
441+
CLANG_WARN_ENUM_CONVERSION = YES;
442+
CLANG_WARN_INT_CONVERSION = YES;
443+
CLANG_WARN_UNREACHABLE_CODE = YES;
444+
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
445+
ENABLE_STRICT_OBJC_MSGSEND = YES;
446+
ENABLE_TESTABILITY = YES;
447+
GCC_NO_COMMON_BLOCKS = YES;
448+
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
449+
GCC_WARN_ABOUT_RETURN_TYPE = YES;
450+
GCC_WARN_UNDECLARED_SELECTOR = YES;
451+
GCC_WARN_UNINITIALIZED_AUTOS = YES;
452+
GCC_WARN_UNUSED_FUNCTION = YES;
453+
GCC_WARN_UNUSED_VARIABLE = YES;
454+
ONLY_ACTIVE_ARCH = YES;
421455
};
422456
name = Debug;
423457
};
Lines changed: 69 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,71 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<Scheme LastUpgradeVersion = "9999" version = "1.3">
3-
<BuildAction parallelizeBuildables = "YES" buildImplicitDependencies = "YES">
4-
<BuildActionEntries>
5-
<BuildActionEntry buildForTesting = "YES" buildForRunning = "YES" buildForProfiling = "YES" buildForArchiving = "YES" buildForAnalyzing = "YES">
6-
<BuildableReference
7-
BuildableIdentifier = "primary"
8-
BlueprintIdentifier = "______Target_Cryptor"
9-
BuildableName = "libCryptor.dylib"
10-
BlueprintName = "Cryptor"
11-
ReferencedContainer = "container:Cryptor.xcodeproj">
12-
</BuildableReference>
13-
</BuildActionEntry>
14-
</BuildActionEntries>
15-
</BuildAction>
16-
<TestAction
17-
buildConfiguration = "Debug"
18-
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
19-
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
20-
shouldUseLaunchSchemeArgsEnv = "YES">
21-
<Testables>
22-
</Testables>
23-
</TestAction>
2+
<Scheme
3+
LastUpgradeVersion = "0800"
4+
version = "1.3">
5+
<BuildAction
6+
parallelizeBuildables = "YES"
7+
buildImplicitDependencies = "YES">
8+
<BuildActionEntries>
9+
<BuildActionEntry
10+
buildForTesting = "YES"
11+
buildForRunning = "YES"
12+
buildForProfiling = "YES"
13+
buildForArchiving = "YES"
14+
buildForAnalyzing = "YES">
15+
<BuildableReference
16+
BuildableIdentifier = "primary"
17+
BlueprintIdentifier = "______Target_Cryptor"
18+
BuildableName = "libCryptor.dylib"
19+
BlueprintName = "Cryptor"
20+
ReferencedContainer = "container:Cryptor.xcodeproj">
21+
</BuildableReference>
22+
</BuildActionEntry>
23+
</BuildActionEntries>
24+
</BuildAction>
25+
<TestAction
26+
buildConfiguration = "Debug"
27+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
28+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29+
shouldUseLaunchSchemeArgsEnv = "YES">
30+
<Testables>
31+
</Testables>
32+
<AdditionalOptions>
33+
</AdditionalOptions>
34+
</TestAction>
35+
<LaunchAction
36+
buildConfiguration = "Debug"
37+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
38+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
39+
launchStyle = "0"
40+
useCustomWorkingDirectory = "NO"
41+
ignoresPersistentStateOnLaunch = "NO"
42+
debugDocumentVersioning = "YES"
43+
debugServiceExtension = "internal"
44+
allowLocationSimulation = "YES">
45+
<MacroExpansion>
46+
<BuildableReference
47+
BuildableIdentifier = "primary"
48+
BlueprintIdentifier = "______Target_Cryptor"
49+
BuildableName = "libCryptor.dylib"
50+
BlueprintName = "Cryptor"
51+
ReferencedContainer = "container:Cryptor.xcodeproj">
52+
</BuildableReference>
53+
</MacroExpansion>
54+
<AdditionalOptions>
55+
</AdditionalOptions>
56+
</LaunchAction>
57+
<ProfileAction
58+
buildConfiguration = "Release"
59+
shouldUseLaunchSchemeArgsEnv = "YES"
60+
savedToolIdentifier = ""
61+
useCustomWorkingDirectory = "NO"
62+
debugDocumentVersioning = "YES">
63+
</ProfileAction>
64+
<AnalyzeAction
65+
buildConfiguration = "Debug">
66+
</AnalyzeAction>
67+
<ArchiveAction
68+
buildConfiguration = "Release"
69+
revealArchiveInOrganizer = "YES">
70+
</ArchiveAction>
2471
</Scheme>

README.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,17 @@ This package is functionally complete and has all current relevant tests passing
1111
## Prerequisites
1212

1313
### Swift
14-
* Swift Open Source `swift-DEVELOPMENT-SNAPSHOT-2016-05-09-a` toolchain (**Minimum REQUIRED for latest release**)
15-
* Swift Open Source `swift-DEVELOPMENT-SNAPSHOT-2016-05-31-a` toolchain *or*
16-
* Swift Open Source `swift-DEVELOPMENT-SNAPSHOT-2016-06-06-a` toolchain (*Recommended*)
14+
* Swift Open Source `swift-DEVELOPMENT-SNAPSHOT-2016-06-20-a` toolchain (**Minimum REQUIRED for latest release**)
1715

1816
### OS X
1917

2018
* OS X 10.11.0 (*El Capitan*) or higher
21-
* Xcode Version 7.3.1 (7D1012) or higher using the one of the above toolchains (*Recommended*)
19+
* Xcode Version 8.0 beta (8S128d) or higher using the above toolchain (*Recommended*)
2220

2321
### Linux
2422

2523
* Ubuntu 15.10 (or 14.04 but only tested on 15.10)
26-
* One of the Swift Open Source toolchains listed above
24+
* The Swift Open Source toolchains listed above
2725

2826
## Build
2927

Sources/Crypto.swift

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,11 @@ extension CryptoDigest {
7373
}
7474

7575
///
76-
/// Extension for NSData to return an NSData object containing the digest.
76+
/// Extension for Data to return an Data object containing the digest.
7777
///
78-
extension NSData: CryptoDigest {
78+
#if os(OSX)
79+
80+
extension Data: CryptoDigest {
7981
///
8082
/// Calculates the Message Digest for this data.
8183
///
@@ -85,23 +87,17 @@ extension NSData: CryptoDigest {
8587
///
8688
/// - Note: Not supported on Linux due to differences in the `NSData` Foundation API.
8789
///
88-
public func digest(using algorithm: Digest.Algorithm) -> Self {
90+
public func digest(using algorithm: Digest.Algorithm) -> Data {
8991

90-
#if os(OSX)
91-
92-
// This force unwrap may look scary but for CommonCrypto this cannot fail.
93-
// The API allows for optionals to support the OpenSSL implementation which can.
94-
let result = (Digest(using: algorithm).update(data: self)?.final())!
95-
let data = self.dynamicType.init(bytes: result, length: result.count)
96-
return data
97-
98-
#elseif os(Linux)
99-
100-
fatalError("This API currently not supported on Linux.")
101-
102-
#endif
92+
// This force unwrap may look scary but for CommonCrypto this cannot fail.
93+
// The API allows for optionals to support the OpenSSL implementation which can.
94+
let result = (Digest(using: algorithm).update(data: self)?.final())!
95+
let data = self.dynamicType.init(bytes: result, count: result.count)
96+
return data
10397
}
10498
}
99+
100+
#endif
105101

106102
///
107103
/// Extension for String to return a String containing the digest.

Sources/HMAC.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ public class HMAC : Updateable {
238238

239239
self.algorithm = algorithm
240240
#if os(OSX)
241-
CCHmacInit(context, algorithm.nativeValue(), key, size_t(key.lengthOfBytes(using: NSUTF8StringEncoding)))
241+
CCHmacInit(context, algorithm.nativeValue(), key, size_t(key.lengthOfBytes(using: String.Encoding.utf8)))
242242
#elseif os(Linux)
243243
HMAC_Init(context, key, Int32(key.utf8.count), algorithm.nativeValue())
244244
#endif

Tests/Cryptor/CryptorTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ class CryptorTests: XCTestCase {
415415
XCTAssertEqual(shaShortBlock.sha384, sha384BlockOutput)
416416
XCTAssertEqual(shaShortBlock.sha512, sha512BlockOutput)
417417
#if os(OSX)
418-
let theData: NSData = shaShortBlock.data(using:NSUTF8StringEncoding)!
418+
let theData: Data = shaShortBlock.data(using:String.Encoding.utf8)!
419419
XCTAssertEqual(theData.sha224, CryptoUtils.data(fromHex: sha224BlockOutput))
420420
XCTAssertEqual(theData.sha256, CryptoUtils.data(fromHex: sha256BlockOutput))
421421
XCTAssertEqual(theData.sha384, CryptoUtils.data(fromHex: sha384BlockOutput))

0 commit comments

Comments
 (0)