Replace MD5 implementation with my own code
[u/mdw/putty] / ssh.h
CommitLineData
37508af4 1#include <string.h>
2
bea1ef5f 3#define SSH_CIPHER_IDEA 1
9697bfd2 4#define SSH_CIPHER_DES 2
bea1ef5f 5#define SSH_CIPHER_3DES 3
6#define SSH_CIPHER_BLOWFISH 6
7
374330e2 8struct RSAKey {
9 int bits;
10 int bytes;
8f203108 11#ifdef MSCRYPTOAPI
12 unsigned long exponent;
13 unsigned char *modulus;
14#else
374330e2 15 void *modulus;
16 void *exponent;
8f203108 17#endif
374330e2 18};
19
20int makekey(unsigned char *data, struct RSAKey *result,
21 unsigned char **keystr);
22void rsaencrypt(unsigned char *data, int length, struct RSAKey *key);
23int rsastr_len(struct RSAKey *key);
24void rsastr_fmt(char *str, struct RSAKey *key);
25
26typedef unsigned int word32;
27typedef unsigned int uint32;
28
8160fbfc 29unsigned long crc32(const void *s, size_t len);
374330e2 30
48672163 31typedef struct {
32 uint32 h[4];
33} MD5_Core_State;
34
374330e2 35struct MD5Context {
8f203108 36#ifdef MSCRYPTOAPI
37 unsigned long hHash;
38#else
48672163 39 MD5_Core_State core;
40 unsigned char block[BLKSIZE];
41 int blkused;
42 uint32 lenhi, lenlo;
8f203108 43#endif
374330e2 44};
45
46void MD5Init(struct MD5Context *context);
47void MD5Update(struct MD5Context *context, unsigned char const *buf,
48 unsigned len);
49void MD5Final(unsigned char digest[16], struct MD5Context *context);
50
51struct 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
8f203108 57#ifndef MSCRYPTOAPI
374330e2 58void SHATransform(word32 *digest, word32 *data);
8f203108 59#endif
374330e2 60
61int random_byte(void);
62void random_add_noise(void *noise, int length);
c5e9c988 63
64void logevent (char *);