Skip to content

Commit

Permalink
[crypto]fix build when MBEDTLS_X509_CSR_WRITE_C not configure (#19754)
Browse files Browse the repository at this point in the history
add MBEDTLS_X509_CSR_WRITE_C conditional build

Signed-off-by: Qingsong Gou <[email protected]>
  • Loading branch information
ck-telecom authored Jun 21, 2022
1 parent b486d3d commit a573952
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/crypto/CHIPCryptoPALmbedTLS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1036,6 +1036,7 @@ P256Keypair::~P256Keypair()

CHIP_ERROR P256Keypair::NewCertificateSigningRequest(uint8_t * out_csr, size_t & csr_length) const
{
#if defined(MBEDTLS_X509_CSR_WRITE_C)
CHIP_ERROR error = CHIP_NO_ERROR;
int result = 0;
size_t out_length;
Expand Down Expand Up @@ -1083,6 +1084,10 @@ CHIP_ERROR P256Keypair::NewCertificateSigningRequest(uint8_t * out_csr, size_t &

_log_mbedTLS_error(result);
return error;
#else
ChipLogError(Crypto, "MBEDTLS_X509_CSR_WRITE_C is not enabled. CSR cannot be created");
return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE;
#endif
}

CHIP_ERROR VerifyCertificateSigningRequest(const uint8_t * csr_buf, size_t csr_length, P256PublicKey & pubkey)
Expand Down

0 comments on commit a573952

Please sign in to comment.