You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
849 B

  1. #ifndef _ENCRYPT_H
  2. #define _ENCRYPT_H
  3. #include <sys/socket.h>
  4. #include <string.h>
  5. #include <stdlib.h>
  6. #include <stdio.h>
  7. #include <openssl/md5.h>
  8. #include <openssl/evp.h>
  9. #define BUF_SIZE 4096
  10. #define TABLE 0
  11. #define RC4 1
  12. union {
  13. struct {
  14. unsigned char *encrypt_table;
  15. unsigned char *decrypt_table;
  16. } table;
  17. struct {
  18. unsigned char *key;
  19. int key_len;
  20. } rc4;
  21. } enc_ctx;
  22. void get_table(const char* key);
  23. void encrypt_ctx(char *buf, int len, EVP_CIPHER_CTX *ctx);
  24. void decrypt_ctx(char *buf, int len, EVP_CIPHER_CTX *ctx);
  25. void enc_ctx_init(EVP_CIPHER_CTX *ctx, int enc);
  26. void enc_key_init(const char *pass);
  27. unsigned int _i;
  28. unsigned long long _a;
  29. int _method;
  30. #define LOGD(...) ((void)fprintf(stdout, __VA_ARGS__))
  31. #define LOGE(...) ((void)fprintf(stderr, __VA_ARGS__))
  32. #endif // _ENCRYPT_H