Differences between debug and release versions in ct_eq

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

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

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
28/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
rust
領域
cryptography

調査の方向性

Start with the sqrt_ratio_3mod4_one test in k256/src/arithmetic/hash2curve.rs, run it with and without --release as the issue shows, then read the ct_eq comparison near line 82 of primeorder/src/osswu.rs. Done means the test gives the same result in both builds and the constant-time comparison is fixed. This is cryptographic code, so a maintainer should review any change.

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

説明

See tests below:

diff --git a/k256/src/arithmetic/hash2curve.rs b/k256/src/arithmetic/hash2curve.rs
index 0ef28ebb..602c7603 100644
--- a/k256/src/arithmetic/hash2curve.rs
+++ b/k256/src/arithmetic/hash2curve.rs
@@ -289,6 +289,17 @@ mod tests {
     use hex_literal::hex;
     use proptest::{num::u64::ANY, prelude::ProptestConfig, proptest};

+    #[test]
+    fn sqrt_ratio_3mod4_one() {
+        use primeorder::osswu::OsswuMap;
+
+        let (is_square, root) =
+            FieldElement::sqrt_ratio_3mod4(FieldElement::ONE, FieldElement::ONE);
+
+        assert!(bool::from(is_square), "1 / 1 must be a quadratic residue");
+        assert_eq!(root.square().normalize(), FieldElement::ONE);
+    }
+

The release differs from the debug version:

cargo test -p k256 --features hash2curve --release sqrt_ratio_3mod4_one
cargo test -p k256 --features hash2curve sqrt_ratio_3mod4_one

It affects this line: https://github.com/RustCrypto/elliptic-curves/blob/189246045ba2ab93b68111dc4be30ba825eb93df/primeorder/src/osswu.rs#L82

主要言語
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 を短くまとめたダイジェスト。