Skip to content

Commit 46504c9

Browse files
committed
Pass sqlite3_malloc fn ptr in xEncrypt.
1 parent 70f2c43 commit 46504c9

File tree

2 files changed

+15
-11
lines changed

2 files changed

+15
-11
lines changed

cevfs/cevfs.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1049,7 +1049,8 @@ static int cevfsWrite(
10491049
nDest, // data-in length
10501050
iv, // IV out
10511051
&pEncBuf, // dataOut; result is written here.
1052-
&tmp_csz // On successful return, the number of bytes written to dataOut.
1052+
&tmp_csz, // On successful return, the number of bytes written to dataOut.
1053+
sqlite3_malloc
10531054
);
10541055
}
10551056

cevfs/cevfs.h

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
#ifndef cevfs_h
1010
#define cevfs_h
1111

12+
#define CEVFS_OK 0
13+
1214
#define CEVFS_ERROR 111
1315
#define CEVFS_ERROR_PAGE_SIZE_TOO_SMALL (CEVFS_ERROR | (1<<8))
1416
#define CEVFS_ERROR_MALFORMED_KEY (CEVFS_ERROR | (2<<8))
@@ -27,12 +29,13 @@ struct CevfsMethods {
2729
int (*xUncompress)(void *pCtx, char *aDest, size_t *pnDataOutSize, char *aSrc, size_t nDataInSize);
2830

2931
int (*xEncrypt)(
30-
void *pCtx,
31-
const void *pDataIn,
32-
size_t nDataInSize,
33-
void *pIvOut,
34-
void **pDataOut,
35-
size_t *nDataSizeOut
32+
void *pCtx, // in: the context
33+
const void *pDataIn, // in: the unencrypted data
34+
size_t nDataInSize, // in: the size of the unencrypted data
35+
void *pIvOut, // out: the randomly created IV
36+
void **pDataOut, // out: the encrypted data
37+
size_t *nDataSizeOut, // out: size of encrypted data
38+
void *sqlite3_malloc(int n) // in: pointer to the sqlite3_malloc function
3639
);
3740

3841
int (*xDecrypt)(
@@ -65,10 +68,10 @@ int cevfs_destroy_vfs(const char *zName);
6568
\param destUri URI of non-existing destination database file with optional parameters (block_size, key)
6669
*/
6770
int cevfs_build(
68-
const char *srcDbPath,
69-
const char *destUri,
70-
void *pCtx, // Context pointer to be passed to CEVFS methods.
71-
t_xAutoDetect
71+
const char *zSrcFilename, // Source SQLite DB filename, including path. Can be a URI.
72+
const char *zDestFilename, // Destination SQLite DB filename, including path. Can be a URI.
73+
void *pCtx, // Context pointer to be passed to CEVFS xMethods.
74+
t_xAutoDetect // xAutoDetect method to set up xMethods.
7275
);
7376

7477
#endif /* cevfs_h */

0 commit comments

Comments
 (0)