Skip to content

Commit

Permalink
Fixed ValidateCertificateChain() Implementation for mbedTLS. (#16727)
Browse files Browse the repository at this point in the history
In the mbedTLS implementation the root certificate shouldn't be included
in the certificate chain. It is sufficient that it is included in the
trusted certificates list.
  • Loading branch information
emargolis authored and pull[bot] committed Oct 12, 2023
1 parent 7eae248 commit 9ba5038
Showing 1 changed file with 0 additions and 4 deletions.
4 changes: 0 additions & 4 deletions src/crypto/CHIPCryptoPALmbedTLS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1302,10 +1302,6 @@ CHIP_ERROR ValidateCertificateChain(const uint8_t * rootCertificate, size_t root
mbedResult = mbedtls_x509_crt_parse(&certChain, Uint8::to_const_uchar(caCertificate), caCertificateLen);
VerifyOrExit(mbedResult == 0, (result = CertificateChainValidationResult::kICAFormatInvalid, error = CHIP_ERROR_INTERNAL));

/* Add the root to the chain */
mbedResult = mbedtls_x509_crt_parse(&certChain, Uint8::to_const_uchar(rootCertificate), rootCertificateLen);
VerifyOrExit(mbedResult == 0, (result = CertificateChainValidationResult::kRootFormatInvalid, error = CHIP_ERROR_INTERNAL));

/* Parse the root cert */
mbedResult = mbedtls_x509_crt_parse(&rootCert, Uint8::to_const_uchar(rootCertificate), rootCertificateLen);
VerifyOrExit(mbedResult == 0, (result = CertificateChainValidationResult::kRootFormatInvalid, error = CHIP_ERROR_INTERNAL));
Expand Down

0 comments on commit 9ba5038

Please sign in to comment.