Browse Source

Sanitize imports.

tags/0.1.0.0
Thomas Kerber 1 year ago
parent
commit
b82ebd6a8d
Signed by: Thomas Kerber <tk@drwx.org> GPG Key ID: 8489B911F9ED617B
8 changed files with 34 additions and 32 deletions
  1. +2
    -1
      src/Yggdrasil/Adversarial.hs
  2. +5
    -4
      src/Yggdrasil/Distribution.hs
  3. +5
    -5
      src/Yggdrasil/ExecutionModel.hs
  4. +6
    -4
      src/Yggdrasil/Functionalities.hs
  5. +6
    -6
      tests/ExecTests.hs
  6. +5
    -5
      tests/FunctTests.hs
  7. +1
    -1
      tests/Spec.hs
  8. +4
    -6
      yggdrasil.cabal

+ 2
- 1
src/Yggdrasil/Adversarial.hs View File

@@ -4,8 +4,9 @@ module Yggdrasil.Adversarial (
WithAdversary, Adversary, createAdversarial, noAdversary, dummyAdversary
) where

import Data.Dynamic
import Data.Dynamic (Typeable)
import Yggdrasil.ExecutionModel
(Action, Functionality(Functionality), create, interface')

type WithAdversary b c = Action (Maybe b) -> c


+ 5
- 4
src/Yggdrasil/Distribution.hs View File

@@ -6,10 +6,10 @@ module Yggdrasil.Distribution (
Distribution, Sampler, sample, sample', coin, uniform
) where

import Control.Monad
import Crypto.Random
import Data.Bits
import Data.Maybe
import Control.Monad (ap)
import Crypto.Random (SystemDRG, randomBytesGenerate)
import Data.Bits ((.&.))
import Data.Maybe (fromJust)
import qualified Data.ByteArray as B

newtype Distribution b = Distribution (forall s. Sampler s => s -> (b, s))
@@ -32,6 +32,7 @@ instance Sampler SystemDRG where
sampleCoin s = (b .&. 1 == 1, s')
where
(ba :: B.Bytes, s') = randomBytesGenerate 1 s
-- fromJust is safe, as the array is not empty.
(b, _) = fromJust $ B.uncons ba

sample :: Sampler s => s -> Distribution b -> (b, s)

+ 5
- 5
src/Yggdrasil/ExecutionModel.hs View File

@@ -8,11 +8,11 @@ module Yggdrasil.ExecutionModel (
interface, interface', self, doSample, create, run
) where

import Control.Monad
import Control.Monad.Trans.Class
import Control.Monad.Trans.Maybe
import Data.Dynamic
import Yggdrasil.Distribution
import Control.Monad (ap)
import Control.Monad.Trans.Class (lift)
import Control.Monad.Trans.Maybe (MaybeT(MaybeT), runMaybeT)
import Data.Dynamic (Dynamic, Typeable, fromDynamic, toDyn)
import Yggdrasil.Distribution (Distribution)

newtype World = World [Dynamic]


+ 6
- 4
src/Yggdrasil/Functionalities.hs View File

@@ -4,10 +4,12 @@ module Yggdrasil.Functionalities (
randomOracle, signature, robustSignature
) where

import Data.Dynamic
import Yggdrasil.Adversarial
import Yggdrasil.ExecutionModel
import Yggdrasil.Distribution
import Data.Dynamic (Typeable)
import Yggdrasil.Adversarial (WithAdversary)
import Yggdrasil.ExecutionModel (
Action, Functionality(Functionality), Ref, Operation, abort, doSample,
interface, interface')
import Yggdrasil.Distribution (Distribution, coin)

crsOp :: Distribution b -> Operation (Maybe b) () b
crsOp _ (Just x, _, ()) = return (Just x, x)

+ 6
- 6
tests/ExecTests.hs View File

@@ -2,12 +2,12 @@

module ExecTests (spec) where

import Crypto.Random
import Data.Maybe
import Test.Hspec
import Test.Hspec.QuickCheck
import Yggdrasil.ExecutionModel
import Yggdrasil.Distribution
import Crypto.Random (getSystemDRG)
import Data.Maybe (fromJust)
import Test.Hspec (Spec, describe, it, shouldBe)
import Test.Hspec.QuickCheck (prop)
import Yggdrasil.ExecutionModel (Action, doSample, external, run, self)
import Yggdrasil.Distribution (uniform, sample')

inSampleRange :: Int -> Bool
inSampleRange x = x > 4700 && x < 5300

+ 5
- 5
tests/FunctTests.hs View File

@@ -2,11 +2,11 @@

module FunctTests (spec) where

import Crypto.Random
import Test.Hspec
import Yggdrasil.ExecutionModel
import Yggdrasil.Distribution
import Yggdrasil.Functionalities
import Crypto.Random (getSystemDRG)
import Test.Hspec (Spec, describe, it, shouldBe)
import Yggdrasil.ExecutionModel (Action, create, run)
import Yggdrasil.Distribution (uniform, sample')
import Yggdrasil.Functionalities (commonRandomString, randomOracle)

crsSameTest :: Action Bool
crsSameTest = do

+ 1
- 1
tests/Spec.hs View File

@@ -1,4 +1,4 @@
import Test.Hspec
import Test.Hspec (hspec)

import qualified ExecTests
import qualified FunctTests

+ 4
- 6
yggdrasil.cabal View File

@@ -1,6 +1,3 @@

name: yggdrasil
version: 0.1.0.0
synopsis: Executable specifications of composable security protocols.
@@ -10,7 +7,6 @@ license: AGPL-3
license-file: LICENSE
author: Thomas Kerber
maintainer: t.kerber@ed.ac.uk
category: Cryptography
build-type: Simple
extra-source-files: ChangeLog.md
@@ -21,15 +17,14 @@ library
Yggdrasil.Distribution
Yggdrasil.ExecutionModel
Yggdrasil.Functionalities
-- other-modules:
other-extensions: GADTs
Rank2Types
ScopedTypeVariables
TupleSections
build-depends: base
, cryptonite
, memory
, transformers
build-depends: base >= 4.11 && < 4.12
, cryptonite >= 0.25 && < 0.26
, memory >= 0.14 && < 0.15
, transformers >= 0.5 && < 0.6
hs-source-dirs: src
default-language: Haskell2010
ghc-options: -Wall -Werror

Loading…
Cancel
Save