ed448-goldilocks: `SigningKey::sign_ctx` docs say "Ed448ph", but it signs with Ed448 (phflag 0)

オープン 初心者向け
#1,990 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@NginxL がすでに取り組んでいます。

2026年12月6日 から。

  • #2005 @NginxL による — オープン

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
80/100
issue の種類
ドキュメント
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
rust

調査の方向性

src/sign/signing_key.rs、src/sign/context.rs、src/sign/verifying_key.rs のコメントを読み、引用されている trait の実装とテストを確認して、各 trait がどのモードを使用するかを確かめてください。ドキュメントを更新し、context 付き Ed448 と Ed448ph を区別してください。必要に応じて、src/sign.rs にある context なしの鍵用 trait のモードも明確にしてください。コメントが一貫して各モードを説明し、引用されたコードと一致すれば完了です。

索引モデルが issue の本文から書いたものです。

説明

SigningKey::sign_ctx has this doc comment: "Sign a message in the given context with this [SigningKey] using the Ed448ph algorithm" (src/sign/signing_key.rs:444-445). The function calls ExpandedSecretKey::sign_ctx, which is self.sign_inner(0, ctx, m) (src/sign/expanded.rs:94-96). phflag 0 is Ed448 (PureEdDSA) with a context, as the inner doc comment says (expanded.rs:89-93). The tests agree with the code: the RFC 8032 Ed448 vector with context "foo" is checked through sign_ctx (src/sign/verifying_key.rs:349-356, :410-411), and the Ed448ph vectors go through sign_prehashed (:367-380, :401-409). The verifier counterpart verify_ctx is already documented as "Ed448" mode (verifying_key.rs:225-230).

Two related comments describe the context type as Ed448ph only, although the same type is also used for Ed448 with a context:

  • SigningKey::with_context (signing_key.rs:425-426): "Create a signing context that can be used for Ed448ph with [signature::DigestSigner]". The returned Context also implements signature::Signer (:282-287), which calls sign_ctx (Ed448). DigestSigner and PrehashSigner on it (:257-280) are Ed448ph.
  • Context (src/sign/context.rs:1): "Ed448 contexts as used by Ed448ph." On the verifier side, Verifier for Context<VerifyingKey> calls verify_ctx, which is Ed448 (verifying_key.rs:80-84), and DigestVerifier is Ed448ph (:86-100). VerifyingKey::with_context (verifying_key.rs:200) mentions only DigestVerifier.

These are the same in 0.14.0-pre.15 (latest on crates.io) and on master (af04a147).

Suggested wording:

--- a/ed448-goldilocks/src/sign/signing_key.rs
-    /// Create a signing context that can be used for Ed448ph with
-    /// [`signature::DigestSigner`]
+    /// Create a signing context. With [`signature::Signer`] it signs with Ed448
+    /// (PureEdDSA) using this context; with [`signature::DigestSigner`] or
+    /// [`signature::hazmat::PrehashSigner`] it signs with Ed448ph (HashEdDSA) using this context.
@@
-    /// Sign a `message` in the given `context` with this [`SigningKey`] using the Ed448ph algorithm
-    /// defined in [RFC8032 §5.2](https://datatracker.ietf.org/doc/html/rfc8032#section-5.2).
+    /// Sign a `message` in the given `context` with this [`SigningKey`] using the Ed448 algorithm
+    /// (PureEdDSA, not Ed448ph) defined in [RFC8032 §5.2](https://datatracker.ietf.org/doc/html/rfc8032#section-5.2).
--- a/ed448-goldilocks/src/sign/context.rs
-/// Ed448 contexts as used by Ed448ph.
+/// Ed448 contexts, used by both Ed448 (with context) and Ed448ph.
--- a/ed448-goldilocks/src/sign/verifying_key.rs
-    /// Create a context for this verifying key that can be used with [`signature::DigestVerifier`].
+    /// Create a context for this verifying key. [`signature::Verifier`] verifies Ed448 (PureEdDSA)
+    /// with this context; [`signature::DigestVerifier`] verifies Ed448ph with this context.

Optionally, the module docs (src/sign.rs:35-41) could also say which mode each trait uses on the bare keys. Signer/Verifier are Ed448 with an empty context (signing_key.rs:250-255, verifying_key.rs:59-63). DigestSigner, PrehashSigner and DigestVerifier are Ed448ph with an empty context (signing_key.rs:228-248, verifying_key.rs:65-78). That difference is easy to miss when the code is written against the signature traits.

主要言語
Rust
スター
884
フォーク
319
平均マージ
18時間 34分
マージ済み PR(30日)
7

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

RustCrypto/elliptic-curves のほかの issue

RustCrypto/elliptic-curves の issue をすべて見る

似ている issue

Rust の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。