-
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
Make ECDSA sign/verify format spec-compliant #8236
Make ECDSA sign/verify format spec-compliant #8236
Conversation
- Use raw <r,s> concatenated point format for input/output to ECDSA signature primitives, so that format on the wire matches spec. This will allow CASE to follow spec encoding. - Update some utilities to add missign bits/pieces. - Add associated unit tests Fixes project-chip#8209
- Method is cheaper and more direct than conversions. - Overall code is smaller. - Refactor the message versions to defer to the sign_hash/verify_hash
Need to make this large number (1k+) to catch some signature serialization corner casesconnectedhomeip/src/crypto/tests/CHIPCryptoPALTest.cpp Lines 794 to 804 in 57e6a60
This comment was generated by todo based on a
|
{ | ||
EC_POINT_clear_free(key_point); | ||
key_point = nullptr; | ||
BN_clear_free(s); |
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.
ScopedBigNum and ScopedPoint would be so nice. I think some OpenSSL C++ headers have unique_ptr implementations for this.
@tcarmelveilleux will deal with my comments in a followup; merging to get other things unblocked, since none of those comments are critical. |
…ort Span - Fix leftover nits from @bzbarsky-apple's review of project-chip#8236 - In order to add span support cleanly, added Span support to Reader and BufferWriter, and fixed all necessary breakage. Testing done: pass all unit tests and CASE cert tests
See #8408 for follow-up. |
) * Fix leftover from #8236 and make BufferReader/Writer support Span - Fix leftover nits from @bzbarsky-apple's review of #8236 - In order to add span support cleanly, added Span support to Reader and BufferWriter, and fixed all necessary breakage. Testing done: pass all unit tests and CASE cert tests * Fix mbedTLS usage of EcdsaAsn1SignatureToRaw * Apply review comments from @bzbarsky-apple * Use some span reassign instead of out_size ref * Restyled by clang-format * Remove unnecessary nullptr checks handled by Span::size() * Improve IntegerToDer test coverage - Assign to output spans - Use new span function for validity checks (`is_span_usable`) - Replace an untested CHIPCert.cpp usage with tested version * Add is_span_usable() tests * Restyled by clang-format * Grammar fix to kick CI * Commit forgotten removal of obsolete ConvertIntegerRawToDER from CHIPCert.h * Apply review comments from @mspang * Fix clang Co-authored-by: Restyled.io <[email protected]>
* Make ECDSA sign/verify format spec-compliant - Use raw <r,s> concatenated point format for input/output to ECDSA signature primitives, so that format on the wire matches spec. This will allow CASE to follow spec encoding. - Update some utilities to add missign bits/pieces. - Add associated unit tests Fixes project-chip#8209 * Fix some comment typos * Make OpenSSL and mbedTLS use raw signatures directly - Method is cheaper and more direct than conversions. - Overall code is smaller. - Refactor the message versions to defer to the sign_hash/verify_hash * Restyled by clang-format * Fix issue with cert conversion * Use CHIPCert module for raw to DER conversion * Ran clang-format * Restyled by clang-format * Fix unit tests * Remove debug logging left by mistake * Restyled by shellharden * Restyled by shfmt * Address review comments from @andy31415 * Fix merge issues * Restyled by clang-format * Fix test script and improve signing unit test * Restyled by shellharden * Reduce signing unit test case numbers for now * Apply review from @pan-apple * Fix test_suites.sh * Please the gods of shell-harden * Please the gods of shell-harden some more Co-authored-by: Restyled.io <[email protected]>
…ort Span (project-chip#8408) * Fix leftover from project-chip#8236 and make BufferReader/Writer support Span - Fix leftover nits from @bzbarsky-apple's review of project-chip#8236 - In order to add span support cleanly, added Span support to Reader and BufferWriter, and fixed all necessary breakage. Testing done: pass all unit tests and CASE cert tests * Fix mbedTLS usage of EcdsaAsn1SignatureToRaw * Apply review comments from @bzbarsky-apple * Use some span reassign instead of out_size ref * Restyled by clang-format * Remove unnecessary nullptr checks handled by Span::size() * Improve IntegerToDer test coverage - Assign to output spans - Use new span function for validity checks (`is_span_usable`) - Replace an untested CHIPCert.cpp usage with tested version * Add is_span_usable() tests * Restyled by clang-format * Grammar fix to kick CI * Commit forgotten removal of obsolete ConvertIntegerRawToDER from CHIPCert.h * Apply review comments from @mspang * Fix clang Co-authored-by: Restyled.io <[email protected]>
Problem
Change overview
to ECDSA signature primitives, so that format on the wire
matches spec. This will allow CASE to follow spec encoding.
This is also needed for device attestation and CSR response
spec compliance.
TLS wrappers.
should be non-nullptr, but with size zero)
more code, more heap and more ASN.1 handling dependencies
if a hardware-based TLS accelerator does not support raw
signatures.
Testing
ninja -C out/host check
against latest merge with master with both OpenSSL and mbedTLS on Linux, all tests still pass (after fixes)