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 the constructor of Snuffle base class #43

Closed
moien007 opened this issue Mar 17, 2020 · 1 comment
Closed

Fix the constructor of Snuffle base class #43

moien007 opened this issue Mar 17, 2020 · 1 comment
Assignees
Labels
enhancement New feature or request major Requiring a major version update according to semantic versioning

Comments

@moien007
Copy link
Contributor

The Snuffle base class's constructor's first parameter is in byte[] key which doesn't make sense, in is same as ref keyword (which means a reference to the specified value rather than value itself as you know) with the difference that in doesn't allow modifications to the value that being referenced (at the language level).

https://github.com/idaviddesmet/NaCl.Core/blob/54372a2914d9f770d1bd3c42898fb17928f57a28/src/NaCl.Core/Base/Snuffle.cs#L40

So what is happening here in this constructor is that we are passing a reference to a byte array (which arrays are references too) so the goal we are looking for (a read-only input or const char *key in C) is not achieved here. In order to fix this problem, we have to replace the in byte[] key with ReadOnlyMemory<byte> key which introduces a lot of changes in the code plus it is a breaking change.

Regards.

@daviddesmet
Copy link
Owner

Good spot! This was somehow slip away when implementing Span. Will fix it in the next commit.

@daviddesmet daviddesmet self-assigned this Mar 18, 2020
@daviddesmet daviddesmet added the enhancement New feature or request label Mar 19, 2020
@daviddesmet daviddesmet added the major Requiring a major version update according to semantic versioning label Sep 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request major Requiring a major version update according to semantic versioning
Projects
None yet
Development

No branches or pull requests

2 participants