** SQLITE_HAVE_ZONEFILE_CODEC defined.
*/
typedef struct ZonefileCodec ZonefileCodec;
-static int zonefileCodecCreate(int,unsigned char*,int,ZonefileCodec**,char**);
+static int zonefileCodecCreate(
+ int,int,unsigned char*,int,ZonefileCodec**,char**);
static int zonefileCodecNonceSize(ZonefileCodec*);
static void zonefileCodecEncode(ZonefileCodec*, unsigned char*, int);
static void zonefileCodecDecode(ZonefileCodec*, unsigned char*, int);
struct ZonefileCodec {
u8 aKey[16];
+ int bEncrypt; /* Second parameter passed to Create() */
};
/* Create a new encryption module instance using algorithm iAlg.
*/
static int zonefileCodecCreate(
int iAlg,
+ int bEncrypt, /* True for encryption, zero for decryption */
unsigned char *pKey, int nKey,
ZonefileCodec **pp,
char **pzErr
for(i=0; i<sizeof(pRet->aKey); i++){
pRet->aKey[i] = pKey[i % nKey];
}
+ pRet->bEncrypt = bEncrypt;
}
}
){
int i;
u8 *aNonce = &pIn[nIn];
+ assert( pCodec->bEncrypt );
sqlite3_randomness(16, aNonce);
for(i=0; i<nIn; i++){
pIn[i] = pIn[i] ^ aNonce[i%16] ^ pCodec->aKey[i%16];
){
int i;
u8 *aNonce = &pIn[nIn-16];
+ assert( pCodec->bEncrypt==0 );
for(i=0; i<nIn-16; i++){
pIn[i] = pIn[i] ^ aNonce[i%16] ^ pCodec->aKey[i%16];
}
if( sParam.encryptionType!=0 ){
int n = strlen(sParam.encryptionKey);
rc = zonefileCodecCreate(
- sParam.encryptionType, (u8*)sParam.encryptionKey, n, &pCodec, &zErr
+ sParam.encryptionType, 1, (u8*)sParam.encryptionKey, n, &pCodec, &zErr
);
if( rc!=SQLITE_OK ){
if( zErr ){
zErr = sqlite3_mprintf("missing encryption key for file \"%s\"", zFile);
rc = SQLITE_ERROR;
}else{
- rc = zonefileCodecCreate(hdr.encryptionType, (u8*)z, n, &pCodec, &zErr);
+ rc = zonefileCodecCreate(hdr.encryptionType, 0, (u8*)z,n,&pCodec,&zErr);
}
}
-C Test\sedge\scases\sin\sthe\szonefile\smodule.\sFix\sa\sbroken\serror\smessage\sin\sthe\ssame.
-D 2018-02-24T08:26:21.801
+C Add\sextra\sparameter\sto\szonefileCodecCreate()\sto\sindicate\swhether\sthe\snew\nobject\swill\sbe\sused\sfor\smock-encryption\sor\smock-decryption.
+D 2018-02-26T07:58:39.046
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F Makefile.in a2d2fb8d17c39ab5ec52beb27850b903949080848236923f436156b72a958737
F ext/userauth/user-auth.txt e6641021a9210364665fe625d067617d03f27b04
F ext/userauth/userauth.c 3410be31283abba70255d71fd24734e017a4497f
F ext/zonefile/README.md df86ef5b4f9aa8b07e1c8124b3f2dcea616927385aad59d525b784f0a06d446c
-F ext/zonefile/zonefile.c eeba1f8a353661998b2e54d499c0fd7241946d48285d1e20fc86ac1c81651b6c
-F ext/zonefile/zonefile1.test 43e10166a74187d997a224c4f199cabfdbf4c17f704759fd37b0fcb8616c26a3
+F ext/zonefile/zonefile.c 4af6b26c047f6510816536e7423cc5fa61b28c9ad77d83bf0648637de9d67441
+F ext/zonefile/zonefile1.test 79ac1a99674b986dab6ce5e8bf342e9585cd7fd02406ea223c969624b93dd46f
F ext/zonefile/zonefileenc.test 10e770105edeff6a05df6be8db5481eaa8fcda2422ec5446ad21b34ed70d02d7
F ext/zonefile/zonefilefault.test 6f0b10364972981380de65e8665b7a8f882a70ec7ee188695fe199f2851e180e
F install-sh 9d4de14ab9fb0facae2f48780b874848cbf2f895 x
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P 9a99afafa3fb9ec4823e5030cb04a685d64942ec04a1154b729dc4c0f313dc4a
-R 6618d746fdec54fbaf0229c804a7cf37
+P 1764ade22b52eba0226ae2e6e837a1b0967023eabd7d50e9f87c5e7042ea2f12
+R c1770a6f91e4d8e969767de9b3f750ba
U dan
-Z 6cb0aff8f941832f5fc5365c2afb34dd
+Z 4642b01a17023ca2ce0927319db5bcf7