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

[ReSubmitted][Chip-Cert] Prevent extra bytes to be encoded when converting key to chip-b64 #16121

Merged
merged 1 commit into from
Mar 14, 2022

Conversation

willyrakotoarisoa
Copy link
Contributor

Problem

  • Existing code encodes bytes beyond the buffer actually containing the
    key.
  • The issue was sizeof(P256SerializedKeypair) that includes 'length'
    field as well as 'bytes' field.

Change overview

  • Make use of serializedKeypair.Length() to retrieve actual key length
  • Clarify usage of buffer sizes vs actual used lengths
  • Additionally, do not assume that P256SerializedKeypair 'bytes' field
    is the first field of the data structure (i.e. has implicitly same
    address as the structure itself)

Testing

How was this tested? (at least one bullet point required)

  • Manually tested with the chip-cert convert-key

…chip-b64

Observed :
- Existing code encodes bytes beyond the buffer actually containing the
key.
- The issue was sizeof(P256SerializedKeypair) that includes 'length'
field as well as 'bytes' field.

Changes :
- Make use of serializedKeypair.Length() to retrieve actual key length
- Clarify usage of buffer sizes vs actual used lengths
- Additionally, do not assume that P256SerializedKeypair 'bytes' field
is the first field of the data structure (i.e. has implicitly same
address as the structure itself)
@github-actions
Copy link

PR #16121: Size comparison from 86a8444 to 5b7d7b1

Full report (2 builds for mbed, nrfconnect)
platform target config section 86a8444 5b7d7b1 change % change
mbed lock-app CY8CPROTO_062_4343W+release (read only) 6224 6224 0 0.0
(read/write) 2351012 2351012 0 0.0
.bss 186212 186212 0 0.0
.data 5784 5784 0 0.0
.text 1313612 1313612 0 0.0
nrfconnect all-clusters-app nrf52840dk_nrf52840 (read/write) 1152643 1152643 0 0.0
bss 146188 146188 0 0.0
rodata 144516 144516 0 0.0
text 786676 786676 0 0.0

@andy31415 andy31415 merged commit 70ba6a4 into project-chip:master Mar 14, 2022
andrei-menzopol pushed a commit to andrei-menzopol/connectedhomeip that referenced this pull request Apr 14, 2022
…chip-b64 (project-chip#16121)

Observed :
- Existing code encodes bytes beyond the buffer actually containing the
key.
- The issue was sizeof(P256SerializedKeypair) that includes 'length'
field as well as 'bytes' field.

Changes :
- Make use of serializedKeypair.Length() to retrieve actual key length
- Clarify usage of buffer sizes vs actual used lengths
- Additionally, do not assume that P256SerializedKeypair 'bytes' field
is the first field of the data structure (i.e. has implicitly same
address as the structure itself)
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.

4 participants