diff --git a/FIXED_POINT_ANALYSIS.md b/FIXED_POINT_ANALYSIS.md index 3558a29..0d2bbb9 100644 --- a/FIXED_POINT_ANALYSIS.md +++ b/FIXED_POINT_ANALYSIS.md @@ -11,7 +11,7 @@ Fixed-point multiplication uses precomputed multiples of the secp256k1 generator These precomputed values are stored in `test/ecdsa_constants.h` as `G1_1_G1SECP256K1.SIG_AFF[]` and loaded into device constant memory `ECDSACONST.d_mul_table[]` during `initialize()`. -**The problem**: The batch kernel `arith::fixedPMulByCombinedDAA` expects R1 to contain these precomputed multiples, but the current test calls `ec_pmul_random_init()` which overwrites R1 with input points instead. +**The problem**: The batch kernel `arith::fixedPMulByCombinedDAA` expects R1 to contain these precomputed multiples, but the current test calls `ec_pmul_init()` which overwrites R1 with input points instead. ## Two Fixed-Point Implementations @@ -50,9 +50,9 @@ __global__ void fixedPMulByCombinedDAA(typename EC::Base *R0, ```cpp // test/ecdsa_ec_fixed_pmul.cu -solver.ec_pmul_random_init(RANDOM_S, RANDOM_KEY_X, RANDOM_KEY_Y, count); +solver.ec_pmul_init(RANDOM_S, RANDOM_KEY_X, RANDOM_KEY_Y, count); ↓ -// include/gecc/ecdsa/gsv.h:ec_pmul_random_init() +// include/gecc/ecdsa/gsv.h:ec_pmul_init() processScalarPoint<<<>>>(..., R1, ...); // ← Fills R1 with input points (WRONG!) ↓ solver.ecdsa_ec_pmul(MAX_SM_NUMS, 256, false); // false = fixed-point diff --git a/FIXED_POINT_SOLUTION.md b/FIXED_POINT_SOLUTION.md index 8c42444..4931cf9 100644 --- a/FIXED_POINT_SOLUTION.md +++ b/FIXED_POINT_SOLUTION.md @@ -4,7 +4,7 @@ The fixed-point multiplication test in `test/ecdsa_ec_fixed_pmul.cu` was producing incorrect results. ## Root Cause -The test was calling `ec_pmul_random_init()` which populated R1 with arbitrary input points, but the batch kernel `fixedPMulByCombinedDAA` expected R1 to contain precomputed multiples of the generator G. +The test was calling `ec_pmul_init()` which populated R1 with arbitrary input points, but the batch kernel `fixedPMulByCombinedDAA` expected R1 to contain precomputed multiples of the generator G. ## Solution Created a new test kernel that directly uses the `fixed_point_mult()` device function, which correctly accesses the precomputed table from device constant memory (`ECDSACONST.d_mul_table[]`). @@ -21,7 +21,7 @@ Created a new test kernel that directly uses the `fixed_point_mult()` device fun - Stores results properly 3. **Rewrote correctness test** `test_ecdsa_ec_fixed_pmul_correctness()`: - - Allocates memory directly (no `ec_pmul_random_init()`) + - Allocates memory directly (no `ec_pmul_init()`) - Calls the new test kernel - Reads results and prints them diff --git a/include/gecc/ecdsa/gsv.h b/include/gecc/ecdsa/gsv.h index b5e582a..e8401ef 100644 --- a/include/gecc/ecdsa/gsv.h +++ b/include/gecc/ecdsa/gsv.h @@ -1529,8 +1529,8 @@ template