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    283   		}
   284    284   		h &= ((~g) & 0xffffffffLU);
   285    285   	}
   286    286           
   287    287           return(h);
   288    288   }
   289    289   
   290         -static int cvfs_decrypt(unsigned char *out, const unsigned char *in, unsigned long in_out_length, struct cvfs_key *key) {
          290  +static int cvfs_decrypt(unsigned char *out, const unsigned char *in, unsigned long offset, unsigned long in_out_length, struct cvfs_key *key) {
   291    291   	unsigned long i;
   292    292   	unsigned char in_ch, out_ch;
   293    293   	int ch_idx;
   294    294   
   295         -	for (i = 0; i < in_out_length; i++) {
          295  +	for (i = offset; i < in_out_length; i++) {
   296    296   		in_ch = in[i];
   297    297   
   298    298   		ch_idx = (in_ch + (i / key->typedata.rotate_subst.rotate_length)) % 256;
   299    299   
   300    300   		out_ch = key->typedata.rotate_subst.subst[ch_idx];
   301    301   		out[i] = out_ch;
   302    302   	}
................................................................................
   510    510   if {$obsfucate} {
   511    511   	puts "static void ${code_tag}_decryptFile(const char *path, struct cvfs_data *finfo) {"
   512    512   	puts "\tstatic struct cvfs_key key = { [string map [list "\n" " "] [encrypt_key_export $obsfucation_key "c"]] };"
   513    513   	puts "\tunsigned char *new_data, *old_data;"
   514    514   	puts "\tint decrypt_ret, free_old_data;"
   515    515   	puts ""
   516    516   	puts "\tnew_data = (void *) Tcl_Alloc(finfo->size);"
   517         -	puts "\tdecrypt_ret = cvfs_decrypt(new_data, finfo->data, finfo->size, &key);"
          517  +	puts "\tdecrypt_ret = cvfs_decrypt(new_data, finfo->data, 0, finfo->size, &key);"
   518    518   	puts "\tif (decrypt_ret != 0) {"
   519    519   	puts "\t\tTcl_Free((void *) new_data);"
   520    520   	puts ""
   521    521   	puts "\t\treturn;"
   522    522   	puts "\t}"
   523    523   	puts ""
   524    524   	puts "\tfree_old_data = finfo->free;"