crypto.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. #ifndef _CRYPTO_H_
  2. #define _CRYPTO_H_
  3. #include "flow.h"
  4. #define n2s(c,s) ((s=(((unsigned int)(c[0]))<< 8)| \
  5. (((unsigned int)(c[1])) )),c+=2)
  6. /* Curves */
  7. int extract_parameters(flow *f, uint8_t *hs);
  8. int encrypt(flow *f, uint8_t *input, uint8_t *output, int32_t len, int32_t incoming, int32_t type, int32_t enc);
  9. int extract_server_random(flow *f, uint8_t *hs);
  10. int compute_master_secret(flow *f);
  11. int PRF(flow *f, uint8_t *secret, int32_t secret_len,
  12. uint8_t *seed1, int32_t seed1_len,
  13. uint8_t *seed2, int32_t seed2_len,
  14. uint8_t *seed3, int32_t seed3_len,
  15. uint8_t *seed4, int32_t seed4_len,
  16. uint8_t *output, int32_t output_len);
  17. int update_finish_hash(flow *f, uint8_t *hs);
  18. int verify_finish_hash(flow *f, uint8_t *p, int32_t incoming);
  19. int init_ciphers(flow *f);
  20. void update_context(flow *f, uint8_t *input, int32_t len, int32_t incoming, int32_t type, int32_t enc);
  21. void check_handshake(struct packet_info *info);
  22. #define PRE_MASTER_MAX_LEN BUFSIZ
  23. #define SLITHEEN_KEYGEN_CONST "SLITHEEN_KEYGEN"
  24. #define SLITHEEN_KEYGEN_CONST_SIZE 15
  25. #endif