rlwe-challenges-0.1.0.1: Ring-LWE/LWR challenges using Lol.

Copyright(c) Eric Crockett 2011-2017
Chris Peikert 2011-2017
LicenseGPL-2
Maintainerecrockett0@email.com
Stabilityexperimental
PortabilityPOSIX
Safe HaskellNone
LanguageHaskell2010

Crypto.RLWE.Challenges.Common

Contents

Description

Utility functions for handling exceptions and creating file paths.

Synopsis

Documentation

type T = CT Source #

Concrete Tensor type used to generate and verify instances.

data ChallengeU Source #

Holds an (untyped) proto-buf Ring-LWE/LWR challenge.

Constructors

CU !Challenge ![InstanceU] 

data InstanceU Source #

Holds an (untyped) proto-buf Ring-LWE/LWR instance.

Constructors

IC 

Fields

ID 

Fields

IR 

Fields

type Zq q = ZqBasic q Int64 Source #

Concrete type used to generate and verify instances

type RRq q = RRq q Double Source #

Concrete type used to generate and verify instances

challengeList :: MonadIO m => FilePath -> m [String] Source #

Yield a list of challenge names by getting all directory contents and filtering on all directories whose names start with "chall".

checkFileExists :: (MonadIO m, MonadError String m) => FilePath -> m () Source #

Do nothing if the file exists, otherwise throw an exception in the monad.

parseBeaconAddr :: MonadError String m => Challenge -> m BeaconAddr Source #

Parse the beacon time/offset used to reveal a challenge from a proto-buf stream.

suppressedSecretID :: InstanceID -> Record -> Int32 -> InstanceID Source #

Yield the ID of the suppressed secret for a challenge, given a beacon record and a byte offset.

Directory Structure

challengeFilesDir :: FilePath -> String -> FilePath Source #

The root directory for challenges and their instances.

challFilePath :: FilePath -> String -> FilePath Source #

The name for a challenge file is some string with a .challenge extension.

instFilePath :: FilePath -> String -> InstanceID -> FilePath Source #

The name for an instance file is some string followed by a hex ID with a .instance extension.

secretFilePath :: FilePath -> String -> InstanceID -> FilePath Source #

The name for a secret file is some string followed by a hex ID with the .secret extension.

beaconFilePath :: FilePath -> BeaconEpoch -> FilePath Source #

The name of a beacon XML file.

certFilePath :: FilePath -> FilePath Source #

The filename for the NIST X509 certificate.

instIDString :: InstanceID -> String Source #

Hex representation of the instance ID.

Functions for easy exceptions.

throwErrorIf :: MonadError String m => Bool -> String -> m () Source #

Throw an error if the condition is True.

throwErrorUnless :: MonadError String m => Bool -> String -> m () Source #

Throw an error if the condition is False.

maybeThrowError :: MonadError String m => Maybe a -> String -> m a Source #

Throw an error if the input is Nothing.

printPassFailGeneric Source #

Arguments

:: MonadIO m 
=> Color

Color to print failure message.

-> String

String to print if computation succeeds.

-> String

String to print if computation fails.

-> ExceptT String m a

Computation to test.

-> m (Maybe a) 

Pretty printing of error messages.

printPassFail :: MonadIO m => String -> String -> ExceptT String m a -> m (Maybe a) Source #

Specialized version of printPassFailGeneric that fails in red.

printPassWarn :: MonadIO m => String -> String -> ExceptT String m a -> m (Maybe a) Source #

Specialized version of printPassFailGeneric that fails in yellow.

printANSI :: MonadIO m => Color -> String -> m () Source #

Print the input string in the specified color.