Browse Source

it works again

wangyu 8 years ago
parent
commit
7933edd9ac
3 changed files with 357 additions and 219 deletions
  1. 3 3
      encrypt.cpp
  2. 352 214
      main.cpp
  3. 2 2
      makefile

+ 3 - 3
encrypt.cpp

@@ -13,7 +13,7 @@
 static int8_t zero_iv[]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,   0,0,0,0};//this prog use zero iv,you should make sure first block of data contains a random/nonce data
 
 extern const int max_data_len;
-const int buf_len=65535;
+extern const int buf_len;//=65535;
 
 map<int, string> auth_mode_tostring = {{auth_none, "none"}, {auth_md5, "md5"}, {auth_crc32, "crc32"},{auth_sum,"sum"}};
 map<int, string> cipher_mode_tostring={{cipher_none,"none"},{cipher_aes128cbc,"aes128cbc"},{cipher_xor,"xor"}};
@@ -277,7 +277,7 @@ int my_encrypt_old(const char *data0,char *output,int &len,char * key)
 	static const int disable_all=0;
 	static const int disable_aes=0;
 
-	char data[65535+100];
+	char data[buf_len];
 	memcpy(data,data0,len);
 
 	if(disable_all)
@@ -326,7 +326,7 @@ int my_decrypt_old(const char *data0,char *output,int &len,char * key)
 	static const int disable_all=0;
 	static const int disable_aes=0;
 
-	char data[65535+100];
+	char data[buf_len];
 	memcpy(data,data0,len);
 
 	if(disable_all)

File diff suppressed because it is too large
+ 352 - 214
main.cpp


+ 2 - 2
makefile

@@ -2,7 +2,7 @@ ccmips=mips-openwrt-linux-g++
 all:
 	killall udp2raw||true
 	sleep 1
-	g++ main.cpp -o udp2raw -static -lrt -ggdb -I. aes.c md5.c encrypt.cpp log.cpp -O3  -std=c++11
-	${ccmips} -O3 main.cpp -o udp2raw_mips  -lrt   -I. aes.c md5.c encrypt.cpp log.cpp -std=c++11
+	g++ main.cpp -o udp2raw -static -lrt -ggdb -I. aes.c md5.c encrypt.cpp log.cpp  -std=c++11 
+	${ccmips} main.cpp -o udp2raw_mips  -lrt   -I. aes.c md5.c encrypt.cpp log.cpp -std=c++11
 
 

Some files were not shown because too many files changed in this diff