Skip to content

Commit

Permalink
Disabled cert validation test in certain platforms
Browse files Browse the repository at this point in the history
  • Loading branch information
vijs committed Dec 2, 2021
1 parent d6d4834 commit cb3698e
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/credentials/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import("//build_overrides/chip.gni")
import("//build_overrides/nlassert.gni")
import("${chip_root}/src/crypto/crypto.gni")
import("${chip_root}/src/platform/device.gni")

static_library("credentials") {
output_name = "libCredentials"
Expand Down Expand Up @@ -48,6 +49,10 @@ static_library("credentials") {
sources += [ "${chip_root}/examples/platform/nxp/se05x/DeviceAttestationSe05xCredsExample.cpp" ]
}

if (chip_device_platform == "esp32" || chip_device_platform == "nrfconnect") {
defines = [ "CURRENT_TIME_NOT_IMPLEMENTED=1" ]
}

cflags = [ "-Wconversion" ]

public_deps = [
Expand Down
2 changes: 2 additions & 0 deletions src/credentials/examples/DefaultDeviceAttestationVerifier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,9 @@ AttestationVerificationResult DefaultDACVerifier::VerifyAttestationInformation(c
VerifyOrReturnError(mAttestationTrustStore->GetProductAttestationAuthorityCert(akid, paaDerBuffer) == CHIP_NO_ERROR,
AttestationVerificationResult::kPaaNotFound);

#if !defined(CURRENT_TIME_NOT_IMPLEMENTED)
VerifyOrReturnError(IsCertificateValidAtCurrentTime(dacDerBuffer) == CHIP_NO_ERROR, AttestationVerificationResult::kDacExpired);
#endif

VerifyOrReturnError(IsCertificateValidAtIssuance(dacDerBuffer, paiDerBuffer) == CHIP_NO_ERROR,
AttestationVerificationResult::kPaiExpired);
Expand Down
4 changes: 4 additions & 0 deletions src/crypto/tests/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ chip_test_suite("tests") {
sources += [ "CHIPCryptoPALTest.cpp" ]
}

if (chip_device_platform == "esp32" || chip_device_platform == "nrfconnect") {
defines = [ "CURRENT_TIME_NOT_IMPLEMENTED=1" ]
}

cflags = [ "-Wconversion" ]

public_deps = [
Expand Down
2 changes: 2 additions & 0 deletions src/crypto/tests/CHIPCryptoPALTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1947,9 +1947,11 @@ static void TestX509_IssuingTimestampValidation(nlTestSuite * inSuite, void * in
err = IsCertificateValidAtIssuance(kDacCert, leafCert);
NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR);

#if !defined(CURRENT_TIME_NOT_IMPLEMENTED)
// test certificate validity (this one contains validity until year 9999 so it will not fail soon)
err = IsCertificateValidAtCurrentTime(kDacCert);
NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR);
#endif
}

static void TestSKID_x509Extraction(nlTestSuite * inSuite, void * inContext)
Expand Down

0 comments on commit cb3698e

Please sign in to comment.