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

Add clamp function to Scalar struct #498

Merged
merged 6 commits into from
Jan 9, 2023

Conversation

SergeStrashko
Copy link
Contributor

@SergeStrashko SergeStrashko commented Jan 8, 2023

  • test added
  • Little change to Scalar::from_bytes to remove mut Scalar variable (I think this way it's a bit more clean)

@SergeStrashko SergeStrashko changed the title Add clamp function to Scalar struct (#497) Add clamp function to Scalar struct Jan 8, 2023
@tarcieri
Copy link
Contributor

tarcieri commented Jan 8, 2023

Just as a general impression: you're making a lot of superfluous copies of secret key material. IMO when dealing with key material you should try to make as few copies as possible.

LLVM will most likely optimize them all away, but it would be better if you wrote the code in such a way it didn't make copies in the first place.

src/scalar.rs Outdated Show resolved Hide resolved
src/scalar.rs Outdated Show resolved Hide resolved
src/scalar.rs Outdated Show resolved Hide resolved
src/scalar.rs Outdated Show resolved Hide resolved
@SergeStrashko SergeStrashko requested a review from tarcieri January 8, 2023 15:00
src/scalar.rs Show resolved Hide resolved
src/scalar.rs Show resolved Hide resolved
src/scalar.rs Outdated Show resolved Hide resolved
@tarcieri tarcieri merged commit fedb145 into dalek-cryptography:main Jan 9, 2023
@tarcieri
Copy link
Contributor

tarcieri commented Jan 9, 2023

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants