commit 7ec20de4316921667116e4b14403e85f1a22dc81
parent 52967380909d1980604ee10f0683f068f3a865e0
Author: Jared Tobin <jared@jtobin.io>
Date: Sat, 1 Aug 2026 12:32:05 -0230
lib: document add_mixed's affine precondition
add_mixed# discards the second point's z coordinate, so add_mixed is
correct only when that point has z == 1. Nothing checks it and nothing
in the library calls it, but it is exported.
Diffstat:
1 file changed, 4 insertions(+), 0 deletions(-)
diff --git a/lib/Crypto/Curve/Secp256k1.hs b/lib/Crypto/Curve/Secp256k1.hs
@@ -719,6 +719,10 @@ add_proj (P ax ay az) (P bx by bz) =
{-# INLINABLE add_proj #-}
-- algo 8, renes et al, 2015
+--
+-- the second point must be affine, i.e. have z == 1. this is not
+-- checked, and the result is meaningless otherwise; use add_proj if
+-- the second point may be in projective form.
add_mixed :: Projective -> Projective -> Projective
add_mixed (P ax ay az) (P bx by bz) =
let !(# x, y, z #) = add_mixed# (# ax, ay, az #) (# bx, by, bz #)