@@ -63,7 +63,7 @@ void SecurePairingSession::Clear()
63
63
memset (&mPoint [0 ], 0 , sizeof (mPoint ));
64
64
memset (&mWS [0 ][0 ], 0 , sizeof (mWS ));
65
65
memset (&mKe [0 ], 0 , sizeof (mKe ));
66
- mNextExpectedMsg = Spake2pMsgType:: kSpake2pMsgError ;
66
+ mNextExpectedMsg = Protocols::SecureChannel::MsgType::PASE_Spake2pError ;
67
67
mSpake2p .Init (nullptr );
68
68
mCommissioningHash .Clear ();
69
69
mIterationCount = 0 ;
@@ -240,7 +240,7 @@ CHIP_ERROR SecurePairingSession::WaitForPairing(uint32_t mySetUpPINCode, uint32_
240
240
241
241
mIterationCount = pbkdf2IterCount;
242
242
243
- mNextExpectedMsg = Spake2pMsgType:: kPBKDFParamRequest ;
243
+ mNextExpectedMsg = Protocols::SecureChannel::MsgType::PBKDFParamRequest ;
244
244
mPairingComplete = false ;
245
245
246
246
ChipLogDetail (Ble, " Waiting for PBKDF param request" );
@@ -253,14 +253,14 @@ CHIP_ERROR SecurePairingSession::WaitForPairing(uint32_t mySetUpPINCode, uint32_
253
253
return err;
254
254
}
255
255
256
- CHIP_ERROR SecurePairingSession::AttachHeaderAndSend (uint8_t msgType, System::PacketBufferHandle msgBuf)
256
+ CHIP_ERROR SecurePairingSession::AttachHeaderAndSend (Protocols::SecureChannel::MsgType msgType, System::PacketBufferHandle msgBuf)
257
257
{
258
258
CHIP_ERROR err = CHIP_NO_ERROR;
259
259
260
260
PayloadHeader payloadHeader;
261
261
262
262
payloadHeader
263
- .SetMessageType (msgType) //
263
+ .SetMessageType (static_cast < uint8_t >( msgType) ) //
264
264
.SetProtocolID (Protocols::kProtocol_SecureChannel );
265
265
266
266
uint16_t headerSize = payloadHeader.EncodeSizeBytes ();
@@ -331,9 +331,9 @@ CHIP_ERROR SecurePairingSession::SendPBKDFParamRequest()
331
331
err = mCommissioningHash .AddData (req->Start (), req->DataLength ());
332
332
SuccessOrExit (err);
333
333
334
- mNextExpectedMsg = Spake2pMsgType:: kPBKDFParamResponse ;
334
+ mNextExpectedMsg = Protocols::SecureChannel::MsgType::PBKDFParamResponse ;
335
335
336
- err = AttachHeaderAndSend (Spake2pMsgType:: kPBKDFParamRequest , std::move (req));
336
+ err = AttachHeaderAndSend (Protocols::SecureChannel::MsgType::PBKDFParamRequest , std::move (req));
337
337
SuccessOrExit (err);
338
338
339
339
ChipLogDetail (Ble, " Sent PBKDF param request" );
@@ -422,9 +422,9 @@ CHIP_ERROR SecurePairingSession::SendPBKDFParamResponse()
422
422
err = mSpake2p .ComputeL (mPoint , &sizeof_point, &mWS [1 ][0 ], kSpake2p_WS_Length );
423
423
SuccessOrExit (err);
424
424
425
- mNextExpectedMsg = Spake2pMsgType:: kSpake2pMsg1 ;
425
+ mNextExpectedMsg = Protocols::SecureChannel::MsgType::PASE_Spake2p1 ;
426
426
427
- err = AttachHeaderAndSend (Spake2pMsgType:: kPBKDFParamResponse , std::move (resp));
427
+ err = AttachHeaderAndSend (Protocols::SecureChannel::MsgType::PBKDFParamResponse , std::move (resp));
428
428
SuccessOrExit (err);
429
429
430
430
ChipLogDetail (Ble, " Sent PBKDF param response" );
@@ -505,10 +505,10 @@ CHIP_ERROR SecurePairingSession::SendMsg1()
505
505
memcpy (msg_pA->Start (), &X[0 ], X_len);
506
506
507
507
msg_pA->SetDataLength (data_len);
508
- mNextExpectedMsg = Spake2pMsgType:: kSpake2pMsg2 ;
508
+ mNextExpectedMsg = Protocols::SecureChannel::MsgType::PASE_Spake2p2 ;
509
509
510
510
// Call delegate to send the Msg1 to peer
511
- err = AttachHeaderAndSend (Spake2pMsgType:: kSpake2pMsg1 , std::move (msg_pA));
511
+ err = AttachHeaderAndSend (Protocols::SecureChannel::MsgType::PASE_Spake2p1 , std::move (msg_pA));
512
512
SuccessOrExit (err);
513
513
514
514
ChipLogDetail (Ble, " Sent spake2p msg1" );
@@ -568,10 +568,10 @@ CHIP_ERROR SecurePairingSession::HandleMsg1_and_SendMsg2(const PacketHeader & he
568
568
}
569
569
570
570
resp->SetDataLength (data_len);
571
- mNextExpectedMsg = Spake2pMsgType:: kSpake2pMsg3 ;
571
+ mNextExpectedMsg = Protocols::SecureChannel::MsgType::PASE_Spake2p3 ;
572
572
573
573
// Call delegate to send the Msg2 to peer
574
- err = AttachHeaderAndSend (Spake2pMsgType:: kSpake2pMsg2 , std::move (resp));
574
+ err = AttachHeaderAndSend (Protocols::SecureChannel::MsgType::PASE_Spake2p2 , std::move (resp));
575
575
SuccessOrExit (err);
576
576
577
577
ChipLogDetail (Ble, " Sent spake2p msg2" );
@@ -625,7 +625,7 @@ CHIP_ERROR SecurePairingSession::HandleMsg2_and_SendMsg3(const PacketHeader & he
625
625
resp->SetDataLength (verifier_len);
626
626
627
627
// Call delegate to send the Msg3 to peer
628
- err = AttachHeaderAndSend (Spake2pMsgType:: kSpake2pMsg3 , std::move (resp));
628
+ err = AttachHeaderAndSend (Protocols::SecureChannel::MsgType::PASE_Spake2p3 , std::move (resp));
629
629
SuccessOrExit (err);
630
630
631
631
ChipLogDetail (Ble, " Sent spake2p msg3" );
@@ -665,9 +665,9 @@ CHIP_ERROR SecurePairingSession::HandleMsg3(const PacketHeader & header, const S
665
665
666
666
ChipLogDetail (Ble, " Received spake2p msg3" );
667
667
668
- // We will set NextExpectedMsg to kSpake2pMsgError in all cases
669
- // However, when we are using IP rendezvous, we might set it to kSpake2pMsg1 .
670
- mNextExpectedMsg = Spake2pMsgType:: kSpake2pMsgError ;
668
+ // We will set NextExpectedMsg to PASE_Spake2pError in all cases
669
+ // However, when we are using IP rendezvous, we might set it to PASE_Spake2p1 .
670
+ mNextExpectedMsg = Protocols::SecureChannel::MsgType::PASE_Spake2pError ;
671
671
672
672
VerifyOrExit (hash != nullptr , err = CHIP_ERROR_MESSAGE_INCOMPLETE);
673
673
VerifyOrExit (msg->DataLength () == kMAX_Hash_Length , err = CHIP_ERROR_INVALID_MESSAGE_LENGTH);
@@ -715,7 +715,7 @@ void SecurePairingSession::SendErrorMsg(Spake2pErrorType errorCode)
715
715
716
716
msg->SetDataLength (msglen);
717
717
718
- err = AttachHeaderAndSend (Spake2pMsgType:: kSpake2pMsgError , std::move (msg));
718
+ err = AttachHeaderAndSend (Protocols::SecureChannel::MsgType::PASE_Spake2pError , std::move (msg));
719
719
SuccessOrExit (err);
720
720
721
721
exit :
@@ -758,25 +758,25 @@ CHIP_ERROR SecurePairingSession::HandlePeerMessage(const PacketHeader & packetHe
758
758
759
759
mPeerAddress = peerAddress;
760
760
761
- switch (static_cast <Spake2pMsgType >(payloadHeader.GetMessageType ()))
761
+ switch (static_cast <Protocols::SecureChannel::MsgType >(payloadHeader.GetMessageType ()))
762
762
{
763
- case Spake2pMsgType:: kPBKDFParamRequest :
763
+ case Protocols::SecureChannel::MsgType::PBKDFParamRequest :
764
764
err = HandlePBKDFParamRequest (packetHeader, msg);
765
765
break ;
766
766
767
- case Spake2pMsgType:: kPBKDFParamResponse :
767
+ case Protocols::SecureChannel::MsgType::PBKDFParamResponse :
768
768
err = HandlePBKDFParamResponse (packetHeader, msg);
769
769
break ;
770
770
771
- case Spake2pMsgType:: kSpake2pMsg1 :
771
+ case Protocols::SecureChannel::MsgType::PASE_Spake2p1 :
772
772
err = HandleMsg1_and_SendMsg2 (packetHeader, msg);
773
773
break ;
774
774
775
- case Spake2pMsgType:: kSpake2pMsg2 :
775
+ case Protocols::SecureChannel::MsgType::PASE_Spake2p2 :
776
776
err = HandleMsg2_and_SendMsg3 (packetHeader, msg);
777
777
break ;
778
778
779
- case Spake2pMsgType:: kSpake2pMsg3 :
779
+ case Protocols::SecureChannel::MsgType::PASE_Spake2p3 :
780
780
err = HandleMsg3 (packetHeader, msg);
781
781
break ;
782
782
0 commit comments