Address code analysis warnings

Signed-off-by: Simon Rozman <simon@rozman.si>
This commit is contained in:
2019-08-22 20:44:38 +02:00
parent a459823beb
commit 6fb5cb88d2
60 changed files with 935 additions and 960 deletions

View File

@@ -83,7 +83,7 @@ namespace eap
///
/// \param[in] other Configuration to move from
///
config(_Inout_ config &&other);
config(_Inout_ config &&other) noexcept;
///
/// Copies configuration
@@ -101,7 +101,7 @@ namespace eap
///
/// \returns Reference to this object
///
config& operator=(_Inout_ config &&other);
config& operator=(_Inout_ config &&other) noexcept;
///
/// Clones this object
@@ -187,7 +187,7 @@ namespace eap
///
/// \param[in] other Configuration to move from
///
config_method(_Inout_ config_method &&other);
config_method(_Inout_ config_method &&other) noexcept;
///
/// Copies configuration
@@ -205,7 +205,7 @@ namespace eap
///
/// \returns Reference to this object
///
config_method& operator=(_Inout_ config_method &&other);
config_method& operator=(_Inout_ config_method &&other) noexcept;
/// \name XML management
/// @{
@@ -271,7 +271,7 @@ namespace eap
///
/// \param[in] other Configuration to move from
///
config_method_with_cred(_Inout_ config_method_with_cred &&other);
config_method_with_cred(_Inout_ config_method_with_cred &&other) noexcept;
///
/// Copies configuration
@@ -289,7 +289,7 @@ namespace eap
///
/// \returns Reference to this object
///
config_method_with_cred& operator=(_Inout_ config_method_with_cred &&other);
config_method_with_cred& operator=(_Inout_ config_method_with_cred &&other) noexcept;
/// \name XML management
/// @{
@@ -335,7 +335,7 @@ namespace eap
///
/// \param[in] other Configuration to move from
///
config_provider(_Inout_ config_provider &&other);
config_provider(_Inout_ config_provider &&other) noexcept;
///
/// Copies configuration
@@ -353,7 +353,7 @@ namespace eap
///
/// \returns Reference to this object
///
config_provider& operator=(_Inout_ config_provider &&other);
config_provider& operator=(_Inout_ config_provider &&other) noexcept;
virtual config* clone() const;
@@ -431,7 +431,7 @@ namespace eap
///
/// \param[in] other Configuration to move from
///
config_connection(_Inout_ config_connection &&other);
config_connection(_Inout_ config_connection &&other) noexcept;
///
/// Copies configuration
@@ -449,7 +449,7 @@ namespace eap
///
/// \returns Reference to this object
///
config_connection& operator=(_Inout_ config_connection &&other);
config_connection& operator=(_Inout_ config_connection &&other) noexcept;
virtual config* clone() const;

View File

@@ -86,7 +86,7 @@ namespace eap
///
/// \param[in] other Credentials to move from
///
credentials(_Inout_ credentials &&other);
credentials(_Inout_ credentials &&other) noexcept;
///
/// Copies credentials
@@ -104,7 +104,7 @@ namespace eap
///
/// \returns Reference to this object
///
credentials& operator=(_Inout_ credentials &&other);
credentials& operator=(_Inout_ credentials &&other) noexcept;
///
/// Resets credentials
@@ -216,7 +216,7 @@ namespace eap
///
virtual source_t combine(
_In_ DWORD dwFlags,
_In_ HANDLE hTokenImpersonateUser,
_In_opt_ HANDLE hTokenImpersonateUser,
_In_opt_ const credentials *cred_cached,
_In_ const config_method &cfg,
_In_opt_z_ LPCTSTR pszTargetName) = 0;
@@ -251,7 +251,7 @@ namespace eap
///
/// \param[in] other Credentials to move from
///
credentials_identity(_Inout_ credentials_identity &&other);
credentials_identity(_Inout_ credentials_identity &&other) noexcept;
///
/// Copies credentials
@@ -269,7 +269,7 @@ namespace eap
///
/// \returns Reference to this object
///
credentials_identity& operator=(_Inout_ credentials_identity &&other);
credentials_identity& operator=(_Inout_ credentials_identity &&other) noexcept;
virtual config* clone() const;
@@ -311,7 +311,7 @@ namespace eap
///
virtual source_t combine(
_In_ DWORD dwFlags,
_In_ HANDLE hTokenImpersonateUser,
_In_opt_ HANDLE hTokenImpersonateUser,
_In_opt_ const credentials *cred_cached,
_In_ const config_method &cfg,
_In_opt_z_ LPCTSTR pszTargetName);
@@ -354,7 +354,7 @@ namespace eap
///
/// \param[in] other Credentials to move from
///
credentials_pass(_Inout_ credentials_pass &&other);
credentials_pass(_Inout_ credentials_pass &&other) noexcept;
///
/// Copies credentials
@@ -372,7 +372,7 @@ namespace eap
///
/// \returns Reference to this object
///
credentials_pass& operator=(_Inout_ credentials_pass &&other);
credentials_pass& operator=(_Inout_ credentials_pass &&other) noexcept;
virtual config* clone() const;
virtual void clear();
@@ -423,7 +423,7 @@ namespace eap
///
virtual source_t combine(
_In_ DWORD dwFlags,
_In_ HANDLE hTokenImpersonateUser,
_In_opt_ HANDLE hTokenImpersonateUser,
_In_opt_ const credentials *cred_cached,
_In_ const config_method &cfg,
_In_opt_z_ LPCTSTR pszTargetName);
@@ -465,7 +465,7 @@ namespace eap
///
/// \param[in] other Credentials to move from
///
credentials_connection(_Inout_ credentials_connection &&other);
credentials_connection(_Inout_ credentials_connection &&other) noexcept;
///
/// Copies credentials
@@ -483,7 +483,7 @@ namespace eap
///
/// \returns Reference to this object
///
credentials_connection& operator=(_Inout_ credentials_connection &&other);
credentials_connection& operator=(_Inout_ credentials_connection &&other) noexcept;
virtual config* clone() const;

View File

@@ -551,7 +551,7 @@ inline unsigned __int64 htonll(unsigned __int64 val);
/// \param[in ] val A 24-bit unsigned number in host byte order
/// \param[out] out A 24-bit unsigned number in network byte order
///
inline void hton24(_In_ unsigned int val, _Out_ unsigned char out[3]);
inline void hton24(_In_ unsigned int val, _Out_writes_(3) unsigned char out[3]);
///
/// Converts a 24-bit integer from TCP/IP network to host byte order.
@@ -658,6 +658,9 @@ namespace eap
///
/// Constructor
///
/// Note: This constructor does not initialize data. Use sanitizing_blob_zf class when zero-initialization is required.
///
#pragma warning(suppress: 26495)
inline sanitizing_blob_f()
{
}
@@ -677,7 +680,7 @@ namespace eap
///
/// \param[inout] other BLOB to move from
///
inline sanitizing_blob_f(_Inout_ sanitizing_blob_f<N> &&other)
inline sanitizing_blob_f(_Inout_ sanitizing_blob_f<N> &&other) noexcept
{
memcpy(data, other.data, N);
}
@@ -687,7 +690,7 @@ namespace eap
///
/// \param[inout] other Zero-initialized BLOB to move from
///
inline sanitizing_blob_f(_Inout_ sanitizing_blob_zf<N> &&other)
inline sanitizing_blob_f(_Inout_ sanitizing_blob_zf<N> &&other) noexcept
{
memcpy(data, other.data, N);
memset(other.data, 0, N);
@@ -722,7 +725,7 @@ namespace eap
///
/// \returns Reference to this object
///
inline sanitizing_blob_f& operator=(_Inout_ sanitizing_blob_f<N> &&other)
inline sanitizing_blob_f& operator=(_Inout_ sanitizing_blob_f<N> &&other) noexcept
{
if (this != std::addressof(other))
memcpy(data, other.data, N);
@@ -736,7 +739,7 @@ namespace eap
///
/// \returns Reference to this object
///
inline sanitizing_blob_f& operator=(_Inout_ sanitizing_blob_zf<N> &&other)
inline sanitizing_blob_f& operator=(_Inout_ sanitizing_blob_zf<N> &&other) noexcept
{
if (this != std::addressof(other)) {
memcpy(data, other.data, N);
@@ -827,7 +830,7 @@ namespace eap
///
/// \param[inout] other Zero-initialized BLOB to move from
///
inline sanitizing_blob_zf(_Inout_ sanitizing_blob_zf<N> &&other) :
inline sanitizing_blob_zf(_Inout_ sanitizing_blob_zf<N> &&other) noexcept :
sanitizing_blob_f<N>(std::move(other))
{
memset(other.data, 0, N);
@@ -848,7 +851,7 @@ namespace eap
///
/// \param[inout] other BLOB to move from
///
inline sanitizing_blob_zf(_Inout_ sanitizing_blob_f<N> &&other) :
inline sanitizing_blob_zf(_Inout_ sanitizing_blob_f<N> &&other) noexcept :
sanitizing_blob_f<N>(std::move(other))
{
}
@@ -874,7 +877,7 @@ namespace eap
///
/// \returns Reference to this object
///
inline sanitizing_blob_zf& operator=(_Inout_ sanitizing_blob_zf<N> &&other)
inline sanitizing_blob_zf& operator=(_Inout_ sanitizing_blob_zf<N> &&other) noexcept
{
if (this != std::addressof(other)) {
memcpy(data, other.data, N);
@@ -904,7 +907,7 @@ namespace eap
///
/// \returns Reference to this object
///
inline sanitizing_blob_zf& operator=(_Inout_ sanitizing_blob_f<N> &&other)
inline sanitizing_blob_zf& operator=(_Inout_ sanitizing_blob_f<N> &&other) noexcept
{
if (this != std::addressof(other))
memcpy(data, other.data, N);
@@ -1110,7 +1113,7 @@ inline void operator<<(_Inout_ eap::cursor_out &cursor, _In_ const std::basic_st
template<class _Traits, class _Ax>
inline size_t pksizeof(_In_ const std::basic_string<wchar_t, _Traits, _Ax> &val)
{
return sizeof(char)*(WideCharToMultiByte(CP_UTF8, 0, val.c_str(), (int)val.length(), NULL, 0, NULL, NULL) + 1);
return sizeof(char)*(WideCharToMultiByte(CP_UTF8, 0, val.c_str(), (int)val.length(), NULL, 0, NULL, NULL)) + sizeof(char);
}
@@ -1407,7 +1410,7 @@ inline unsigned __int64 htonll(unsigned __int64 val)
#endif
inline void hton24(_In_ unsigned int val, _Out_ unsigned char out[3])
inline void hton24(_In_ unsigned int val, _Out_writes_(3) unsigned char out[3])
{
assert(val <= 0xffffff);
out[0] = (val >> 16) & 0xff;

View File

@@ -357,7 +357,7 @@ namespace eapxml
/// - <0 if failed.
/// Use `SUCCEEDED()` macro to test for first two cases (>=0) or `FAILED()` to test for failure.
///
inline HRESULT put_element_base64(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pCurrentDOMNode, _In_z_ const BSTR bstrElementName, _In_opt_z_ const BSTR bstrNamespace, _In_count_(nValueLen) LPCVOID pValue, _In_ SIZE_T nValueLen, _Out_opt_ winstd::com_obj<IXMLDOMElement> *ppXmlElement = NULL);
inline HRESULT put_element_base64(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pCurrentDOMNode, _In_z_ const BSTR bstrElementName, _In_opt_z_ const BSTR bstrNamespace, _In_bytecount_(nValueLen) LPCVOID pValue, _In_ SIZE_T nValueLen, _Out_opt_ winstd::com_obj<IXMLDOMElement> *ppXmlElement = NULL);
///
/// Creates a new child element with hexadecimal encoded text from BLOB
@@ -376,7 +376,7 @@ namespace eapxml
/// - <0 if failed.
/// Use `SUCCEEDED()` macro to test for first two cases (>=0) or `FAILED()` to test for failure.
///
inline HRESULT put_element_hex(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pCurrentDOMNode, _In_z_ const BSTR bstrElementName, _In_opt_z_ const BSTR bstrNamespace, _In_count_(nValueLen) LPCVOID pValue, _In_ SIZE_T nValueLen, _Out_opt_ winstd::com_obj<IXMLDOMElement> *ppXmlElement = NULL);
inline HRESULT put_element_hex(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pCurrentDOMNode, _In_z_ const BSTR bstrElementName, _In_opt_z_ const BSTR bstrNamespace, _In_bytecount_(nValueLen) LPCVOID pValue, _In_ SIZE_T nValueLen, _Out_opt_ winstd::com_obj<IXMLDOMElement> *ppXmlElement = NULL);
///
/// Returns attribute text
@@ -481,7 +481,7 @@ namespace eapxml
/// - <0 if failed.
/// Use `SUCCEEDED()` macro to test for first two cases (>=0) or `FAILED()` to test for failure.
///
inline HRESULT put_attrib_value(_In_ IXMLDOMNode *pCurrentDOMNode, _In_z_ const BSTR bstrAttributeName, _In_opt_z_ _In_z_ const BSTR bstrValue);
inline HRESULT put_attrib_value(_In_ IXMLDOMNode *pCurrentDOMNode, _In_z_ const BSTR bstrAttributeName, _In_z_ const BSTR bstrValue);
///
/// Sets node attribute converted from number
@@ -496,7 +496,7 @@ namespace eapxml
/// - <0 if failed.
/// Use `SUCCEEDED()` macro to test for first two cases (>=0) or `FAILED()` to test for failure.
///
inline HRESULT put_attrib_value(_In_ IXMLDOMNode *pCurrentDOMNode, _In_z_ const BSTR bstrAttributeName, _In_opt_z_ _In_ DWORD dwValue);
inline HRESULT put_attrib_value(_In_ IXMLDOMNode *pCurrentDOMNode, _In_z_ const BSTR bstrAttributeName, _In_ DWORD dwValue);
///
/// Sets node attribute converted from boolean
@@ -511,7 +511,7 @@ namespace eapxml
/// - <0 if failed.
/// Use `SUCCEEDED()` macro to test for first two cases (>=0) or `FAILED()` to test for failure.
///
inline HRESULT put_attrib_value(_In_ IXMLDOMNode *pCurrentDOMNode, _In_z_ const BSTR bstrAttributeName, _In_opt_z_ _In_ bool bValue);
inline HRESULT put_attrib_value(_In_ IXMLDOMNode *pCurrentDOMNode, _In_z_ const BSTR bstrAttributeName, _In_ bool bValue);
///
/// Sets node attribute to Base64 encoded text from BLOB
@@ -527,7 +527,7 @@ namespace eapxml
/// - <0 if failed.
/// Use `SUCCEEDED()` macro to test for first two cases (>=0) or `FAILED()` to test for failure.
///
inline HRESULT put_attrib_base64(_In_ IXMLDOMNode *pCurrentDOMNode, _In_z_ const BSTR bstrAttributeName, _In_opt_z_ _In_count_(nValueLen) LPCVOID pValue, _In_ SIZE_T nValueLen);
inline HRESULT put_attrib_base64(_In_ IXMLDOMNode *pCurrentDOMNode, _In_z_ const BSTR bstrAttributeName, _In_bytecount_(nValueLen) LPCVOID pValue, _In_ SIZE_T nValueLen);
///
/// Sets node attribute to hexadecimal encoded text from BLOB
///
@@ -542,7 +542,7 @@ namespace eapxml
/// - <0 if failed.
/// Use `SUCCEEDED()` macro to test for first two cases (>=0) or `FAILED()` to test for failure.
///
inline HRESULT put_attrib_hex(_In_ IXMLDOMNode *pCurrentDOMNode, _In_z_ const BSTR bstrAttributeName, _In_count_(nValueLen) LPCVOID pValue, _In_ SIZE_T nValueLen);
inline HRESULT put_attrib_hex(_In_ IXMLDOMNode *pCurrentDOMNode, _In_z_ const BSTR bstrAttributeName, _In_bytecount_(nValueLen) LPCVOID pValue, _In_ SIZE_T nValueLen);
///
/// Builds XPath for a given node
@@ -786,7 +786,7 @@ namespace eapxml
pbstrValue = std::move(bstrEn);
return S_OK;
} else
return ERROR_NOT_FOUND;
return HRESULT_FROM_WIN32(ERROR_NOT_FOUND);
}
winstd::com_obj<IXMLDOMNode> pXmlElLocalizedText;
@@ -831,7 +831,6 @@ namespace eapxml
{
assert(pDoc);
assert(pCurrentDOMNode);
assert(ppXmlElement);
static const VARIANT varNodeTypeEl = { VT_I4, 0, 0, 0, { NODE_ELEMENT } };
HRESULT hr;
@@ -878,7 +877,7 @@ namespace eapxml
}
inline HRESULT put_element_base64(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pCurrentDOMNode, _In_z_ const BSTR bstrElementName, _In_opt_z_ const BSTR bstrNamespace, _In_count_(nValueLen) LPCVOID pValue, _In_ SIZE_T nValueLen, _Out_opt_ winstd::com_obj<IXMLDOMElement> *ppXmlElement)
inline HRESULT put_element_base64(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pCurrentDOMNode, _In_z_ const BSTR bstrElementName, _In_opt_z_ const BSTR bstrNamespace, _In_bytecount_(nValueLen) LPCVOID pValue, _In_ SIZE_T nValueLen, _Out_opt_ winstd::com_obj<IXMLDOMElement> *ppXmlElement)
{
std::wstring sBase64;
winstd::base64_enc enc;
@@ -887,7 +886,7 @@ namespace eapxml
}
inline HRESULT put_element_hex(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pCurrentDOMNode, _In_z_ const BSTR bstrElementName, _In_opt_z_ const BSTR bstrNamespace, _In_count_(nValueLen) LPCVOID pValue, _In_ SIZE_T nValueLen, _Out_opt_ winstd::com_obj<IXMLDOMElement> *ppXmlElement)
inline HRESULT put_element_hex(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pCurrentDOMNode, _In_z_ const BSTR bstrElementName, _In_opt_z_ const BSTR bstrNamespace, _In_bytecount_(nValueLen) LPCVOID pValue, _In_ SIZE_T nValueLen, _Out_opt_ winstd::com_obj<IXMLDOMElement> *ppXmlElement)
{
std::wstring sHex;
winstd::hex_enc enc;
@@ -936,8 +935,6 @@ namespace eapxml
inline HRESULT get_attrib_value(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrAttributeName, _Out_ bool &pbValue)
{
assert(pbValue);
winstd::bstr bstr;
HRESULT hr = get_attrib_value(pXmlParent, bstrAttributeName, bstr);
if (SUCCEEDED(hr)) {
@@ -1012,7 +1009,7 @@ namespace eapxml
}
inline HRESULT put_attrib_base64(_In_ IXMLDOMNode *pCurrentDOMNode, _In_z_ const BSTR bstrAttributeName, _In_count_(nValueLen) LPCVOID pValue, _In_ SIZE_T nValueLen)
inline HRESULT put_attrib_base64(_In_ IXMLDOMNode *pCurrentDOMNode, _In_z_ const BSTR bstrAttributeName, _In_bytecount_(nValueLen) LPCVOID pValue, _In_ SIZE_T nValueLen)
{
std::wstring sBase64;
winstd::base64_enc enc;
@@ -1021,7 +1018,7 @@ namespace eapxml
}
inline HRESULT put_attrib_hex(_In_ IXMLDOMNode *pCurrentDOMNode, _In_z_ const BSTR bstrAttributeName, _In_count_(nValueLen) LPCVOID pValue, _In_ SIZE_T nValueLen)
inline HRESULT put_attrib_hex(_In_ IXMLDOMNode *pCurrentDOMNode, _In_z_ const BSTR bstrAttributeName, _In_bytecount_(nValueLen) LPCVOID pValue, _In_ SIZE_T nValueLen)
{
std::wstring sHex;
winstd::hex_enc enc;

View File

@@ -69,7 +69,7 @@ namespace eap
///
/// \param[in] other Method to move from
///
method(_Inout_ method &&other);
method(_Inout_ method &&other) noexcept;
///
/// Moves a method
@@ -78,7 +78,7 @@ namespace eap
///
/// \returns Reference to this object
///
method& operator=(_Inout_ method &&other);
method& operator=(_Inout_ method &&other) noexcept;
/// \name Session management
/// @{
@@ -144,12 +144,12 @@ namespace eap
///
/// \sa [EapPeerGetResult function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363611.aspx)
///
/// \param[in ] reason The reason code for the authentication result returned in \p pResult.
/// \param[out] pResult A pointer to a structure that contains the authentication results.
/// \param[in ] reason The reason code for the authentication result returned in \p pResult.
/// \param[inout] pResult A pointer to a structure that contains the authentication results.
///
virtual void get_result(
_In_ EapPeerMethodResultReason reason,
_Out_ EapPeerMethodResult *pResult);
_In_ EapPeerMethodResultReason reason,
_Inout_ EapPeerMethodResult *pResult);
/// \name User Interaction
/// @{
@@ -236,7 +236,7 @@ namespace eap
///
/// \param[in] other Method to move from
///
method_tunnel(_Inout_ method_tunnel &&other);
method_tunnel(_Inout_ method_tunnel &&other) noexcept;
///
/// Moves a method
@@ -245,7 +245,7 @@ namespace eap
///
/// \returns Reference to this object
///
method_tunnel& operator=(_Inout_ method_tunnel &&other);
method_tunnel& operator=(_Inout_ method_tunnel &&other) noexcept;
/// \name Session management
/// @{
@@ -274,8 +274,8 @@ namespace eap
/// @}
virtual void get_result(
_In_ EapPeerMethodResultReason reason,
_Out_ EapPeerMethodResult *pResult);
_In_ EapPeerMethodResultReason reason,
_Inout_ EapPeerMethodResult *pResult);
/// \name User Interaction
/// @{
@@ -326,7 +326,7 @@ namespace eap
///
/// \param[in] other Method to move from
///
method_eap(_Inout_ method_eap &&other);
method_eap(_Inout_ method_eap &&other) noexcept;
///
/// Moves a method
@@ -335,7 +335,7 @@ namespace eap
///
/// \returns Reference to this object
///
method_eap& operator=(_Inout_ method_eap &&other);
method_eap& operator=(_Inout_ method_eap &&other) noexcept;
/// \name Session management
/// @{

View File

@@ -93,17 +93,17 @@ namespace eap
///
/// Allocate BLOB
///
BYTE* alloc_memory(_In_ size_t size);
BYTE* alloc_memory(_In_ size_t size) const;
///
/// Free BLOB allocated with this peer
///
void free_memory(_In_ BYTE *ptr);
void free_memory(_In_ BYTE *ptr) const;
///
/// Free EAP_ERROR allocated with `make_error()` method
///
void free_error_memory(_In_ EAP_ERROR *err);
void free_error_memory(_In_ EAP_ERROR *err) const;
///
/// Makes a new method configuration
@@ -147,6 +147,35 @@ namespace eap
///
void log_error(_In_ const EAP_ERROR *err) const;
///
/// Logs error and optionally returns EAP_ERROR
///
inline DWORD log_error(_Out_opt_ EAP_ERROR **eap_err, _In_ DWORD dwErrorCode, _In_opt_z_ LPCWSTR pszRootCauseString = NULL, _In_opt_z_ LPCWSTR pszRepairString = NULL, _In_opt_ DWORD dwReasonCode = 0, _In_opt_ LPCGUID pRootCauseGuid = NULL, _In_opt_ LPCGUID pRepairGuid = NULL, _In_opt_ LPCGUID pHelpLinkGuid = NULL) const
{
EAP_ERROR *e = make_error(dwErrorCode, pszRootCauseString, pszRepairString, dwReasonCode, pRootCauseGuid, pRepairGuid, pHelpLinkGuid);
log_error(e);
if (eap_err)
*eap_err = e;
else
free_error_memory(e);
return dwErrorCode;
}
///
/// Logs error and optionally returns EAP_ERROR
///
inline DWORD log_error(_Out_opt_ EAP_ERROR **eap_err, _In_ std::exception &err) const
{
EAP_ERROR *e = make_error(err);
log_error(e);
DWORD dwWinError = e->dwWinError;
if (eap_err)
*eap_err = e;
else
free_error_memory(e);
return dwWinError;
}
///
/// Logs Unicode string config value
///
@@ -288,7 +317,7 @@ namespace eap
///
/// \returns Encrypted data
///
std::vector<unsigned char> encrypt(_In_ HCRYPTPROV hProv, _In_bytecount_(size) const void *data, _In_ size_t size, _Out_opt_ HCRYPTHASH hHash = NULL) const;
std::vector<unsigned char> encrypt(_In_ HCRYPTPROV hProv, _In_bytecount_(size) const void *data, _In_ size_t size, _In_opt_ HCRYPTHASH hHash = NULL) const;
///
@@ -301,7 +330,7 @@ namespace eap
/// \returns Encrypted data
///
template<class _Elem, class _Traits, class _Ax>
std::vector<unsigned char> encrypt(_In_ HCRYPTPROV hProv, _In_ const std::basic_string<_Elem, _Traits, _Ax> &val, _Out_opt_ HCRYPTHASH hHash = NULL) const
std::vector<unsigned char> encrypt(_In_ HCRYPTPROV hProv, _In_ const std::basic_string<_Elem, _Traits, _Ax> &val, _In_opt_ HCRYPTHASH hHash = NULL) const
{
return encrypt(hProv, val.c_str(), val.length()*sizeof(_Elem), hHash);
}
@@ -317,7 +346,7 @@ namespace eap
/// \returns Encrypted data
///
template<class _Traits, class _Ax>
std::vector<unsigned char> encrypt(_In_ HCRYPTPROV hProv, _In_ const std::basic_string<wchar_t, _Traits, _Ax> &val, _Out_opt_ HCRYPTHASH hHash = NULL) const
std::vector<unsigned char> encrypt(_In_ HCRYPTPROV hProv, _In_ const std::basic_string<wchar_t, _Traits, _Ax> &val, _In_opt_ HCRYPTHASH hHash = NULL) const
{
winstd::sanitizing_string val_utf8;
WideCharToMultiByte(CP_UTF8, 0, val, val_utf8, NULL, NULL);
@@ -380,13 +409,15 @@ namespace eap
/// \returns Decrypted data
///
template<class _Ty, class _Ax>
std::vector<_Ty, _Ax> decrypt(_In_ HCRYPTPROV hProv, _In_bytecount_(size) const void *data, _In_ size_t size, _Out_opt_ HCRYPTHASH hHash = NULL) const
std::vector<_Ty, _Ax> decrypt(_In_ HCRYPTPROV hProv, _In_bytecount_(size) const void *data, _In_ size_t size, _In_opt_ HCRYPTHASH hHash = NULL) const
{
// Import the private RSA key.
HRSRC res = FindResource(m_instance, MAKEINTRESOURCE(IDR_EAP_KEY_PRIVATE), RT_RCDATA);
assert(res);
if (!res)
throw winstd::win_runtime_error(__FUNCTION__ " FindResource failed.");
HGLOBAL res_handle = LoadResource(m_instance, res);
assert(res_handle);
if (!res_handle)
throw winstd::win_runtime_error(__FUNCTION__ " LoadResource failed.");
winstd::crypt_key key_rsa;
std::unique_ptr<unsigned char[], winstd::LocalFree_delete<unsigned char[]> > keyinfo_data;
DWORD keyinfo_size = 0;
@@ -423,7 +454,7 @@ namespace eap
/// \returns Decrypted string
///
template<class _Elem, class _Traits, class _Ax>
std::basic_string<_Elem, _Traits, _Ax> decrypt_str(_In_ HCRYPTPROV hProv, _In_bytecount_(size) const void *data, _In_ size_t size, _Out_opt_ HCRYPTHASH hHash = NULL) const
std::basic_string<_Elem, _Traits, _Ax> decrypt_str(_In_ HCRYPTPROV hProv, _In_bytecount_(size) const void *data, _In_ size_t size, _In_opt_ HCRYPTHASH hHash = NULL) const
{
std::vector<_Elem, sanitizing_allocator<_Elem> > buf(std::move(decrypt(hProv, data, size, hHash)));
return std::basic_string<_Elem, _Traits, _Ax>(buf.data(), buf.size());
@@ -441,7 +472,7 @@ namespace eap
/// \returns Decrypted string
///
template<class _Traits, class _Ax>
std::basic_string<wchar_t, _Traits, _Ax> decrypt_str(_In_ HCRYPTPROV hProv, _In_bytecount_(size) const void *data, _In_ size_t size, _Out_opt_ HCRYPTHASH hHash = NULL) const
std::basic_string<wchar_t, _Traits, _Ax> decrypt_str(_In_ HCRYPTPROV hProv, _In_bytecount_(size) const void *data, _In_ size_t size, _In_opt_ HCRYPTHASH hHash = NULL) const
{
winstd::sanitizing_string buf(std::move(decrypt_str(hProv, data, size, hHash)));
std::basic_string<wchar_t, _Traits, _Ax> dec;
@@ -865,13 +896,13 @@ namespace eap
/// \param[out] ppDataFromInteractiveUI A pointer that receives a credentials BLOB that can be used in authentication. The caller should free the inner pointers using the function \p EapPeerFreeMemory(), starting at the innermost pointer. If a non-NULL value is supplied for this parameter, meaning that an existing data BLOB is passed to it, the supplied data BLOB will be updated and returned in this parameter.
///
virtual void query_ui_blob_from_interactive_ui_input_fields(
_In_ DWORD dwVersion,
_In_ DWORD dwFlags,
_In_ DWORD dwUIContextDataSize,
_In_count_(dwUIContextDataSize) const BYTE *pUIContextData,
_In_ const EAP_INTERACTIVE_UI_DATA *pEapInteractiveUIData,
_Out_ DWORD *pdwDataFromInteractiveUISize,
_Out_ BYTE **ppDataFromInteractiveUI) const;
_In_ DWORD dwVersion,
_In_ DWORD dwFlags,
_In_ DWORD dwUIContextDataSize,
_In_count_(dwUIContextDataSize) const BYTE *pUIContextData,
_In_ const EAP_INTERACTIVE_UI_DATA *pEapInteractiveUIData,
_Out_ DWORD *pdwDataFromInteractiveUISize,
_Outptr_result_buffer_(*pdwDataFromInteractiveUISize) BYTE **ppDataFromInteractiveUI) const;
/// \name Session management
/// @{
@@ -942,9 +973,9 @@ namespace eap
/// \param[inout] pdwSendPacketSize A pointer to a value that contains the size in bytes of the buffer allocated for the response packet. On return, this parameter receives a pointer to the actual size in bytes of \p pSendPacket.
///
virtual void get_response_packet(
_In_ EAP_SESSION_HANDLE hSession,
_Inout_bytecap_(*dwSendPacketSize) EapPacket *pSendPacket,
_Inout_ DWORD *pdwSendPacketSize) = 0;
_In_ EAP_SESSION_HANDLE hSession,
_Out_bytecapcount_(*pdwSendPacketSize) EapPacket *pSendPacket,
_Inout_ DWORD *pdwSendPacketSize) = 0;
/// @}
@@ -953,14 +984,14 @@ namespace eap
///
/// \sa [EapPeerGetResult function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363611.aspx)
///
/// \param[in ] hSession A unique handle for this EAP authentication session on the EAPHost server. This handle is returned in the \p pSessionHandle parameter in a previous call to `EapPeerBeginSession()`.
/// \param[in ] reason The reason code for the authentication result returned in \p pResult.
/// \param[out] pResult A pointer to a structure that contains the authentication results.
/// \param[in ] hSession A unique handle for this EAP authentication session on the EAPHost server. This handle is returned in the \p pSessionHandle parameter in a previous call to `EapPeerBeginSession()`.
/// \param[in ] reason The reason code for the authentication result returned in \p pResult.
/// \param[inout] pResult A pointer to a structure that contains the authentication results.
///
virtual void get_result(
_In_ EAP_SESSION_HANDLE hSession,
_In_ EapPeerMethodResultReason reason,
_Out_ EapPeerMethodResult *pResult) = 0;
_In_ EAP_SESSION_HANDLE hSession,
_In_ EapPeerMethodResultReason reason,
_Inout_ EapPeerMethodResult *pResult) = 0;
/// \name User Interaction
/// @{

View File

@@ -66,7 +66,7 @@ namespace eap
///
/// \param[in] other Credentials to move from
///
ui_context(_Inout_ ui_context &&other);
ui_context(_Inout_ ui_context &&other) noexcept;
///
/// Copies context
@@ -84,7 +84,7 @@ namespace eap
///
/// \returns Reference to this object
///
ui_context& operator=(_Inout_ ui_context &&other);
ui_context& operator=(_Inout_ ui_context &&other) noexcept;
/// \name BLOB management
/// @{

View File

@@ -40,7 +40,7 @@ eap::config::config(_In_ const config &other) :
}
eap::config::config(_Inout_ config &&other) :
eap::config::config(_Inout_ config &&other) noexcept :
m_module(other.m_module)
{
}
@@ -55,7 +55,7 @@ eap::config& eap::config::operator=(_In_ const config &other)
}
eap::config& eap::config::operator=(_Inout_ config &&other)
eap::config& eap::config::operator=(_Inout_ config &&other) noexcept
{
if (this != &other)
assert(&m_module == &other.m_module);
@@ -103,7 +103,7 @@ eap::config_method::config_method(_In_ const config_method &other) :
}
eap::config_method::config_method(_Inout_ config_method &&other) :
eap::config_method::config_method(_Inout_ config_method &&other) noexcept :
m_level (std::move(other.m_level )),
m_allow_save (std::move(other.m_allow_save )),
m_last_status(std::move(other.m_last_status)),
@@ -127,7 +127,7 @@ eap::config_method& eap::config_method::operator=(_In_ const config_method &othe
}
eap::config_method& eap::config_method::operator=(_Inout_ config_method &&other)
eap::config_method& eap::config_method::operator=(_Inout_ config_method &&other) noexcept
{
if (this != &other) {
assert(m_level == other.m_level); // Allow move within same configuration level only.
@@ -231,7 +231,7 @@ eap::config_method_with_cred::config_method_with_cred(_In_ const config_method_w
}
eap::config_method_with_cred::config_method_with_cred(_Inout_ config_method_with_cred &&other) :
eap::config_method_with_cred::config_method_with_cred(_Inout_ config_method_with_cred &&other) noexcept :
m_use_cred (std::move(other.m_use_cred)),
m_cred (std::move(other.m_cred )),
config_method(std::move(other ))
@@ -251,7 +251,7 @@ eap::config_method_with_cred& eap::config_method_with_cred::operator=(_In_ const
}
eap::config_method_with_cred& eap::config_method_with_cred::operator=(_Inout_ config_method_with_cred &&other)
eap::config_method_with_cred& eap::config_method_with_cred::operator=(_Inout_ config_method_with_cred &&other) noexcept
{
if (this != &other) {
(config_method&)*this = std::move(other );
@@ -362,7 +362,7 @@ eap::config_provider::config_provider(_In_ const config_provider &other) :
}
eap::config_provider::config_provider(_Inout_ config_provider &&other) :
eap::config_provider::config_provider(_Inout_ config_provider &&other) noexcept :
m_namespace (std::move(other.m_namespace )),
m_id (std::move(other.m_id )),
m_read_only (std::move(other.m_read_only )),
@@ -404,7 +404,7 @@ eap::config_provider& eap::config_provider::operator=(_In_ const config_provider
}
eap::config_provider& eap::config_provider::operator=(_Inout_ config_provider &&other)
eap::config_provider& eap::config_provider::operator=(_Inout_ config_provider &&other) noexcept
{
if (this != &other) {
(config&&)*this = std::move(other );
@@ -700,7 +700,7 @@ eap::config_connection::config_connection(_In_ const config_connection &other) :
}
eap::config_connection::config_connection(_Inout_ config_connection &&other) :
eap::config_connection::config_connection(_Inout_ config_connection &&other) noexcept :
m_providers(std::move(other.m_providers)),
config (std::move(other ))
{
@@ -718,7 +718,7 @@ eap::config_connection& eap::config_connection::operator=(_In_ const config_conn
}
eap::config_connection& eap::config_connection::operator=(_Inout_ config_connection &&other)
eap::config_connection& eap::config_connection::operator=(_Inout_ config_connection &&other) noexcept
{
if (this != &other) {
(config&&)*this = std::move(other );

View File

@@ -53,7 +53,7 @@ eap::credentials::credentials(_In_ const credentials &other) :
}
eap::credentials::credentials(_Inout_ credentials &&other) :
eap::credentials::credentials(_Inout_ credentials &&other) noexcept :
m_identity(std::move(other.m_identity)),
config(std::move(other))
{
@@ -71,7 +71,7 @@ eap::credentials& eap::credentials::operator=(_In_ const credentials &other)
}
eap::credentials& eap::credentials::operator=(_Inout_ credentials &&other)
eap::credentials& eap::credentials::operator=(_Inout_ credentials &&other) noexcept
{
if (this != &other) {
(config&)*this = std::move(other);
@@ -177,7 +177,7 @@ eap::credentials_identity::credentials_identity(_In_ const credentials_identity
}
eap::credentials_identity::credentials_identity(_Inout_ credentials_identity &&other) : credentials(std::move(other))
eap::credentials_identity::credentials_identity(_Inout_ credentials_identity &&other) noexcept : credentials(std::move(other))
{
}
@@ -191,7 +191,7 @@ eap::credentials_identity& eap::credentials_identity::operator=(_In_ const crede
}
eap::credentials_identity& eap::credentials_identity::operator=(_Inout_ credentials_identity &&other)
eap::credentials_identity& eap::credentials_identity::operator=(_Inout_ credentials_identity &&other) noexcept
{
if (this != &other)
(credentials&)*this = std::move(other);
@@ -297,7 +297,7 @@ LPCTSTR eap::credentials_identity::target_suffix() const
eap::credentials::source_t eap::credentials_identity::combine(
_In_ DWORD dwFlags,
_In_ HANDLE hTokenImpersonateUser,
_In_opt_ HANDLE hTokenImpersonateUser,
_In_opt_ const credentials *cred_cached,
_In_ const config_method &cfg,
_In_opt_z_ LPCTSTR pszTargetName)
@@ -359,7 +359,7 @@ eap::credentials_pass::credentials_pass(_In_ const credentials_pass &other) :
}
eap::credentials_pass::credentials_pass(_Inout_ credentials_pass &&other) :
eap::credentials_pass::credentials_pass(_Inout_ credentials_pass &&other) noexcept :
m_password (std::move(other.m_password)),
m_enc_alg (std::move(other.m_enc_alg )),
credentials(std::move(other ))
@@ -379,7 +379,7 @@ eap::credentials_pass& eap::credentials_pass::operator=(_In_ const credentials_p
}
eap::credentials_pass& eap::credentials_pass::operator=(_Inout_ credentials_pass &&other)
eap::credentials_pass& eap::credentials_pass::operator=(_Inout_ credentials_pass &&other) noexcept
{
if (this != &other) {
(credentials&)*this = std::move(other );
@@ -603,7 +603,7 @@ LPCTSTR eap::credentials_pass::target_suffix() const
eap::credentials::source_t eap::credentials_pass::combine(
_In_ DWORD dwFlags,
_In_ HANDLE hTokenImpersonateUser,
_In_opt_ HANDLE hTokenImpersonateUser,
_In_opt_ const credentials *cred_cached,
_In_ const config_method &cfg,
_In_opt_z_ LPCTSTR pszTargetName)
@@ -737,7 +737,7 @@ eap::credentials_connection::credentials_connection(_In_ const credentials_conne
}
eap::credentials_connection::credentials_connection(_Inout_ credentials_connection &&other) :
eap::credentials_connection::credentials_connection(_Inout_ credentials_connection &&other) noexcept :
m_cfg ( other.m_cfg ),
m_namespace(std::move(other.m_namespace)),
m_id (std::move(other.m_id )),
@@ -760,7 +760,7 @@ eap::credentials_connection& eap::credentials_connection::operator=(_In_ const c
}
eap::credentials_connection& eap::credentials_connection::operator=(_Inout_ credentials_connection &&other)
eap::credentials_connection& eap::credentials_connection::operator=(_Inout_ credentials_connection &&other) noexcept
{
if (this != &other) {
(config&)*this = std::move(other );
@@ -948,7 +948,7 @@ template<class _Elem, class _Traits, class _Ax>
inline static basic_string<_Elem, _Traits, _Ax> kph_encrypt(_In_ HCRYPTPROV hProv, _In_z_ const char *src)
{
basic_string<_Elem, _Traits, _Ax> str;
unsigned short key[8];
unsigned short key[8] = { 0 };
// Generate the key.
if (!CryptGenRandom(hProv, sizeof(key), (BYTE*)key))

View File

@@ -34,13 +34,13 @@ eap::method::method(_In_ module &mod) :
}
eap::method::method(_Inout_ method &&other) :
eap::method::method(_Inout_ method &&other) noexcept :
m_module(other.m_module)
{
}
eap::method& eap::method::operator=(_Inout_ method &&other)
eap::method& eap::method::operator=(_Inout_ method &&other) noexcept
{
if (this != std::addressof(other)) {
assert(std::addressof(m_module) == std::addressof(other.m_module)); // Move method within same module only!
@@ -96,7 +96,7 @@ EapPeerMethodResponseAction eap::method::set_ui_context(
}
void eap::method::get_response_attributes(_Inout_ EapAttributes *pAttribs)
void eap::method::get_response_attributes(_Out_ EapAttributes *pAttribs)
{
assert(pAttribs);
@@ -126,14 +126,14 @@ eap::method_tunnel::method_tunnel(_In_ module &mod, _In_ method *inner) :
}
eap::method_tunnel::method_tunnel(_Inout_ method_tunnel &&other) :
eap::method_tunnel::method_tunnel(_Inout_ method_tunnel &&other) noexcept :
m_inner(std::move(other.m_inner)),
method (std::move(other ))
{
}
eap::method_tunnel& eap::method_tunnel::operator=(_Inout_ method_tunnel &&other)
eap::method_tunnel& eap::method_tunnel::operator=(_Inout_ method_tunnel &&other) noexcept
{
if (this != std::addressof(other)) {
(method&)*this = std::move(other );
@@ -213,7 +213,7 @@ EapPeerMethodResponseAction eap::method_tunnel::set_ui_context(
}
void eap::method_tunnel::get_response_attributes(_Inout_ EapAttributes *pAttribs)
void eap::method_tunnel::get_response_attributes(_Out_ EapAttributes *pAttribs)
{
assert(m_inner);
m_inner->get_response_attributes(pAttribs);
@@ -240,7 +240,7 @@ eap::method_eap::method_eap(_In_ module &mod, _In_ winstd::eap_type_t eap_method
}
eap::method_eap::method_eap(_Inout_ method_eap &&other) :
eap::method_eap::method_eap(_Inout_ method_eap &&other) noexcept :
m_eap_method (std::move(other.m_eap_method)),
m_id (std::move(other.m_id )),
m_send_nak (std::move(other.m_send_nak )),
@@ -249,7 +249,7 @@ eap::method_eap::method_eap(_Inout_ method_eap &&other) :
}
eap::method_eap& eap::method_eap::operator=(_Inout_ method_eap &&other)
eap::method_eap& eap::method_eap::operator=(_Inout_ method_eap &&other) noexcept
{
if (this != std::addressof(other)) {
assert(m_eap_method == other.m_eap_method); // Move method within same EAP method type only!
@@ -274,7 +274,7 @@ void eap::method_eap::begin_session(
// Inner method can generate packets of up to 64kB (less the EAP packet header).
// Initialize inner method with appropriately less packet size maximum.
if (dwMaxSendPacketSize < sizeof(EapPacket))
throw invalid_argument(string_printf(__FUNCTION__ " Maximum packet size too small (minimum: %u, available: %u).", sizeof(EapPacket) + 1, dwMaxSendPacketSize));
throw invalid_argument(string_printf(__FUNCTION__ " Maximum packet size too small (minimum: %zu, available: %u).", sizeof(EapPacket) + 1, dwMaxSendPacketSize));
assert(m_inner);
m_inner->begin_session(dwFlags, pAttributeArray, hTokenImpersonateUser, std::min<DWORD>(dwMaxSendPacketSize, MAXWORD) - sizeof(EapPacket));
}
@@ -337,7 +337,7 @@ void eap::method_eap::get_response_packet(
// Check packet size. We will suggest one EAP method alone, so we need one byte for data.
size_t size_packet = sizeof(EapPacket) + 1;
if (size_packet > size_max)
throw invalid_argument(string_printf(__FUNCTION__ " This method does not support packet fragmentation, but the data size is too big to fit in one packet (packet: %u, maximum: %u).", size_packet, size_max));
throw invalid_argument(string_printf(__FUNCTION__ " This method does not support packet fragmentation, but the data size is too big to fit in one packet (packet: %zu, maximum: %u).", size_packet, size_max));
packet.reserve(size_packet); // To avoid reallocation when inserting EAP packet header later.
// Data of Legacy Nak packet is a list of supported EAP types: our method alone.

View File

@@ -28,7 +28,7 @@ using namespace winstd;
// eap::module
//////////////////////////////////////////////////////////////////////
eap::module::module(eap_type_t eap_method) :
eap::module::module(_In_ eap_type_t eap_method) :
m_eap_method(eap_method),
m_instance(NULL)
{
@@ -141,16 +141,16 @@ EAP_ERROR* eap::module::make_error(_In_ const EAP_ERROR *err) const
}
BYTE* eap::module::alloc_memory(_In_ size_t size)
BYTE* eap::module::alloc_memory(_In_ size_t size) const
{
BYTE *p = (BYTE*)HeapAlloc(m_heap, 0, size);
if (!p)
throw win_runtime_error(winstd::string_printf(__FUNCTION__ " Error allocating memory for BLOB (%uB).", size));
throw win_runtime_error(winstd::string_printf(__FUNCTION__ " Error allocating memory for BLOB (%zuB).", size));
return p;
}
void eap::module::free_memory(_In_ BYTE *ptr)
void eap::module::free_memory(_In_ BYTE *ptr) const
{
#if !EAP_ENCRYPT_BLOBS
// Since we do security here and some of the BLOBs contain credentials, sanitize every memory block before freeing.
@@ -160,7 +160,7 @@ void eap::module::free_memory(_In_ BYTE *ptr)
}
void eap::module::free_error_memory(_In_ EAP_ERROR *err)
void eap::module::free_error_memory(_In_ EAP_ERROR *err) const
{
// pRootCauseString and pRepairString always trail the ppEapError to reduce number of (de)allocations.
HeapFree(m_heap, 0, err);
@@ -193,7 +193,7 @@ eap::config_method* eap::module::make_config_method()
}
std::vector<unsigned char> eap::module::encrypt(_In_ HCRYPTPROV hProv, _In_bytecount_(size) const void *data, _In_ size_t size, _Out_opt_ HCRYPTHASH hHash) const
std::vector<unsigned char> eap::module::encrypt(_In_ HCRYPTPROV hProv, _In_bytecount_(size) const void *data, _In_ size_t size, _In_opt_ HCRYPTHASH hHash) const
{
// Generate 256-bit AES session key.
crypt_key key_aes;
@@ -202,9 +202,11 @@ std::vector<unsigned char> eap::module::encrypt(_In_ HCRYPTPROV hProv, _In_bytec
// Import the public RSA key.
HRSRC res = FindResource(m_instance, MAKEINTRESOURCE(IDR_EAP_KEY_PUBLIC), RT_RCDATA);
assert(res);
if (!res)
throw winstd::win_runtime_error(__FUNCTION__ " FindResource failed.");
HGLOBAL res_handle = LoadResource(m_instance, res);
assert(res_handle);
if (!res_handle)
throw winstd::win_runtime_error(__FUNCTION__ " LoadResource failed.");
crypt_key key_rsa;
unique_ptr<CERT_PUBLIC_KEY_INFO, LocalFree_delete<CERT_PUBLIC_KEY_INFO> > keyinfo_data;
DWORD keyinfo_size = 0;
@@ -321,13 +323,13 @@ void eap::peer::query_interactive_ui_input_fields(
void eap::peer::query_ui_blob_from_interactive_ui_input_fields(
_In_ DWORD dwVersion,
_In_ DWORD dwFlags,
_In_ DWORD dwUIContextDataSize,
_In_count_(dwUIContextDataSize) const BYTE *pUIContextData,
_In_ const EAP_INTERACTIVE_UI_DATA *pEapInteractiveUIData,
_Out_ DWORD *pdwDataFromInteractiveUISize,
_Out_ BYTE **ppDataFromInteractiveUI) const
_In_ DWORD dwVersion,
_In_ DWORD dwFlags,
_In_ DWORD dwUIContextDataSize,
_In_count_(dwUIContextDataSize) const BYTE *pUIContextData,
_In_ const EAP_INTERACTIVE_UI_DATA *pEapInteractiveUIData,
_Out_ DWORD *pdwDataFromInteractiveUISize,
_Outptr_result_buffer_(*pdwDataFromInteractiveUISize) BYTE **ppDataFromInteractiveUI) const
{
UNREFERENCED_PARAMETER(dwVersion);
UNREFERENCED_PARAMETER(dwFlags);

View File

@@ -43,7 +43,7 @@ eap::ui_context::ui_context(_In_ const ui_context &other) :
}
eap::ui_context::ui_context(_Inout_ ui_context &&other) :
eap::ui_context::ui_context(_Inout_ ui_context &&other) noexcept :
m_cfg ( other.m_cfg ),
m_cred ( other.m_cred ),
packable(std::move(other ))
@@ -63,7 +63,7 @@ eap::ui_context& eap::ui_context::operator=(_In_ const ui_context &other)
}
eap::ui_context& eap::ui_context::operator=(_Inout_ ui_context &&other)
eap::ui_context& eap::ui_context::operator=(_Inout_ ui_context &&other) noexcept
{
if (this != &other) {
assert(std::addressof(m_cfg ) == std::addressof(other.m_cfg )); // Move context within same configuration only!

View File

@@ -108,8 +108,10 @@ inline void wxInitializeConfig();
#pragma once
#include <wx/msw/winundef.h> // Fixes `CreateDialog` name collision
#pragma warning(push)
#pragma warning(disable: 26444)
#include "../res/wxEAP_UI.h"
#pragma warning(pop)
#include "../../EAPBase/include/Config.h"
#include "../../EAPBase/include/Credentials.h"
@@ -126,6 +128,10 @@ inline void wxInitializeConfig();
#include <list>
#include <memory>
#pragma warning(push)
#pragma warning(disable: 26444)
/// \addtogroup EAPBaseGUI
/// @{
@@ -195,7 +201,7 @@ public:
m_providers),
is_single ?
wxEAPGetProviderName(provider->m_name) :
winstd::tstring_printf(_T("%s (%u)"), static_cast<LPCTSTR>(wxEAPGetProviderName(provider->m_name)), count));
winstd::tstring_printf(_T("%s (%zu)"), static_cast<LPCTSTR>(wxEAPGetProviderName(provider->m_name)), count));
}
}
@@ -248,7 +254,11 @@ protected:
// Create provider.
eap::config_provider cfg_provider(m_cfg.m_module);
GUID guid;
CoCreateGuid(&guid);
HRESULT hr = CoCreateGuid(&guid);
if (FAILED(hr)) {
wxLogError(winstd::tstring_printf(wxT("error 0x%08x generating GUID"), hr).c_str());
return;
}
cfg_provider.m_namespace = L"urn:uuid";
cfg_provider.m_id = winstd::wstring_guid(guid).substr(1, 36);
cfg_provider.m_methods.push_back(std::move(cfg_method));
@@ -258,7 +268,7 @@ protected:
eap::config_provider &cfg_provider2 = m_cfg.m_providers.back();
eap::config_method *cfg_method2 = cfg_provider2.m_methods.front().get();
_wxT *page = new _wxT(cfg_provider2, *cfg_method2, m_providers);
m_providers->InsertPage(m_providers->GetSelection() + 1, page, wxEAPGetProviderName(cfg_provider2.m_name), true);
m_providers->InsertPage((size_t)m_providers->GetSelection() + 1, page, wxEAPGetProviderName(cfg_provider2.m_name), true);
this->Layout();
this->GetSizer()->Fit(this);
@@ -1132,3 +1142,5 @@ inline void wxInitializeConfig()
wxConfigBase *cfgPrev = wxConfigBase::Set(new wxConfig(wxT(PRODUCT_NAME_STR), wxT(VENDOR_NAME_STR)));
if (cfgPrev) wxDELETE(cfgPrev);
}
#pragma warning(pop)

View File

@@ -65,7 +65,7 @@ namespace eap
///
/// \param[in] other Configuration to move from
///
config_method_eaphost(_Inout_ config_method_eaphost &&other);
config_method_eaphost(_Inout_ config_method_eaphost &&other) noexcept;
///
/// Copies configuration
@@ -83,7 +83,7 @@ namespace eap
///
/// \returns Reference to this object
///
config_method_eaphost& operator=(_Inout_ config_method_eaphost &&other);
config_method_eaphost& operator=(_Inout_ config_method_eaphost &&other) noexcept;
virtual config* clone() const;

View File

@@ -67,7 +67,7 @@ namespace eap
///
/// \param[in] other Credentials to move from
///
credentials_eaphost(_Inout_ credentials_eaphost &&other);
credentials_eaphost(_Inout_ credentials_eaphost &&other) noexcept;
///
/// Copies credentials
@@ -85,7 +85,7 @@ namespace eap
///
/// \returns Reference to this object
///
credentials_eaphost& operator=(_Inout_ credentials_eaphost &&other);
credentials_eaphost& operator=(_Inout_ credentials_eaphost &&other) noexcept;
virtual config* clone() const;
virtual void clear();
@@ -136,7 +136,7 @@ namespace eap
///
virtual source_t combine(
_In_ DWORD dwFlags,
_In_ HANDLE hTokenImpersonateUser,
_In_opt_ HANDLE hTokenImpersonateUser,
_In_opt_ const credentials *cred_cached,
_In_ const config_method &cfg,
_In_opt_z_ LPCTSTR pszTargetName);

View File

@@ -61,7 +61,7 @@ namespace eap
///
/// \param[in] other EAP method to move from
///
method_eaphost(_Inout_ method_eaphost &&other);
method_eaphost(_Inout_ method_eaphost &&other) noexcept;
///
/// Moves an EAP method
@@ -70,7 +70,7 @@ namespace eap
///
/// \returns Reference to this object
///
method_eaphost& operator=(_Inout_ method_eaphost &&other);
method_eaphost& operator=(_Inout_ method_eaphost &&other) noexcept;
/// \name Session management
/// @{
@@ -99,8 +99,8 @@ namespace eap
/// @}
virtual void get_result(
_In_ EapPeerMethodResultReason reason,
_Out_ EapPeerMethodResult *pResult);
_In_ EapPeerMethodResultReason reason,
_Inout_ EapPeerMethodResult *pResult);
/// \name User Interaction
/// @{

View File

@@ -45,7 +45,7 @@ eap::config_method_eaphost::config_method_eaphost(_In_ const config_method_eapho
}
eap::config_method_eaphost::config_method_eaphost(_Inout_ config_method_eaphost &&other) :
eap::config_method_eaphost::config_method_eaphost(_Inout_ config_method_eaphost &&other) noexcept :
m_type (std::move(other.m_type )),
m_type_str (std::move(other.m_type_str)),
m_cfg_blob (std::move(other.m_cfg_blob)),
@@ -67,7 +67,7 @@ eap::config_method_eaphost& eap::config_method_eaphost::operator=(_In_ const con
}
eap::config_method_eaphost& eap::config_method_eaphost::operator=(_Inout_ config_method_eaphost &&other)
eap::config_method_eaphost& eap::config_method_eaphost::operator=(_Inout_ config_method_eaphost &&other) noexcept
{
if (this != &other) {
(config_method&&)*this = std::move(other );

View File

@@ -42,7 +42,7 @@ eap::credentials_eaphost::credentials_eaphost(_In_ const credentials_eaphost &ot
}
eap::credentials_eaphost::credentials_eaphost(_Inout_ credentials_eaphost &&other) :
eap::credentials_eaphost::credentials_eaphost(_Inout_ credentials_eaphost &&other) noexcept :
m_cred_blob(std::move(other.m_cred_blob)),
credentials(std::move(other ))
{
@@ -60,7 +60,7 @@ eap::credentials_eaphost& eap::credentials_eaphost::operator=(_In_ const credent
}
eap::credentials_eaphost& eap::credentials_eaphost::operator=(_Inout_ credentials_eaphost &&other)
eap::credentials_eaphost& eap::credentials_eaphost::operator=(_Inout_ credentials_eaphost &&other) noexcept
{
if (this != &other) {
(credentials&)*this = std::move(other);
@@ -220,7 +220,7 @@ LPCTSTR eap::credentials_eaphost::target_suffix() const
eap::credentials::source_t eap::credentials_eaphost::combine(
_In_ DWORD dwFlags,
_In_ HANDLE hTokenImpersonateUser,
_In_opt_ HANDLE hTokenImpersonateUser,
_In_opt_ const credentials *cred_cached,
_In_ const config_method &cfg,
_In_opt_z_ LPCTSTR pszTargetName)

View File

@@ -37,7 +37,7 @@ eap::method_eaphost::method_eaphost(_In_ module &mod, _In_ config_method_eaphost
}
eap::method_eaphost::method_eaphost(_Inout_ method_eaphost &&other) :
eap::method_eaphost::method_eaphost(_Inout_ method_eaphost &&other) noexcept :
m_cfg ( other.m_cfg ),
m_cred ( other.m_cred ),
m_session_id(std::move(other.m_session_id)),
@@ -46,7 +46,7 @@ eap::method_eaphost::method_eaphost(_Inout_ method_eaphost &&other) :
}
eap::method_eaphost& eap::method_eaphost::operator=(_Inout_ method_eaphost &&other)
eap::method_eaphost& eap::method_eaphost::operator=(_Inout_ method_eaphost &&other) noexcept
{
if (this != std::addressof(other)) {
assert(std::addressof(m_cfg ) == std::addressof(other.m_cfg )); // Move method within same configuration only!
@@ -257,7 +257,7 @@ EapPeerMethodResponseAction eap::method_eaphost::set_ui_context(
}
void eap::method_eaphost::get_response_attributes(_Inout_ EapAttributes *pAttribs)
void eap::method_eaphost::get_response_attributes(_Out_ EapAttributes *pAttribs)
{
// Get response attributes from EapHost peer.
eap_error_runtime error;

View File

@@ -74,7 +74,7 @@ namespace eap
///
/// \param[in] other Configuration to move from
///
config_method_eapgtc(_Inout_ config_method_eapgtc &&other);
config_method_eapgtc(_Inout_ config_method_eapgtc &&other) noexcept;
///
/// Copies configuration
@@ -92,7 +92,7 @@ namespace eap
///
/// \returns Reference to this object
///
config_method_eapgtc& operator=(_Inout_ config_method_eapgtc &&other);
config_method_eapgtc& operator=(_Inout_ config_method_eapgtc &&other) noexcept;
virtual config* clone() const;

View File

@@ -57,7 +57,7 @@ namespace eap
///
/// \param[in] other GTC method to move from
///
method_gtc(_Inout_ method_gtc &&other);
method_gtc(_Inout_ method_gtc &&other) noexcept;
///
/// Moves a GTC method
@@ -66,7 +66,7 @@ namespace eap
///
/// \returns Reference to this object
///
method_gtc& operator=(_Inout_ method_gtc &&other);
method_gtc& operator=(_Inout_ method_gtc &&other) noexcept;
/// \name Session management
/// @{
@@ -93,8 +93,8 @@ namespace eap
/// @}
virtual void get_result(
_In_ EapPeerMethodResultReason reason,
_Out_ EapPeerMethodResult *pResult);
_In_ EapPeerMethodResultReason reason,
_Inout_ EapPeerMethodResult *pResult);
/// \name User Interaction
/// @{

View File

@@ -41,7 +41,7 @@ eap::config_method_eapgtc::config_method_eapgtc(_In_ const config_method_eapgtc
}
eap::config_method_eapgtc::config_method_eapgtc(_Inout_ config_method_eapgtc &&other) :
eap::config_method_eapgtc::config_method_eapgtc(_Inout_ config_method_eapgtc &&other) noexcept :
config_method_with_cred(std::move(other))
{
}
@@ -56,7 +56,7 @@ eap::config_method_eapgtc& eap::config_method_eapgtc::operator=(_In_ const confi
}
eap::config_method_eapgtc& eap::config_method_eapgtc::operator=(_Inout_ config_method_eapgtc &&other)
eap::config_method_eapgtc& eap::config_method_eapgtc::operator=(_Inout_ config_method_eapgtc &&other) noexcept
{
if (this != &other)
(config_method_with_cred&&)*this = std::move(other);

View File

@@ -36,7 +36,7 @@ eap::method_gtc::method_gtc(_In_ module &mod, _In_ config_method_eapgtc &cfg, _I
}
eap::method_gtc::method_gtc(_Inout_ method_gtc &&other) :
eap::method_gtc::method_gtc(_Inout_ method_gtc &&other) noexcept :
m_cfg ( other.m_cfg ),
m_cred ( other.m_cred ),
m_challenge(std::move(other.m_challenge)),
@@ -46,7 +46,7 @@ eap::method_gtc::method_gtc(_Inout_ method_gtc &&other) :
}
eap::method_gtc& eap::method_gtc::operator=(_Inout_ method_gtc &&other)
eap::method_gtc& eap::method_gtc::operator=(_Inout_ method_gtc &&other) noexcept
{
if (this != std::addressof(other)) {
assert(std::addressof(m_cfg ) == std::addressof(other.m_cfg )); // Move method within same configuration only!
@@ -113,7 +113,7 @@ void eap::method_gtc::get_response_packet(
WideCharToMultiByte(CP_UTF8, 0, m_response, response_utf8, NULL, NULL);
if (sizeof(sanitizing_string::value_type)*response_utf8.length() > size_max)
throw invalid_argument(string_printf(__FUNCTION__ " This method does not support packet fragmentation, but the data size is too big to fit in one packet (packet: %u, maximum: %u).", sizeof(sanitizing_string::value_type)*response_utf8.length(), size_max));
throw invalid_argument(string_printf(__FUNCTION__ " This method does not support packet fragmentation, but the data size is too big to fit in one packet (packet: %zu, maximum: %u).", sizeof(sanitizing_string::value_type)*response_utf8.length(), size_max));
packet.assign(response_utf8.begin(), response_utf8.end());
}

View File

@@ -56,6 +56,9 @@ typedef wxEAPCredentialsConfigPanel<eap::credentials_pass, wxGTCPasswordCredenti
#include <Windows.h>
#pragma warning(push)
#pragma warning(disable: 26444)
/// \addtogroup EAPBaseGUI
/// @{
@@ -138,3 +141,5 @@ protected:
};
/// @}
#pragma warning(pop)

View File

@@ -66,7 +66,7 @@ namespace eap
///
/// \param[in] other Configuration to move from
///
config_method_mschapv2(_Inout_ config_method_mschapv2 &&other);
config_method_mschapv2(_Inout_ config_method_mschapv2 &&other) noexcept;
///
/// Copies configuration
@@ -84,7 +84,7 @@ namespace eap
///
/// \returns Reference to this object
///
config_method_mschapv2& operator=(_Inout_ config_method_mschapv2 &&other);
config_method_mschapv2& operator=(_Inout_ config_method_mschapv2 &&other) noexcept;
virtual config* clone() const;
@@ -134,7 +134,7 @@ namespace eap
///
/// \param[in] other Configuration to move from
///
config_method_eapmschapv2(_Inout_ config_method_eapmschapv2 &&other);
config_method_eapmschapv2(_Inout_ config_method_eapmschapv2 &&other) noexcept;
///
/// Copies configuration
@@ -152,7 +152,7 @@ namespace eap
///
/// \returns Reference to this object
///
config_method_eapmschapv2& operator=(_Inout_ config_method_eapmschapv2 &&other);
config_method_eapmschapv2& operator=(_Inout_ config_method_eapmschapv2 &&other) noexcept;
virtual config* clone() const;

View File

@@ -62,7 +62,7 @@ namespace eap
///
/// \param[in] other MSCHAPv2 method to move from
///
method_mschapv2_base(_Inout_ method_mschapv2_base &&other);
method_mschapv2_base(_Inout_ method_mschapv2_base &&other) noexcept;
///
/// Moves a MSCHAPv2 method
@@ -71,7 +71,7 @@ namespace eap
///
/// \returns Reference to this object
///
method_mschapv2_base& operator=(_Inout_ method_mschapv2_base &&other);
method_mschapv2_base& operator=(_Inout_ method_mschapv2_base &&other) noexcept;
/// \name Session management
/// @{
@@ -94,8 +94,8 @@ namespace eap
/// @}
virtual void get_result(
_In_ EapPeerMethodResultReason reason,
_Out_ EapPeerMethodResult *pResult);
_In_ EapPeerMethodResultReason reason,
_Inout_ EapPeerMethodResult *pResult);
protected:
///
@@ -162,7 +162,7 @@ namespace eap
///
/// \param[in] other MSCHAPv2 method to move from
///
method_mschapv2(_Inout_ method_mschapv2 &&other);
method_mschapv2(_Inout_ method_mschapv2 &&other) noexcept;
///
/// Moves a MSCHAPv2 method
@@ -171,7 +171,7 @@ namespace eap
///
/// \returns Reference to this object
///
method_mschapv2& operator=(_Inout_ method_mschapv2 &&other);
method_mschapv2& operator=(_Inout_ method_mschapv2 &&other) noexcept;
/// \name Packet processing
/// @{
@@ -208,7 +208,7 @@ namespace eap
///
/// \param[in] other MSCHAPv2 method to move from
///
method_mschapv2_diameter(_Inout_ method_mschapv2_diameter &&other);
method_mschapv2_diameter(_Inout_ method_mschapv2_diameter &&other) noexcept;
///
/// Moves a MSCHAPv2 method
@@ -217,7 +217,7 @@ namespace eap
///
/// \returns Reference to this object
///
method_mschapv2_diameter& operator=(_Inout_ method_mschapv2_diameter &&other);
method_mschapv2_diameter& operator=(_Inout_ method_mschapv2_diameter &&other) noexcept;
/// \name Session management
/// @{

View File

@@ -40,7 +40,7 @@ eap::config_method_mschapv2::config_method_mschapv2(_In_ const config_method_msc
}
eap::config_method_mschapv2::config_method_mschapv2(_Inout_ config_method_mschapv2 &&other) :
eap::config_method_mschapv2::config_method_mschapv2(_Inout_ config_method_mschapv2 &&other) noexcept :
config_method_with_cred(std::move(other))
{
}
@@ -55,7 +55,7 @@ eap::config_method_mschapv2& eap::config_method_mschapv2::operator=(_In_ const c
}
eap::config_method_mschapv2& eap::config_method_mschapv2::operator=(_Inout_ config_method_mschapv2 &&other)
eap::config_method_mschapv2& eap::config_method_mschapv2::operator=(_Inout_ config_method_mschapv2 &&other) noexcept
{
if (this != &other)
(config_method_with_cred&&)*this = std::move(other);
@@ -103,7 +103,7 @@ eap::config_method_eapmschapv2::config_method_eapmschapv2(_In_ const config_meth
}
eap::config_method_eapmschapv2::config_method_eapmschapv2(_Inout_ config_method_eapmschapv2 &&other) :
eap::config_method_eapmschapv2::config_method_eapmschapv2(_Inout_ config_method_eapmschapv2 &&other) noexcept :
config_method_mschapv2(std::move(other))
{
}
@@ -118,7 +118,7 @@ eap::config_method_eapmschapv2& eap::config_method_eapmschapv2::operator=(_In_ c
}
eap::config_method_eapmschapv2& eap::config_method_eapmschapv2::operator=(_Inout_ config_method_eapmschapv2 &&other)
eap::config_method_eapmschapv2& eap::config_method_eapmschapv2::operator=(_Inout_ config_method_eapmschapv2 &&other) noexcept
{
if (this != &other)
(config_method_mschapv2&&)*this = std::move(other);

View File

@@ -37,7 +37,7 @@ eap::method_mschapv2_base::method_mschapv2_base(_In_ module &mod, _In_ config_me
}
eap::method_mschapv2_base::method_mschapv2_base(_Inout_ method_mschapv2_base &&other) :
eap::method_mschapv2_base::method_mschapv2_base(_Inout_ method_mschapv2_base &&other) noexcept :
m_cfg ( other.m_cfg ),
m_cred ( other.m_cred ),
m_cp (std::move(other.m_cp )),
@@ -51,7 +51,7 @@ eap::method_mschapv2_base::method_mschapv2_base(_Inout_ method_mschapv2_base &&o
}
eap::method_mschapv2_base& eap::method_mschapv2_base::operator=(_Inout_ method_mschapv2_base &&other)
eap::method_mschapv2_base& eap::method_mschapv2_base::operator=(_Inout_ method_mschapv2_base &&other) noexcept
{
if (this != std::addressof(other)) {
assert(std::addressof(m_cfg ) == std::addressof(other.m_cfg )); // Move method within same configuration only!
@@ -93,7 +93,7 @@ void eap::method_mschapv2_base::get_response_packet(
_In_opt_ DWORD size_max)
{
if (m_packet_res.size() > size_max)
throw invalid_argument(string_printf(__FUNCTION__ " This method does not support packet fragmentation, but the data size is too big to fit in one packet (packet: %u, maximum: %u).", m_packet_res.size(), size_max));
throw invalid_argument(string_printf(__FUNCTION__ " This method does not support packet fragmentation, but the data size is too big to fit in one packet (packet: %zu, maximum: %u).", m_packet_res.size(), size_max));
packet.assign(m_packet_res.begin(), m_packet_res.end());
}
@@ -211,13 +211,13 @@ eap::method_mschapv2::method_mschapv2(_In_ module &mod, _In_ config_method_mscha
}
eap::method_mschapv2::method_mschapv2(_Inout_ method_mschapv2 &&other) :
eap::method_mschapv2::method_mschapv2(_Inout_ method_mschapv2 &&other) noexcept :
method_mschapv2_base(std::move(other ))
{
}
eap::method_mschapv2& eap::method_mschapv2::operator=(_Inout_ method_mschapv2 &&other)
eap::method_mschapv2& eap::method_mschapv2::operator=(_Inout_ method_mschapv2 &&other) noexcept
{
if (this != std::addressof(other))
(method_mschapv2_base&)*this = std::move(other);
@@ -328,14 +328,14 @@ eap::method_mschapv2_diameter::method_mschapv2_diameter(_In_ module &mod, _In_ c
}
eap::method_mschapv2_diameter::method_mschapv2_diameter(_Inout_ method_mschapv2_diameter &&other) :
eap::method_mschapv2_diameter::method_mschapv2_diameter(_Inout_ method_mschapv2_diameter &&other) noexcept :
m_phase (std::move(other.m_phase)),
method_mschapv2_base(std::move(other ))
{
}
eap::method_mschapv2_diameter& eap::method_mschapv2_diameter::operator=(_Inout_ method_mschapv2_diameter &&other)
eap::method_mschapv2_diameter& eap::method_mschapv2_diameter::operator=(_Inout_ method_mschapv2_diameter &&other) noexcept
{
if (this != std::addressof(other)) {
(method_mschapv2_base&)*this = std::move(other );

View File

@@ -65,7 +65,7 @@ namespace eap
///
/// \param[in] other Configuration to move from
///
config_method_pap(_Inout_ config_method_pap &&other);
config_method_pap(_Inout_ config_method_pap &&other) noexcept;
///
/// Copies configuration
@@ -83,7 +83,7 @@ namespace eap
///
/// \returns Reference to this object
///
config_method_pap& operator=(_Inout_ config_method_pap &&other);
config_method_pap& operator=(_Inout_ config_method_pap &&other) noexcept;
virtual config* clone() const;

View File

@@ -58,7 +58,7 @@ namespace eap
///
/// \param[in] other PAP method to move from
///
method_pap_diameter(_Inout_ method_pap_diameter &&other);
method_pap_diameter(_Inout_ method_pap_diameter &&other) noexcept;
///
/// Moves a PAP method
@@ -67,7 +67,7 @@ namespace eap
///
/// \returns Reference to this object
///
method_pap_diameter& operator=(_Inout_ method_pap_diameter &&other);
method_pap_diameter& operator=(_Inout_ method_pap_diameter &&other) noexcept;
/// \name Session management
/// @{
@@ -94,8 +94,8 @@ namespace eap
/// @}
virtual void get_result(
_In_ EapPeerMethodResultReason reason,
_Out_ EapPeerMethodResult *pResult);
_In_ EapPeerMethodResultReason reason,
_Inout_ EapPeerMethodResult *pResult);
protected:
config_method_pap &m_cfg; ///< Method configuration

View File

@@ -40,7 +40,7 @@ eap::config_method_pap::config_method_pap(_In_ const config_method_pap &other) :
}
eap::config_method_pap::config_method_pap(_Inout_ config_method_pap &&other) :
eap::config_method_pap::config_method_pap(_Inout_ config_method_pap &&other) noexcept :
config_method_with_cred(std::move(other))
{
}
@@ -55,7 +55,7 @@ eap::config_method_pap& eap::config_method_pap::operator=(_In_ const config_meth
}
eap::config_method_pap& eap::config_method_pap::operator=(_Inout_ config_method_pap &&other)
eap::config_method_pap& eap::config_method_pap::operator=(_Inout_ config_method_pap &&other) noexcept
{
if (this != &other)
(config_method_with_cred&&)*this = std::move(other);

View File

@@ -37,7 +37,7 @@ eap::method_pap_diameter::method_pap_diameter(_In_ module &mod, _In_ config_meth
}
eap::method_pap_diameter::method_pap_diameter(_Inout_ method_pap_diameter &&other) :
eap::method_pap_diameter::method_pap_diameter(_Inout_ method_pap_diameter &&other) noexcept :
m_cfg ( other.m_cfg ),
m_cred ( other.m_cred ),
m_phase (std::move(other.m_phase )),
@@ -47,7 +47,7 @@ eap::method_pap_diameter::method_pap_diameter(_Inout_ method_pap_diameter &&othe
}
eap::method_pap_diameter& eap::method_pap_diameter::operator=(_Inout_ method_pap_diameter &&other)
eap::method_pap_diameter& eap::method_pap_diameter::operator=(_Inout_ method_pap_diameter &&other) noexcept
{
if (this != std::addressof(other)) {
assert(std::addressof(m_cfg ) == std::addressof(other.m_cfg )); // Move method within same configuration only!
@@ -122,7 +122,7 @@ void eap::method_pap_diameter::get_response_packet(
_In_opt_ DWORD size_max)
{
if (m_packet_res.size() > size_max)
throw invalid_argument(string_printf(__FUNCTION__ " This method does not support packet fragmentation, but the data size is too big to fit in one packet (packet: %u, maximum: %u).", m_packet_res.size(), size_max));
throw invalid_argument(string_printf(__FUNCTION__ " This method does not support packet fragmentation, but the data size is too big to fit in one packet (packet: %zu, maximum: %u).", m_packet_res.size(), size_max));
packet.assign(m_packet_res.begin(), m_packet_res.end());
}

View File

@@ -89,7 +89,7 @@ namespace eap
///
/// \param[in] other Configuration to move from
///
config_method_tls(_Inout_ config_method_tls &&other);
config_method_tls(_Inout_ config_method_tls &&other) noexcept;
///
/// Copies configuration
@@ -107,7 +107,7 @@ namespace eap
///
/// \returns Reference to this object
///
config_method_tls& operator=(_Inout_ config_method_tls &&other);
config_method_tls& operator=(_Inout_ config_method_tls &&other) noexcept;
virtual config* clone() const;

View File

@@ -67,7 +67,7 @@ namespace eap
///
/// \param[in] other Credentials to move from
///
credentials_tls(_Inout_ credentials_tls &&other);
credentials_tls(_Inout_ credentials_tls &&other) noexcept;
///
/// Copies credentials
@@ -85,7 +85,7 @@ namespace eap
///
/// \returns Reference to this object
///
credentials_tls& operator=(_Inout_ credentials_tls &&other);
credentials_tls& operator=(_Inout_ credentials_tls &&other) noexcept;
virtual config* clone() const;
virtual void clear();
@@ -138,7 +138,7 @@ namespace eap
///
virtual source_t combine(
_In_ DWORD dwFlags,
_In_ HANDLE hTokenImpersonateUser,
_In_opt_ HANDLE hTokenImpersonateUser,
_In_opt_ const credentials *cred_cached,
_In_ const config_method &cfg,
_In_opt_z_ LPCTSTR pszTargetName);

View File

@@ -80,7 +80,7 @@ eap::config_method_tls::config_method_tls(_In_ const config_method_tls &other) :
}
eap::config_method_tls::config_method_tls(_Inout_ config_method_tls &&other) :
eap::config_method_tls::config_method_tls(_Inout_ config_method_tls &&other) noexcept :
m_trusted_root_ca(std::move(other.m_trusted_root_ca)),
m_server_names(std::move(other.m_server_names)),
config_method_with_cred(std::move(other))
@@ -100,7 +100,7 @@ eap::config_method_tls& eap::config_method_tls::operator=(_In_ const config_meth
}
eap::config_method_tls& eap::config_method_tls::operator=(_Inout_ config_method_tls &&other)
eap::config_method_tls& eap::config_method_tls::operator=(_Inout_ config_method_tls &&other) noexcept
{
if (this != &other) {
(config_method_with_cred&&)*this = std::move(other);

View File

@@ -40,7 +40,7 @@ eap::credentials_tls::credentials_tls(_In_ const credentials_tls &other) :
}
eap::credentials_tls::credentials_tls(_Inout_ credentials_tls &&other) :
eap::credentials_tls::credentials_tls(_Inout_ credentials_tls &&other) noexcept :
m_cert(std::move(other.m_cert)),
credentials(std::move(other))
{
@@ -58,7 +58,7 @@ eap::credentials_tls& eap::credentials_tls::operator=(_In_ const credentials_tls
}
eap::credentials_tls& eap::credentials_tls::operator=(_Inout_ credentials_tls &&other)
eap::credentials_tls& eap::credentials_tls::operator=(_Inout_ credentials_tls &&other) noexcept
{
if (this != &other) {
(credentials&)*this = std::move(other);
@@ -260,7 +260,7 @@ std::wstring eap::credentials_tls::get_identity() const
unique_ptr<CERT_ALT_NAME_INFO, LocalFree_delete<CERT_ALT_NAME_INFO> > san_info;
if (strcmp(m_cert->pCertInfo->rgExtension[idx_ext].pszObjId, szOID_SUBJECT_ALT_NAME2) == 0) {
unsigned char *output = NULL;
DWORD size_output;
DWORD size_output = 0;
if (!CryptDecodeObjectEx(
X509_ASN_ENCODING | PKCS_7_ASN_ENCODING,
szOID_SUBJECT_ALT_NAME2,
@@ -272,7 +272,7 @@ std::wstring eap::credentials_tls::get_identity() const
san_info.reset((CERT_ALT_NAME_INFO*)output);
} else if (strcmp(m_cert->pCertInfo->rgExtension[idx_ext].pszObjId, szOID_SUBJECT_ALT_NAME) == 0) {
unsigned char *output = NULL;
DWORD size_output;
DWORD size_output = 0;
if (!CryptDecodeObjectEx(
X509_ASN_ENCODING | PKCS_7_ASN_ENCODING,
szOID_SUBJECT_ALT_NAME,
@@ -300,7 +300,7 @@ std::wstring eap::credentials_tls::get_identity() const
eap::credentials::source_t eap::credentials_tls::combine(
_In_ DWORD dwFlags,
_In_ HANDLE hTokenImpersonateUser,
_In_opt_ HANDLE hTokenImpersonateUser,
_In_opt_ const credentials *cred_cached,
_In_ const config_method &cfg,
_In_opt_z_ LPCTSTR pszTargetName)

View File

@@ -225,8 +225,10 @@ void wxTLSServerTrustPanel::OnRootCADClick(wxCommandEvent& event)
wxTLSServerTrustPanelBase::OnRootCADClick(event);
wxCertificateClientData *cert = dynamic_cast<wxCertificateClientData*>(event.GetClientObject());
if (cert)
if (cert) {
#pragma warning(suppress: 6387) // The pvReserved parameter is annotated as _In_
CryptUIDlgViewContext(CERT_STORE_CERTIFICATE_CONTEXT, cert->m_cert, this->GetHWND(), NULL, 0, NULL);
}
}
@@ -237,6 +239,7 @@ void wxTLSServerTrustPanel::OnRootCAAddStore(wxCommandEvent& event)
winstd::cert_store store;
if (store.create(NULL, _T("ROOT"))) {
winstd::cert_context cert;
#pragma warning(suppress: 6387) // The pvReserved parameter is annotated as _In_
cert.attach(CryptUIDlgSelectCertificateFromStore(store, this->GetHWND(), NULL, NULL, 0, 0, NULL));
if (cert)
AddRootCA(cert);

View File

@@ -69,7 +69,7 @@ namespace eap
///
/// \param[in] other Configuration to move from
///
config_method_ttls(_Inout_ config_method_ttls &&other);
config_method_ttls(_Inout_ config_method_ttls &&other) noexcept;
///
/// Copies configuration
@@ -87,7 +87,7 @@ namespace eap
///
/// \returns Reference to this object
///
config_method_ttls& operator=(_Inout_ config_method_ttls &&other);
config_method_ttls& operator=(_Inout_ config_method_ttls &&other) noexcept;
virtual config* clone() const;

View File

@@ -62,7 +62,7 @@ namespace eap
///
/// \param[in] other Credentials to move from
///
credentials_ttls(_Inout_ credentials_ttls &&other);
credentials_ttls(_Inout_ credentials_ttls &&other) noexcept;
///
/// Copies credentials
@@ -80,7 +80,7 @@ namespace eap
///
/// \returns Reference to this object
///
credentials_ttls& operator=(_Inout_ credentials_ttls &&other);
credentials_ttls& operator=(_Inout_ credentials_ttls &&other) noexcept;
virtual config* clone() const;
virtual void clear();
@@ -127,7 +127,7 @@ namespace eap
///
virtual source_t combine(
_In_ DWORD dwFlags,
_In_ HANDLE hTokenImpersonateUser,
_In_opt_ HANDLE hTokenImpersonateUser,
_In_opt_ const credentials *cred_cached,
_In_ const config_method &cfg,
_In_opt_z_ LPCTSTR pszTargetName);

View File

@@ -93,7 +93,7 @@ namespace eap
///
/// \param[in] other Method to move from
///
method_defrag(_Inout_ method_defrag &&other);
method_defrag(_Inout_ method_defrag &&other) noexcept;
///
/// Moves a method
@@ -102,7 +102,7 @@ namespace eap
///
/// \returns Reference to this object
///
method_defrag& operator=(_Inout_ method_defrag &&other);
method_defrag& operator=(_Inout_ method_defrag &&other) noexcept;
/// \name Session management
/// @{
@@ -129,7 +129,6 @@ namespace eap
/// @}
protected:
DWORD m_size_frag_max; ///< Maximum size of a fragment
sanitizing_blob m_data_req; ///< Data in request
sanitizing_blob m_data_res; ///< Data in response
bool m_send_res; ///< Are we sending a response?
@@ -156,7 +155,7 @@ namespace eap
///
/// \param[in] other Method to move from
///
method_eapmsg(_Inout_ method_eapmsg &&other);
method_eapmsg(_Inout_ method_eapmsg &&other) noexcept;
///
/// Moves a method
@@ -165,7 +164,7 @@ namespace eap
///
/// \returns Reference to this object
///
method_eapmsg& operator=(_Inout_ method_eapmsg &&other);
method_eapmsg& operator=(_Inout_ method_eapmsg &&other) noexcept;
/// \name Session management
/// @{
@@ -230,7 +229,7 @@ namespace eap
///
/// \param[in] other TTLS method to move from
///
method_ttls(_Inout_ method_ttls &&other);
method_ttls(_Inout_ method_ttls &&other) noexcept;
///
/// Moves a TTLS method
@@ -239,7 +238,7 @@ namespace eap
///
/// \returns Reference to this object
///
method_ttls& operator=(_Inout_ method_ttls &&other);
method_ttls& operator=(_Inout_ method_ttls &&other) noexcept;
/// \name Session management
/// @{
@@ -266,8 +265,8 @@ namespace eap
/// @}
virtual void get_result(
_In_ EapPeerMethodResultReason reason,
_Out_ EapPeerMethodResult *pResult);
_In_ EapPeerMethodResultReason reason,
_Inout_ EapPeerMethodResult *pResult);
protected:
#if EAP_TLS < EAP_TLS_SCHANNEL_FULL

View File

@@ -115,16 +115,16 @@ namespace eap
_Out_ EapPeerMethodOutput *pEapOutput);
virtual void get_response_packet(
_In_ EAP_SESSION_HANDLE hSession,
_Inout_bytecap_(*dwSendPacketSize) EapPacket *pSendPacket,
_Inout_ DWORD *pdwSendPacketSize);
_In_ EAP_SESSION_HANDLE hSession,
_Out_bytecapcount_(*pdwSendPacketSize) EapPacket *pSendPacket,
_Inout_ DWORD *pdwSendPacketSize);
/// @}
virtual void get_result(
_In_ EAP_SESSION_HANDLE hSession,
_In_ EapPeerMethodResultReason reason,
_Out_ EapPeerMethodResult *pResult);
_In_ EAP_SESSION_HANDLE hSession,
_In_ EapPeerMethodResultReason reason,
_Inout_ EapPeerMethodResult *pResult);
/// \name User Interaction
/// @{
@@ -167,12 +167,12 @@ namespace eap
///
/// Checks all configured providers and tries to combine credentials.
///
const config_method_ttls* combine_credentials(
_Success_(return != 0) const config_method_ttls* combine_credentials(
_In_ DWORD dwFlags,
_In_ const config_connection &cfg,
_In_count_(dwUserDataSize) const BYTE *pUserData,
_In_ DWORD dwUserDataSize,
_Out_ credentials_connection& cred_out,
_Inout_ credentials_connection& cred_out,
_In_ HANDLE hTokenImpersonateUser);
protected:
@@ -223,7 +223,7 @@ namespace eap
///
/// \param[in] other Thread to move from
///
crl_checker(_Inout_ crl_checker &&other);
crl_checker(_Inout_ crl_checker &&other) noexcept;
///
/// Moves a thread
@@ -232,7 +232,7 @@ namespace eap
///
/// \returns Reference to this object
///
crl_checker& operator=(_Inout_ crl_checker &&other);
crl_checker& operator=(_Inout_ crl_checker &&other) noexcept;
///
/// Verifies server's certificate if it has been revoked

View File

@@ -61,7 +61,7 @@ namespace eap
///
/// \param[in] other Credentials to move from
///
ui_context_ttls(_Inout_ ui_context_ttls &&other);
ui_context_ttls(_Inout_ ui_context_ttls &&other) noexcept;
///
/// Copies context
@@ -79,7 +79,7 @@ namespace eap
///
/// \returns Reference to this object
///
ui_context_ttls& operator=(_Inout_ ui_context_ttls &&other);
ui_context_ttls& operator=(_Inout_ ui_context_ttls &&other) noexcept;
/// \name BLOB management
/// @{

View File

@@ -45,7 +45,7 @@ eap::config_method_ttls::config_method_ttls(const _In_ config_method_ttls &other
}
eap::config_method_ttls::config_method_ttls(_Inout_ config_method_ttls &&other) :
eap::config_method_ttls::config_method_ttls(_Inout_ config_method_ttls &&other) noexcept :
m_inner(std::move(other.m_inner)),
m_anonymous_identity(std::move(other.m_anonymous_identity)),
config_method_tls(std::move(other))
@@ -65,7 +65,7 @@ eap::config_method_ttls& eap::config_method_ttls::operator=(const _In_ config_me
}
eap::config_method_ttls& eap::config_method_ttls::operator=(_Inout_ config_method_ttls &&other)
eap::config_method_ttls& eap::config_method_ttls::operator=(_Inout_ config_method_ttls &&other) noexcept
{
if (this != &other) {
(config_method_tls&&)*this = std::move(other);

View File

@@ -41,7 +41,7 @@ eap::credentials_ttls::credentials_ttls(_In_ const credentials_ttls &other) :
}
eap::credentials_ttls::credentials_ttls(_Inout_ credentials_ttls &&other) :
eap::credentials_ttls::credentials_ttls(_Inout_ credentials_ttls &&other) noexcept :
m_inner(std::move(other.m_inner)),
credentials_tls(std::move(other))
{
@@ -59,7 +59,7 @@ eap::credentials_ttls& eap::credentials_ttls::operator=(_In_ const credentials_t
}
eap::credentials_ttls& eap::credentials_ttls::operator=(_Inout_ credentials_ttls &&other)
eap::credentials_ttls& eap::credentials_ttls::operator=(_Inout_ credentials_ttls &&other) noexcept
{
if (this != &other) {
(credentials_tls&)*this = std::move(other);
@@ -180,7 +180,7 @@ wstring eap::credentials_ttls::get_identity() const
eap::credentials::source_t eap::credentials_ttls::combine(
_In_ DWORD dwFlags,
_In_ HANDLE hTokenImpersonateUser,
_In_opt_ HANDLE hTokenImpersonateUser,
_In_opt_ const credentials *cred_cached,
_In_ const config_method &cfg,
_In_opt_z_ LPCTSTR pszTargetName)

View File

@@ -37,7 +37,7 @@ eap::method_defrag::method_defrag(_In_ module &mod, _In_ method *inner) :
}
eap::method_defrag::method_defrag(_Inout_ method_defrag &&other) :
eap::method_defrag::method_defrag(_Inout_ method_defrag &&other) noexcept :
m_data_req (std::move(other.m_data_req)),
m_data_res (std::move(other.m_data_res)),
m_send_res (std::move(other.m_send_res)),
@@ -46,7 +46,7 @@ eap::method_defrag::method_defrag(_Inout_ method_defrag &&other) :
}
eap::method_defrag& eap::method_defrag::operator=(_Inout_ method_defrag &&other)
eap::method_defrag& eap::method_defrag::operator=(_Inout_ method_defrag &&other) noexcept
{
if (this != std::addressof(other)) {
(method_tunnel&)*this = std::move(other );
@@ -181,7 +181,7 @@ eap::method_eapmsg::method_eapmsg(_In_ module &mod, _In_ const wchar_t *identity
}
eap::method_eapmsg::method_eapmsg(_Inout_ method_eapmsg &&other) :
eap::method_eapmsg::method_eapmsg(_Inout_ method_eapmsg &&other) noexcept :
m_identity (std::move(other.m_identity )),
m_phase (std::move(other.m_phase )),
m_packet_res (std::move(other.m_packet_res)),
@@ -190,7 +190,7 @@ eap::method_eapmsg::method_eapmsg(_Inout_ method_eapmsg &&other) :
}
eap::method_eapmsg& eap::method_eapmsg::operator=(_Inout_ method_eapmsg &&other)
eap::method_eapmsg& eap::method_eapmsg::operator=(_Inout_ method_eapmsg &&other) noexcept
{
if (this != std::addressof(other)) {
(method_tunnel&)*this = std::move(other );
@@ -215,7 +215,7 @@ void eap::method_eapmsg::begin_session(
// Inner method can generate packets of up to 16MB (less the Diameter AVP header).
// Initialize inner method with appropriately less packet size maximum.
if (dwMaxSendPacketSize < sizeof(diameter_avp_header))
throw invalid_argument(string_printf(__FUNCTION__ " Maximum packet size too small (minimum: %u, available: %u).", sizeof(diameter_avp_header) + 1, dwMaxSendPacketSize));
throw invalid_argument(string_printf(__FUNCTION__ " Maximum packet size too small (minimum: %zu, available: %u).", sizeof(diameter_avp_header) + 1, dwMaxSendPacketSize));
assert(m_inner);
m_inner->begin_session(dwFlags, pAttributeArray, hTokenImpersonateUser, std::min<DWORD>(dwMaxSendPacketSize, 0xffffff) - sizeof(diameter_avp_header));
@@ -325,7 +325,7 @@ void eap::method_eapmsg::get_response_packet(
packet.insert(packet.end(), (unsigned int)((4 - size_packet) % 4), 0);
} else {
if (m_packet_res.size() > size_max)
throw invalid_argument(string_printf(__FUNCTION__ " This method does not support packet fragmentation, but the data size is too big to fit in one packet (packet: %u, maximum: %u).", m_packet_res.size(), size_max));
throw invalid_argument(string_printf(__FUNCTION__ " This method does not support packet fragmentation, but the data size is too big to fit in one packet (packet: %zu, maximum: %u).", m_packet_res.size(), size_max));
packet.assign(m_packet_res.begin(), m_packet_res.end());
}
@@ -344,10 +344,12 @@ eap::method_ttls::method_ttls(_In_ module &mod, _In_ config_method_ttls &cfg, _I
m_packet_res_inner(false),
method_tunnel(mod, inner)
{
m_eap_attr_desc.dwNumberOfAttributes = 0;
m_eap_attr_desc.pAttribs = NULL;
}
eap::method_ttls::method_ttls(_Inout_ method_ttls &&other) :
eap::method_ttls::method_ttls(_Inout_ method_ttls &&other) noexcept :
m_cfg ( other.m_cfg ),
m_cred ( other.m_cred ),
m_user_ctx (std::move(other.m_user_ctx )),
@@ -362,10 +364,12 @@ eap::method_ttls::method_ttls(_Inout_ method_ttls &&other) :
m_eap_attr (std::move(other.m_eap_attr )),
method_tunnel (std::move(other ))
{
m_eap_attr_desc.dwNumberOfAttributes = (DWORD)m_eap_attr.size();
m_eap_attr_desc.pAttribs = m_eap_attr.data();
}
eap::method_ttls& eap::method_ttls::operator=(_Inout_ method_ttls &&other)
eap::method_ttls& eap::method_ttls::operator=(_Inout_ method_ttls &&other) noexcept
{
if (this != std::addressof(other)) {
assert(std::addressof(m_cfg ) == std::addressof(other.m_cfg )); // Move method within same configuration only!
@@ -770,11 +774,11 @@ void eap::method_ttls::get_response_packet(
if (FAILED(status))
throw sec_runtime_error(status, __FUNCTION__ " Error getting Schannel required encryption sizes.");
if (m_packet_res.size() + sizes.cbHeader + sizes.cbTrailer > size_max)
throw invalid_argument(string_printf(__FUNCTION__ " This method does not support packet fragmentation, but the data size is too big to fit in one packet (packet: %u, maximum: %u).", m_packet_res.size(), size_max));
throw invalid_argument(string_printf(__FUNCTION__ " This method does not support packet fragmentation, but the data size is too big to fit in one packet (packet: %zu, maximum: %u).", m_packet_res.size(), size_max));
sizes.cbMaximumMessage = std::min<unsigned long>(sizes.cbMaximumMessage, size_max - (unsigned long)(m_packet_res.size() + sizes.cbHeader + sizes.cbTrailer));
// Get inner response packet.
packet.reserve(sizes.cbHeader + sizes.cbMaximumMessage + sizes.cbTrailer);
packet.reserve((size_t)sizes.cbHeader + sizes.cbMaximumMessage + sizes.cbTrailer);
method_tunnel::get_response_packet(packet, sizes.cbMaximumMessage);
if (!packet.empty()) {
DWORD size_data = (DWORD)packet.size();
@@ -799,7 +803,7 @@ void eap::method_ttls::get_response_packet(
m_packet_res.insert(m_packet_res.end(), reinterpret_cast<const unsigned char*>(buf[0].pvBuffer), reinterpret_cast<const unsigned char*>(buf[0].pvBuffer) + buf[0].cbBuffer + buf[1].cbBuffer + buf[2].cbBuffer);
}
} else if (m_packet_res.size() > size_max)
throw invalid_argument(string_printf(__FUNCTION__ " This method does not support packet fragmentation, but the data size is too big to fit in one packet (packet: %u, maximum: %u).", m_packet_res.size(), size_max));
throw invalid_argument(string_printf(__FUNCTION__ " This method does not support packet fragmentation, but the data size is too big to fit in one packet (packet: %zu, maximum: %u).", m_packet_res.size(), size_max));
packet.assign(m_packet_res.begin(), m_packet_res.end());
}
@@ -819,7 +823,7 @@ void eap::method_ttls::get_result(
// Prepare EAP result attributes.
if (pResult->pAttribArray) {
m_eap_attr.reserve(pResult->pAttribArray->dwNumberOfAttributes + 3);
m_eap_attr.reserve((size_t)pResult->pAttribArray->dwNumberOfAttributes + 3);
m_eap_attr.clear();
// Copy all EAP attributes from inner method up to blank terminator. Exclude any MPPE-Recv-Key or MPPE-Send-Key if found.
for (auto attr = pResult->pAttribArray->pAttribs, attr_end = pResult->pAttribArray->pAttribs + pResult->pAttribArray->dwNumberOfAttributes; attr != attr_end && attr->eaType; ++attr) {

View File

@@ -92,6 +92,8 @@ void eap::peer_ttls::get_identity(
_Out_ BOOL *pfInvokeUI,
_Out_ WCHAR **ppwszIdentity)
{
assert(ppUserDataOut);
assert(pdwUserDataOutSize);
assert(pfInvokeUI);
assert(ppwszIdentity);
@@ -111,7 +113,10 @@ void eap::peer_ttls::get_identity(
if ((dwFlags & EAP_FLAG_MACHINE_AUTH) == 0) {
// Per-user authentication, request UI.
log_event(&EAPMETHOD_TRACE_EVT_CRED_INVOKE_UI2, event_data::blank);
*ppUserDataOut = NULL;
*pdwUserDataOutSize = 0;
*pfInvokeUI = TRUE;
*ppwszIdentity = NULL;
return;
} else {
// Per-machine authentication, cannot use UI.
@@ -308,9 +313,9 @@ void eap::peer_ttls::process_request_packet(
void eap::peer_ttls::get_response_packet(
_In_ EAP_SESSION_HANDLE hSession,
_Inout_bytecap_(*dwSendPacketSize) EapPacket *pSendPacket,
_Inout_ DWORD *pdwSendPacketSize)
_In_ EAP_SESSION_HANDLE hSession,
_Out_bytecapcount_(*pdwSendPacketSize) EapPacket *pSendPacket,
_Inout_ DWORD *pdwSendPacketSize)
{
assert(pdwSendPacketSize);
assert(pSendPacket || !*pdwSendPacketSize);
@@ -393,8 +398,8 @@ void eap::peer_ttls::set_ui_context(
void eap::peer_ttls::get_response_attributes(
_In_ EAP_SESSION_HANDLE hSession,
_Inout_ EapAttributes *pAttribs)
_In_ EAP_SESSION_HANDLE hSession,
_Out_ EapAttributes *pAttribs)
{
static_cast<session*>(hSession)->m_method->get_response_attributes(pAttribs);
}
@@ -422,12 +427,12 @@ void eap::peer_ttls::spawn_crl_check(_Inout_ winstd::cert_context &&cert)
}
const eap::config_method_ttls* eap::peer_ttls::combine_credentials(
_Success_(return != 0) const eap::config_method_ttls* eap::peer_ttls::combine_credentials(
_In_ DWORD dwFlags,
_In_ const config_connection &cfg,
_In_count_(dwUserDataSize) const BYTE *pUserData,
_In_ DWORD dwUserDataSize,
_Out_ credentials_connection& cred_out,
_Inout_ credentials_connection& cred_out,
_In_ HANDLE hTokenImpersonateUser)
{
#if EAP_USE_NATIVE_CREDENTIAL_CACHE
@@ -560,7 +565,7 @@ eap::peer_ttls::crl_checker::crl_checker(_In_ module &mod, _Inout_ winstd::cert_
}
eap::peer_ttls::crl_checker::crl_checker(_Inout_ crl_checker &&other) :
eap::peer_ttls::crl_checker::crl_checker(_Inout_ crl_checker &&other) noexcept :
m_module( other.m_module ),
m_thread(std::move(other.m_thread)),
m_abort (std::move(other.m_abort )),
@@ -569,7 +574,7 @@ eap::peer_ttls::crl_checker::crl_checker(_Inout_ crl_checker &&other) :
}
eap::peer_ttls::crl_checker& eap::peer_ttls::crl_checker::operator=(_Inout_ crl_checker &&other)
eap::peer_ttls::crl_checker& eap::peer_ttls::crl_checker::operator=(_Inout_ crl_checker &&other) noexcept
{
if (this != std::addressof(other)) {
assert(std::addressof(m_module) == std::addressof(other.m_module)); // Move threads within same module only!
@@ -627,7 +632,7 @@ DWORD WINAPI eap::peer_ttls::crl_checker::verify(_In_ crl_checker *obj)
switch (status_rev.dwError) {
case CRYPT_E_NO_REVOCATION_CHECK:
// Revocation check could not be performed.
c += status_rev.dwIndex + 1;
c += (size_t)status_rev.dwIndex + 1;
if (c == c_end) {
// This "error" is expected for the root CA certificate.
} else {
@@ -663,7 +668,7 @@ DWORD WINAPI eap::peer_ttls::crl_checker::verify(_In_ crl_checker *obj)
}}
// Resume checking the rest of the chain.
c += status_rev.dwIndex + 1;
c += (size_t)status_rev.dwIndex + 1;
break;
case ERROR_SUCCESS:
@@ -674,7 +679,7 @@ DWORD WINAPI eap::peer_ttls::crl_checker::verify(_In_ crl_checker *obj)
default:
// Checking one of the certificates in the chain for revocation failed. Resume checking the rest.
obj->m_module.log_event(&EAPMETHOD_TLS_SERVER_CERT_REVOKE_FAILED, event_data((unsigned int)eap_type_ttls), event_data(subj), event_data(status_rev.dwError), event_data::blank);
c += status_rev.dwIndex + 1;
c += (size_t)status_rev.dwIndex + 1;
}
} else {
// Revocation check finished.

View File

@@ -41,7 +41,7 @@ eap::ui_context_ttls::ui_context_ttls(_In_ const ui_context_ttls &other) :
}
eap::ui_context_ttls::ui_context_ttls(_Inout_ ui_context_ttls &&other) :
eap::ui_context_ttls::ui_context_ttls(_Inout_ ui_context_ttls &&other) noexcept :
m_data (std::move(other.m_data)),
ui_context(std::move(other ))
{
@@ -59,7 +59,7 @@ eap::ui_context_ttls& eap::ui_context_ttls::operator=(_In_ const ui_context_ttls
}
eap::ui_context_ttls& eap::ui_context_ttls::operator=(_Inout_ ui_context_ttls &&other)
eap::ui_context_ttls& eap::ui_context_ttls::operator=(_Inout_ ui_context_ttls &&other) noexcept
{
if (this != &other) {
(ui_context&)*this = std::move(other );

View File

@@ -323,8 +323,10 @@ void eap::peer_ttls_ui::invoke_identity_ui(
wxLogError("Unsupported authentication mode.");
break;
}
default : wxLogError("Unsupported inner authentication method.");
default: wxLogError("Unsupported inner authentication method.");
}
if (!panel)
throw invalid_argument("Invalid authentication mode");
panel->SetRemember(src_inner == eap::credentials::source_storage);
dlg.AddContent(panel);