haskell-crypto / cryptonite

lowlevel set of cryptographic primitives for haskell
Other
226 stars 139 forks source link

Fix build on GHC 9.2 #354

Closed josephcsible closed 2 years ago

fumieval commented 3 years ago

I had to make the following change to make it compile;

diff --git a/Crypto/Internal/WordArray.hs b/Crypto/Internal/WordArray.hs
index 0f3c0f6..247dc6a 100644
--- a/Crypto/Internal/WordArray.hs
+++ b/Crypto/Internal/WordArray.hs
@@ -114,7 +114,7 @@ mutableArray32FromAddrBE (I# n) a = IO $ \s ->
         loop i st mb
             | booleanPrim (i ==# n) = (# st, MutableArray32 mb #)
             | otherwise             =
-                let !st' = writeWord32Array# mb i (be32Prim (indexWord32OffAddr# a i)) st
+                let !st' = writeWord32Array# mb i (wordToWord32# (be32Prim (word32ToWord# (indexWord32OffAddr# a i)))) st
                  in loop (i +# 1#) st' mb

 -- | freeze a Mutable Array of Word32 into a immutable Array of Word32
josephcsible commented 3 years ago

Even on top of my change? That doesn't make sense to me.

fumieval commented 3 years ago

Ah I was checking out a wrong version. Nevermind

ysangkok commented 2 years ago

@vincenthz Anything comments on this? It would be nice since Cryptonite is a pretty popular library.

josephcsible commented 2 years ago

I fail to see how that's related to this PR.

georgefst commented 2 years ago

Could you please rebase this on master? I've checked that it merges cleanly and builds.

This would be very helpful for MacOS users due to https://github.com/haskell-crypto/cryptonite/pull/359.

josephcsible commented 2 years ago

Rebased.

maerten commented 2 years ago

josephcsible/cryptonite @ 0d04e90dc33b6aeaf8a5686921d6999599429fb0 fixes the issue for me on M1 / GHC 9.2.2 (pre-release).

I did notice a few warnings:

cryptonite                       > [ 52 of 136] Compiling Crypto.Hash.Blake2
cryptonite                       > [ 53 of 136] Compiling Crypto.Hash.Algorithms
cryptonite                       > [ 54 of 136] Compiling Crypto.Hash
cryptonite                       > [ 55 of 136] Compiling Crypto.Internal.WordArray
cryptonite                       > [ 56 of 136] Compiling Crypto.Cipher.Twofish.Primitive
cryptonite                       >
cryptonite                       > /private/var/folders/0c/zmpjp7l568xcvnt49pkkn5p00000gn/T/stack-58eba4f7893625b7/cryptonite-0.29/Crypto/Cipher/Twofish/Primitive.hs:84:19: warning: [-Wincomplete-uni-patterns]
cryptonite                       >     Pattern match(es) are non-exhaustive
cryptonite                       >     In a pattern binding:
cryptonite                       >         Patterns of type ‘[Word32]’ not matched:
cryptonite                       >             []
cryptonite                       >             [(GHC.Word.W32# _)]
cryptonite                       >             [(GHC.Word.W32# _), (GHC.Word.W32# _)]
cryptonite                       >             [(GHC.Word.W32# _), (GHC.Word.W32# _), (GHC.Word.W32# _)]
cryptonite                       >             ...
cryptonite                       >    |
cryptonite                       > 84 |             where [k0, k1, k2, k3] = fmap (\offset -> arrayRead32 ks $ (8 + 4 * ind) + offset) [0..3]
cryptonite                       >    |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cryptonite                       >
cryptonite                       > /private/var/folders/0c/zmpjp7l568xcvnt49pkkn5p00000gn/T/stack-58eba4f7893625b7/cryptonite-0.29/Crypto/Cipher/Twofish/Primitive.hs:119:19: warning: [-Wincomplete-uni-patterns]
cryptonite                       >     Pattern match(es) are non-exhaustive
cryptonite                       >     In a pattern binding:
cryptonite                       >         Patterns of type ‘[Word32]’ not matched:
cryptonite                       >             []
cryptonite                       >             [(GHC.Word.W32# _)]
cryptonite                       >             [(GHC.Word.W32# _), (GHC.Word.W32# _)]
cryptonite                       >             [(GHC.Word.W32# _), (GHC.Word.W32# _), (GHC.Word.W32# _)]
cryptonite                       >             ...
cryptonite                       >     |
cryptonite                       > 119 |             where [k0, k1, k2, k3] = fmap (\offset -> arrayRead32 ks $ (4 + 4 * ind) + offset) [0..3]
cryptonite                       >     |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cryptonite                       >
cryptonite                       > /private/var/folders/0c/zmpjp7l568xcvnt49pkkn5p00000gn/T/stack-58eba4f7893625b7/cryptonite-0.29/Crypto/Cipher/Twofish/Primitive.hs:210:11: warning: [-Wincomplete-uni-patterns]
cryptonite                       >     Pattern match(es) are non-exhaustive
cryptonite                       >     In a pattern binding:
cryptonite                       >         Patterns of type ‘[Word8]’ not matched:
cryptonite                       >             []
cryptonite                       >             [_]
cryptonite                       >             [_, _]
cryptonite                       >             [_, _, _]
cryptonite                       >             ...
cryptonite                       >     |
cryptonite                       > 210 |           [w0, w1, w2, w3, w4, w5, w6, w7, w8, w9, w10, w11, w12, w13, w14, w15] = take 16 ws
cryptonite                       >     |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cryptonite                       >
cryptonite                       > /private/var/folders/0c/zmpjp7l568xcvnt49pkkn5p00000gn/T/stack-58eba4f7893625b7/cryptonite-0.29/Crypto/Cipher/Twofish/Primitive.hs:258:11: warning: [-Wincomplete-uni-patterns]
cryptonite                       >     Pattern match(es) are non-exhaustive
cryptonite                       >     In a pattern binding:
cryptonite                       >         Patterns of type ‘[Word8]’ not matched:
cryptonite                       >             []
cryptonite                       >             [_]
cryptonite                       >             [_, _]
cryptonite                       >             [_, _, _]
cryptonite                       >             ...
cryptonite                       >     |
cryptonite                       > 258 |           [y0, y1, y2, y3] = take 4 input
cryptonite                       >     |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cryptonite                       > [ 57 of 136] Compiling Crypto.Cipher.Twofish
cryptonite                       > [ 58 of 136] Compiling Crypto.Cipher.CAST5.Primitive
cryptonite                       > [ 59 of 136] Compiling Crypto.Cipher.CAST5
cryptonite                       > [ 60 of 136] Compiling Crypto.Cipher.Blowfish.Box
cryptonite                       > [ 61 of 136] Compiling Crypto.Cipher.Blowfish.Primitive
cryptonite                       > [ 62 of 136] Compiling Crypto.Cipher.Blowfish
cryptonite                       > [ 63 of 136] Compiling Crypto.Internal.Words
cryptonite                       > [ 64 of 136] Compiling Crypto.Cipher.Camellia.Primitive
cryptonite                       > [ 65 of 136] Compiling Crypto.Cipher.Camellia
cryptonite                       > [ 66 of 136] Compiling Crypto.KDF.Argon2
cryptonite                       > [ 67 of 136] Compiling Crypto.KDF.BCryptPBKDF
cryptonite                       > [ 68 of 136] Compiling Crypto.MAC.CMAC
cryptonite                       > [ 69 of 136] Compiling Crypto.MAC.HMAC
cryptonite                       > [ 70 of 136] Compiling Crypto.KDF.PBKDF2
cryptonite                       > [ 71 of 136] Compiling Crypto.KDF.Scrypt
cryptonite                       > [ 72 of 136] Compiling Crypto.KDF.HKDF
cryptonite                       > [ 73 of 136] Compiling Crypto.MAC.KMAC
cryptonite                       > [ 74 of 136] Compiling Crypto.MAC.Poly1305
cryptonite                       > [ 75 of 136] Compiling Crypto.Cipher.ChaChaPoly1305
cryptonite                       > [ 76 of 136] Compiling Crypto.Number.Compat
cryptonite                       >
cryptonite                       > /private/var/folders/0c/zmpjp7l568xcvnt49pkkn5p00000gn/T/stack-58eba4f7893625b7/cryptonite-0.29/Crypto/Number/Compat.hs:57:22: warning: [-Wdeprecations]
cryptonite                       >     In the use of ‘gcdExtInteger’
cryptonite                       >     (imported from GHC.Integer.GMP.Internals):
cryptonite                       >     Deprecated: "Use integerGcde instead"
cryptonite                       >    |
cryptonite                       > 57 |   where (# g, s #) = gcdExtInteger a b
cryptonite                       >    |                      ^^^^^^^^^^^^^
cryptonite                       >
cryptonite                       > /private/var/folders/0c/zmpjp7l568xcvnt49pkkn5p00000gn/T/stack-58eba4f7893625b7/cryptonite-0.29/Crypto/Number/Compat.hs:90:40: warning: [-Wdeprecations]
cryptonite                       >     In the use of ‘powModInteger’
cryptonite                       >     (imported from GHC.Integer.GMP.Internals):
cryptonite                       >     Deprecated: "Use integerPowMod# instead"
cryptonite                       >    |
cryptonite                       > 90 | gmpPowModInteger b e m = GmpSupported (powModInteger b e m)
cryptonite                       >    |                                        ^^^^^^^^^^^^^
cryptonite                       >
cryptonite                       > /private/var/folders/0c/zmpjp7l568xcvnt49pkkn5p00000gn/T/stack-58eba4f7893625b7/cryptonite-0.29/Crypto/Number/Compat.hs:101:13: warning: [-Wdeprecations]
cryptonite                       >     In the use of ‘recipModInteger’
cryptonite                       >     (imported from GHC.Integer.GMP.Internals):
cryptonite                       >     Deprecated: "Use integerRecipMod# instead"
cryptonite                       >     |
cryptonite                       > 101 |   where r = recipModInteger g m
cryptonite                       >     |             ^^^^^^^^^^^^^^^
cryptonite                       >
cryptonite                       > /private/var/folders/0c/zmpjp7l568xcvnt49pkkn5p00000gn/T/stack-58eba4f7893625b7/cryptonite-0.29/Crypto/Number/Compat.hs:132:49: warning: [-Wdeprecations]
cryptonite                       >     In the use of ‘sizeInBaseInteger’
cryptonite                       >     (imported from GHC.Integer.GMP.Internals):
cryptonite                       >     Deprecated: "Use integerSizeInBase# instead"
cryptonite                       >     |
cryptonite                       > 132 | gmpSizeInBytes n = GmpSupported (I# (word2Int# (sizeInBaseInteger n 256#)))
cryptonite                       >     |                                                 ^^^^^^^^^^^^^^^^^
cryptonite                       >
cryptonite                       > /private/var/folders/0c/zmpjp7l568xcvnt49pkkn5p00000gn/T/stack-58eba4f7893625b7/cryptonite-0.29/Crypto/Number/Compat.hs:140:48: warning: [-Wdeprecations]
cryptonite                       >     In the use of ‘sizeInBaseInteger’
cryptonite                       >     (imported from GHC.Integer.GMP.Internals):
cryptonite                       >     Deprecated: "Use integerSizeInBase# instead"
cryptonite                       >     |
cryptonite                       > 140 | gmpSizeInBits n = GmpSupported (I# (word2Int# (sizeInBaseInteger n 2#)))
cryptonite                       >     |                                                ^^^^^^^^^^^^^^^^^
cryptonite                       >
cryptonite                       > /private/var/folders/0c/zmpjp7l568xcvnt49pkkn5p00000gn/T/stack-58eba4f7893625b7/cryptonite-0.29/Crypto/Number/Compat.hs:149:10: warning: [-Wdeprecations]
cryptonite                       >     In the use of ‘exportIntegerToAddr’
cryptonite                       >     (imported from GHC.Integer.GMP.Internals):
cryptonite                       >     Deprecated: "Use integerToAddr# instead"
cryptonite                       >     |
cryptonite                       > 149 |     _ <- exportIntegerToAddr n addr 1#
cryptonite                       >     |          ^^^^^^^^^^^^^^^^^^^
cryptonite                       >
cryptonite                       > /private/var/folders/0c/zmpjp7l568xcvnt49pkkn5p00000gn/T/stack-58eba4f7893625b7/cryptonite-0.29/Crypto/Number/Compat.hs:163:10: warning: [-Wdeprecations]
cryptonite                       >     In the use of ‘exportIntegerToAddr’
cryptonite                       >     (imported from GHC.Integer.GMP.Internals):
cryptonite                       >     Deprecated: "Use integerToAddr# instead"
cryptonite                       >     |
cryptonite                       > 163 |     _ <- exportIntegerToAddr n addr 0#
cryptonite                       >     |          ^^^^^^^^^^^^^^^^^^^
cryptonite                       >
cryptonite                       > /private/var/folders/0c/zmpjp7l568xcvnt49pkkn5p00000gn/T/stack-58eba4f7893625b7/cryptonite-0.29/Crypto/Number/Compat.hs:177:5: warning: [-Wdeprecations]
cryptonite                       >     In the use of ‘importIntegerFromAddr’
cryptonite                       >     (imported from GHC.Integer.GMP.Internals):
cryptonite                       >     Deprecated: "Use integerFromAddr# instead"
cryptonite                       >     |
cryptonite                       > 177 |     importIntegerFromAddr addr (int2Word# n) 1#
cryptonite                       >     |     ^^^^^^^^^^^^^^^^^^^^^
cryptonite                       >
cryptonite                       > /private/var/folders/0c/zmpjp7l568xcvnt49pkkn5p00000gn/T/stack-58eba4f7893625b7/cryptonite-0.29/Crypto/Number/Compat.hs:189:5: warning: [-Wdeprecations]
cryptonite                       >     In the use of ‘importIntegerFromAddr’
cryptonite                       >     (imported from GHC.Integer.GMP.Internals):
cryptonite                       >     Deprecated: "Use integerFromAddr# instead"
cryptonite                       >     |
cryptonite                       > 189 |     importIntegerFromAddr addr (int2Word# n) 0#
cryptonite                       >     |     ^^^^^^^^^^^^^^^^^^^^^
cryptonite                       > [ 77 of 136] Compiling Crypto.Number.Basic
cryptonite                       > [ 78 of 136] Compiling Crypto.ECC.Simple.Types
cryptonite                       > [ 79 of 136] Compiling Crypto.Number.F2m
cryptonite                       > [ 80 of 136] Compiling Crypto.Number.ModArithmetic
cryptonite                       > [ 81 of 136] Compiling Crypto.Number.Nat
cryptonite                       > [ 82 of 136] Compiling Crypto.Number.Serialize.Internal
cryptonite                       > [ 83 of 136] Compiling Crypto.Number.Serialize
cryptonite                       > [ 84 of 136] Compiling Crypto.Number.Serialize.Internal.LE
cryptonite                       > [ 85 of 136] Compiling Crypto.Number.Serialize.LE
cryptonite                       > [ 86 of 136] Compiling Crypto.OTP
cryptonite                       > [ 87 of 136] Compiling Crypto.PubKey.ECC.Types
cryptonite                       > [ 88 of 136] Compiling Crypto.PubKey.Internal
cryptonite                       > [ 89 of 136] Compiling Crypto.PubKey.MaskGenFunction
cryptonite                       > [ 90 of 136] Compiling Crypto.PubKey.RSA.Types
cryptonite                       > [ 91 of 136] Compiling Crypto.PubKey.RSA.Prim
cryptonite                       > [ 92 of 136] Compiling Crypto.Random.Entropy.Source
cryptonite                       > [ 93 of 136] Compiling Crypto.Random.Entropy.Unix
cryptonite                       > [ 94 of 136] Compiling Crypto.Random.Entropy.Backend
cryptonite                       > [ 95 of 136] Compiling Crypto.Random.Entropy.Unsafe
cryptonite                       > [ 96 of 136] Compiling Crypto.Random.Entropy
cryptonite                       > [ 97 of 136] Compiling Crypto.Random.EntropyPool
cryptonite                       > [ 98 of 136] Compiling Crypto.Random.Types
cryptonite                       > [ 99 of 136] Compiling Crypto.Random.SystemDRG
cryptonite                       > [100 of 136] Compiling Crypto.Random.ChaChaDRG
cryptonite                       > [101 of 136] Compiling Crypto.Random
cryptonite                       > [102 of 136] Compiling Crypto.Random.Probabilistic
cryptonite                       > [103 of 136] Compiling Crypto.PubKey.Ed448
cryptonite                       > [104 of 136] Compiling Crypto.PubKey.Ed25519
cryptonite                       > [105 of 136] Compiling Crypto.PubKey.ECC.P256
cryptonite                       > [106 of 136] Compiling Crypto.PubKey.Curve448
cryptonite                       > [107 of 136] Compiling Crypto.PubKey.Curve25519
cryptonite                       > [108 of 136] Compiling Crypto.KDF.BCrypt
cryptonite                       > [109 of 136] Compiling Crypto.ECC.Edwards25519
cryptonite                       > [110 of 136] Compiling Crypto.Cipher.AESGCMSIV
cryptonite                       >
cryptonite                       > /private/var/folders/0c/zmpjp7l568xcvnt49pkkn5p00000gn/T/stack-58eba4f7893625b7/cryptonite-0.29/Crypto/Cipher/AESGCMSIV.hs:193:23: warning: [-Wincomplete-uni-patterns]
cryptonite                       >     Pattern match(es) are non-exhaustive
cryptonite                       >     In a pattern binding:
cryptonite                       >         Patterns of type ‘Maybe (IV c)’ not matched: Nothing
cryptonite                       >     |
cryptonite                       > 193 |   where toIV bs = let Just iv = makeIV (bs :: Bytes) in iv
cryptonite                       >     |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cryptonite                       > [111 of 136] Compiling Crypto.Number.Generate
cryptonite                       > [112 of 136] Compiling Crypto.PubKey.ECC.Prim
cryptonite                       > [113 of 136] Compiling Crypto.PubKey.ECC.ECDSA
cryptonite                       > [114 of 136] Compiling Crypto.PubKey.ECC.Generate
cryptonite                       > [115 of 136] Compiling Crypto.PubKey.DSA
cryptonite                       > [116 of 136] Compiling Crypto.Number.Prime
cryptonite                       > [117 of 136] Compiling Crypto.PubKey.Rabin.Types
cryptonite                       > [118 of 136] Compiling Crypto.PubKey.Rabin.OAEP
cryptonite                       > [119 of 136] Compiling Crypto.PubKey.Rabin.RW
cryptonite                       > [120 of 136] Compiling Crypto.PubKey.Rabin.Modified
cryptonite                       > [121 of 136] Compiling Crypto.PubKey.Rabin.Basic
cryptonite                       > [122 of 136] Compiling Crypto.PubKey.RSA
cryptonite                       > [123 of 136] Compiling Crypto.PubKey.RSA.PSS
cryptonite                       > [124 of 136] Compiling Crypto.PubKey.RSA.PKCS15
cryptonite                       > [125 of 136] Compiling Crypto.PubKey.RSA.OAEP
cryptonite                       > [126 of 136] Compiling Crypto.PubKey.DH
cryptonite                       > [127 of 136] Compiling Crypto.PubKey.ElGamal
cryptonite                       > [128 of 136] Compiling Crypto.PubKey.ECC.DH
cryptonite                       >
cryptonite                       > /private/var/folders/0c/zmpjp7l568xcvnt49pkkn5p00000gn/T/stack-58eba4f7893625b7/cryptonite-0.29/Crypto/PubKey/ECC/DH.hs:47:5: warning: [-Wincomplete-uni-patterns]
cryptonite                       >     Pattern match(es) are non-exhaustive
cryptonite                       >     In a pattern binding: Patterns of type ‘Point’ not matched: PointO
cryptonite                       >    |
cryptonite                       > 47 |     Point x _ = pointMul curve db qa
cryptonite                       >    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cryptonite                       > [129 of 136] Compiling Crypto.ECC.Simple.Prim
cryptonite                       > [130 of 136] Compiling Crypto.ECC
cryptonite                       > [131 of 136] Compiling Crypto.PubKey.EdDSA
cryptonite                       > [132 of 136] Compiling Crypto.PubKey.ECIES
cryptonite                       > [133 of 136] Compiling Crypto.PubKey.ECDSA
cryptonite                       > [134 of 136] Compiling Crypto.Data.AFIS
cryptonite                       > [135 of 136] Compiling Crypto.System.CPU
cryptonite                       > [136 of 136] Compiling Crypto.Tutorial
cryptonite                       >
cryptonite                       > /private/var/folders/0c/zmpjp7l568xcvnt49pkkn5p00000gn/T/stack-58eba4f7893625b7/cryptonite-0.29/cbits/decaf/p448/f_generic.c:56:8: error:
cryptonite                       >      warning: loop not unrolled: the optimizer was unable to perform the requested transformation; the transformation might be disabled or specified as part of an unsupported transformation ordering [-Wpass-failed=transform-warning]
cryptonite                       >    |
cryptonite                       > 56 | mask_t cryptonite_gf_deserialize (gf x, const uint8_t serial[SER_BYTES], int with_hibit) {
cryptonite                       >    |        ^
cryptonite                       > mask_t cryptonite_gf_deserialize (gf x, const uint8_t serial[SER_BYTES], int with_hibit) {
cryptonite                       >        ^
cryptonite                       >
cryptonite                       > /private/var/folders/0c/zmpjp7l568xcvnt49pkkn5p00000gn/T/stack-58eba4f7893625b7/cryptonite-0.29/cbits/decaf/p448/f_field.h:54:38: error:
cryptonite                       >      note: expanded from macro 'cryptonite_gf_deserialize'
cryptonite                       >    |
cryptonite                       > 54 | #define cryptonite_gf_deserialize    cryptonite_gf_448_deserialize
cryptonite                       >    |                                      ^
cryptonite                       > #define cryptonite_gf_deserialize    cryptonite_gf_448_deserialize
cryptonite                       >                                      ^
cryptonite                       >
cryptonite                       > /private/var/folders/0c/zmpjp7l568xcvnt49pkkn5p00000gn/T/stack-58eba4f7893625b7/cryptonite-0.29/cbits/decaf/p448/f_generic.c:56:8: error:
cryptonite                       >      warning: loop not unrolled: the optimizer was unable to perform the requested transformation; the transformation might be disabled or specified as part of an unsupported transformation ordering [-Wpass-failed=transform-warning]
cryptonite                       >    |
cryptonite                       > 56 | mask_t cryptonite_gf_deserialize (gf x, const uint8_t serial[SER_BYTES], int with_hibit) {
cryptonite                       >    |        ^
cryptonite                       >
cryptonite                       > /private/var/folders/0c/zmpjp7l568xcvnt49pkkn5p00000gn/T/stack-58eba4f7893625b7/cryptonite-0.29/cbits/decaf/p448/f_field.h:54:38: error:
cryptonite                       >      note: expanded from macro 'cryptonite_gf_deserialize'
cryptonite                       >    |
cryptonite                       > 54 | #define cryptonite_gf_deserialize    cryptonite_gf_448_deserialize
cryptonite                       >    |                                      ^
cryptonite                       > #define cryptonite_gf_deserialize    cryptonite_gf_448_deserialize
cryptonite                       >                                      ^
cryptonite                       >
cryptonite                       > /private/var/folders/0c/zmpjp7l568xcvnt49pkkn5p00000gn/T/stack-58eba4f7893625b7/cryptonite-0.29/cbits/decaf/p448/f_generic.c:56:8: error:
cryptonite                       >      warning: loop not unrolled: the optimizer was unable to perform the requested transformation; the transformation might be disabled or specified as part of an unsupported transformation ordering [-Wpass-failed=transform-warning]
cryptonite                       >    |
cryptonite                       > 56 | mask_t cryptonite_gf_deserialize (gf x, const uint8_t serial[SER_BYTES], int with_hibit) {
cryptonite                       >    |        ^
cryptonite                       >
cryptonite                       > /private/var/folders/0c/zmpjp7l568xcvnt49pkkn5p00000gn/T/stack-58eba4f7893625b7/cryptonite-0.29/cbits/decaf/p448/f_field.h:54:38: error:
cryptonite                       >      note: expanded from macro 'cryptonite_gf_deserialize'
cryptonite                       >    |
cryptonite                       > 54 | #define cryptonite_gf_deserialize    cryptonite_gf_448_deserialize
cryptonite                       >    |                                      ^
cryptonite                       > #define cryptonite_gf_deserialize    cryptonite_gf_448_deserialize
cryptonite                       >                                      ^
cryptonite                       >
cryptonite                       > /private/var/folders/0c/zmpjp7l568xcvnt49pkkn5p00000gn/T/stack-58eba4f7893625b7/cryptonite-0.29/cbits/decaf/p448/f_generic.c:56:8: error:
cryptonite                       >      warning: loop not unrolled: the optimizer was unable to perform the requested transformation; the transformation might be disabled or specified as part of an unsupported transformation ordering [-Wpass-failed=transform-warning]
cryptonite                       >    |
cryptonite                       > 56 | mask_t cryptonite_gf_deserialize (gf x, const uint8_t serial[SER_BYTES], int with_hibit) {
cryptonite                       >    |        ^
cryptonite                       >
cryptonite                       > /private/var/folders/0c/zmpjp7l568xcvnt49pkkn5p00000gn/T/stack-58eba4f7893625b7/cryptonite-0.29/cbits/decaf/p448/f_field.h:54:38: error:
cryptonite                       >      note: expanded from macro 'cryptonite_gf_deserialize'
cryptonite                       >    |
cryptonite                       > 54 | #define cryptonite_gf_deserialize    cryptonite_gf_448_deserialize
cryptonite                       >    |                                      ^
cryptonite                       > #define cryptonite_gf_deserialize    cryptonite_gf_448_deserialize
cryptonite                       >                                      ^
cryptonite                       >
cryptonite                       > /private/var/folders/0c/zmpjp7l568xcvnt49pkkn5p00000gn/T/stack-58eba4f7893625b7/cryptonite-0.29/cbits/decaf/p448/f_generic.c:56:8: error:
cryptonite                       >      warning: loop not unrolled: the optimizer was unable to perform the requested transformation; the transformation might be disabled or specified as part of an unsupported transformation ordering [-Wpass-failed=transform-warning]
cryptonite                       >    |
cryptonite                       > 56 | mask_t cryptonite_gf_deserialize (gf x, const uint8_t serial[SER_BYTES], int with_hibit) {
cryptonite                       >    |        ^
cryptonite                       >
cryptonite                       > /private/var/folders/0c/zmpjp7l568xcvnt49pkkn5p00000gn/T/stack-58eba4f7893625b7/cryptonite-0.29/cbits/decaf/p448/f_field.h:54:38: error:
cryptonite                       >      note: expanded from macro 'cryptonite_gf_deserialize'
cryptonite                       >    |
cryptonite                       > 54 | #define cryptonite_gf_deserialize    cryptonite_gf_448_deserialize
cryptonite                       >    |                                      ^
cryptonite                       > #define cryptonite_gf_deserialize    cryptonite_gf_448_deserialize
cryptonite                       >                                      ^
cryptonite                       >
cryptonite                       > /private/var/folders/0c/zmpjp7l568xcvnt49pkkn5p00000gn/T/stack-58eba4f7893625b7/cryptonite-0.29/cbits/decaf/p448/f_generic.c:56:8: error:
cryptonite                       >      warning: loop not unrolled: the optimizer was unable to perform the requested transformation; the transformation might be disabled or specified as part of an unsupported transformation ordering [-Wpass-failed=transform-warning]
cryptonite                       >    |
cryptonite                       > 56 | mask_t cryptonite_gf_deserialize (gf x, const uint8_t serial[SER_BYTES], int with_hibit) {
cryptonite                       >    |        ^
cryptonite                       >
cryptonite                       > /private/var/folders/0c/zmpjp7l568xcvnt49pkkn5p00000gn/T/stack-58eba4f7893625b7/cryptonite-0.29/cbits/decaf/p448/f_field.h:54:38: error:
cryptonite                       >      note: expanded from macro 'cryptonite_gf_deserialize'
cryptonite                       >    |
cryptonite                       > 54 | #define cryptonite_gf_deserialize    cryptonite_gf_448_deserialize
cryptonite                       >    |                                      ^
cryptonite                       > #define cryptonite_gf_deserialize    cryptonite_gf_448_deserialize
cryptonite                       >                                      ^
cryptonite                       > 6 warnings generated.
cryptonite                       >
cryptonite                       > /private/var/folders/0c/zmpjp7l568xcvnt49pkkn5p00000gn/T/stack-58eba4f7893625b7/cryptonite-0.29/cbits/decaf/p448/f_generic.c:56:8: error:
cryptonite                       >      warning: loop not unrolled: the optimizer was unable to perform the requested transformation; the transformation might be disabled or specified as part of an unsupported transformation ordering [-Wpass-failed=transform-warning]
cryptonite                       >    |
cryptonite                       > 56 | mask_t cryptonite_gf_deserialize (gf x, const uint8_t serial[SER_BYTES], int with_hibit) {
cryptonite                       >    |        ^
cryptonite                       > mask_t cryptonite_gf_deserialize (gf x, const uint8_t serial[SER_BYTES], int with_hibit) {
cryptonite                       >        ^
cryptonite                       >
cryptonite                       > /private/var/folders/0c/zmpjp7l568xcvnt49pkkn5p00000gn/T/stack-58eba4f7893625b7/cryptonite-0.29/cbits/decaf/p448/f_field.h:54:38: error:
cryptonite                       >      note: expanded from macro 'cryptonite_gf_deserialize'
cryptonite                       >    |
cryptonite                       > 54 | #define cryptonite_gf_deserialize    cryptonite_gf_448_deserialize
cryptonite                       >    |                                      ^
cryptonite                       > #define cryptonite_gf_deserialize    cryptonite_gf_448_deserialize
cryptonite                       >                                      ^
cryptonite                       >
cryptonite                       > /private/var/folders/0c/zmpjp7l568xcvnt49pkkn5p00000gn/T/stack-58eba4f7893625b7/cryptonite-0.29/cbits/decaf/p448/f_generic.c:56:8: error:
cryptonite                       >      warning: loop not unrolled: the optimizer was unable to perform the requested transformation; the transformation might be disabled or specified as part of an unsupported transformation ordering [-Wpass-failed=transform-warning]
cryptonite                       >    |
cryptonite                       > 56 | mask_t cryptonite_gf_deserialize (gf x, const uint8_t serial[SER_BYTES], int with_hibit) {
cryptonite                       >    |        ^
cryptonite                       >
cryptonite                       > /private/var/folders/0c/zmpjp7l568xcvnt49pkkn5p00000gn/T/stack-58eba4f7893625b7/cryptonite-0.29/cbits/decaf/p448/f_field.h:54:38: error:
cryptonite                       >      note: expanded from macro 'cryptonite_gf_deserialize'
cryptonite                       >    |
cryptonite                       > 54 | #define cryptonite_gf_deserialize    cryptonite_gf_448_deserialize
cryptonite                       >    |                                      ^
cryptonite                       > #define cryptonite_gf_deserialize    cryptonite_gf_448_deserialize
cryptonite                       >                                      ^
cryptonite                       >
cryptonite                       > /private/var/folders/0c/zmpjp7l568xcvnt49pkkn5p00000gn/T/stack-58eba4f7893625b7/cryptonite-0.29/cbits/decaf/p448/f_generic.c:56:8: error:
cryptonite                       >      warning: loop not unrolled: the optimizer was unable to perform the requested transformation; the transformation might be disabled or specified as part of an unsupported transformation ordering [-Wpass-failed=transform-warning]
cryptonite                       >    |
cryptonite                       > 56 | mask_t cryptonite_gf_deserialize (gf x, const uint8_t serial[SER_BYTES], int with_hibit) {
cryptonite                       >    |        ^
cryptonite                       >
cryptonite                       > /private/var/folders/0c/zmpjp7l568xcvnt49pkkn5p00000gn/T/stack-58eba4f7893625b7/cryptonite-0.29/cbits/decaf/p448/f_field.h:54:38: error:
cryptonite                       >      note: expanded from macro 'cryptonite_gf_deserialize'
cryptonite                       >    |
cryptonite                       > 54 | #define cryptonite_gf_deserialize    cryptonite_gf_448_deserialize
cryptonite                       >    |                                      ^
cryptonite                       > #define cryptonite_gf_deserialize    cryptonite_gf_448_deserialize
cryptonite                       >                                      ^
cryptonite                       >
cryptonite                       > /private/var/folders/0c/zmpjp7l568xcvnt49pkkn5p00000gn/T/stack-58eba4f7893625b7/cryptonite-0.29/cbits/decaf/p448/f_generic.c:56:8: error:
cryptonite                       >      warning: loop not unrolled: the optimizer was unable to perform the requested transformation; the transformation might be disabled or specified as part of an unsupported transformation ordering [-Wpass-failed=transform-warning]
cryptonite                       >    |
cryptonite                       > 56 | mask_t cryptonite_gf_deserialize (gf x, const uint8_t serial[SER_BYTES], int with_hibit) {
cryptonite                       >    |        ^
cryptonite                       >
cryptonite                       > /private/var/folders/0c/zmpjp7l568xcvnt49pkkn5p00000gn/T/stack-58eba4f7893625b7/cryptonite-0.29/cbits/decaf/p448/f_field.h:54:38: error:
cryptonite                       >      note: expanded from macro 'cryptonite_gf_deserialize'
cryptonite                       >    |
cryptonite                       > 54 | #define cryptonite_gf_deserialize    cryptonite_gf_448_deserialize
cryptonite                       >    |                                      ^
cryptonite                       > #define cryptonite_gf_deserialize    cryptonite_gf_448_deserialize
cryptonite                       >                                      ^
cryptonite                       >
cryptonite                       > /private/var/folders/0c/zmpjp7l568xcvnt49pkkn5p00000gn/T/stack-58eba4f7893625b7/cryptonite-0.29/cbits/decaf/p448/f_generic.c:56:8: error:
cryptonite                       >      warning: loop not unrolled: the optimizer was unable to perform the requested transformation; the transformation might be disabled or specified as part of an unsupported transformation ordering [-Wpass-failed=transform-warning]
cryptonite                       >    |
cryptonite                       > 56 | mask_t cryptonite_gf_deserialize (gf x, const uint8_t serial[SER_BYTES], int with_hibit) {
cryptonite                       >    |        ^
cryptonite                       >
cryptonite                       > /private/var/folders/0c/zmpjp7l568xcvnt49pkkn5p00000gn/T/stack-58eba4f7893625b7/cryptonite-0.29/cbits/decaf/p448/f_field.h:54:38: error:
cryptonite                       >      note: expanded from macro 'cryptonite_gf_deserialize'
cryptonite                       >    |
cryptonite                       > 54 | #define cryptonite_gf_deserialize    cryptonite_gf_448_deserialize
cryptonite                       >    |                                      ^
cryptonite                       > #define cryptonite_gf_deserialize    cryptonite_gf_448_deserialize
cryptonite                       >                                      ^
cryptonite                       >
cryptonite                       > /private/var/folders/0c/zmpjp7l568xcvnt49pkkn5p00000gn/T/stack-58eba4f7893625b7/cryptonite-0.29/cbits/decaf/p448/f_generic.c:56:8: error:
cryptonite                       >      warning: loop not unrolled: the optimizer was unable to perform the requested transformation; the transformation might be disabled or specified as part of an unsupported transformation ordering [-Wpass-failed=transform-warning]
cryptonite                       >    |
cryptonite                       > 56 | mask_t cryptonite_gf_deserialize (gf x, const uint8_t serial[SER_BYTES], int with_hibit) {
cryptonite                       >    |        ^
cryptonite                       >
cryptonite                       > /private/var/folders/0c/zmpjp7l568xcvnt49pkkn5p00000gn/T/stack-58eba4f7893625b7/cryptonite-0.29/cbits/decaf/p448/f_field.h:54:38: error:
cryptonite                       >      note: expanded from macro 'cryptonite_gf_deserialize'
cryptonite                       >    |
cryptonite                       > 54 | #define cryptonite_gf_deserialize    cryptonite_gf_448_deserialize
cryptonite                       >    |                                      ^
cryptonite                       > #define cryptonite_gf_deserialize    cryptonite_gf_448_deserialize
cryptonite                       >                                      ^
cryptonite                       > 6 warnings generated.
cryptonite                       > copy/register
cryptonite                       > Installing library in /Users/maarten/.stack/snapshots/aarch64-osx/854c9a80623d545e79bd94467dda9c44647a6ff310360cc215204311f1bd4e24/9.2.1.20220303/lib/aarch64-osx-ghc-9.2.1.20220303/cryptonite-0.29-HQyWn9C1cMF1ZS5GqQN8CW
cryptonite                       > Registering library for cryptonite-0.29..
josephcsible commented 2 years ago

Are any of those warnings specific to GHC 9.2 or my changes? If not, then they're out of scope of this PR.

maerten commented 2 years ago

Comparing the diff from building with 9.0.2 and 9.2.2 (pre-release), the following warnings are specific to GHC 9.2:

cryptonite                       > [ 56 of 136] Compiling Crypto.Cipher.Twofish.Primitive
cryptonite                       >
cryptonite                       > /private/var/folders/0c/zmpjp7l568xcvnt49pkkn5p00000gn/T/stack-58eba4f7893625b7/cryptonite-0.29/Crypto/Cipher/Twofish/Primitive.hs:84:19: warning: [-Wincomplete-uni-patterns]
cryptonite                       >     Pattern match(es) are non-exhaustive
cryptonite                       >     In a pattern binding:
cryptonite                       >         Patterns of type ‘[Word32]’ not matched:
cryptonite                       >             []
cryptonite                       >             [(GHC.Word.W32# _)]
cryptonite                       >             [(GHC.Word.W32# _), (GHC.Word.W32# _)]
cryptonite                       >             [(GHC.Word.W32# _), (GHC.Word.W32# _), (GHC.Word.W32# _)]
cryptonite                       >             ...
cryptonite                       >    |
cryptonite                       > 84 |             where [k0, k1, k2, k3] = fmap (\offset -> arrayRead32 ks $ (8 + 4 * ind) + offset) [0..3]
cryptonite                       >    |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cryptonite                       >
cryptonite                       > /private/var/folders/0c/zmpjp7l568xcvnt49pkkn5p00000gn/T/stack-58eba4f7893625b7/cryptonite-0.29/Crypto/Cipher/Twofish/Primitive.hs:119:19: warning: [-Wincomplete-uni-patterns]
cryptonite                       >     Pattern match(es) are non-exhaustive
cryptonite                       >     In a pattern binding:
cryptonite                       >         Patterns of type ‘[Word32]’ not matched:
cryptonite                       >             []
cryptonite                       >             [(GHC.Word.W32# _)]
cryptonite                       >             [(GHC.Word.W32# _), (GHC.Word.W32# _)]
cryptonite                       >             [(GHC.Word.W32# _), (GHC.Word.W32# _), (GHC.Word.W32# _)]
cryptonite                       >             ...
cryptonite                       >     |
cryptonite                       > 119 |             where [k0, k1, k2, k3] = fmap (\offset -> arrayRead32 ks $ (4 + 4 * ind) + offset) [0..3]
cryptonite                       >     |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cryptonite                       >
cryptonite                       > /private/var/folders/0c/zmpjp7l568xcvnt49pkkn5p00000gn/T/stack-58eba4f7893625b7/cryptonite-0.29/Crypto/Cipher/Twofish/Primitive.hs:210:11: warning: [-Wincomplete-uni-patterns]
cryptonite                       >     Pattern match(es) are non-exhaustive
cryptonite                       >     In a pattern binding:
cryptonite                       >         Patterns of type ‘[Word8]’ not matched:
cryptonite                       >             []
cryptonite                       >             [_]
cryptonite                       >             [_, _]
cryptonite                       >             [_, _, _]
cryptonite                       >             ...
cryptonite                       >     |
cryptonite                       > 210 |           [w0, w1, w2, w3, w4, w5, w6, w7, w8, w9, w10, w11, w12, w13, w14, w15] = take 16 ws
cryptonite                       >     |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cryptonite                       >
cryptonite                       > /private/var/folders/0c/zmpjp7l568xcvnt49pkkn5p00000gn/T/stack-58eba4f7893625b7/cryptonite-0.29/Crypto/Cipher/Twofish/Primitive.hs:258:11: warning: [-Wincomplete-uni-patterns]
cryptonite                       >     Pattern match(es) are non-exhaustive
cryptonite                       >     In a pattern binding:
cryptonite                       >         Patterns of type ‘[Word8]’ not matched:
cryptonite                       >             []
cryptonite                       >             [_]
cryptonite                       >             [_, _]
cryptonite                       >             [_, _, _]
cryptonite                       >             ...
cryptonite                       >     |
cryptonite                       > 258 |           [y0, y1, y2, y3] = take 4 input
cryptonite                       >     |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cryptonite                       > [ 57 of 136] Compiling Crypto.Cipher.Twofish
cryptonite                       >
cryptonite                       > /private/var/folders/0c/zmpjp7l568xcvnt49pkkn5p00000gn/T/stack-58eba4f7893625b7/cryptonite-0.29/Crypto/Cipher/AESGCMSIV.hs:193:23: warning: [-Wincomplete-uni-patterns]
cryptonite                       >     Pattern match(es) are non-exhaustive
cryptonite                       >     In a pattern binding:
cryptonite                       >         Patterns of type ‘Maybe (IV c)’ not matched: Nothing
cryptonite                       >     |
cryptonite                       > 193 |   where toIV bs = let Just iv = makeIV (bs :: Bytes) in iv
cryptonite                       >     |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cryptonite                       >
cryptonite                       > /private/var/folders/0c/zmpjp7l568xcvnt49pkkn5p00000gn/T/stack-58eba4f7893625b7/cryptonite-0.29/Crypto/PubKey/ECC/DH.hs:47:5: warning: [-Wincomplete-uni-patterns]
cryptonite                       >     Pattern match(es) are non-exhaustive
cryptonite                       >     In a pattern binding: Patterns of type ‘Point’ not matched: PointO
cryptonite                       >    |
cryptonite                       > 47 |     Point x _ = pointMul curve db qa
cryptonite                       >    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
josephcsible commented 2 years ago

Those patterns were always incomplete. The reason those warnings just started appearing on 9.2 is that -Wincomplete-uni-patterns being part of -Wall is new to 9.2: https://gitlab.haskell.org/ghc/ghc/-/merge_requests/4614

tfausak commented 2 years ago

cryptonite-0.30 builds with GHC 9.2.2 for me.

josephcsible commented 2 years ago

Indeed, it seems @vincenthz fixed this a slightly different way in 20b194fc97eed03be8bc382af1f67803f53dce6d.