mirror of
https://github.com/wangyu-/udp2raw.git
synced 2025-01-19 14:29:34 +08:00
added some TODOs
This commit is contained in:
parent
2be65585a0
commit
7142dd018d
47
encrypt.cpp
47
encrypt.cpp
@ -17,23 +17,13 @@ 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
|
|||||||
****/
|
****/
|
||||||
|
|
||||||
char key[16];//generated from key_string by md5.
|
char key[16];//generated from key_string by md5.
|
||||||
/*
|
//TODO key derive function
|
||||||
TODO
|
|
||||||
|
|
||||||
Change md5 to HMAC-md5 if necessary.Change padding to PKCS#7 style if necessary.
|
|
||||||
|
|
||||||
Need someone with cryptography knowledge to help review the encryption method.
|
|
||||||
|
|
||||||
Change them if necessary(I can do this by myself,if it turns out to be necessary).
|
|
||||||
|
|
||||||
github issue:
|
|
||||||
|
|
||||||
https://github.com/wangyu-/udp2raw-tunnel/issues/17
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
unordered_map<int, const char *> auth_mode_tostring = {{auth_none, "none"}, {auth_md5, "md5"}, {auth_crc32, "crc32"},{auth_simple,"simple"}};
|
unordered_map<int, const char *> auth_mode_tostring = {{auth_none, "none"}, {auth_md5, "md5"}, {auth_crc32, "crc32"},{auth_simple,"simple"}};
|
||||||
|
//TODO HMAC-md5 ,HMAC-sha1
|
||||||
|
|
||||||
unordered_map<int, const char *> cipher_mode_tostring={{cipher_none,"none"},{cipher_aes128cbc,"aes128cbc"},{cipher_xor,"xor"}};
|
unordered_map<int, const char *> cipher_mode_tostring={{cipher_none,"none"},{cipher_aes128cbc,"aes128cbc"},{cipher_xor,"xor"}};
|
||||||
|
//TODO aes-gcm
|
||||||
|
|
||||||
auth_mode_t auth_mode=auth_md5;
|
auth_mode_t auth_mode=auth_md5;
|
||||||
cipher_mode_t cipher_mode=cipher_aes128cbc;
|
cipher_mode_t cipher_mode=cipher_aes128cbc;
|
||||||
@ -356,13 +346,28 @@ int my_decrypt(const char *data,char *output,int &len,char * key)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int my_encrypt_pesudo_header(uint8_t *data,uint8_t *output,int &len,uint8_t * key,uint8_t *header,int hlen)
|
int encrypt_AE(const char *data,char *output,int &len,char * key)
|
||||||
{
|
{
|
||||||
|
//TODO
|
||||||
return 0;
|
//use encrypt-then-MAC scheme
|
||||||
}
|
return -1;
|
||||||
int my_decrypt_pesudo_header(uint8_t *data,uint8_t *output,int &len,uint8_t * key,uint8_t *header,int hlen)
|
}
|
||||||
{
|
|
||||||
return 0;
|
int decrypt_AE(const char *data,char *output,int &len,char * key)
|
||||||
|
{
|
||||||
|
//TODO
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int encrypt_AEAD(uint8_t *data,uint8_t *output,int &len,uint8_t * key,uint8_t *header,int hlen)
|
||||||
|
{
|
||||||
|
//TODO
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int decrypt_AEAD(uint8_t *data,uint8_t *output,int &len,uint8_t * key,uint8_t *header,int hlen)
|
||||||
|
{
|
||||||
|
//TODO
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,9 +17,6 @@ extern char key[16];
|
|||||||
int my_encrypt(const char *data,char *output,int &len,char * key);
|
int my_encrypt(const char *data,char *output,int &len,char * key);
|
||||||
int my_decrypt(const char *data,char *output,int &len,char * key);
|
int my_decrypt(const char *data,char *output,int &len,char * key);
|
||||||
|
|
||||||
int my_encrypt_pesudo_header(uint8_t *data,uint8_t *output,int &len,uint8_t * key,uint8_t *header,int hlen);
|
|
||||||
int my_decrypt_pesudo_header(uint8_t *data,uint8_t *output,int &len,uint8_t * key,uint8_t *header,int hlen);
|
|
||||||
|
|
||||||
|
|
||||||
unsigned short csum(const unsigned short *ptr,int nbytes) ;
|
unsigned short csum(const unsigned short *ptr,int nbytes) ;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user