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

Make Curve25519 PublicKeys conform to Equatable #173

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

Sajjon
Copy link
Contributor

@Sajjon Sajjon commented Apr 14, 2023

Make Curve25519 PublicKeys conform to Equatable

Checklist

  • I've run tests to see all new and existing tests pass
  • I've followed the code style of the rest of the project
  • I've read the Contribution Guidelines
  • I've updated the documentation if necessary

If you've made changes to gyb files

  • I've run .script/generate_boilerplate_files_with_gyb and included updated generated files in a commit of this pull request

Motivation:

When PublicKey's are used in struct's that are marked Equatable those structs cannot be auto-synthetized conform to Equatable since these PublicKeys before this PR do not conform to Equatable. This is rather annoying. And during the 5 years I've been working in the crypto industry I have added my own conformance to CryptoKit's PublicKeys to be Equatable probably more than 10 times!

There exists no security risk in making PublicKeys conform to Equatable, the current implementation does not use safeCompare, it could, but I deem it not necessary.

There is really no drawback in adding Equatable conformance.

Modifications:

  1. Make Curve25519.Signing.PublicKey be Equatable
  2. Make Curve25519.KeyAgreement.PublicKey be Equatable
  3. Add tests for these.

Result:

Curve25519.Signing.PublicKey and Curve25519.KeyAgreement.PublicKey now conform to Equatable.

Copy link
Collaborator

@Lukasa Lukasa left a comment

Choose a reason for hiding this comment

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

Thanks for this. I'm marking this as Request Changes just as a visual note to myself to return to it.

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.

None yet

2 participants