// Verbose and explicit verification of Message 1 to 4 against IEEE Std 802.11-2016, 12.7.6.2.
Verbose and explicit verification of Message 1 to 4 against IEEE Std 802.11-2016, 12.7.6.2.
Verbose and explicit verification of Message 1 to 4 against IEEE Std 802 . 11 - 2016 12 . 7 . 6 . 2 .
fn validate_message_1(frame: &eapol::KeyFrame) -> Result<(), failure::Error> {
    // IEEE Std 802.11-2016, 12.7.2 b.4)
    ensure!(!frame.key_info.install(), Error::InvalidInstallBitValue(message_number(frame)));
    // IEEE Std 802.11-2016, 12.7.2 b.5)
    ensure!(frame.key_info.key_ack(), Error::InvalidKeyAckBitValue(message_number(frame)));
    // IEEE Std 802.11-2016, 12.7.2 b.6)
    ensure!(!frame.key_info.key_mic(), Error::InvalidKeyMicBitValue(message_number(frame)));
    // IEEE Std 802.11-2016, 12.7.2 b.7)
    ensure!(!frame.key_info.secure(), Error::InvalidSecureBitValue(message_number(frame)));
    // IEEE Std 802.11-2016, 12.7.2 b.8)
    ensure!(!frame.key_info.error(), Error::InvalidErrorBitValue(message_number(frame)));
    // IEEE Std 802.11-2016, 12.7.2 b.9)
    ensure!(!frame.key_info.request(), Error::InvalidRequestBitValue(message_number(frame)));
    // IEEE Std 802.11-2016, 12.7.2 b.10)
    ensure!(
        !frame.key_info.encrypted_key_data(),
        Error::InvalidEncryptedKeyDataBitValue(message_number(frame))
    );
    // IEEE Std 802.11-2016, 12.7.2 e)
    ensure!(!is_zero(&frame.key_nonce[..]), Error::InvalidNonce(message_number(frame)));
    // IEEE Std 802.11-2016, 12.7.2 f)
    // IEEE Std 802.11-2016, 12.7.6.2
    ensure!(is_zero(&frame.key_iv[..]), Error::InvalidIv(frame.version, message_number(frame)));
    // IEEE Std 802.11-2016, 12.7.2 g)
    ensure!(frame.key_rsc == 0, Error::InvalidRsc(message_number(frame)));
    // The first message of the Handshake is also required to carry a zeroed MIC.
    // Some routers however send messages without zeroing out the MIC beforehand.
    // To ensure compatibility with such routers, the MIC of the first message is
    // allowed to be set.
    // This assumption faces no security risk because the message's MIC is only
    // validated in the Handshake and not in the Supplicant or Authenticator
    // implementation.
    Ok(())
}
fn validate_message_1 ( frame : & eapol :: KeyFrame ) -> Result < ( ) , failure :: Error > { // IEEE Std 802.11-2016, 12.7.2 b.4) ensure ! ( frame key_info install ( ) Error InvalidInstallBitValue ( message_number ( frame ) ) ) ; // IEEE Std 802.11-2016, 12.7.2 b.5) ensure ! ( frame key_info key_ack ( ) Error InvalidKeyAckBitValue ( message_number ( frame ) ) ) ; // IEEE Std 802.11-2016, 12.7.2 b.6) ensure ! ( frame key_info key_mic ( ) Error InvalidKeyMicBitValue ( message_number ( frame ) ) ) ; // IEEE Std 802.11-2016, 12.7.2 b.7) ensure ! ( frame key_info secure ( ) Error InvalidSecureBitValue ( message_number ( frame ) ) ) ; // IEEE Std 802.11-2016, 12.7.2 b.8) ensure ! ( frame key_info error ( ) Error InvalidErrorBitValue ( message_number ( frame ) ) ) ; // IEEE Std 802.11-2016, 12.7.2 b.9) ensure ! ( frame key_info request ( ) Error InvalidRequestBitValue ( message_number ( frame ) ) ) ; // IEEE Std 802.11-2016, 12.7.2 b.10) ensure ! ( frame key_info encrypted_key_data ( ) Error InvalidEncryptedKeyDataBitValue ( message_number ( frame ) ) ) ; // IEEE Std 802.11-2016, 12.7.2 e) ensure ! ( is_zero ( frame key_nonce [ ] ) Error InvalidNonce ( message_number ( frame ) ) ) ; // IEEE Std 802.11-2016, 12.7.2 f) // IEEE Std 802.11-2016, 12.7.6.2 ensure ! ( is_zero ( frame key_iv [ ] ) Error InvalidIv ( frame version message_number ( frame ) ) ) ; // IEEE Std 802.11-2016, 12.7.2 g) ensure ! ( frame key_rsc 0 Error InvalidRsc ( message_number ( frame ) ) ) ; // The first message of the Handshake is also required to carry a zeroed MIC. // Some routers however send messages without zeroing out the MIC beforehand. // To ensure compatibility with such routers, the MIC of the first message is // allowed to be set. // This assumption faces no security risk because the message's MIC is only // validated in the Handshake and not in the Supplicant or Authenticator // implementation. Ok ( ( ) ) }
Verbose and explicit verification of Message 1 to 4 against IEEE Std 802.11-2016, 12.7.6.2.
Verbose and explicit verification of Message 1 to 4 against IEEE Std 802 . 11 - 2016 12 . 7 . 6 . 2 .
frame
&eapol::KeyFrame