Skip to content

Commit f0371ed

Browse files
committed
Cleaned up project and updated dependencies
1 parent a4ae407 commit f0371ed

File tree

10 files changed

+87
-34
lines changed

10 files changed

+87
-34
lines changed

CryptomatorCryptoLib.xcodeproj/project.pbxproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,12 +154,12 @@
154154
4A7C21362451F2AC00DE81E6 /* Info.plist */,
155155
9EB822C0248AF82200879838 /* AesCtr.swift */,
156156
9E44EEA524599C6900A37B01 /* AesSiv.swift */,
157+
9E97DC8C25F77BA40046C83E /* ContentCryptor.swift */,
157158
74F0F753248FC89B00B4C26D /* CryptoError.swift */,
158159
9E9BB811245412E900F9FF51 /* Cryptor.swift */,
159160
74F0F7592490C1EB00B4C26D /* CryptoSupport.swift */,
160161
9E9BB8132454708600F9FF51 /* Masterkey.swift */,
161162
74B4D38C2588CD60006C0567 /* MasterkeyFile.swift */,
162-
9E97DC8C25F77BA40046C83E /* ContentCryptor.swift */,
163163
);
164164
path = CryptomatorCryptoLib;
165165
sourceTree = "<group>";
@@ -320,7 +320,7 @@
320320
isa = PBXProject;
321321
attributes = {
322322
LastSwiftUpdateCheck = 1140;
323-
LastUpgradeCheck = 1240;
323+
LastUpgradeCheck = 1250;
324324
ORGANIZATIONNAME = "Skymatic GmbH";
325325
TargetAttributes = {
326326
4A7C21312451F2AC00DE81E6 = {
@@ -788,7 +788,7 @@
788788
repositoryURL = "https://github.com/norio-nomura/Base32.git";
789789
requirement = {
790790
kind = upToNextMinorVersion;
791-
minimumVersion = 0.8.0;
791+
minimumVersion = 0.9.0;
792792
};
793793
};
794794
/* End XCRemoteSwiftPackageReference section */

CryptomatorCryptoLib.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

CryptomatorCryptoLib.xcodeproj/xcshareddata/xcschemes/CryptomatorCryptoLib.xcscheme

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "1240"
3+
LastUpgradeVersion = "1250"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Scheme
3+
LastUpgradeVersion = "1250"
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 = "749260CD25B17A9A004B3426"
18+
BuildableName = "scrypt.framework"
19+
BlueprintName = "scrypt"
20+
ReferencedContainer = "container:CryptomatorCryptoLib.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+
</TestAction>
33+
<LaunchAction
34+
buildConfiguration = "Debug"
35+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
36+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
37+
launchStyle = "0"
38+
useCustomWorkingDirectory = "NO"
39+
ignoresPersistentStateOnLaunch = "NO"
40+
debugDocumentVersioning = "YES"
41+
debugServiceExtension = "internal"
42+
allowLocationSimulation = "YES">
43+
</LaunchAction>
44+
<ProfileAction
45+
buildConfiguration = "Release"
46+
shouldUseLaunchSchemeArgsEnv = "YES"
47+
savedToolIdentifier = ""
48+
useCustomWorkingDirectory = "NO"
49+
debugDocumentVersioning = "YES">
50+
<MacroExpansion>
51+
<BuildableReference
52+
BuildableIdentifier = "primary"
53+
BlueprintIdentifier = "749260CD25B17A9A004B3426"
54+
BuildableName = "scrypt.framework"
55+
BlueprintName = "scrypt"
56+
ReferencedContainer = "container:CryptomatorCryptoLib.xcodeproj">
57+
</BuildableReference>
58+
</MacroExpansion>
59+
</ProfileAction>
60+
<AnalyzeAction
61+
buildConfiguration = "Debug">
62+
</AnalyzeAction>
63+
<ArchiveAction
64+
buildConfiguration = "Release"
65+
revealArchiveInOrganizer = "YES">
66+
</ArchiveAction>
67+
</Scheme>

Package.resolved

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ let package = Package(
2020
.library(name: "CryptomatorCryptoLib", targets: ["CryptomatorCryptoLib"])
2121
],
2222
dependencies: [
23-
.package(url: "https://github.com/norio-nomura/Base32.git", .upToNextMinor(from: "0.8.0"))
23+
.package(url: "https://github.com/norio-nomura/Base32.git", .upToNextMinor(from: "0.9.0"))
2424
],
2525
targets: [
2626
.target(name: "CryptomatorCryptoLib", dependencies: ["Base32", "scrypt"]),

Sources/CryptomatorCryptoLib/ContentCryptor.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ protocol ContentCryptor {
2020
- Parameter key: The encryption key.
2121
- Parameter nonce: The nonce/IV to use.
2222
- Parameter ad: Associated data, which needs to be authenticated during decryption.
23-
- Returns: Nonce/IV + ciphertext + MAC/tag, as a concatenated byte array
23+
- Returns: Nonce/IV + ciphertext + MAC/tag, as a concatenated byte array.
2424
*/
2525
func encrypt(_ chunk: [UInt8], key: [UInt8], nonce: [UInt8], ad: [UInt8]...) throws -> [UInt8]
2626

@@ -30,18 +30,18 @@ protocol ContentCryptor {
3030
- Parameter chunk: The nonce/IV + ciphertext + MAC/tag, as a concatenated byte array.
3131
- Parameter key: The encryption key.
3232
- Parameter ad: Associated data, which needs to be authenticated during decryption.
33-
- Returns: The original cleartext
33+
- Returns: The original cleartext.
3434
*/
3535
func decrypt(_ chunk: [UInt8], key: [UInt8], ad: [UInt8]...) throws -> [UInt8]
3636
}
3737

3838
class CtrThenHmacContentCryptor: ContentCryptor {
39-
private let macKey: [UInt8]
40-
private let cryptoSupport: CryptoSupport
41-
4239
let nonceLen = kCCBlockSizeAES128
4340
let tagLen = Int(CC_SHA256_DIGEST_LENGTH)
4441

42+
private let macKey: [UInt8]
43+
private let cryptoSupport: CryptoSupport
44+
4545
init(macKey: [UInt8], cryptoSupport: CryptoSupport) {
4646
self.macKey = macKey
4747
self.cryptoSupport = cryptoSupport

Sources/CryptomatorCryptoLib/Cryptor.swift

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,9 @@
66
// Copyright © 2020 Skymatic GmbH. All rights reserved.
77
//
88

9+
import Base32
910
import CommonCrypto
1011
import Foundation
11-
#if COCOAPODS
12-
import SwiftBase32
13-
#else
14-
import Base32
15-
#endif
1612

1713
public extension Data {
1814
init?(base64UrlEncoded base64String: String, options: Data.Base64DecodingOptions = []) {
@@ -65,16 +61,16 @@ struct FileHeader {
6561

6662
public class Cryptor {
6763
private let fileHeaderLegacyPayloadSize = 8
68-
private let cleartextChunkSize = 32 * 1024
69-
private var ciphertextChunkSize: Int {
70-
return contentCryptor.nonceLen + cleartextChunkSize + contentCryptor.tagLen
71-
}
72-
7364
public var fileHeaderSize: Int {
7465
let fileHeaderPayloadSize = fileHeaderLegacyPayloadSize + kCCKeySizeAES256
7566
return contentCryptor.nonceLen + fileHeaderPayloadSize + contentCryptor.tagLen
7667
}
7768

69+
private let cleartextChunkSize = 32 * 1024
70+
private var ciphertextChunkSize: Int {
71+
return contentCryptor.nonceLen + cleartextChunkSize + contentCryptor.tagLen
72+
}
73+
7874
private let masterkey: Masterkey
7975
private let cryptoSupport: CryptoSupport
8076
private let contentCryptor: ContentCryptor

Sources/CryptomatorCryptoLib/MasterkeyFile.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,7 @@
88

99
import CommonCrypto
1010
import Foundation
11-
#if COCOAPODS
12-
import CryptomatorCryptoLib.scrypt
13-
#else
1411
import scrypt
15-
#endif
1612

1713
struct Content: Codable, Equatable {
1814
let version: Int

Sources/scrypt/scrypt.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,4 @@ FOUNDATION_EXPORT double scryptVersionNumber;
1515
FOUNDATION_EXPORT const unsigned char scryptVersionString[];
1616

1717
// In this header, you should import all the public headers of your framework using statements like #import <scrypt/PublicHeader.h>
18-
#if COCOAPODS
19-
#import "crypto_scrypt.h"
20-
#else
2118
#import <scrypt/crypto_scrypt.h>
22-
#endif
23-
24-

0 commit comments

Comments
 (0)