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