Skip to content

Commit 879a9c6

Browse files
authored
[crypto] Align PSA P256Keypair::Serialize buffer cleanup with the mbedTLS backend (project-chip#73344)
The mbedTLS implementation of P256Keypair::Serialize calls ClearSecretData on its temporary buffer before returning. Apply the same call in the two PSA-based implementations so all three follow one convention.
1 parent 2bc1662 commit 879a9c6

2 files changed

Lines changed: 2 additions & 0 deletions

File tree

src/crypto/CHIPCryptoPALPSA.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -882,6 +882,7 @@ CHIP_ERROR P256Keypair::Serialize(P256SerializedKeypair & output) const
882882
error = output.SetLength(bbuf.Needed());
883883

884884
exit:
885+
ClearSecretData(privateKey, sizeof(privateKey));
885886
LogPsaError(status);
886887

887888
return error;

src/platform/silabs/efr32/CHIPCryptoPALPsaEfr32.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -849,6 +849,7 @@ CHIP_ERROR P256Keypair::Serialize(P256SerializedKeypair & output) const
849849
error = output.SetLength(bbuf.Needed());
850850

851851
exit:
852+
ClearSecretData(privateKey, sizeof(privateKey));
852853
LogPsaError(status);
853854

854855
return error;

0 commit comments

Comments
 (0)