-
Couldn't load subscription status.
- Fork 563
Implementation of elliptic-curve traits for curve25519 and ed25519.
#746
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
Draft
carloskiki
wants to merge
29
commits into
dalek-cryptography:main
Choose a base branch
from
carloskiki:elliptic-curve
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
4af7c38
implement KeyInit for SigningKey
carloskiki 878ade7
move behind "digest" feature
carloskiki 1a6ea17
implement KeySizeUser for VerifyingKey
carloskiki 0fcca09
move imports behind "digest" feature
carloskiki 8898298
update "digest" feature description
carloskiki 3d36f72
fix import statements
carloskiki 0f8392f
first batch of trait implementations
carloskiki a4c10d8
fix: FieldElement trait for CurveArithmetic
carloskiki c0a313b
remove unecessary digest requirements
carloskiki 8cf3f00
impl ShrAssign for Scalar
carloskiki f5365ed
impl Reduce for Scalar
carloskiki 9579a5b
impl Ord for Scalar
carloskiki 15a8763
impl IsHigh for Scalar
carloskiki 3b72a93
implement trivial AsRef for Scalar
carloskiki 9dbf077
implementation typechecks
carloskiki 0841636
complete implementations
carloskiki 72ba9e7
fix: things not being behind feature flag
carloskiki 49f41fa
remove comment
carloskiki a3c3f52
fix: clippy lints
carloskiki d82f71e
fix comment wording
carloskiki 5d8774f
standardize Zeroize impls
carloskiki 6d6a91c
fix: comment wording
carloskiki aa1bdba
fix: test compilation
carloskiki 4cb744f
clean comment
carloskiki bff18e4
add `EdwardsAffinePoint` for `elliptic-curve` trait implementations
carloskiki 51c523b
Merge branch 'main' of https://github.com/dalek-cryptography/curve255…
carloskiki 48962e7
Revert "add `EdwardsAffinePoint` for `elliptic-curve` trait implement…
carloskiki a2082d8
Merge branch 'main' into elliptic-curve
carloskiki 7805902
fixup implementation with new affine point
carloskiki File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| use elliptic_curve::{bigint::U256, consts::U32, Curve, CurveArithmetic, FieldBytesEncoding}; | ||
|
|
||
| use crate::{constants::BASEPOINT_ORDER_PRIVATE, edwards::affine::AffinePoint, EdwardsPoint, Scalar}; | ||
|
|
||
| /// QUESTION: I don't know where to put this singleton. Maybe in the crate's root? | ||
| #[derive(Clone, Copy, Debug, Default, Eq, PartialEq, PartialOrd, Ord, Hash)] | ||
| pub struct Ed25519; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ed25519 is the name of the EdDSA variant. RFC7748 calls the Edwards form of the curve "edwards25519" |
||
|
|
||
| impl Curve for Ed25519 { | ||
| type FieldBytesSize = U32; | ||
|
|
||
| type Uint = U256; | ||
|
|
||
| const ORDER: Self::Uint = U256::from_le_slice(&BASEPOINT_ORDER_PRIVATE.bytes); | ||
| } | ||
|
|
||
| impl CurveArithmetic for Ed25519 { | ||
| type AffinePoint = AffinePoint; | ||
|
|
||
| type ProjectivePoint = EdwardsPoint; | ||
|
|
||
| type Scalar = Scalar; | ||
| } | ||
|
|
||
| impl FieldBytesEncoding<Ed25519> for U256 {} | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd probably put it in
edwards.rs