Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

0 lines
2.4 KiB

  1. // =========================================================================== // UAMEncrypt.c � 1998-2001 Microsoft Corp. All rights reserved. // =========================================================================== // Ecryption functions for use by Microsoft User Authentication Method. // // =========================================================================== #ifdef UAM_TARGET_CARBON #include <CoreFoundation/CoreFoundation.h> #endif #include <string.h> #include <ctype.h> #include "UAMEncrypt.h" #include "UAMDebug.h" // --------------------------------------------------------------------------- // � UAM_GetEncryptedLmOwfPassword() // --------------------------------------------------------------------------- // Using a combination of the above to functions, build an encrypted owf // password that we can send back to the server. // // Returns: TRUE if the encryption attempt succeeded. // Boolean UAM_GetEncryptedLmOwfPassword( char* inClearTextPassword, char* inServerChallenge, char* outEncryptedOwfPassword ) { LM_OWF_PASSWORD theLmOwfPassword; memset(&theLmOwfPassword, '\0', sizeof(theLmOwfPassword)); if (!MacSspCalculateLmOwfPassword( (PLM_PASSWORD)inClearTextPassword, (PLM_OWF_PASSWORD)&theLmOwfPassword)) { return(false); } if (!MacSspCalculateLmResponse( (PLM_CHALLENGE)inServerChallenge, (PLM_OWF_PASSWORD)&theLmOwfPassword, (PLM_RESPONSE)outEncryptedOwfPassword)) { return(false); } return(true); } // --------------------------------------------------------------------------- // � UAM_GetDoubleEncryptedLmOwfPasswords() // --------------------------------------------------------------------------- // Taken from the NT RtlXXX sources, this algorithm is designed to deal with the encryption // of two passwords, when the OneWayFunction of one is known on the target. Specifically, // // for passwords x, y // -- do a one way encryption of x to Owf(x) -> result(0..15) // -- do a one way encryption of y to Owf(x) -> result(16..31) // Boolean UAM_GetDoubleEncryptedLmOwfPasswords( char* inClearTextPassword, char* inKey, char* outEncryptedOwfPasswords ) { if (!MacSspCalculateLmOwfPassword( (char*)inClearTextPassword, (PLM_OWF_PASSWORD)outEncryptedOwfPasswords)) { return(false); } if (!MacSspCalculateLmOwfPassword( (char*)inKey, (PLM_OWF_PASSWORD)(outEncryptedOwfPasswords + kOneWayEncryptedArgSize))) { return(false); } return(true); }