From 0d20b309e2db2fa45e0446ce156de8bc3cd87476 Mon Sep 17 00:00:00 2001 From: Tobias Dammers Date: Mon, 26 Jun 2023 13:23:45 +0200 Subject: [PATCH] Prevent BLS Affine values from being coerced. The same safeguard already existed for the Point type, but we also need it for Affine. --- .../src/Cardano/Crypto/EllipticCurve/BLS12_381/Internal.hs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cardano-crypto-class/src/Cardano/Crypto/EllipticCurve/BLS12_381/Internal.hs b/cardano-crypto-class/src/Cardano/Crypto/EllipticCurve/BLS12_381/Internal.hs index af956ae41..2eccaa004 100644 --- a/cardano-crypto-class/src/Cardano/Crypto/EllipticCurve/BLS12_381/Internal.hs +++ b/cardano-crypto-class/src/Cardano/Crypto/EllipticCurve/BLS12_381/Internal.hs @@ -232,6 +232,10 @@ type Point2 = Point Curve2 newtype Affine curve = Affine (ForeignPtr Void) +-- Making sure different 'Affine's are not 'Coercible', which would ruin the +-- intended type safety: +type role Affine nominal + type Affine1 = Affine Curve1 type Affine2 = Affine Curve2