1999-01-08 16:10:19 +03:00
|
|
|
#include <string.h>
|
|
|
|
|
1999-07-06 23:42:57 +04:00
|
|
|
#define SSH_CIPHER_IDEA 1
|
1999-10-25 12:59:40 +04:00
|
|
|
#define SSH_CIPHER_DES 2
|
1999-07-06 23:42:57 +04:00
|
|
|
#define SSH_CIPHER_3DES 3
|
|
|
|
#define SSH_CIPHER_BLOWFISH 6
|
|
|
|
|
1999-01-08 16:02:13 +03:00
|
|
|
struct RSAKey {
|
|
|
|
int bits;
|
|
|
|
int bytes;
|
2000-03-24 12:45:49 +03:00
|
|
|
#ifdef MSCRYPTOAPI
|
|
|
|
unsigned long exponent;
|
|
|
|
unsigned char *modulus;
|
|
|
|
#else
|
1999-01-08 16:02:13 +03:00
|
|
|
void *modulus;
|
|
|
|
void *exponent;
|
2000-03-24 12:45:49 +03:00
|
|
|
#endif
|
1999-01-08 16:02:13 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
int makekey(unsigned char *data, struct RSAKey *result,
|
|
|
|
unsigned char **keystr);
|
|
|
|
void rsaencrypt(unsigned char *data, int length, struct RSAKey *key);
|
|
|
|
int rsastr_len(struct RSAKey *key);
|
|
|
|
void rsastr_fmt(char *str, struct RSAKey *key);
|
|
|
|
|
|
|
|
typedef unsigned int word32;
|
|
|
|
typedef unsigned int uint32;
|
|
|
|
|
2000-03-08 19:13:32 +03:00
|
|
|
unsigned long crc32(const void *s, size_t len);
|
1999-01-08 16:02:13 +03:00
|
|
|
|
|
|
|
struct MD5Context {
|
2000-03-24 12:45:49 +03:00
|
|
|
#ifdef MSCRYPTOAPI
|
|
|
|
unsigned long hHash;
|
|
|
|
#else
|
|
|
|
uint32 buf[4];
|
|
|
|
uint32 bits[2];
|
|
|
|
unsigned char in[64];
|
|
|
|
#endif
|
1999-01-08 16:02:13 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
void MD5Init(struct MD5Context *context);
|
|
|
|
void MD5Update(struct MD5Context *context, unsigned char const *buf,
|
|
|
|
unsigned len);
|
|
|
|
void MD5Final(unsigned char digest[16], struct MD5Context *context);
|
|
|
|
|
|
|
|
struct ssh_cipher {
|
|
|
|
void (*sesskey)(unsigned char *key);
|
|
|
|
void (*encrypt)(unsigned char *blk, int len);
|
|
|
|
void (*decrypt)(unsigned char *blk, int len);
|
|
|
|
};
|
|
|
|
|
2000-03-24 12:45:49 +03:00
|
|
|
#ifndef MSCRYPTOAPI
|
1999-01-08 16:02:13 +03:00
|
|
|
void SHATransform(word32 *digest, word32 *data);
|
2000-03-24 12:45:49 +03:00
|
|
|
#endif
|
1999-01-08 16:02:13 +03:00
|
|
|
|
|
|
|
int random_byte(void);
|
|
|
|
void random_add_noise(void *noise, int length);
|
1999-11-09 14:10:04 +03:00
|
|
|
|
|
|
|
void logevent (char *);
|