Skip to content

Commit 9f438a0

Browse files
committed
Add cevfs_build project for easy reference.
This project is meant to be built into a stand-alone utility to be executed from the command line.
1 parent 0b58382 commit 9f438a0

File tree

4 files changed

+422
-0
lines changed

4 files changed

+422
-0
lines changed

cevfs.xcworkspace/contents.xcworkspacedata

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

cevfs_build/cevfs_build.c

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
//
2+
// main.c
3+
// ceimport
4+
//
5+
// Created by Ryan Homer on 2/4/2016.
6+
// Copyright © 2016 Murage Inc. All rights reserved.
7+
//
8+
9+
#include <stdio.h>
10+
#include <assert.h>
11+
#include <string.h>
12+
#include "cevfs.h"
13+
#include "xMethods.c"
14+
15+
typedef uint8_t u8;
16+
17+
extern const char *fileTail(const char *z);
18+
extern void *sqlite3HexToBlob(sqlite3 *db, const char *z, int n);
19+
20+
int main(int argc, const char * argv[]) {
21+
if( argc != 4 ){
22+
printf("Usage: %s UNCOMPRESSED COMPRESSED KEY\n", fileTail(argv[0]));
23+
printf(" UNCOMPRESSED: URI of uncompressed SQLite DB file.\n");
24+
printf(" COMPRESSED: URI of new compressed DB with optional ?block_size=<block_size>\n");
25+
printf(" KEY: Encryption key in the form: x'<hex1><hex2>...<hex32>'\n");
26+
return EXIT_FAILURE;
27+
}
28+
29+
int rc;
30+
31+
// This context will be passed to xAutoDetect and the functions defined within.
32+
struct context ctx;
33+
34+
// Convert encryption key string to hex blob.
35+
// This assumes that the key is in the form of x'<hex-string>'
36+
// You should, of course, implement proper error checking.
37+
const char *key = arvg[3]+2;
38+
char *keyBytes = sqlite3HexToBlob(NULL, key, strlen(key)-1);
39+
40+
ctx.pKey = keyBytes; // 32-bit encryption hex key
41+
ctx.nKeySz = kCCKeySizeAES256; // key size in bytes
42+
ctx.nIvSz = kCCBlockSizeAES128; // size of IV in bytes
43+
44+
// If you will be using the VFS name to determine how you set up your xMethods,
45+
// you may want to pass the VFS name as a command line parameter as well.
46+
// For now, we'll just pass "CEVFS-default".
47+
rc = cevfs_build(argv[1], argv[2], "CEVFS-default", &ctx, cevfsAutoDetect);
48+
return rc;
49+
}
Lines changed: 255 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,255 @@
1+
// !$*UTF8*$!
2+
{
3+
archiveVersion = 1;
4+
classes = {
5+
};
6+
objectVersion = 46;
7+
objects = {
8+
9+
/* Begin PBXBuildFile section */
10+
944223791D20A7E00016E082 /* cevfs_build.c in Sources */ = {isa = PBXBuildFile; fileRef = 944223781D20A7E00016E082 /* cevfs_build.c */; };
11+
9442237B1D20BCAE0016E082 /* libsqlite.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9442237A1D20BCAE0016E082 /* libsqlite.a */; };
12+
/* End PBXBuildFile section */
13+
14+
/* Begin PBXCopyFilesBuildPhase section */
15+
944223691D20A59B0016E082 /* CopyFiles */ = {
16+
isa = PBXCopyFilesBuildPhase;
17+
buildActionMask = 2147483647;
18+
dstPath = /usr/share/man/man1/;
19+
dstSubfolderSpec = 0;
20+
files = (
21+
);
22+
runOnlyForDeploymentPostprocessing = 1;
23+
};
24+
/* End PBXCopyFilesBuildPhase section */
25+
26+
/* Begin PBXFileReference section */
27+
9442236B1D20A59B0016E082 /* cevfs_build */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = cevfs_build; sourceTree = BUILT_PRODUCTS_DIR; };
28+
944223751D20A6870016E082 /* xMethods.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = xMethods.c; sourceTree = "<group>"; };
29+
944223781D20A7E00016E082 /* cevfs_build.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cevfs_build.c; sourceTree = "<group>"; };
30+
9442237A1D20BCAE0016E082 /* libsqlite.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libsqlite.a; path = "../../../Library/Developer/Xcode/DerivedData/cevfs-hfabimsbqwgxjbecetgifrofdoaw/Build/Products/Debug/libsqlite.a"; sourceTree = "<group>"; };
31+
/* End PBXFileReference section */
32+
33+
/* Begin PBXFrameworksBuildPhase section */
34+
944223681D20A59B0016E082 /* Frameworks */ = {
35+
isa = PBXFrameworksBuildPhase;
36+
buildActionMask = 2147483647;
37+
files = (
38+
9442237B1D20BCAE0016E082 /* libsqlite.a in Frameworks */,
39+
);
40+
runOnlyForDeploymentPostprocessing = 0;
41+
};
42+
/* End PBXFrameworksBuildPhase section */
43+
44+
/* Begin PBXGroup section */
45+
944223621D20A59B0016E082 = {
46+
isa = PBXGroup;
47+
children = (
48+
944223781D20A7E00016E082 /* cevfs_build.c */,
49+
944223751D20A6870016E082 /* xMethods.c */,
50+
9442237E1D20BD300016E082 /* Frameworks */,
51+
9442236C1D20A59B0016E082 /* Products */,
52+
);
53+
sourceTree = "<group>";
54+
};
55+
9442236C1D20A59B0016E082 /* Products */ = {
56+
isa = PBXGroup;
57+
children = (
58+
9442236B1D20A59B0016E082 /* cevfs_build */,
59+
);
60+
name = Products;
61+
sourceTree = "<group>";
62+
};
63+
9442237E1D20BD300016E082 /* Frameworks */ = {
64+
isa = PBXGroup;
65+
children = (
66+
9442237A1D20BCAE0016E082 /* libsqlite.a */,
67+
);
68+
name = Frameworks;
69+
sourceTree = "<group>";
70+
};
71+
/* End PBXGroup section */
72+
73+
/* Begin PBXNativeTarget section */
74+
9442236A1D20A59B0016E082 /* cevfs_build */ = {
75+
isa = PBXNativeTarget;
76+
buildConfigurationList = 944223721D20A59B0016E082 /* Build configuration list for PBXNativeTarget "cevfs_build" */;
77+
buildPhases = (
78+
944223671D20A59B0016E082 /* Sources */,
79+
944223681D20A59B0016E082 /* Frameworks */,
80+
944223691D20A59B0016E082 /* CopyFiles */,
81+
);
82+
buildRules = (
83+
);
84+
dependencies = (
85+
);
86+
name = cevfs_build;
87+
productName = cevfs_build;
88+
productReference = 9442236B1D20A59B0016E082 /* cevfs_build */;
89+
productType = "com.apple.product-type.tool";
90+
};
91+
/* End PBXNativeTarget section */
92+
93+
/* Begin PBXProject section */
94+
944223631D20A59B0016E082 /* Project object */ = {
95+
isa = PBXProject;
96+
attributes = {
97+
LastUpgradeCheck = 0730;
98+
ORGANIZATIONNAME = "Murage Inc.";
99+
TargetAttributes = {
100+
9442236A1D20A59B0016E082 = {
101+
CreatedOnToolsVersion = 7.3.1;
102+
};
103+
};
104+
};
105+
buildConfigurationList = 944223661D20A59B0016E082 /* Build configuration list for PBXProject "cevfs_build" */;
106+
compatibilityVersion = "Xcode 3.2";
107+
developmentRegion = English;
108+
hasScannedForEncodings = 0;
109+
knownRegions = (
110+
en,
111+
);
112+
mainGroup = 944223621D20A59B0016E082;
113+
productRefGroup = 9442236C1D20A59B0016E082 /* Products */;
114+
projectDirPath = "";
115+
projectRoot = "";
116+
targets = (
117+
9442236A1D20A59B0016E082 /* cevfs_build */,
118+
);
119+
};
120+
/* End PBXProject section */
121+
122+
/* Begin PBXSourcesBuildPhase section */
123+
944223671D20A59B0016E082 /* Sources */ = {
124+
isa = PBXSourcesBuildPhase;
125+
buildActionMask = 2147483647;
126+
files = (
127+
944223791D20A7E00016E082 /* cevfs_build.c in Sources */,
128+
);
129+
runOnlyForDeploymentPostprocessing = 0;
130+
};
131+
/* End PBXSourcesBuildPhase section */
132+
133+
/* Begin XCBuildConfiguration section */
134+
944223701D20A59B0016E082 /* Debug */ = {
135+
isa = XCBuildConfiguration;
136+
buildSettings = {
137+
CLANG_ANALYZER_NONNULL = YES;
138+
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
139+
CLANG_CXX_LIBRARY = "libc++";
140+
CLANG_ENABLE_MODULES = YES;
141+
CLANG_ENABLE_OBJC_ARC = YES;
142+
CLANG_WARN_BOOL_CONVERSION = YES;
143+
CLANG_WARN_CONSTANT_CONVERSION = YES;
144+
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
145+
CLANG_WARN_EMPTY_BODY = YES;
146+
CLANG_WARN_ENUM_CONVERSION = YES;
147+
CLANG_WARN_INT_CONVERSION = YES;
148+
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
149+
CLANG_WARN_UNREACHABLE_CODE = YES;
150+
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
151+
CODE_SIGN_IDENTITY = "-";
152+
COPY_PHASE_STRIP = NO;
153+
DEBUG_INFORMATION_FORMAT = dwarf;
154+
ENABLE_STRICT_OBJC_MSGSEND = YES;
155+
ENABLE_TESTABILITY = YES;
156+
GCC_C_LANGUAGE_STANDARD = gnu99;
157+
GCC_DYNAMIC_NO_PIC = NO;
158+
GCC_NO_COMMON_BLOCKS = YES;
159+
GCC_OPTIMIZATION_LEVEL = 0;
160+
GCC_PREPROCESSOR_DEFINITIONS = (
161+
"DEBUG=1",
162+
"$(inherited)",
163+
);
164+
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
165+
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
166+
GCC_WARN_UNDECLARED_SELECTOR = YES;
167+
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
168+
GCC_WARN_UNUSED_FUNCTION = YES;
169+
GCC_WARN_UNUSED_VARIABLE = YES;
170+
MACOSX_DEPLOYMENT_TARGET = 10.11;
171+
MTL_ENABLE_DEBUG_INFO = YES;
172+
ONLY_ACTIVE_ARCH = YES;
173+
OTHER_LDFLAGS = "-lz";
174+
SDKROOT = macosx;
175+
USER_HEADER_SEARCH_PATHS = "../cevfs/**";
176+
};
177+
name = Debug;
178+
};
179+
944223711D20A59B0016E082 /* Release */ = {
180+
isa = XCBuildConfiguration;
181+
buildSettings = {
182+
CLANG_ANALYZER_NONNULL = YES;
183+
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
184+
CLANG_CXX_LIBRARY = "libc++";
185+
CLANG_ENABLE_MODULES = YES;
186+
CLANG_ENABLE_OBJC_ARC = YES;
187+
CLANG_WARN_BOOL_CONVERSION = YES;
188+
CLANG_WARN_CONSTANT_CONVERSION = YES;
189+
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
190+
CLANG_WARN_EMPTY_BODY = YES;
191+
CLANG_WARN_ENUM_CONVERSION = YES;
192+
CLANG_WARN_INT_CONVERSION = YES;
193+
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
194+
CLANG_WARN_UNREACHABLE_CODE = YES;
195+
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
196+
CODE_SIGN_IDENTITY = "-";
197+
COPY_PHASE_STRIP = NO;
198+
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
199+
ENABLE_NS_ASSERTIONS = NO;
200+
ENABLE_STRICT_OBJC_MSGSEND = YES;
201+
GCC_C_LANGUAGE_STANDARD = gnu99;
202+
GCC_NO_COMMON_BLOCKS = YES;
203+
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
204+
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
205+
GCC_WARN_UNDECLARED_SELECTOR = YES;
206+
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
207+
GCC_WARN_UNUSED_FUNCTION = YES;
208+
GCC_WARN_UNUSED_VARIABLE = YES;
209+
MACOSX_DEPLOYMENT_TARGET = 10.11;
210+
MTL_ENABLE_DEBUG_INFO = NO;
211+
OTHER_LDFLAGS = "-lz";
212+
SDKROOT = macosx;
213+
USER_HEADER_SEARCH_PATHS = "../cevfs/**";
214+
};
215+
name = Release;
216+
};
217+
944223731D20A59B0016E082 /* Debug */ = {
218+
isa = XCBuildConfiguration;
219+
buildSettings = {
220+
PRODUCT_NAME = "$(TARGET_NAME)";
221+
};
222+
name = Debug;
223+
};
224+
944223741D20A59B0016E082 /* Release */ = {
225+
isa = XCBuildConfiguration;
226+
buildSettings = {
227+
PRODUCT_NAME = "$(TARGET_NAME)";
228+
};
229+
name = Release;
230+
};
231+
/* End XCBuildConfiguration section */
232+
233+
/* Begin XCConfigurationList section */
234+
944223661D20A59B0016E082 /* Build configuration list for PBXProject "cevfs_build" */ = {
235+
isa = XCConfigurationList;
236+
buildConfigurations = (
237+
944223701D20A59B0016E082 /* Debug */,
238+
944223711D20A59B0016E082 /* Release */,
239+
);
240+
defaultConfigurationIsVisible = 0;
241+
defaultConfigurationName = Release;
242+
};
243+
944223721D20A59B0016E082 /* Build configuration list for PBXNativeTarget "cevfs_build" */ = {
244+
isa = XCConfigurationList;
245+
buildConfigurations = (
246+
944223731D20A59B0016E082 /* Debug */,
247+
944223741D20A59B0016E082 /* Release */,
248+
);
249+
defaultConfigurationIsVisible = 0;
250+
defaultConfigurationName = Release;
251+
};
252+
/* End XCConfigurationList section */
253+
};
254+
rootObject = 944223631D20A59B0016E082 /* Project object */;
255+
}

0 commit comments

Comments
 (0)