ssh.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. #include <string.h>
  2. #define SSH_CIPHER_IDEA 1
  3. #define SSH_CIPHER_DES 2
  4. #define SSH_CIPHER_3DES 3
  5. #define SSH_CIPHER_BLOWFISH 6
  6. struct RSAKey {
  7. int bits;
  8. int bytes;
  9. #ifdef MSCRYPTOAPI
  10. unsigned long exponent;
  11. unsigned char *modulus;
  12. #else
  13. void *modulus;
  14. void *exponent;
  15. #endif
  16. };
  17. int makekey(unsigned char *data, struct RSAKey *result,
  18. unsigned char **keystr);
  19. void rsaencrypt(unsigned char *data, int length, struct RSAKey *key);
  20. int rsastr_len(struct RSAKey *key);
  21. void rsastr_fmt(char *str, struct RSAKey *key);
  22. typedef unsigned int word32;
  23. typedef unsigned int uint32;
  24. unsigned long crc32(const void *s, size_t len);
  25. typedef struct {
  26. uint32 h[4];
  27. } MD5_Core_State;
  28. struct MD5Context {
  29. #ifdef MSCRYPTOAPI
  30. unsigned long hHash;
  31. #else
  32. MD5_Core_State core;
  33. unsigned char block[64];
  34. int blkused;
  35. uint32 lenhi, lenlo;
  36. #endif
  37. };
  38. void MD5Init(struct MD5Context *context);
  39. void MD5Update(struct MD5Context *context, unsigned char const *buf,
  40. unsigned len);
  41. void MD5Final(unsigned char digest[16], struct MD5Context *context);
  42. struct ssh_cipher {
  43. void (*sesskey)(unsigned char *key);
  44. void (*encrypt)(unsigned char *blk, int len);
  45. void (*decrypt)(unsigned char *blk, int len);
  46. };
  47. #ifndef MSCRYPTOAPI
  48. void SHATransform(word32 *digest, word32 *data);
  49. #endif
  50. int random_byte(void);
  51. void random_add_noise(void *noise, int length);
  52. void logevent (char *);
  53. int ssh_compression_init(int);
  54. void ssh_compress(unsigned char *src, unsigned int srclen,
  55. unsigned char **dest, unsigned int *destlen);
  56. void ssh_decompress(unsigned char *src, unsigned int srclen,
  57. unsigned char **dest, unsigned int *destlen);