From 3c345cd7c292cbfad7062d2dca88b90971e33781 Mon Sep 17 00:00:00 2001 From: Paul Zander <69502639+pjzander-signify@users.noreply.github.com> Date: Wed, 31 Mar 2021 15:15:29 +0200 Subject: [PATCH] Pin code is used in the endian mode of the processor (#5726) (#5730) --- src/transport/PASESession.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/transport/PASESession.cpp b/src/transport/PASESession.cpp index 7f61424be92478..2d3b7bc1d15969 100644 --- a/src/transport/PASESession.cpp +++ b/src/transport/PASESession.cpp @@ -196,7 +196,10 @@ CHIP_ERROR PASESession::Init(uint16_t myKeyId, uint32_t setupCode, SessionEstabl CHIP_ERROR PASESession::ComputePASEVerifier(uint32_t setUpPINCode, uint32_t pbkdf2IterCount, const uint8_t * salt, size_t saltLen, PASEVerifier & verifier) { - return pbkdf2_sha256(reinterpret_cast(&setUpPINCode), sizeof(setUpPINCode), salt, saltLen, pbkdf2IterCount, + uint8_t littleEndianSetupPINCode[sizeof(uint32_t)]; + Encoding::LittleEndian::Put32(littleEndianSetupPINCode, setUpPINCode); + + return pbkdf2_sha256(littleEndianSetupPINCode, sizeof(littleEndianSetupPINCode), salt, saltLen, pbkdf2IterCount, sizeof(PASEVerifier), &verifier[0][0]); }