packages feed

ppad-secp256k1 0.5.1 → 0.5.2

raw patch · 3 files changed

+20/−14 lines, 3 filesdep ~ppad-fixeddep ~ppad-hmac-drbgdep ~ppad-sha256

Dependency ranges changed: ppad-fixed, ppad-hmac-drbg, ppad-sha256

Files

CHANGELOG view
@@ -1,5 +1,9 @@ # Changelog +- 0.5.2 (2025-12-28)+  * Adds an explicit 64-bit architecture constraint.+  * Tests on GHC.10.3.+ - 0.5.1 (2025-12-27)   * Improves the constant-time semantics in wNAF scalar multiplication,     replacing "indexing via a constant-time selected value" by performing
lib/Crypto/Curve/Secp256k1.hs view
@@ -1,5 +1,6 @@ {-# OPTIONS_HADDOCK prune #-} {-# LANGUAGE BangPatterns #-}+{-# LANGUAGE CPP #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE DerivingStrategies #-} {-# LANGUAGE LambdaCase #-}@@ -10,6 +11,11 @@ {-# LANGUAGE UnboxedTuples #-} {-# LANGUAGE ViewPatterns #-} +#include "MachDeps.h"+#if WORD_SIZE_IN_BITS != 64+#error "ppad-secp256k1 requires a 64-bit architecture"+#endif+ -- | -- Module: Crypto.Curve.Secp256k1 -- Copyright: (c) 2024 Jared Tobin@@ -137,8 +143,7 @@ pattern Z = (# Limb 0##, Limb 0##, Limb 0##, Limb 0## #)  pattern P :: Limb4 -> Limb4 -> Limb4 -> Projective-pattern P x y z =-  Projective (C.Montgomery x) (C.Montgomery y) (C.Montgomery z)+pattern P x y z = Projective (C.Montgomery x) (C.Montgomery y) (C.Montgomery z) {-# COMPLETE P #-}  -- utilities ------------------------------------------------------------------@@ -285,10 +290,7 @@  -- modQ via conditional subtraction modQ :: Wider -> Wider-modQ x =-  let !(Wider xw) = x-      !(Wider qw) = _CURVE_Q-  in  W.select x (x - _CURVE_Q) (CT.not (W.lt# xw qw))+modQ x = W.select x (x - _CURVE_Q) (CT.not (W.lt x _CURVE_Q)) {-# INLINABLE modQ #-}  -- bytewise xor@@ -442,8 +444,8 @@  -- Constant-time selection of Projective points. select_proj :: Projective -> Projective -> CT.Choice -> Projective-select_proj (P ax ay az) (P bx by bz) c =-  P (W.select# ax bx c) (W.select# ay by c) (W.select# az bz c)+select_proj (Projective ax ay az) (Projective bx by bz) c =+  Projective (C.select ax bx c) (C.select ay by c) (C.select az bz c) {-# INLINE select_proj #-}  -- unboxed internals ----------------------------------------------------------@@ -607,7 +609,7 @@                !abs_b       = CT.select_word# b0 (Exts.minusWord# mnum b0) bor               !is_zero     = CT.from_word_eq# b0 0##-              !c0          = CT.from_word# (Exts.and# w 1##)+              !c0          = CT.from_bit# (Exts.and# w 1##)               !off_nz      = Exts.minusWord# (Exts.plusWord# off0 abs_b) 1##               !off         = CT.select_word# off0 off_nz (CT.not is_zero) 
ppad-secp256k1.cabal view
@@ -1,6 +1,6 @@ cabal-version:      3.0 name:               ppad-secp256k1-version:            0.5.1+version:            0.5.2 synopsis:           Schnorr signatures, ECDSA, and ECDH on the elliptic curve                     secp256k1 license:            MIT@@ -9,7 +9,7 @@ maintainer:         jared@ppad.tech category:           Cryptography build-type:         Simple-tested-with:        GHC == { 9.8.1, 9.6.4 }+tested-with:        GHC == { 9.10.3 } extra-doc-files:    CHANGELOG description:   Pure BIP0340-style Schnorr signatures, deterministic RFC6979 ECDSA, and@@ -36,9 +36,9 @@   build-depends:       base >= 4.9 && < 5     , bytestring >= 0.9 && < 0.13-    , ppad-hmac-drbg >= 0.1 && < 0.2-    , ppad-sha256 >= 0.2 && < 0.3-    , ppad-fixed >= 0.1.2 && < 0.2+    , ppad-hmac-drbg >= 0.1.3 && < 0.2+    , ppad-sha256 >= 0.2.4 && < 0.3+    , ppad-fixed >= 0.1.3 && < 0.2     , primitive >= 0.8 && < 0.10  test-suite secp256k1-tests