linklayerprotocols/pppnif/SPPP/MSCHAP.CPP
branchGCC_SURGE
changeset 47 a96f0f8e6602
parent 0 af10295192d8
equal deleted inserted replaced
46:73696f712f10 47:a96f0f8e6602
   315 
   315 
   316 #endif //  __MS_CHAP_WITH_LAN_MANAGER__
   316 #endif //  __MS_CHAP_WITH_LAN_MANAGER__
   317 	}
   317 	}
   318 
   318 
   319 
   319 
   320 inline void CPppMsChap::ProcessFailureMessageL(
   320 void CPppMsChap::ProcessFailureMessageL(
   321 					const TDesC8& aFailureMessage,
   321 					const TDesC8& aFailureMessage,
   322 					TUint& aErrorCode, 
   322 					TUint& aErrorCode, 
   323 					TUint8& aRetryFlag, 
   323 					TUint8& aRetryFlag, 
   324 					TBool& aHasNewChallenge, 
   324 					TBool& aHasNewChallenge, 
   325 					TDes8& aChallenge, 
   325 					TDes8& aChallenge, 
   462 		aPasswordProtoVersion = 1;
   462 		aPasswordProtoVersion = 1;
   463 		}
   463 		}
   464 	}
   464 	}
   465 
   465 
   466 
   466 
   467 inline void CPppMsChap::RetryPasswordL()
   467 void CPppMsChap::RetryPasswordL()
   468 /**
   468 /**
   469    Retries the authentication.
   469    Retries the authentication.
   470    @internalComponent
   470    @internalComponent
   471 */
   471 */
   472 	{
   472 	{
   475 	iResponseRetryCount = 0;
   475 	iResponseRetryCount = 0;
   476 	RespondL();
   476 	RespondL();
   477 	}
   477 	}
   478 
   478 
   479 
   479 
   480 inline void CPppMsChap::NTChallengeResponseL(const TDesC8& aChallenge,
   480 void CPppMsChap::NTChallengeResponseL(const TDesC8& aChallenge,
   481 					     const TDesC16& aPassword,
   481 					     const TDesC16& aPassword,
   482 					     TDes8& aResponse)
   482 					     TDes8& aResponse)
   483 /**
   483 /**
   484    Computes a MS-CHAP Windows NT compatible Challenge Response.
   484    Computes a MS-CHAP Windows NT compatible Challenge Response.
   485    @param aChallenge [in] A MS-CHAP Challenge (8 octets).
   485    @param aChallenge [in] A MS-CHAP Challenge (8 octets).
   510 	CleanupStack::PopAndDestroy(paddedPasswordHashBuf);
   510 	CleanupStack::PopAndDestroy(paddedPasswordHashBuf);
   511 	ASSERT(aResponse.Length() == KPppMsChapNTResponseSize);
   511 	ASSERT(aResponse.Length() == KPppMsChapNTResponseSize);
   512 	}
   512 	}
   513 
   513 
   514 
   514 
   515 inline void CPppMsChap::NtPasswordHashL(const TDesC16& aPassword,
   515 void CPppMsChap::NtPasswordHashL(const TDesC16& aPassword,
   516 					TDes8& aPasswordHash)
   516 					TDes8& aPasswordHash)
   517 /**
   517 /**
   518    Computes the hash of the Microsoft Windows NT password using MD4.
   518    Computes the hash of the Microsoft Windows NT password using MD4.
   519    @param aPassword [in] The Microsoft Windows NT password (0 to 256
   519    @param aPassword [in] The Microsoft Windows NT password (0 to 256
   520    Unicode char).
   520    Unicode char).
   550 
   550 
   551 	ASSERT(aPasswordHash.Length() == KPppMsChapHashSize);
   551 	ASSERT(aPasswordHash.Length() == KPppMsChapHashSize);
   552 	}
   552 	}
   553 
   553 
   554 
   554 
   555 inline void CPppMsChap::ChallengeResponseL(const TDesC8& aChallenge,
   555 void CPppMsChap::ChallengeResponseL(const TDesC8& aChallenge,
   556 					TDes8& aPaddablePasswordHash,
   556 					TDes8& aPaddablePasswordHash,
   557 					TDes8& aResponse)
   557 					TDes8& aResponse)
   558 /**
   558 /**
   559    Computes the Challenge Response.
   559    Computes the Challenge Response.
   560    @param aChallenge [in] A MS-CHAP Challenge (8 octets).
   560    @param aChallenge [in] A MS-CHAP Challenge (8 octets).
   665 	CleanupStack::PopAndDestroy(desKeyBuf);
   665 	CleanupStack::PopAndDestroy(desKeyBuf);
   666 	ASSERT(aCypher.Length() == KPppMsChapDESCipherTextSize);
   666 	ASSERT(aCypher.Length() == KPppMsChapDESCipherTextSize);
   667 	}
   667 	}
   668 
   668 
   669 
   669 
   670 inline void CPppMsChap::MakeDesKey(const TDesC8& aMsChapKey, 
   670 void CPppMsChap::MakeDesKey(const TDesC8& aMsChapKey, 
   671 				TDes8& aDesKey)
   671 				TDes8& aDesKey)
   672 /**
   672 /**
   673    Creates a DES key by inserting the parity bits.  The DES algorithm
   673    Creates a DES key by inserting the parity bits.  The DES algorithm
   674    takes as input a 64-bit stream where the 8th, 16th, 24th, etc. bits
   674    takes as input a 64-bit stream where the 8th, 16th, 24th, etc. bits
   675    are parity bits ignored by the encrypting algorithm.
   675    are parity bits ignored by the encrypting algorithm.
   752 
   752 
   753 #ifdef __MS_CHAP_WITH_LAN_MANAGER__
   753 #ifdef __MS_CHAP_WITH_LAN_MANAGER__
   754 
   754 
   755 // NB The use of the LAN Manager compatible challenge response has
   755 // NB The use of the LAN Manager compatible challenge response has
   756 // been deprecated according to RFC 2433.
   756 // been deprecated according to RFC 2433.
   757 inline void CPppMsChap::LmChallengeResponseL(const TDesC8& aChallenge,
   757 void CPppMsChap::LmChallengeResponseL(const TDesC8& aChallenge,
   758 					const TDesC8& aPassword, 
   758 					const TDesC8& aPassword, 
   759 					TDes8& aResponse)
   759 					TDes8& aResponse)
   760 /**
   760 /**
   761    Computes a MS-CHAP LAN Manager compatible Challenge Response.
   761    Computes a MS-CHAP LAN Manager compatible Challenge Response.
   762    @param aChallenge [in] A MS-CHAP Challenge (8 octets).
   762    @param aChallenge [in] A MS-CHAP Challenge (8 octets).
   791 	}
   791 	}
   792 
   792 
   793 
   793 
   794 // NB The use of the LAN Manager compatible challenge response has
   794 // NB The use of the LAN Manager compatible challenge response has
   795 // been deprecated according to RFC 2433.
   795 // been deprecated according to RFC 2433.
   796 inline void CPppMsChap::LmPasswordHashL(const TDesC8& aPassword,
   796 void CPppMsChap::LmPasswordHashL(const TDesC8& aPassword,
   797 					TDes8& aPasswordHash)
   797 					TDes8& aPasswordHash)
   798 /**
   798 /**
   799    Computes the hash of the LAN Manager password using DES.
   799    Computes the hash of the LAN Manager password using DES.
   800    @param aPassword [in] The LAN Manager password (0 to 14 OEM char).
   800    @param aPassword [in] The LAN Manager password (0 to 14 OEM char).
   801    @param aPasswordHash [out] The DES hash of the LAN Manager password
   801    @param aPasswordHash [out] The DES hash of the LAN Manager password
   838 	ASSERT(aPasswordHash.Length() == KPppMsChapHashSize);
   838 	ASSERT(aPasswordHash.Length() == KPppMsChapHashSize);
   839 	}
   839 	}
   840 
   840 
   841 // NB The use of the LAN Manager compatible challenge response has
   841 // NB The use of the LAN Manager compatible challenge response has
   842 // been deprecated according to RFC 2433.
   842 // been deprecated according to RFC 2433.
   843 inline void CPppMsChap::DesHashL(const TDesC8& aClear, TDes8& aCypher)
   843 void CPppMsChap::DesHashL(const TDesC8& aClear, TDes8& aCypher)
   844 /**
   844 /**
   845    Makes aCypher an irreversibly encrypted form of aClear by
   845    Makes aCypher an irreversibly encrypted form of aClear by
   846    encrypting known text using aClear as the secret key.  The known
   846    encrypting known text using aClear as the secret key.  The known
   847    text consists of the string "KGS!@#$%".
   847    text consists of the string "KGS!@#$%".
   848    @param aClear [in] A plaintext used as the secret key for
   848    @param aClear [in] A plaintext used as the secret key for