Commit 64374bad authored by aligungr's avatar aligungr

Authentication abnormal case handling

parent 6e23a56c
...@@ -46,8 +46,6 @@ void NasMm::receiveAuthenticationRequestEap(const nas::AuthenticationRequest &ms ...@@ -46,8 +46,6 @@ void NasMm::receiveAuthenticationRequestEap(const nas::AuthenticationRequest &ms
m_timers->t3521.stop(); m_timers->t3521.stop();
}; };
m_timers->t3520.stop();
// Read EAP-AKA' request // Read EAP-AKA' request
auto &receivedEap = (const eap::EapAkaPrime &)*msg.eapMessage->eap; auto &receivedEap = (const eap::EapAkaPrime &)*msg.eapMessage->eap;
auto receivedRand = receivedEap.attributes.getRand(); auto receivedRand = receivedEap.attributes.getRand();
...@@ -281,6 +279,8 @@ void NasMm::receiveAuthenticationRequest5gAka(const nas::AuthenticationRequest & ...@@ -281,6 +279,8 @@ void NasMm::receiveAuthenticationRequest5gAka(const nas::AuthenticationRequest &
if ((m_usim->m_currentNsCtx && m_usim->m_currentNsCtx->ngKsi == msg.ngKSI.ksi) || if ((m_usim->m_currentNsCtx && m_usim->m_currentNsCtx->ngKsi == msg.ngKSI.ksi) ||
(m_usim->m_nonCurrentNsCtx && m_usim->m_nonCurrentNsCtx->ngKsi == msg.ngKSI.ksi)) (m_usim->m_nonCurrentNsCtx && m_usim->m_nonCurrentNsCtx->ngKsi == msg.ngKSI.ksi))
{ {
m_timers->t3520.start();
sendFailure(nas::EMmCause::NGKSI_ALREADY_IN_USE); sendFailure(nas::EMmCause::NGKSI_ALREADY_IN_USE);
return; return;
} }
...@@ -323,33 +323,32 @@ void NasMm::receiveAuthenticationRequest5gAka(const nas::AuthenticationRequest & ...@@ -323,33 +323,32 @@ void NasMm::receiveAuthenticationRequest5gAka(const nas::AuthenticationRequest &
keys::DeriveKeysSeafAmf(*m_base->config, *m_usim->m_currentPlmn, *m_usim->m_nonCurrentNsCtx); keys::DeriveKeysSeafAmf(*m_base->config, *m_usim->m_currentPlmn, *m_usim->m_nonCurrentNsCtx);
// Send response // Send response
m_timers->t3520.stop();
nas::AuthenticationResponse resp; nas::AuthenticationResponse resp;
resp.authenticationResponseParameter = nas::IEAuthenticationResponseParameter{}; resp.authenticationResponseParameter = nas::IEAuthenticationResponseParameter{};
resp.authenticationResponseParameter->rawData = m_usim->m_resStar.copy(); resp.authenticationResponseParameter->rawData = m_usim->m_resStar.copy();
sendNasMessage(resp);
// 5.4.1.3.7, Item c) sendNasMessage(resp);
// NOTE: Spec says UE shall start any retransmission timers previously stopped due to MAC failure
(void)0;
} }
else if (autnCheck == EAutnValidationRes::MAC_FAILURE) else if (autnCheck == EAutnValidationRes::MAC_FAILURE)
{ {
// 5.4.1.3.7, Item c)
// NOTE: Spec says UE shall stop any retransmission timers
(void)0;
m_timers->t3520.start(); m_timers->t3520.start();
sendFailure(nas::EMmCause::MAC_FAILURE); sendFailure(nas::EMmCause::MAC_FAILURE);
} }
else if (autnCheck == EAutnValidationRes::SYNCHRONISATION_FAILURE) else if (autnCheck == EAutnValidationRes::SYNCHRONISATION_FAILURE)
{ {
m_timers->t3520.start();
auto milenage = calculateMilenage(m_usim->m_sqnMng->getSqn(), rand, true); auto milenage = calculateMilenage(m_usim->m_sqnMng->getSqn(), rand, true);
auto auts = keys::CalculateAuts(m_usim->m_sqnMng->getSqn(), milenage.ak_r, milenage.mac_s); auto auts = keys::CalculateAuts(m_usim->m_sqnMng->getSqn(), milenage.ak_r, milenage.mac_s);
sendFailure(nas::EMmCause::SYNCH_FAILURE, std::move(auts)); sendFailure(nas::EMmCause::SYNCH_FAILURE, std::move(auts));
} }
else else
{ {
m_timers->t3520.start();
// the other case, separation bit mismatched // the other case, separation bit mismatched
sendFailure(nas::EMmCause::NON_5G_AUTHENTICATION_UNACCEPTABLE); sendFailure(nas::EMmCause::NON_5G_AUTHENTICATION_UNACCEPTABLE);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment