-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added time validity checking to Device Attestation Verifier #12212
Conversation
PR #12212: Size comparison from b87d1fa to 0214b5e Increases above 0.2%:
Increases (2 builds for linux)
Full report (38 builds for efr32, esp32, k32w, linux, mbed, nrfconnect, p6, qpg, telink)
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Time validity checks need to be better explained and to make sure they validate what is intended (see comments)
Ping @vijs ? |
PR #12212: Size comparison from 7e99454 to a0e0f0b Increases above 0.2%:
Increases (2 builds for linux)
Full report (38 builds for efr32, esp32, k32w, linux, mbed, nrfconnect, p6, qpg, telink)
|
Handle PAA/PAI re-issue and enable below time validationsconnectedhomeip/src/crypto/CHIPCryptoPALOpenSSL.cpp Lines 1731 to 1741 in 4ef7efd
This comment was generated by todo based on a
|
Handle PAA/PAI re-issue and enable below time validationconnectedhomeip/src/crypto/CHIPCryptoPALmbedTLS.cpp Lines 1313 to 1323 in 4ef7efd
This comment was generated by todo based on a
|
PR #12212: Size comparison from 7e99454 to 4ef7efd Full report (7 builds for efr32, p6, telink)
|
2d30fd4
to
2ee24f5
Compare
PR #12212: Size comparison from a5513c2 to 2ee24f5 Increases above 0.2%:
Increases (2 builds for linux)
Full report (23 builds for efr32, esp32, linux, mbed, p6, telink)
|
2ee24f5
to
dddeb59
Compare
PR #12212: Size comparison from cea8769 to dddeb59 Increases above 0.2%:
Increases (2 builds for linux)
Full report (26 builds for efr32, esp32, linux, mbed, p6, qpg, telink)
|
dddeb59
to
cb3698e
Compare
PR #12212: Size comparison from 7cba51d to cb3698e Increases above 0.2%:
Increases (2 builds for linux)
Full report (39 builds for efr32, esp32, k32w, linux, mbed, nrfconnect, p6, qpg, telink)
|
…chip#12212) * Added time validity checking to Device Attestation Verifier * Added new methods to validate a certificate and implemented review comments * Renamed IsCertificateValid to IsCertificateValidAtCurrentTime * Removed "invalid issuing timestamp" test * Disabled cert validation test in certain platforms
// check if certificate's notBefore timestamp is earlier than or equal to current time. | ||
result = mbedtls_x509_time_is_past(&mbedCertificate.valid_from); | ||
VerifyOrExit(result == 1, error = CHIP_ERROR_CERT_EXPIRED); | ||
|
||
// check if certificate's notAfter timestamp is later than current time. | ||
result = mbedtls_x509_time_is_future(&mbedCertificate.valid_to); | ||
VerifyOrExit(result == 1, error = CHIP_ERROR_CERT_EXPIRED); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The usage of mbedtls_x509_time_is_past
and mbedtls_x509_time_is_past
are incorrect.
E.g. for mbedtls_x509_time_is_past
, the documentation says:
* \note Intended usage is "if( is_past( valid_to ) ) ERROR".
* Hence the return value of 1 if on internal errors.
...
* \return 1 if the given time is in the past or an error occurred,
* 0 otherwise.
Therefore, if an error occurred, we accept the validity.
Correct should be something like this:
// check if certificate's notBefore timestamp is earlier than or equal to current time.
result = mbedtls_x509_time_is_future(&mbedCertificate.CHIP_CRYPTO_PAL_PRIVATE_X509(valid_from));
VerifyOrExit(result == 0, error = CHIP_ERROR_CERT_EXPIRED);
// check if certificate's notAfter timestamp is later than current time.
result = mbedtls_x509_time_is_past(&mbedCertificate.CHIP_CRYPTO_PAL_PRIVATE_X509(valid_to));
VerifyOrExit(result == 0, error = CHIP_ERROR_CERT_EXPIRED);
Problem
Change overview
Testing