Check-in [a400fc4409]
Overview
Comment:Updated to support partial decryption of data
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: a400fc44090cc4efa252a45dda88f6b3e0b8f43d
User & Date: rkeene on 2016-12-09 04:18:12
Other Links: manifest | tags
Context
2016-12-09
15:00
Updated to latest version of tcc4tcl check-in: 05b1c2cb3a user: rkeene tags: trunk
04:18
Updated to support partial decryption of data check-in: a400fc4409 user: rkeene tags: trunk
2016-11-10
21:14
Updated to use Tcl allocation routines for memory allocating/releasing check-in: 0fb3b3b582 user: rkeene tags: trunk
Changes

Modified kitsh/buildsrc/kitsh-0.0/dir2c.tcl from [74a40bc096] to [990f9a7e47].

283
284
285
286
287
288
289
290

291
292
293
294
295

296
297
298
299
300
301
302
283
284
285
286
287
288
289

290
291
292
293
294

295
296
297
298
299
300
301
302







-
+




-
+







		}
		h &= ((~g) & 0xffffffffLU);
	}
        
        return(h);
}

static int cvfs_decrypt(unsigned char *out, const unsigned char *in, unsigned long in_out_length, struct cvfs_key *key) {
static int cvfs_decrypt(unsigned char *out, const unsigned char *in, unsigned long offset, unsigned long in_out_length, struct cvfs_key *key) {
	unsigned long i;
	unsigned char in_ch, out_ch;
	int ch_idx;

	for (i = 0; i < in_out_length; i++) {
	for (i = offset; i < in_out_length; i++) {
		in_ch = in[i];

		ch_idx = (in_ch + (i / key->typedata.rotate_subst.rotate_length)) % 256;

		out_ch = key->typedata.rotate_subst.subst[ch_idx];
		out[i] = out_ch;
	}
510
511
512
513
514
515
516
517

518
519
520
521
522
523
524
510
511
512
513
514
515
516

517
518
519
520
521
522
523
524







-
+







if {$obsfucate} {
	puts "static void ${code_tag}_decryptFile(const char *path, struct cvfs_data *finfo) {"
	puts "\tstatic struct cvfs_key key = { [string map [list "\n" " "] [encrypt_key_export $obsfucation_key "c"]] };"
	puts "\tunsigned char *new_data, *old_data;"
	puts "\tint decrypt_ret, free_old_data;"
	puts ""
	puts "\tnew_data = (void *) Tcl_Alloc(finfo->size);"
	puts "\tdecrypt_ret = cvfs_decrypt(new_data, finfo->data, finfo->size, &key);"
	puts "\tdecrypt_ret = cvfs_decrypt(new_data, finfo->data, 0, finfo->size, &key);"
	puts "\tif (decrypt_ret != 0) {"
	puts "\t\tTcl_Free((void *) new_data);"
	puts ""
	puts "\t\treturn;"
	puts "\t}"
	puts ""
	puts "\tfree_old_data = finfo->free;"