Skip to content

Commit 1096274

Browse files
ck-telecompull[bot]
authored andcommitted
[crypto]fix build when MBEDTLS_X509_CSR_WRITE_C not configure (#19754)
add MBEDTLS_X509_CSR_WRITE_C conditional build Signed-off-by: Qingsong Gou <gouqs@hotmail.com>
1 parent d278c74 commit 1096274

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/crypto/CHIPCryptoPALmbedTLS.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -1036,6 +1036,7 @@ P256Keypair::~P256Keypair()
10361036

10371037
CHIP_ERROR P256Keypair::NewCertificateSigningRequest(uint8_t * out_csr, size_t & csr_length) const
10381038
{
1039+
#if defined(MBEDTLS_X509_CSR_WRITE_C)
10391040
CHIP_ERROR error = CHIP_NO_ERROR;
10401041
int result = 0;
10411042
size_t out_length;
@@ -1083,6 +1084,10 @@ CHIP_ERROR P256Keypair::NewCertificateSigningRequest(uint8_t * out_csr, size_t &
10831084

10841085
_log_mbedTLS_error(result);
10851086
return error;
1087+
#else
1088+
ChipLogError(Crypto, "MBEDTLS_X509_CSR_WRITE_C is not enabled. CSR cannot be created");
1089+
return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE;
1090+
#endif
10861091
}
10871092

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

0 commit comments

Comments
 (0)