Processing of vendor specific TLS messages introduced

This commit is contained in:
Simon Rozman 2016-08-13 18:48:02 +02:00
parent c749753c68
commit eb918f3141
2 changed files with 32 additions and 2 deletions

View File

@ -370,6 +370,17 @@ namespace eap
///
void process_application_data(_In_bytecount_(msg_size) const void *msg, _In_ size_t msg_size);
///
/// Processes a vendor-specific TLS message
///
/// \note Please see `m_cipher_spec` member if the message data came encrypted.
///
/// \param[in] type TLS message type
/// \param[in] msg TLS message data
/// \param[in] msg_size TLS message data size
///
void process_vendor_data(_In_ unsigned char type, _In_bytecount_(msg_size) const void *msg, _In_ size_t msg_size);
///
/// Verifies server's certificate if trusted by configuration
///
@ -378,7 +389,7 @@ namespace eap
///
/// Encrypt TLS message
///
/// \param[inout] msg TLS message to encrypt
/// \param[inout] msg TLS message to encrypt
///
void encrypt_message(_Inout_ sanitizing_blob &msg);

View File

@ -906,7 +906,7 @@ void eap::method_tls::process_packet(_In_bytecount_(size_pck) const void *_pck,
process_handshake(msg, msg_end - msg);
break;
case tls_message_type_application_data:
case tls_message_type_application_data: {
if (!m_cipher_spec)
throw win_runtime_error(EAP_E_EAPHOST_METHOD_INVALID_PACKET, __FUNCTION__ " Application data should be encrypted.");
@ -915,6 +915,15 @@ void eap::method_tls::process_packet(_In_bytecount_(size_pck) const void *_pck,
process_application_data(msg_dec.data(), msg_dec.size());
break;
}
default:
if (m_cipher_spec) {
sanitizing_blob msg_dec(msg, msg_end);
decrypt_message(msg_dec);
process_vendor_data(hdr->type, msg_dec.data(), msg_dec.size());
} else
process_vendor_data(hdr->type, msg, msg_end - msg);
}
}
pck = msg_end;
@ -1095,6 +1104,16 @@ void eap::method_tls::process_application_data(_In_bytecount_(msg_size) const vo
{
UNREFERENCED_PARAMETER(msg);
UNREFERENCED_PARAMETER(msg_size);
// TODO: Parse application data (Diameter AVP)
}
void eap::method_tls::process_vendor_data(_In_ unsigned char type, _In_bytecount_(msg_size) const void *msg, _In_ size_t msg_size)
{
UNREFERENCED_PARAMETER(type);
UNREFERENCED_PARAMETER(msg);
UNREFERENCED_PARAMETER(msg_size);
}