Skip to content

Commit

Permalink
[EFR32] Fix CSR length. (#22080)
Browse files Browse the repository at this point in the history
  • Loading branch information
rcasallas-silabs authored Aug 22, 2022
1 parent f68b948 commit 6681060
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/platform/EFR32/CHIPCryptoPALPsaEfr32.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -894,7 +894,9 @@ P256Keypair::~P256Keypair()
CHIP_ERROR P256Keypair::NewCertificateSigningRequest(uint8_t * out_csr, size_t & csr_length) const
{
MutableByteSpan csr(out_csr, csr_length);
return GenerateCertificateSigningRequest(this, csr);
CHIP_ERROR err = GenerateCertificateSigningRequest(this, csr);
csr_length = (CHIP_NO_ERROR == err) ? csr.size() : 0;
return err;
}

CHIP_ERROR VerifyCertificateSigningRequest(const uint8_t * csr_buf, size_t csr_length, P256PublicKey & pubkey)
Expand Down
4 changes: 3 additions & 1 deletion src/platform/EFR32/Efr32PsaOpaqueKeypair.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,9 @@ CHIP_ERROR EFR32OpaqueP256Keypair::Deserialize(P256SerializedKeypair & input)
CHIP_ERROR EFR32OpaqueP256Keypair::NewCertificateSigningRequest(uint8_t * out_csr, size_t & csr_length) const
{
MutableByteSpan csr(out_csr, csr_length);
return GenerateCertificateSigningRequest(this, csr);
CHIP_ERROR err = GenerateCertificateSigningRequest(this, csr);
csr_length = (CHIP_NO_ERROR == err) ? csr.size() : 0;
return err;
}

CHIP_ERROR EFR32OpaqueP256Keypair::ECDSA_sign_msg(const uint8_t * msg, size_t msg_length, P256ECDSASignature & out_signature) const
Expand Down

0 comments on commit 6681060

Please sign in to comment.