Skip to content
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

Fix leftover from #8236 and make BufferReader/Writer support Span #8408

Merged

Conversation

tcarmelveilleux
Copy link
Contributor

@tcarmelveilleux tcarmelveilleux commented Jul 15, 2021

Problem

Change overview

  • Fix leftover nits from @bzbarsky-apple's review of Make ECDSA sign/verify format spec-compliant #8236
  • In order to add span support cleanly, added Span support to
    Reader and BufferWriter, and fixed all necessary breakage.
  • Use new span function for validity checks (is_span_usable)
  • Replace an untested CHIPCert.cpp usage with tested version
  • Add unit tests to RawIntegerToDer

Testing

  • Ran cert tests (scripts/tests/test_suite.sh) integration tests
  • Ran ninja -C out/host check on Linux
  • Added unit tests to cover new Reader and BufferWriter features and RawIntegerToDer

…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
@todo
Copy link

todo bot commented Jul 15, 2021

De-uint16-ify everything related to this library

// TODO: De-uint16-ify everything related to this library
uint16_t octets_read;
uint16_t header;


This comment was generated by todo based on a TODO comment in 672ddc0 in #8408. cc @tcarmelveilleux.

src/crypto/CHIPCryptoPAL.cpp Outdated Show resolved Hide resolved
src/crypto/CHIPCryptoPAL.cpp Outdated Show resolved Hide resolved
src/crypto/CHIPCryptoPAL.cpp Outdated Show resolved Hide resolved
src/crypto/CHIPCryptoPAL.cpp Outdated Show resolved Hide resolved
src/lib/support/tests/TestBufferWriter.cpp Outdated Show resolved Hide resolved
@github-actions
Copy link

Size increase report for "esp32-example-build" from 193eb3c

File Section File VM
chip-all-clusters-app.elf .flash.text 104 104
chip-temperature-measurement-app.elf .flash.text 112 112
chip-shell.elf .flash.text 40 40
chip-lock-app.elf .flash.text 84 84
Full report output
BLOAT REPORT

Files found only in the build output:
    report.csv

Comparing ./master_artifact/chip-persistent-storage.elf and ./pull_artifact/chip-persistent-storage.elf:

sections,vmsize,filesize
.debug_info,0,1896
.debug_line,0,69
.debug_str,0,3

Comparing ./master_artifact/chip-all-clusters-app.elf and ./pull_artifact/chip-all-clusters-app.elf:

sections,vmsize,filesize
.debug_info,0,40969
.debug_line,0,6671
.debug_abbrev,0,514
.debug_str,0,449
.debug_loc,0,357
.flash.text,104,104
.strtab,0,98
.shstrtab,0,-2
[Unmapped],0,-104
.debug_ranges,0,-272

Comparing ./master_artifact/chip-pigweed-app.elf and ./pull_artifact/chip-pigweed-app.elf:

sections,vmsize,filesize
.debug_info,0,632
.debug_line,0,23
.debug_str,0,1

Comparing ./master_artifact/chip-temperature-measurement-app.elf and ./pull_artifact/chip-temperature-measurement-app.elf:

sections,vmsize,filesize
.debug_info,0,39130
.debug_line,0,5272
.debug_abbrev,0,509
.debug_str,0,448
.flash.text,112,112
.debug_loc,0,105
.strtab,0,98
.shstrtab,0,-2
[Unmapped],0,-112
.debug_ranges,0,-248

Comparing ./master_artifact/chip-shell.elf and ./pull_artifact/chip-shell.elf:

sections,vmsize,filesize
.debug_info,0,29196
.debug_line,0,2895
.debug_str,0,757
.debug_abbrev,0,422
.debug_loc,0,118
.flash.text,40,40
[Unmapped],0,-40
.debug_ranges,0,-184

Comparing ./master_artifact/chip-lock-app.elf and ./pull_artifact/chip-lock-app.elf:

sections,vmsize,filesize
.debug_info,0,42695
.debug_line,0,5760
.debug_abbrev,0,976
.debug_str,0,448
.debug_loc,0,425
.strtab,0,98
.flash.text,84,84
.shstrtab,0,-2
[Unmapped],0,-84
.debug_ranges,0,-256


@github-actions
Copy link

Size increase report for "nrfconnect-example-build" from 193eb3c

File Section File VM
chip-lock.elf text 112 112
chip-shell.elf text 52 52
chip-shell.elf device_handles -4 -4
Full report output
BLOAT REPORT

Files found only in the build output:
    report.csv

Comparing ./master_artifact/chip-lock.elf and ./pull_artifact/chip-lock.elf:

sections,vmsize,filesize
.debug_info,0,20890
.debug_line,0,1788
.debug_abbrev,0,502
.debug_str,0,499
.debug_ranges,0,400
text,112,112
.debug_loc,0,101
.debug_frame,0,4

Comparing ./master_artifact/chip-shell.elf and ./pull_artifact/chip-shell.elf:

sections,vmsize,filesize
.debug_info,0,16661
.debug_line,0,1117
.debug_str,0,717
.debug_abbrev,0,386
text,52,52
.debug_frame,0,4
device_handles,-4,-4
.debug_ranges,0,-48
.debug_loc,0,-53


src/crypto/CHIPCryptoPAL.cpp Outdated Show resolved Hide resolved
src/crypto/CHIPCryptoPAL.h Outdated Show resolved Hide resolved
- Assign to output spans
- Use new span function for validity checks (`is_span_usable`)
- Replace an untested CHIPCert.cpp usage with tested version
src/crypto/tests/RawIntegerToDer_test_vectors.h Outdated Show resolved Hide resolved
src/crypto/tests/RawIntegerToDer_test_vectors.h Outdated Show resolved Hide resolved
src/lib/support/BufferWriter.h Show resolved Hide resolved
src/lib/support/BufferReader.h Show resolved Hide resolved
src/lib/support/Span.h Outdated Show resolved Hide resolved
@bzbarsky-apple bzbarsky-apple merged commit db0e079 into project-chip:master Jul 20, 2021
nikita-s-wrk pushed a commit to nikita-s-wrk/connectedhomeip that referenced this pull request Sep 23, 2021
…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 <commits@restyled.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants