lio 0.9.1.2 → 0.9.2.0
raw patch · 5 files changed
+11/−49 lines, 5 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- LIO.Data.Time: getCurrentTime :: MonadLIO l m => m UTCTime
- LIO.Data.Time: getZonedTime :: MonadLIO l m => m ZonedTime
- LIO.Data.Time: utcToLocalZonedTime :: MonadLIO l m => UTCTime -> m ZonedTime
Files
- LIO/Core.hs +1/−1
- LIO/Data/Time.hs +0/−37
- LIO/FS/TCB.hs +3/−2
- LIO/Labeled.hs +6/−6
- lio.cabal +1/−3
LIO/Core.hs view
@@ -160,7 +160,7 @@ -> LIOState l -- ^ Initial state -> IO (Either SomeException (a, LIOState l))-paranoidLIO act s = (Right `liftM` runLIO act s) `catch` (return . Left)+paranoidLIO act s = (Right `liftM` runLIO act s) `E.catch` (return . Left) -- | Similar to 'evalLIO', but catches all exceptions exceptions -- thrown with 'throwLIO'.
− LIO/Data/Time.hs
@@ -1,37 +0,0 @@-{-# LANGUAGE Trustworthy #-}-{- |--This module re-exports "Data.Time" wrapped in 'LIO'.--WARNING: The time functions can be used to carry out-/external-timing attacks/ with less effort than using threads and-synchronization. It is therefore advised that computations that-operate on sensitive data take the same amount of time regardless of-the input.---}-module LIO.Data.Time (- module Data.Time- , getCurrentTime- , getZonedTime- , utcToLocalZonedTime- ) where--import qualified Data.Time as T-import Data.Time hiding ( getCurrentTime- , getZonedTime- , utcToLocalZonedTime)-import LIO-import LIO.TCB---- | Get the current UTC time from the system clock.-getCurrentTime :: MonadLIO l m => m UTCTime-getCurrentTime = liftLIO $ rethrowIoTCB T.getCurrentTime---- | Get the local time together with a TimeZone.-getZonedTime :: MonadLIO l m => m ZonedTime-getZonedTime = liftLIO $ rethrowIoTCB T.getZonedTime---- | Convert UTC time to local time with TimeZone.-utcToLocalZonedTime :: MonadLIO l m => UTCTime -> m ZonedTime-utcToLocalZonedTime = liftLIO . rethrowIoTCB . T.utcToLocalZonedTime
LIO/FS/TCB.hs view
@@ -44,6 +44,7 @@ import Control.Monad import Control.Exception+import qualified Control.Exception as E import System.FilePath import System.Directory@@ -156,7 +157,7 @@ e <- doesDirectoryExist path unless e $ throwIO FSRootNoExist doFail = throwIO FSRootCorrupt- throwOnFail act = act `catch` (\(_:: SomeException) -> doFail)+ throwOnFail act = act `E.catch` (\(_:: SomeException) -> doFail) -- | Initialize filesystem at the given path. The supplied path must be -- absolute, otherwise @initFSTCB@ throw 'FSRootInvalid'. If the FS has@@ -221,7 +222,7 @@ Right l | h == h' -> return l _ -> doFail where doFail = throwIO $ FSLabelCorrupt path- throwOnFail act = act `catch` (\(_:: SomeException) -> doFail)+ throwOnFail act = act `E.catch` (\(_:: SomeException) -> doFail) -- | Create a directory object with the given label.
LIO/Labeled.hs view
@@ -256,7 +256,7 @@ -- does not exceed a particular label. -- -- If an exception is thrown within a @toLabeled@ block, such that--- the outer context is withing a 'catch', which is further within+-- the outer context is withing a 'catchLIO', which is further within -- a @toLabeled@ block, infromation can be leaked. Consider the -- following program that uses 'DCLabel's. (Note that 'discard' is -- simply @toLabeled@ that throws throws the result away.)@@ -269,10 +269,10 @@ -- > stash <- readLIORef lRef -- > writeLIORef lRef $ stash ++ "\n" ++ guess ++ ":" -- > discard top $ do--- > catch ( discard top $ do--- > secret <- readLIORef hRef--- > when (secret == guess) $ throwIO . userError $ "got it!"--- > ) (\(e :: IOError) -> return ())+-- > catchLIO ( discard top $ do+-- > secret <- readLIORef hRef+-- > when (secret == guess) $ throwIO . userError $ "got it!"+-- > ) (\(e :: IOError) -> return ()) -- > l <- getLabel -- > when (l == bottom) $ do stash <- readLIORef lRef -- > writeLIORef lRef $ stash ++ "no!"@@ -292,7 +292,7 @@ -- Note that the current label is 'bottom' (which in DCLabels is -- @<True , False>@), and the secret is leaked. The fundamental issue -- is that the outer 'discard' allows for the current label to remain--- low even though the 'catch' raised the current label when the+-- low even though the 'catchLIO' raised the current label when the -- secret was found (and thus exception was throw). As a consequence, -- 'toLabeled' catches all exceptions, and returns a 'Labeled' -- value that may have a labeled exception as wrapped by @throw@.
lio.cabal view
@@ -1,5 +1,5 @@ Name: lio-Version: 0.9.1.2+Version: 0.9.2.0 Cabal-Version: >= 1.8 Build-type: Simple License: GPL@@ -113,8 +113,6 @@ LIO.Concurrent.TCB LIO.Concurrent.LMVar LIO.Concurrent.LMVar.TCB- -- * Time library- LIO.Data.Time -- * DCLabels LIO.DCLabel LIO.DCLabel.Core