Skip to content

Commit 8e77074

Browse files
committed
Add cevfs_mod.c for shell activation.
1 parent 9f438a0 commit 8e77074

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

cevfs_build/cevfs_mod.c

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/**
2+
CEVFS - Compression & Encryption VFS
3+
cevfs_mod (shell module activation)
4+
5+
Copyright (c) 2016 Ryan Homer, Murage Inc.
6+
7+
MIT License
8+
9+
Permission is hereby granted, free of charge, to any person obtaining a copy
10+
of this software and associated documentation files (the "Software"), to deal
11+
in the Software without restriction, including without limitation the rights
12+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13+
copies of the Software, and to permit persons to whom the Software is
14+
furnished to do so, subject to the following conditions:
15+
16+
The above copyright notice and this permission notice shall be included in all
17+
copies or substantial portions of the Software.
18+
19+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25+
SOFTWARE.
26+
*/
27+
28+
#include "xMethods.c"
29+
30+
struct context ctx;
31+
32+
void sqlite3_activate_cerod(const char *key) {
33+
char *pKeyBytes = sqlite3HexToBlob(NULL, key+2, strlen(key+2)-1);
34+
35+
ctx.pKey = pKeyBytes; // 32-bit encryption hex key
36+
ctx.nKeySz = kCCKeySizeAES256; // key size in bytes
37+
ctx.nIvSz = kCCBlockSizeAES128; // size of IV in bytes
38+
39+
cevfs_create_vfs("cevfs-cerod", NULL, &ctx, cevfsAutoDetect, 1);
40+
}

0 commit comments

Comments
 (0)