1 line
1.7 KiB
C
1 line
1.7 KiB
C
|
/*****************************************************************/
/** Microsoft Windows **/
/** Copyright (C) Microsoft Corp., 1991-1995 **/
/*****************************************************************/
#pragma once
#include "ntlmsspi.h"
#include "crypto.h"
#include "descrypt.h"
#include "rc4.h"
#define __RPC_FAR
//
// From ntsam.h
//
#define SAM_MAX_PASSWORD_LENGTH 256
#define ERROR_SUCCESS 0
#define ERROR_INVALID_FUNCTION -1070
#define ntoh(a) ((((a) << 24) & 0xFF000000) | (((a) << 8) & 0x00FF0000) | (((a) >> 8) & 0x0000FF00) | (((a) >> 24) & 0x000000FF))
//
// From sampass.h
//
typedef struct _SAMPR_USER_PASSWORD
{
WCHAR Buffer[256];
DWORD Length;
}SAMPR_USER_PASSWORD;
typedef struct _SAMPR_USER_PASSWORD __RPC_FAR *PSAMPR_USER_PASSWORD;
typedef struct _SAMPR_ENCRYPTED_USER_PASSWORD
{
UCHAR Buffer[516];
}SAMPR_ENCRYPTED_USER_PASSWORD;
typedef struct _SAMPR_ENCRYPTED_USER_PASSWORD __RPC_FAR *PSAMPR_ENCRYPTED_USER_PASSWORD;
bool EncryptStdBlock(
IN PBLOCK_KEY BlockKey,
OUT PCYPHER_BLOCK CypherBlock
);
bool CalculateLmOwfPassword(
IN PLM_PASSWORD LmPassword,
OUT PLM_OWF_PASSWORD LmOwfPassword
);
bool EncryptBlock(
IN PCLEAR_BLOCK ClearBlock,
IN PBLOCK_KEY BlockKey,
OUT PCYPHER_BLOCK CypherBlock
);
bool EncryptLmOwfPwdWithLmOwfPwd(
IN PLM_OWF_PASSWORD DataLmOwfPassword,
IN PLM_OWF_PASSWORD KeyLmOwfPassword,
OUT PENCRYPTED_LM_OWF_PASSWORD EncryptedLmOwfPassword
);
DWORD SampEncryptLmPasswords(
LPSTR OldUpcasePassword,
LPSTR NewUpcasePassword,
LPSTR NewPassword,
PSAMPR_ENCRYPTED_USER_PASSWORD NewEncryptedWithOldLm,
PENCRYPTED_NT_OWF_PASSWORD OldLmOwfEncryptedWithNewLm
);
|