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

Use ROS<byte> instead of byte[] where it makes sense on S.S.C.Cose #66741

Merged
merged 13 commits into from
Apr 1, 2022

Conversation

jozkee
Copy link
Member

@jozkee jozkee commented Mar 16, 2022

For v1 of the library we shipped with many methods receiving byte[] as argument, this was due to defer of thought of where we should properly use ReadOnlySpan<byte> and ReadOnlyMemory<byte>.
This PR should also be a place for further discussion of Span vs Memory usage in the APIs and their interaction with System,Formats.Cbor APIs.

Contributes to #62600 MVP+1.

@jozkee jozkee added this to the 7.0.0 milestone Mar 16, 2022
@jozkee jozkee requested a review from bartonjs March 16, 2022 23:16
@jozkee jozkee self-assigned this Mar 16, 2022
@dotnet-issue-labeler
Copy link

Note regarding the new-api-needs-documentation label:

This serves as a reminder for when your PR is modifying a ref *.cs file and adding/modifying public APIs, to please make sure the API implementation in the src *.cs file is documented with triple slash comments, so the PR reviewers can sign off that change.

@ghost
Copy link

ghost commented Mar 16, 2022

Tagging subscribers to this area: @dotnet/area-system-security, @vcsjones
See info in area-owners.md if you want to be subscribed.

Issue Details

For v1 of the library we shipped with many methods receiving byte[] as argument, this was due to defer of thought of where we should properly use ReadOnlySpan<byte> and ReadOnlyMemory<byte>.
This PR should also be a place for further discussion of Span vs Memory usage in the APIs and their interaction with System,Formats.Cbor APIs.

Contributes to #62600 MVP+1.

Author: Jozkee
Assignees: Jozkee
Labels:

area-System.Security

Milestone: 7.0.0

@jozkee jozkee requested a review from bartonjs March 23, 2022 19:07
// we rent a bigger buffer if that's the case.
if (buffer.Length < expectedToBeSignedSize)
{
rentedToBeSignedBuffer = ArrayPool<byte>.Shared.Rent(expectedToBeSignedSize);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to see this rent go away and us be able to create the TBS with non-contiguous memory (and hashed using IncrementalHash).

But I expect that'll be forced upon us when we add support for Stream-based detached content; so it's OK for now.

@jozkee jozkee requested a review from bartonjs March 31, 2022 08:49
jozkee added 3 commits March 31, 2022 13:12
* Add comment describing reusability of encoded protected headers
* Cache toBeSigned
@jozkee jozkee requested a review from bartonjs March 31, 2022 21:20
Copy link
Member

@bartonjs bartonjs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All the remaining items are minor and limited to the tests. Please fix them, but I don't need to see any followup.

@jozkee jozkee merged commit 321cec8 into dotnet:main Apr 1, 2022
@jozkee jozkee deleted the cose_span branch April 1, 2022 06:00
@ghost ghost locked as resolved and limited conversation to collaborators May 1, 2022
@bartonjs bartonjs added cryptographic-docs-impact needs-further-triage Issue has been initially triaged, but needs deeper consideration or reconsideration labels Aug 26, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-System.Security needs-further-triage Issue has been initially triaged, but needs deeper consideration or reconsideration new-api-needs-documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants