haskell-crypto / cryptonite

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

Compatibility with GHC 9.0.1 #340

Closed danwdart closed 2 years ago

danwdart commented 3 years ago

GHC 9.0.1 removes powModSecInteger etc, replaced by the bignum library.

Compiling produces:

Crypto/Number/Compat.hs:76:43: error:
    • Variable not in scope:
        powModSecInteger :: Integer -> Integer -> Integer -> Integer
    • Perhaps you meant one of these:
        ‘gmpPowModSecInteger’ (line 76),
        ‘powModInteger’ (imported from GHC.Integer.GMP.Internals)
   |
76 | gmpPowModSecInteger b e m = GmpSupported (powModSecInteger b e m)
   |                                           ^^^^^^^^^^^^^^^^

Crypto/Number/Compat.hs:107:32: error:
    Variable not in scope: nextPrimeInteger :: Integer -> Integer
    |
107 | gmpNextPrime n = GmpSupported (nextPrimeInteger n)
    |                                ^^^^^^^^^^^^^^^^

Crypto/Number/Compat.hs:116:10: error:
    • Variable not in scope:
        testPrimeInteger :: Integer -> Int# -> Int#
    • Perhaps you meant ‘testBitInteger’ (imported from GHC.Integer.GMP.Internals)
    |
116 |     case testPrimeInteger n tries of
ekmett commented 3 years ago

Just got bitten by this myself.

sjakobi commented 3 years ago

The latest v0.29 release appears to build with GHC 9.0.1.

I think v0.28 (and older?!) should get some bounds so dependency solvers won't consider them for GHC >= 9.0. I'm not quite sure which bounds should be added though.

sjakobi commented 3 years ago

I'm not quite sure which bounds should be added though.

integer-gmp < 1.1 I think.

EDIT: https://gitlab.haskell.org/ghc/ghc/-/issues/19811 is slightly related.

sjakobi commented 3 years ago

As a Hackage trustee I have created revisions that prevent cryptonite < 0.29 from building with integer-gmp >= 1.1, e.g. http://hackage.haskell.org/package/cryptonite-0.28/revisions/.

ysangkok commented 2 years ago

This can be closed now that 0.30 is released and is compatible with the 9.0 series.

danwdart commented 2 years ago

That's great, thanks! Looking forward to testing it.