windows-nt/Source/XPSP1/NT/net/sfm/uam/uam5src/uamsrc/encrypt.h
2020-09-26 16:20:57 +08:00

1 line
1.5 KiB
C

/*
*
* Encryption Header. Function prototypes and defines for encrypted MSUAM authentication
*
*/
#ifndef DECR_KEY
#define DECR_KEY 0
#define ENCR_KEY 1
#define ENCR_STD 2
#define ENCR_SES 4
#endif
#define ENCR_RESULT_LENGTH 24
#define ENCRYPT 0
#define DECRYPT 1
#define LOCK_CRYPT() 0
#define UNLOCK_CRYPT() 0
#define StdEncrPwd "KGS!@#$%"
#define GETBIT(p, bit) (unsigned char) ((p[bit >> 3] >> (7 - (bit & 07))) & 01)
void UprCString(char* psz);
unsigned char *OneWayFunction(unsigned char *pucPwd, unsigned char *pucDest, short scb);
unsigned char *Encrypt(unsigned char *key, unsigned char *source, unsigned char *dest);
unsigned pascal CryptIOCTL2(unsigned, unsigned char *, unsigned char *, unsigned char *);
//short pascal DES_CBC( unsigned, unsigned char *, unsigned char *, unsigned char *, unsigned char *, unsigned);
//void setkey(unsigned char *key);
Boolean SetupUAMEncrypt( void );
void CleanupUAMEncrypt( void );
/*-------------------------------------------------------------------*\
The DES key table (schedule). Generated from the key.
\*-------------------------------------------------------------------*/
typedef struct _KeyTbl
{
unsigned char KS[16][48];
} KeyTbl;
void InitKey( unsigned char *Key, KeyTbl * );
void des(unsigned char *inbuf, unsigned char *outbuf, KeyTbl *, int crypt_mode);
void key_table(unsigned char *key, KeyTbl *generatedKeyTable);
void des_cipher(unsigned char *block, KeyTbl *keySchedule, int crypt_mode);