entropy 0.3.3 → 0.3.4
raw patch · 2 files changed
+10/−6 lines, 2 filesdep ~basePVP ok
version bump matches the API change (PVP)
Dependency ranges changed: base
API changes (from Hackage documentation)
Files
- System/EntropyNix.hs +8/−4
- entropy.cabal +2/−2
System/EntropyNix.hs view
@@ -77,12 +77,16 @@ #endif fdReadBS :: Fd -> Int -> IO B.ByteString-fdReadBS fd n = do- allocaBytes n $ \buf -> do- rc <- fdReadBuf fd buf (fromIntegral n)+fdReadBS fd n =+ allocaBytes n $ \buf -> go buf n+ where+ go buf 0 = B.packCStringLen (castPtr buf, fromIntegral n)+ go buf cnt | cnt <= n = do+ rc <- fdReadBuf fd (plusPtr buf (n - cnt)) (fromIntegral cnt) case rc of 0 -> ioError (ioeSetErrorString (mkIOError eofErrorType "fdRead" Nothing Nothing) "EOF")- n' -> B.packCStringLen (castPtr buf, fromIntegral n')+ n' -> go buf (cnt - fromIntegral n')+ go _ _ = error "Impossible! The count of bytes left to read is greater than the request or less than zero!" #ifdef HAVE_RDRAND foreign import ccall unsafe "cpu_has_rdrand"
entropy.cabal view
@@ -1,5 +1,5 @@ name: entropy-version: 0.3.3+version: 0.3.4 description: A platform independent method to obtain cryptographically strong entropy (RDRAND when available anywhere, urandom on nix, CryptAPI on Windows, patches welcome). Users looking for cryptographically strong (number-theoretically@@ -18,7 +18,7 @@ -- ^^ Used for HaLVM build-type: Custom -- ^^ Test for RDRAND support using 'ghc'-cabal-version: >=1.10+cabal-version: >=1.17 tested-with: GHC == 7.8.2 -- data-files: extra-source-files: ./cbits/rdrand.c, ./cbits/rdrand.h, README.md