packages feed

rlwe-challenges 0.0.0.1 → 0.1.0.0

raw patch · 24 files changed

+1818/−1119 lines, 24 filesdep +lol-cppdep ~DRBGdep ~MonadRandomdep ~ansi-terminalPVP ok

version bump matches the API change (PVP)

Dependencies added: lol-cpp

Dependency ranges changed: DRBG, MonadRandom, ansi-terminal, base, bytestring, containers, directory, filepath, http-client, http-conduit, lol, mtl, nist-beacon, options, parsec, protocol-buffers, protocol-buffers-descriptor, reflection, tagged, time, transformers

API changes (from Hackage documentation)

+ Crypto.Proto.RLWE.Challenges.InstanceCont1: InstanceCont1 :: !(Int32) -> !(Int32) -> !(ContParams) -> !(Seq SampleCont1) -> InstanceCont1
+ Crypto.Proto.RLWE.Challenges.InstanceCont1: [challengeID] :: InstanceCont1 -> !(Int32)
+ Crypto.Proto.RLWE.Challenges.InstanceCont1: [instanceID] :: InstanceCont1 -> !(Int32)
+ Crypto.Proto.RLWE.Challenges.InstanceCont1: [params] :: InstanceCont1 -> !(ContParams)
+ Crypto.Proto.RLWE.Challenges.InstanceCont1: [samples] :: InstanceCont1 -> !(Seq SampleCont1)
+ Crypto.Proto.RLWE.Challenges.InstanceCont1: data InstanceCont1
+ Crypto.Proto.RLWE.Challenges.InstanceCont1: instance Data.Data.Data Crypto.Proto.RLWE.Challenges.InstanceCont1.InstanceCont1
+ Crypto.Proto.RLWE.Challenges.InstanceCont1: instance GHC.Classes.Eq Crypto.Proto.RLWE.Challenges.InstanceCont1.InstanceCont1
+ Crypto.Proto.RLWE.Challenges.InstanceCont1: instance GHC.Classes.Ord Crypto.Proto.RLWE.Challenges.InstanceCont1.InstanceCont1
+ Crypto.Proto.RLWE.Challenges.InstanceCont1: instance GHC.Generics.Generic Crypto.Proto.RLWE.Challenges.InstanceCont1.InstanceCont1
+ Crypto.Proto.RLWE.Challenges.InstanceCont1: instance GHC.Show.Show Crypto.Proto.RLWE.Challenges.InstanceCont1.InstanceCont1
+ Crypto.Proto.RLWE.Challenges.InstanceCont1: instance Text.ProtocolBuffers.Basic.Default Crypto.Proto.RLWE.Challenges.InstanceCont1.InstanceCont1
+ Crypto.Proto.RLWE.Challenges.InstanceCont1: instance Text.ProtocolBuffers.Basic.Mergeable Crypto.Proto.RLWE.Challenges.InstanceCont1.InstanceCont1
+ Crypto.Proto.RLWE.Challenges.InstanceCont1: instance Text.ProtocolBuffers.Extensions.GPB Crypto.Proto.RLWE.Challenges.InstanceCont1.InstanceCont1
+ Crypto.Proto.RLWE.Challenges.InstanceCont1: instance Text.ProtocolBuffers.Extensions.MessageAPI msg' (msg' -> Crypto.Proto.RLWE.Challenges.InstanceCont1.InstanceCont1) Crypto.Proto.RLWE.Challenges.InstanceCont1.InstanceCont1
+ Crypto.Proto.RLWE.Challenges.InstanceCont1: instance Text.ProtocolBuffers.Reflections.ReflectDescriptor Crypto.Proto.RLWE.Challenges.InstanceCont1.InstanceCont1
+ Crypto.Proto.RLWE.Challenges.InstanceCont1: instance Text.ProtocolBuffers.TextMessage.TextMsg Crypto.Proto.RLWE.Challenges.InstanceCont1.InstanceCont1
+ Crypto.Proto.RLWE.Challenges.InstanceCont1: instance Text.ProtocolBuffers.TextMessage.TextType Crypto.Proto.RLWE.Challenges.InstanceCont1.InstanceCont1
+ Crypto.Proto.RLWE.Challenges.InstanceCont1: instance Text.ProtocolBuffers.WireMessage.Wire Crypto.Proto.RLWE.Challenges.InstanceCont1.InstanceCont1
+ Crypto.Proto.RLWE.Challenges.InstanceDisc1: InstanceDisc1 :: !(Int32) -> !(Int32) -> !(DiscParams) -> !(Seq SampleDisc1) -> InstanceDisc1
+ Crypto.Proto.RLWE.Challenges.InstanceDisc1: [challengeID] :: InstanceDisc1 -> !(Int32)
+ Crypto.Proto.RLWE.Challenges.InstanceDisc1: [instanceID] :: InstanceDisc1 -> !(Int32)
+ Crypto.Proto.RLWE.Challenges.InstanceDisc1: [params] :: InstanceDisc1 -> !(DiscParams)
+ Crypto.Proto.RLWE.Challenges.InstanceDisc1: [samples] :: InstanceDisc1 -> !(Seq SampleDisc1)
+ Crypto.Proto.RLWE.Challenges.InstanceDisc1: data InstanceDisc1
+ Crypto.Proto.RLWE.Challenges.InstanceDisc1: instance Data.Data.Data Crypto.Proto.RLWE.Challenges.InstanceDisc1.InstanceDisc1
+ Crypto.Proto.RLWE.Challenges.InstanceDisc1: instance GHC.Classes.Eq Crypto.Proto.RLWE.Challenges.InstanceDisc1.InstanceDisc1
+ Crypto.Proto.RLWE.Challenges.InstanceDisc1: instance GHC.Classes.Ord Crypto.Proto.RLWE.Challenges.InstanceDisc1.InstanceDisc1
+ Crypto.Proto.RLWE.Challenges.InstanceDisc1: instance GHC.Generics.Generic Crypto.Proto.RLWE.Challenges.InstanceDisc1.InstanceDisc1
+ Crypto.Proto.RLWE.Challenges.InstanceDisc1: instance GHC.Show.Show Crypto.Proto.RLWE.Challenges.InstanceDisc1.InstanceDisc1
+ Crypto.Proto.RLWE.Challenges.InstanceDisc1: instance Text.ProtocolBuffers.Basic.Default Crypto.Proto.RLWE.Challenges.InstanceDisc1.InstanceDisc1
+ Crypto.Proto.RLWE.Challenges.InstanceDisc1: instance Text.ProtocolBuffers.Basic.Mergeable Crypto.Proto.RLWE.Challenges.InstanceDisc1.InstanceDisc1
+ Crypto.Proto.RLWE.Challenges.InstanceDisc1: instance Text.ProtocolBuffers.Extensions.GPB Crypto.Proto.RLWE.Challenges.InstanceDisc1.InstanceDisc1
+ Crypto.Proto.RLWE.Challenges.InstanceDisc1: instance Text.ProtocolBuffers.Extensions.MessageAPI msg' (msg' -> Crypto.Proto.RLWE.Challenges.InstanceDisc1.InstanceDisc1) Crypto.Proto.RLWE.Challenges.InstanceDisc1.InstanceDisc1
+ Crypto.Proto.RLWE.Challenges.InstanceDisc1: instance Text.ProtocolBuffers.Reflections.ReflectDescriptor Crypto.Proto.RLWE.Challenges.InstanceDisc1.InstanceDisc1
+ Crypto.Proto.RLWE.Challenges.InstanceDisc1: instance Text.ProtocolBuffers.TextMessage.TextMsg Crypto.Proto.RLWE.Challenges.InstanceDisc1.InstanceDisc1
+ Crypto.Proto.RLWE.Challenges.InstanceDisc1: instance Text.ProtocolBuffers.TextMessage.TextType Crypto.Proto.RLWE.Challenges.InstanceDisc1.InstanceDisc1
+ Crypto.Proto.RLWE.Challenges.InstanceDisc1: instance Text.ProtocolBuffers.WireMessage.Wire Crypto.Proto.RLWE.Challenges.InstanceDisc1.InstanceDisc1
+ Crypto.Proto.RLWE.Challenges.InstanceRLWR1: InstanceRLWR1 :: !(Int32) -> !(Int32) -> !(RLWRParams) -> !(Seq SampleRLWR1) -> InstanceRLWR1
+ Crypto.Proto.RLWE.Challenges.InstanceRLWR1: [challengeID] :: InstanceRLWR1 -> !(Int32)
+ Crypto.Proto.RLWE.Challenges.InstanceRLWR1: [instanceID] :: InstanceRLWR1 -> !(Int32)
+ Crypto.Proto.RLWE.Challenges.InstanceRLWR1: [params] :: InstanceRLWR1 -> !(RLWRParams)
+ Crypto.Proto.RLWE.Challenges.InstanceRLWR1: [samples] :: InstanceRLWR1 -> !(Seq SampleRLWR1)
+ Crypto.Proto.RLWE.Challenges.InstanceRLWR1: data InstanceRLWR1
+ Crypto.Proto.RLWE.Challenges.InstanceRLWR1: instance Data.Data.Data Crypto.Proto.RLWE.Challenges.InstanceRLWR1.InstanceRLWR1
+ Crypto.Proto.RLWE.Challenges.InstanceRLWR1: instance GHC.Classes.Eq Crypto.Proto.RLWE.Challenges.InstanceRLWR1.InstanceRLWR1
+ Crypto.Proto.RLWE.Challenges.InstanceRLWR1: instance GHC.Classes.Ord Crypto.Proto.RLWE.Challenges.InstanceRLWR1.InstanceRLWR1
+ Crypto.Proto.RLWE.Challenges.InstanceRLWR1: instance GHC.Generics.Generic Crypto.Proto.RLWE.Challenges.InstanceRLWR1.InstanceRLWR1
+ Crypto.Proto.RLWE.Challenges.InstanceRLWR1: instance GHC.Show.Show Crypto.Proto.RLWE.Challenges.InstanceRLWR1.InstanceRLWR1
+ Crypto.Proto.RLWE.Challenges.InstanceRLWR1: instance Text.ProtocolBuffers.Basic.Default Crypto.Proto.RLWE.Challenges.InstanceRLWR1.InstanceRLWR1
+ Crypto.Proto.RLWE.Challenges.InstanceRLWR1: instance Text.ProtocolBuffers.Basic.Mergeable Crypto.Proto.RLWE.Challenges.InstanceRLWR1.InstanceRLWR1
+ Crypto.Proto.RLWE.Challenges.InstanceRLWR1: instance Text.ProtocolBuffers.Extensions.GPB Crypto.Proto.RLWE.Challenges.InstanceRLWR1.InstanceRLWR1
+ Crypto.Proto.RLWE.Challenges.InstanceRLWR1: instance Text.ProtocolBuffers.Extensions.MessageAPI msg' (msg' -> Crypto.Proto.RLWE.Challenges.InstanceRLWR1.InstanceRLWR1) Crypto.Proto.RLWE.Challenges.InstanceRLWR1.InstanceRLWR1
+ Crypto.Proto.RLWE.Challenges.InstanceRLWR1: instance Text.ProtocolBuffers.Reflections.ReflectDescriptor Crypto.Proto.RLWE.Challenges.InstanceRLWR1.InstanceRLWR1
+ Crypto.Proto.RLWE.Challenges.InstanceRLWR1: instance Text.ProtocolBuffers.TextMessage.TextMsg Crypto.Proto.RLWE.Challenges.InstanceRLWR1.InstanceRLWR1
+ Crypto.Proto.RLWE.Challenges.InstanceRLWR1: instance Text.ProtocolBuffers.TextMessage.TextType Crypto.Proto.RLWE.Challenges.InstanceRLWR1.InstanceRLWR1
+ Crypto.Proto.RLWE.Challenges.InstanceRLWR1: instance Text.ProtocolBuffers.WireMessage.Wire Crypto.Proto.RLWE.Challenges.InstanceRLWR1.InstanceRLWR1
+ Crypto.Proto.RLWE.Challenges.Secret1: Secret1 :: !(Int32) -> !(Int32) -> !(Int32) -> !(Int64) -> !(ByteString) -> !(Rq1) -> Secret1
+ Crypto.Proto.RLWE.Challenges.Secret1: [challengeID] :: Secret1 -> !(Int32)
+ Crypto.Proto.RLWE.Challenges.Secret1: [instanceID] :: Secret1 -> !(Int32)
+ Crypto.Proto.RLWE.Challenges.Secret1: [m] :: Secret1 -> !(Int32)
+ Crypto.Proto.RLWE.Challenges.Secret1: [q] :: Secret1 -> !(Int64)
+ Crypto.Proto.RLWE.Challenges.Secret1: [s] :: Secret1 -> !(Rq1)
+ Crypto.Proto.RLWE.Challenges.Secret1: [seed] :: Secret1 -> !(ByteString)
+ Crypto.Proto.RLWE.Challenges.Secret1: data Secret1
+ Crypto.Proto.RLWE.Challenges.Secret1: instance Data.Data.Data Crypto.Proto.RLWE.Challenges.Secret1.Secret1
+ Crypto.Proto.RLWE.Challenges.Secret1: instance GHC.Classes.Eq Crypto.Proto.RLWE.Challenges.Secret1.Secret1
+ Crypto.Proto.RLWE.Challenges.Secret1: instance GHC.Classes.Ord Crypto.Proto.RLWE.Challenges.Secret1.Secret1
+ Crypto.Proto.RLWE.Challenges.Secret1: instance GHC.Generics.Generic Crypto.Proto.RLWE.Challenges.Secret1.Secret1
+ Crypto.Proto.RLWE.Challenges.Secret1: instance GHC.Show.Show Crypto.Proto.RLWE.Challenges.Secret1.Secret1
+ Crypto.Proto.RLWE.Challenges.Secret1: instance Text.ProtocolBuffers.Basic.Default Crypto.Proto.RLWE.Challenges.Secret1.Secret1
+ Crypto.Proto.RLWE.Challenges.Secret1: instance Text.ProtocolBuffers.Basic.Mergeable Crypto.Proto.RLWE.Challenges.Secret1.Secret1
+ Crypto.Proto.RLWE.Challenges.Secret1: instance Text.ProtocolBuffers.Extensions.GPB Crypto.Proto.RLWE.Challenges.Secret1.Secret1
+ Crypto.Proto.RLWE.Challenges.Secret1: instance Text.ProtocolBuffers.Extensions.MessageAPI msg' (msg' -> Crypto.Proto.RLWE.Challenges.Secret1.Secret1) Crypto.Proto.RLWE.Challenges.Secret1.Secret1
+ Crypto.Proto.RLWE.Challenges.Secret1: instance Text.ProtocolBuffers.Reflections.ReflectDescriptor Crypto.Proto.RLWE.Challenges.Secret1.Secret1
+ Crypto.Proto.RLWE.Challenges.Secret1: instance Text.ProtocolBuffers.TextMessage.TextMsg Crypto.Proto.RLWE.Challenges.Secret1.Secret1
+ Crypto.Proto.RLWE.Challenges.Secret1: instance Text.ProtocolBuffers.TextMessage.TextType Crypto.Proto.RLWE.Challenges.Secret1.Secret1
+ Crypto.Proto.RLWE.Challenges.Secret1: instance Text.ProtocolBuffers.WireMessage.Wire Crypto.Proto.RLWE.Challenges.Secret1.Secret1
+ Crypto.RLWE.Challenges.Beacon: BA :: !BeaconEpoch -> !BeaconOffset -> BeaconAddr
+ Crypto.RLWE.Challenges.Beacon: beaconFloor :: BeaconEpoch -> BeaconEpoch
+ Crypto.RLWE.Challenges.Beacon: beaconInterval :: BeaconEpoch
+ Crypto.RLWE.Challenges.Beacon: bytesPerBeacon :: BeaconOffset
+ Crypto.RLWE.Challenges.Beacon: data BeaconAddr
+ Crypto.RLWE.Challenges.Beacon: gmtDateToSeconds :: Int -> Int -> Integer -> Int -> Int -> Int
+ Crypto.RLWE.Challenges.Beacon: instance GHC.Classes.Eq Crypto.RLWE.Challenges.Beacon.BeaconAddr
+ Crypto.RLWE.Challenges.Beacon: instance GHC.Show.Show Crypto.RLWE.Challenges.Beacon.BeaconAddr
+ Crypto.RLWE.Challenges.Beacon: localDateToSeconds :: Int -> Int -> Integer -> Int -> Int -> IO BeaconEpoch
+ Crypto.RLWE.Challenges.Beacon: nextBeaconAddr :: BeaconAddr -> BeaconAddr
+ Crypto.RLWE.Challenges.Beacon: type BeaconEpoch = Int64
+ Crypto.RLWE.Challenges.Beacon: type BeaconOffset = Int32
+ Crypto.RLWE.Challenges.Beacon: validBeaconAddr :: BeaconAddr -> Bool
+ Crypto.RLWE.Challenges.Common: CU :: !Challenge -> ![InstanceU] -> ChallengeU
+ Crypto.RLWE.Challenges.Common: IC :: !Secret -> !InstanceCont -> InstanceU
+ Crypto.RLWE.Challenges.Common: ID :: !Secret -> !InstanceDisc -> InstanceU
+ Crypto.RLWE.Challenges.Common: IR :: !Secret -> !InstanceRLWR -> InstanceU
+ Crypto.RLWE.Challenges.Common: [instc] :: InstanceU -> !InstanceCont
+ Crypto.RLWE.Challenges.Common: [instd] :: InstanceU -> !InstanceDisc
+ Crypto.RLWE.Challenges.Common: [instr] :: InstanceU -> !InstanceRLWR
+ Crypto.RLWE.Challenges.Common: [secret] :: InstanceU -> !Secret
+ Crypto.RLWE.Challenges.Common: beaconFilePath :: FilePath -> BeaconEpoch -> FilePath
+ Crypto.RLWE.Challenges.Common: certFilePath :: FilePath -> FilePath
+ Crypto.RLWE.Challenges.Common: challFilePath :: FilePath -> String -> FilePath
+ Crypto.RLWE.Challenges.Common: challengeFilesDir :: FilePath -> String -> FilePath
+ Crypto.RLWE.Challenges.Common: challengeList :: (MonadIO m) => FilePath -> m [String]
+ Crypto.RLWE.Challenges.Common: checkFileExists :: (MonadIO m, MonadError String m) => FilePath -> m ()
+ Crypto.RLWE.Challenges.Common: data ChallengeU
+ Crypto.RLWE.Challenges.Common: data InstanceU
+ Crypto.RLWE.Challenges.Common: instFilePath :: FilePath -> String -> InstanceID -> FilePath
+ Crypto.RLWE.Challenges.Common: instIDString :: InstanceID -> String
+ Crypto.RLWE.Challenges.Common: maybeThrowError :: (MonadError String m) => Maybe a -> String -> m a
+ Crypto.RLWE.Challenges.Common: parseBeaconAddr :: (MonadError String m) => Challenge -> m BeaconAddr
+ Crypto.RLWE.Challenges.Common: printANSI :: (MonadIO m) => Color -> String -> m ()
+ Crypto.RLWE.Challenges.Common: printPassFail :: (MonadIO m) => String -> String -> ExceptT String m a -> m (Maybe a)
+ Crypto.RLWE.Challenges.Common: printPassFailGeneric :: (MonadIO m) => Color -> String -> String -> ExceptT String m a -> m (Maybe a)
+ Crypto.RLWE.Challenges.Common: printPassWarn :: (MonadIO m) => String -> String -> ExceptT String m a -> m (Maybe a)
+ Crypto.RLWE.Challenges.Common: secretFilePath :: FilePath -> String -> InstanceID -> FilePath
+ Crypto.RLWE.Challenges.Common: suppressedSecretID :: InstanceID -> Record -> Int32 -> InstanceID
+ Crypto.RLWE.Challenges.Common: throwErrorIf :: (MonadError String m) => Bool -> String -> m ()
+ Crypto.RLWE.Challenges.Common: throwErrorUnless :: (MonadError String m) => Bool -> String -> m ()
+ Crypto.RLWE.Challenges.Common: type ChallengeID = Int32
+ Crypto.RLWE.Challenges.Common: type InstDRBG = GenBuffered CtrDRBG
+ Crypto.RLWE.Challenges.Common: type InstanceID = Int32
+ Crypto.RLWE.Challenges.Common: type RRq q = RRq q Double
+ Crypto.RLWE.Challenges.Common: type T = CT
+ Crypto.RLWE.Challenges.Common: type Zq q = ZqBasic q Int64
+ Crypto.RLWE.Challenges.Generate: genChallengeU :: (MonadRandom m) => ChallengeParams -> BeaconAddr -> m ChallengeU
+ Crypto.RLWE.Challenges.Generate: generateMain :: FilePath -> BeaconAddr -> [ChallengeParams] -> IO ()
+ Crypto.RLWE.Challenges.Generate: instanceCont :: (RLWECtx t m zq rrq, Random zq, Random (LiftOf rrq), OrdFloat (LiftOf rrq), MonadRandom rnd, ToRational v) => v -> Int -> rnd (Cyc t m zq, [Sample t m zq rrq])
+ Crypto.RLWE.Challenges.Generate: instanceDisc :: (RLWECtx t m zq, Random zq, MonadRandom rnd, ToRational v) => v -> Int -> rnd (Cyc t m zq, [Sample t m zq])
+ Crypto.RLWE.Challenges.Generate: instanceRLWR :: (RLWRCtx t m zq zp, Random zq, MonadRandom rnd) => Int -> rnd (Cyc t m zq, [Sample t m zq zp])
+ Crypto.RLWE.Challenges.Generate: writeChallengeU :: FilePath -> String -> ChallengeU -> IO ()
+ Crypto.RLWE.Challenges.Params: C :: ChallengeID -> Int32 -> Int64 -> Double -> Int32 -> InstanceID -> Double -> String -> ChallengeParams
+ Crypto.RLWE.Challenges.Params: D :: ChallengeID -> Int32 -> Int64 -> Double -> Int32 -> InstanceID -> Double -> String -> ChallengeParams
+ Crypto.RLWE.Challenges.Params: R :: ChallengeID -> Int32 -> Int64 -> Int64 -> Int32 -> InstanceID -> String -> ChallengeParams
+ Crypto.RLWE.Challenges.Params: [annotation] :: ChallengeParams -> String
+ Crypto.RLWE.Challenges.Params: [challID] :: ChallengeParams -> ChallengeID
+ Crypto.RLWE.Challenges.Params: [eps] :: ChallengeParams -> Double
+ Crypto.RLWE.Challenges.Params: [m] :: ChallengeParams -> Int32
+ Crypto.RLWE.Challenges.Params: [numInstances] :: ChallengeParams -> InstanceID
+ Crypto.RLWE.Challenges.Params: [numSamples] :: ChallengeParams -> Int32
+ Crypto.RLWE.Challenges.Params: [p] :: ChallengeParams -> Int64
+ Crypto.RLWE.Challenges.Params: [q] :: ChallengeParams -> Int64
+ Crypto.RLWE.Challenges.Params: [svar] :: ChallengeParams -> Double
+ Crypto.RLWE.Challenges.Params: data ChallengeParams
+ Crypto.RLWE.Challenges.Params: epsDef :: Double
+ Crypto.RLWE.Challenges.Params: instance GHC.Show.Show Crypto.RLWE.Challenges.Params.ChallengeParams
+ Crypto.RLWE.Challenges.Params: parseChallParams :: String -> InstanceID -> [ChallengeParams]
+ Crypto.RLWE.Challenges.Suppress: getNistCert :: (MonadIO m) => FilePath -> m ()
+ Crypto.RLWE.Challenges.Suppress: suppressChallenge :: (MonadIO m, MonadState RecordState m) => FilePath -> String -> m ()
+ Crypto.RLWE.Challenges.Suppress: suppressMain :: FilePath -> IO ()
+ Crypto.RLWE.Challenges.Suppress: writeBeaconXML :: (MonadIO m) => FilePath -> Record -> m ()
+ Crypto.RLWE.Challenges.Verify: beaconAvailable :: (MonadIO m) => FilePath -> BeaconEpoch -> m Bool
+ Crypto.RLWE.Challenges.Verify: readBeacon :: (MonadIO m, MonadError String m) => FilePath -> BeaconEpoch -> m Record
+ Crypto.RLWE.Challenges.Verify: readChallenge :: (MonadIO m, MonadError String m) => FilePath -> String -> m (BeaconAddr, [InstanceU])
+ Crypto.RLWE.Challenges.Verify: regenChallenge :: (MonadIO m) => FilePath -> String -> m (Maybe ())
+ Crypto.RLWE.Challenges.Verify: verifyInstanceU :: (MonadError String m) => InstanceU -> m ()
+ Crypto.RLWE.Challenges.Verify: verifyMain :: FilePath -> IO ()
- Crypto.Proto.RLWE.Challenges.Secret: Secret :: !(Int32) -> !(Int32) -> !(Int32) -> !(Int64) -> !(ByteString) -> !(Rq) -> Secret
+ Crypto.Proto.RLWE.Challenges.Secret: Secret :: !(Int32) -> !(Int32) -> !(Int32) -> !(Int64) -> !(ByteString) -> !(RqProduct) -> Secret
- Crypto.Proto.RLWE.Challenges.Secret: [s] :: Secret -> !(Rq)
+ Crypto.Proto.RLWE.Challenges.Secret: [s] :: Secret -> !(RqProduct)

Files

CHANGES.md view
@@ -1,6 +1,13 @@ Changelog for rlwe-challenges project ================================ +0.1.0.0+----+ * Support for creating/reading challenges over a base product-ring.+ * Backward compatible with existing challenges.+ * Executable files are now part of a library so that it is easier to reuse+   code to create/verify/attack challenges.+ 0.0.0.1 ----  * Initial release.
+ Challenges.proto view
@@ -0,0 +1,104 @@+// proto messages for RLWE/RLWR challenges. NOTE: the challenges released in+// 2016 use the Instance*1 and Secret1 formats.++import "Lol.proto";+import "RLWE.proto";++// run this:++// hprotoc -I ../lol -a RLWE.proto=Crypto.Proto -a Lol.proto=Crypto.Proto -p Crypto.Proto.RLWE Challenges.proto++message ContParams {                      // continuous RLWE parameters+  required int32 m                 = 1;   // cyclotomic index+  required int64 q                 = 2;   // modulus+  required double svar             = 3;   // scaled variance+  required double bound            = 4;   // gSqNorm error bound+  required int32 numSamples        = 5;   // number of samples+}++message DiscParams {                      // discrete RLWE parameters+  required int32 m                 = 1;   // cyclotomic index+  required int64 q                 = 2;   // modulus+  required double svar             = 3;   // scaled variance+  required int64 bound             = 4;   // gSqNorm error bound+  required int32 numSamples        = 5;   // number of samples+}++message RLWRParams {                      // RLWR parameters+  required int32 m                 = 1;   // cyclotomic index+  required int64 q                 = 2;   // modulus+  required int64 p                 = 3;   // rounding modulus p < q+  required int32 numSamples        = 4;   // number of samples+}++message Challenge {+  required int32 challengeID       = 1;  // unique identifier of challenge+  required int32 numInstances      = 2;  // number of instances in challenge+  required int64 beaconEpoch       = 3;  // beacon epoch for suppressing secret+  required int32 beaconOffset      = 4;  // byte of beacon value used+  oneof params {+    ContParams cparams             = 5;+    DiscParams dparams             = 6;+    RLWRParams rparams             = 7;+  }+}++message InstanceCont1 {                  // continuous RLWE instance+  required int32 challengeID       = 1;  // challenge this instance belongs to+  required int32 instanceID        = 2;  // instance within the challenge+  required ContParams params       = 3;  // problem params (self-containment)+  repeated SampleCont1 samples     = 4;  // the samples+}++message InstanceDisc1 {                  // discrete RLWE instance+  required int32 challengeID       = 1;+  required int32 instanceID        = 2;+  required DiscParams params       = 3;+  repeated SampleDisc1 samples     = 4;+}++message InstanceRLWR1 {                  // RLWR instance+  required int32 challengeID       = 1;+  required int32 instanceID        = 2;+  required RLWRParams params       = 3;+  repeated SampleRLWR1 samples     = 4;+}++message InstanceCont {                   // continuous RLWE instance+  required int32 challengeID       = 1;  // challenge this instance belongs to+  required int32 instanceID        = 2;  // instance within the challenge+  required ContParams params       = 3;  // problem params (self-containment)+  repeated SampleCont samples      = 4;  // the samples+}++message InstanceDisc {                   // discrete RLWE instance+  required int32 challengeID       = 1;+  required int32 instanceID        = 2;+  required DiscParams params       = 3;+  repeated SampleDisc samples      = 4;+}++message InstanceRLWR {                   // RLWR instance+  required int32 challengeID       = 1;+  required int32 instanceID        = 2;+  required RLWRParams params       = 3;+  repeated SampleRLWR samples      = 4;+}++message Secret1 {                        // a secret for an RLWE/RLWE instance+  required int32 challengeID       = 1;+  required int32 instanceID        = 2;+  required int32 m                 = 3;+  required int64 q                 = 4;+  required bytes seed              = 5;+  required Rq1 s                   = 6;+}++message Secret {                          // a secret for an RLWE/RLWE instance+  required int32 challengeID       = 1;+  required int32 instanceID        = 2;+  required int32 m                 = 3;+  required int64 q                 = 4;+  required bytes seed              = 5;+  required RqProduct s             = 6;+}
Crypto/Proto/RLWE/Challenges.hs view
@@ -14,10 +14,10 @@ protoInfo :: ProtoInfo protoInfo  = Prelude'.read-    "ProtoInfo {protoMod = ProtoName {protobufName = FIName \".Challenges\", haskellPrefix = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule = [], baseName = MName \"Challenges\"}, protoFilePath = [\"Crypto\",\"Proto\",\"RLWE\",\"Challenges.hs\"], protoSource = \"Challenges.proto\", extensionKeys = fromList [], messages = [DescriptorInfo {descName = ProtoName {protobufName = FIName \".Challenges.ContParams\", haskellPrefix = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule = [MName \"Challenges\"], baseName = MName \"ContParams\"}, descFilePath = [\"Crypto\",\"Proto\",\"RLWE\",\"Challenges\",\"ContParams.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.ContParams.m\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"ContParams\"], baseName' = FName \"m\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 1}, wireTag = WireTag {getWireTag = 8}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 5}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.ContParams.q\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"ContParams\"], baseName' = FName \"q\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 2}, wireTag = WireTag {getWireTag = 16}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 3}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.ContParams.svar\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"ContParams\"], baseName' = FName \"svar\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 3}, wireTag = WireTag {getWireTag = 25}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 1}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.ContParams.bound\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"ContParams\"], baseName' = FName \"bound\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 4}, wireTag = WireTag {getWireTag = 33}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 1}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.ContParams.numSamples\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"ContParams\"], baseName' = FName \"numSamples\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 5}, wireTag = WireTag {getWireTag = 40}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 5}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False},DescriptorInfo {descName = ProtoName {protobufName = FIName \".Challenges.DiscParams\", haskellPrefix = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule = [MName \"Challenges\"], baseName = MName \"DiscParams\"}, descFilePath = [\"Crypto\",\"Proto\",\"RLWE\",\"Challenges\",\"DiscParams.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.DiscParams.m\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"DiscParams\"], baseName' = FName \"m\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 1}, wireTag = WireTag {getWireTag = 8}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 5}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.DiscParams.q\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"DiscParams\"], baseName' = FName \"q\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 2}, wireTag = WireTag {getWireTag = 16}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 3}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.DiscParams.svar\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"DiscParams\"], baseName' = FName \"svar\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 3}, wireTag = WireTag {getWireTag = 25}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 1}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.DiscParams.bound\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"DiscParams\"], baseName' = FName \"bound\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 4}, wireTag = WireTag {getWireTag = 32}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 3}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.DiscParams.numSamples\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"DiscParams\"], baseName' = FName \"numSamples\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 5}, wireTag = WireTag {getWireTag = 40}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 5}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False},DescriptorInfo {descName = ProtoName {protobufName = FIName \".Challenges.RLWRParams\", haskellPrefix = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule = [MName \"Challenges\"], baseName = MName \"RLWRParams\"}, descFilePath = [\"Crypto\",\"Proto\",\"RLWE\",\"Challenges\",\"RLWRParams.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.RLWRParams.m\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"RLWRParams\"], baseName' = FName \"m\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 1}, wireTag = WireTag {getWireTag = 8}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 5}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.RLWRParams.q\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"RLWRParams\"], baseName' = FName \"q\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 2}, wireTag = WireTag {getWireTag = 16}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 3}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.RLWRParams.p\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"RLWRParams\"], baseName' = FName \"p\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 3}, wireTag = WireTag {getWireTag = 24}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 3}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.RLWRParams.numSamples\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"RLWRParams\"], baseName' = FName \"numSamples\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 4}, wireTag = WireTag {getWireTag = 32}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 5}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False},DescriptorInfo {descName = ProtoName {protobufName = FIName \".Challenges.Challenge\", haskellPrefix = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule = [MName \"Challenges\"], baseName = MName \"Challenge\"}, descFilePath = [\"Crypto\",\"Proto\",\"RLWE\",\"Challenges\",\"Challenge.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.Challenge.challengeID\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"Challenge\"], baseName' = FName \"challengeID\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 1}, wireTag = WireTag {getWireTag = 8}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 5}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.Challenge.numInstances\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"Challenge\"], baseName' = FName \"numInstances\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 2}, wireTag = WireTag {getWireTag = 16}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 5}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.Challenge.beaconEpoch\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"Challenge\"], baseName' = FName \"beaconEpoch\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 3}, wireTag = WireTag {getWireTag = 24}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 3}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.Challenge.beaconOffset\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"Challenge\"], baseName' = FName \"beaconOffset\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 4}, wireTag = WireTag {getWireTag = 32}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 5}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing}], descOneofs = fromList [OneofInfo {oneofName = ProtoName {protobufName = FIName \".Challenges.Challenge.params\", haskellPrefix = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule = [MName \"Challenges\",MName \"Challenge\"], baseName = MName \"Params\"}, oneofFName = ProtoFName {protobufName' = FIName \".Challenges.Challenge.params\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"Challenge\"], baseName' = FName \"params\", baseNamePrefix' = \"\"}, oneofFilePath = [\"Crypto\",\"Proto\",\"RLWE\",\"Challenges\",\"Challenge\",\"Params.hs\"], oneofFields = fromList [(ProtoName {protobufName = FIName \".Challenges.Challenge.params.cparams\", haskellPrefix = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule = [MName \"Challenges\",MName \"Challenge\",MName \"Params\"], baseName = MName \"Cparams\"},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.Challenge.params.cparams\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"Challenge\",MName \"Params\"], baseName' = FName \"cparams\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 5}, wireTag = WireTag {getWireTag = 42}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".Challenges.ContParams\", haskellPrefix = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule = [MName \"Challenges\"], baseName = MName \"ContParams\"}), hsRawDefault = Nothing, hsDefault = Nothing}),(ProtoName {protobufName = FIName \".Challenges.Challenge.params.dparams\", haskellPrefix = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule = [MName \"Challenges\",MName \"Challenge\",MName \"Params\"], baseName = MName \"Dparams\"},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.Challenge.params.dparams\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"Challenge\",MName \"Params\"], baseName' = FName \"dparams\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 6}, wireTag = WireTag {getWireTag = 50}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".Challenges.DiscParams\", haskellPrefix = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule = [MName \"Challenges\"], baseName = MName \"DiscParams\"}), hsRawDefault = Nothing, hsDefault = Nothing}),(ProtoName {protobufName = FIName \".Challenges.Challenge.params.rparams\", haskellPrefix = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule = [MName \"Challenges\",MName \"Challenge\",MName \"Params\"], baseName = MName \"Rparams\"},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.Challenge.params.rparams\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"Challenge\",MName \"Params\"], baseName' = FName \"rparams\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 7}, wireTag = WireTag {getWireTag = 58}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".Challenges.RLWRParams\", haskellPrefix = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule = [MName \"Challenges\"], baseName = MName \"RLWRParams\"}), hsRawDefault = Nothing, hsDefault = Nothing})], oneofMakeLenses = False}], keys = fromList [], extRanges = [], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False},DescriptorInfo {descName = ProtoName {protobufName = FIName \".Challenges.InstanceCont\", haskellPrefix = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule = [MName \"Challenges\"], baseName = MName \"InstanceCont\"}, descFilePath = [\"Crypto\",\"Proto\",\"RLWE\",\"Challenges\",\"InstanceCont.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.InstanceCont.challengeID\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"InstanceCont\"], baseName' = FName \"challengeID\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 1}, wireTag = WireTag {getWireTag = 8}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 5}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.InstanceCont.instanceID\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"InstanceCont\"], baseName' = FName \"instanceID\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 2}, wireTag = WireTag {getWireTag = 16}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 5}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.InstanceCont.params\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"InstanceCont\"], baseName' = FName \"params\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 3}, wireTag = WireTag {getWireTag = 26}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".Challenges.ContParams\", haskellPrefix = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule = [MName \"Challenges\"], baseName = MName \"ContParams\"}), hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.InstanceCont.samples\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"InstanceCont\"], baseName' = FName \"samples\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 4}, wireTag = WireTag {getWireTag = 34}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = True, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".RLWE.SampleCont\", haskellPrefix = [MName \"Crypto\",MName \"Proto\"], parentModule = [MName \"RLWE\"], baseName = MName \"SampleCont\"}), hsRawDefault = Nothing, hsDefault = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False},DescriptorInfo {descName = ProtoName {protobufName = FIName \".Challenges.InstanceDisc\", haskellPrefix = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule = [MName \"Challenges\"], baseName = MName \"InstanceDisc\"}, descFilePath = [\"Crypto\",\"Proto\",\"RLWE\",\"Challenges\",\"InstanceDisc.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.InstanceDisc.challengeID\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"InstanceDisc\"], baseName' = FName \"challengeID\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 1}, wireTag = WireTag {getWireTag = 8}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 5}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.InstanceDisc.instanceID\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"InstanceDisc\"], baseName' = FName \"instanceID\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 2}, wireTag = WireTag {getWireTag = 16}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 5}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.InstanceDisc.params\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"InstanceDisc\"], baseName' = FName \"params\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 3}, wireTag = WireTag {getWireTag = 26}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".Challenges.DiscParams\", haskellPrefix = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule = [MName \"Challenges\"], baseName = MName \"DiscParams\"}), hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.InstanceDisc.samples\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"InstanceDisc\"], baseName' = FName \"samples\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 4}, wireTag = WireTag {getWireTag = 34}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = True, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".RLWE.SampleDisc\", haskellPrefix = [MName \"Crypto\",MName \"Proto\"], parentModule = [MName \"RLWE\"], baseName = MName \"SampleDisc\"}), hsRawDefault = Nothing, hsDefault = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False},DescriptorInfo {descName = ProtoName {protobufName = FIName \".Challenges.InstanceRLWR\", haskellPrefix = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule = [MName \"Challenges\"], baseName = MName \"InstanceRLWR\"}, descFilePath = [\"Crypto\",\"Proto\",\"RLWE\",\"Challenges\",\"InstanceRLWR.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.InstanceRLWR.challengeID\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"InstanceRLWR\"], baseName' = FName \"challengeID\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 1}, wireTag = WireTag {getWireTag = 8}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 5}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.InstanceRLWR.instanceID\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"InstanceRLWR\"], baseName' = FName \"instanceID\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 2}, wireTag = WireTag {getWireTag = 16}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 5}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.InstanceRLWR.params\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"InstanceRLWR\"], baseName' = FName \"params\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 3}, wireTag = WireTag {getWireTag = 26}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".Challenges.RLWRParams\", haskellPrefix = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule = [MName \"Challenges\"], baseName = MName \"RLWRParams\"}), hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.InstanceRLWR.samples\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"InstanceRLWR\"], baseName' = FName \"samples\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 4}, wireTag = WireTag {getWireTag = 34}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = True, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".RLWE.SampleRLWR\", haskellPrefix = [MName \"Crypto\",MName \"Proto\"], parentModule = [MName \"RLWE\"], baseName = MName \"SampleRLWR\"}), hsRawDefault = Nothing, hsDefault = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False},DescriptorInfo {descName = ProtoName {protobufName = FIName \".Challenges.Secret\", haskellPrefix = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule = [MName \"Challenges\"], baseName = MName \"Secret\"}, descFilePath = [\"Crypto\",\"Proto\",\"RLWE\",\"Challenges\",\"Secret.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.Secret.challengeID\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"Secret\"], baseName' = FName \"challengeID\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 1}, wireTag = WireTag {getWireTag = 8}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 5}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.Secret.instanceID\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"Secret\"], baseName' = FName \"instanceID\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 2}, wireTag = WireTag {getWireTag = 16}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 5}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.Secret.m\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"Secret\"], baseName' = FName \"m\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 3}, wireTag = WireTag {getWireTag = 24}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 5}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.Secret.q\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"Secret\"], baseName' = FName \"q\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 4}, wireTag = WireTag {getWireTag = 32}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 3}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.Secret.seed\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"Secret\"], baseName' = FName \"seed\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 5}, wireTag = WireTag {getWireTag = 42}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 12}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.Secret.s\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"Secret\"], baseName' = FName \"s\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 6}, wireTag = WireTag {getWireTag = 50}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".RLWE.Rq\", haskellPrefix = [MName \"Crypto\",MName \"Proto\"], parentModule = [MName \"RLWE\"], baseName = MName \"Rq\"}), hsRawDefault = Nothing, hsDefault = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False}], enums = [], oneofs = [OneofInfo {oneofName = ProtoName {protobufName = FIName \".Challenges.Challenge.params\", haskellPrefix = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule = [MName \"Challenges\",MName \"Challenge\"], baseName = MName \"Params\"}, oneofFName = ProtoFName {protobufName' = FIName \".Challenges.Challenge.params\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"Challenge\"], baseName' = FName \"params\", baseNamePrefix' = \"\"}, oneofFilePath = [\"Crypto\",\"Proto\",\"RLWE\",\"Challenges\",\"Challenge\",\"Params.hs\"], oneofFields = fromList [(ProtoName {protobufName = FIName \".Challenges.Challenge.params.cparams\", haskellPrefix = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule = [MName \"Challenges\",MName \"Challenge\",MName \"Params\"], baseName = MName \"Cparams\"},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.Challenge.params.cparams\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"Challenge\",MName \"Params\"], baseName' = FName \"cparams\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 5}, wireTag = WireTag {getWireTag = 42}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".Challenges.ContParams\", haskellPrefix = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule = [MName \"Challenges\"], baseName = MName \"ContParams\"}), hsRawDefault = Nothing, hsDefault = Nothing}),(ProtoName {protobufName = FIName \".Challenges.Challenge.params.dparams\", haskellPrefix = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule = [MName \"Challenges\",MName \"Challenge\",MName \"Params\"], baseName = MName \"Dparams\"},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.Challenge.params.dparams\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"Challenge\",MName \"Params\"], baseName' = FName \"dparams\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 6}, wireTag = WireTag {getWireTag = 50}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".Challenges.DiscParams\", haskellPrefix = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule = [MName \"Challenges\"], baseName = MName \"DiscParams\"}), hsRawDefault = Nothing, hsDefault = Nothing}),(ProtoName {protobufName = FIName \".Challenges.Challenge.params.rparams\", haskellPrefix = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule = [MName \"Challenges\",MName \"Challenge\",MName \"Params\"], baseName = MName \"Rparams\"},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.Challenge.params.rparams\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"Challenge\",MName \"Params\"], baseName' = FName \"rparams\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 7}, wireTag = WireTag {getWireTag = 58}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".Challenges.RLWRParams\", haskellPrefix = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule = [MName \"Challenges\"], baseName = MName \"RLWRParams\"}), hsRawDefault = Nothing, hsDefault = Nothing})], oneofMakeLenses = False}], knownKeyMap = fromList []}"+    "ProtoInfo {protoMod = ProtoName {protobufName = FIName \".Challenges\", haskellPrefix = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule = [], baseName = MName \"Challenges\"}, protoFilePath = [\"Crypto\",\"Proto\",\"RLWE\",\"Challenges.hs\"], protoSource = \"Challenges.proto\", extensionKeys = fromList [], messages = [DescriptorInfo {descName = ProtoName {protobufName = FIName \".Challenges.ContParams\", haskellPrefix = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule = [MName \"Challenges\"], baseName = MName \"ContParams\"}, descFilePath = [\"Crypto\",\"Proto\",\"RLWE\",\"Challenges\",\"ContParams.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.ContParams.m\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"ContParams\"], baseName' = FName \"m\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 1}, wireTag = WireTag {getWireTag = 8}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 5}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.ContParams.q\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"ContParams\"], baseName' = FName \"q\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 2}, wireTag = WireTag {getWireTag = 16}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 3}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.ContParams.svar\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"ContParams\"], baseName' = FName \"svar\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 3}, wireTag = WireTag {getWireTag = 25}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 1}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.ContParams.bound\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"ContParams\"], baseName' = FName \"bound\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 4}, wireTag = WireTag {getWireTag = 33}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 1}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.ContParams.numSamples\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"ContParams\"], baseName' = FName \"numSamples\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 5}, wireTag = WireTag {getWireTag = 40}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 5}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False},DescriptorInfo {descName = ProtoName {protobufName = FIName \".Challenges.DiscParams\", haskellPrefix = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule = [MName \"Challenges\"], baseName = MName \"DiscParams\"}, descFilePath = [\"Crypto\",\"Proto\",\"RLWE\",\"Challenges\",\"DiscParams.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.DiscParams.m\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"DiscParams\"], baseName' = FName \"m\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 1}, wireTag = WireTag {getWireTag = 8}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 5}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.DiscParams.q\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"DiscParams\"], baseName' = FName \"q\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 2}, wireTag = WireTag {getWireTag = 16}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 3}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.DiscParams.svar\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"DiscParams\"], baseName' = FName \"svar\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 3}, wireTag = WireTag {getWireTag = 25}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 1}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.DiscParams.bound\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"DiscParams\"], baseName' = FName \"bound\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 4}, wireTag = WireTag {getWireTag = 32}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 3}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.DiscParams.numSamples\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"DiscParams\"], baseName' = FName \"numSamples\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 5}, wireTag = WireTag {getWireTag = 40}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 5}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False},DescriptorInfo {descName = ProtoName {protobufName = FIName \".Challenges.RLWRParams\", haskellPrefix = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule = [MName \"Challenges\"], baseName = MName \"RLWRParams\"}, descFilePath = [\"Crypto\",\"Proto\",\"RLWE\",\"Challenges\",\"RLWRParams.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.RLWRParams.m\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"RLWRParams\"], baseName' = FName \"m\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 1}, wireTag = WireTag {getWireTag = 8}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 5}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.RLWRParams.q\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"RLWRParams\"], baseName' = FName \"q\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 2}, wireTag = WireTag {getWireTag = 16}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 3}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.RLWRParams.p\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"RLWRParams\"], baseName' = FName \"p\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 3}, wireTag = WireTag {getWireTag = 24}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 3}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.RLWRParams.numSamples\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"RLWRParams\"], baseName' = FName \"numSamples\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 4}, wireTag = WireTag {getWireTag = 32}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 5}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False},DescriptorInfo {descName = ProtoName {protobufName = FIName \".Challenges.Challenge\", haskellPrefix = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule = [MName \"Challenges\"], baseName = MName \"Challenge\"}, descFilePath = [\"Crypto\",\"Proto\",\"RLWE\",\"Challenges\",\"Challenge.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.Challenge.challengeID\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"Challenge\"], baseName' = FName \"challengeID\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 1}, wireTag = WireTag {getWireTag = 8}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 5}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.Challenge.numInstances\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"Challenge\"], baseName' = FName \"numInstances\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 2}, wireTag = WireTag {getWireTag = 16}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 5}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.Challenge.beaconEpoch\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"Challenge\"], baseName' = FName \"beaconEpoch\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 3}, wireTag = WireTag {getWireTag = 24}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 3}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.Challenge.beaconOffset\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"Challenge\"], baseName' = FName \"beaconOffset\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 4}, wireTag = WireTag {getWireTag = 32}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 5}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing}], descOneofs = fromList [OneofInfo {oneofName = ProtoName {protobufName = FIName \".Challenges.Challenge.params\", haskellPrefix = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule = [MName \"Challenges\",MName \"Challenge\"], baseName = MName \"Params\"}, oneofFName = ProtoFName {protobufName' = FIName \".Challenges.Challenge.params\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"Challenge\"], baseName' = FName \"params\", baseNamePrefix' = \"\"}, oneofFilePath = [\"Crypto\",\"Proto\",\"RLWE\",\"Challenges\",\"Challenge\",\"Params.hs\"], oneofFields = fromList [(ProtoName {protobufName = FIName \".Challenges.Challenge.params.cparams\", haskellPrefix = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule = [MName \"Challenges\",MName \"Challenge\",MName \"Params\"], baseName = MName \"Cparams\"},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.Challenge.params.cparams\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"Challenge\",MName \"Params\"], baseName' = FName \"cparams\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 5}, wireTag = WireTag {getWireTag = 42}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".Challenges.ContParams\", haskellPrefix = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule = [MName \"Challenges\"], baseName = MName \"ContParams\"}), hsRawDefault = Nothing, hsDefault = Nothing}),(ProtoName {protobufName = FIName \".Challenges.Challenge.params.dparams\", haskellPrefix = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule = [MName \"Challenges\",MName \"Challenge\",MName \"Params\"], baseName = MName \"Dparams\"},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.Challenge.params.dparams\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"Challenge\",MName \"Params\"], baseName' = FName \"dparams\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 6}, wireTag = WireTag {getWireTag = 50}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".Challenges.DiscParams\", haskellPrefix = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule = [MName \"Challenges\"], baseName = MName \"DiscParams\"}), hsRawDefault = Nothing, hsDefault = Nothing}),(ProtoName {protobufName = FIName \".Challenges.Challenge.params.rparams\", haskellPrefix = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule = [MName \"Challenges\",MName \"Challenge\",MName \"Params\"], baseName = MName \"Rparams\"},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.Challenge.params.rparams\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"Challenge\",MName \"Params\"], baseName' = FName \"rparams\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 7}, wireTag = WireTag {getWireTag = 58}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".Challenges.RLWRParams\", haskellPrefix = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule = [MName \"Challenges\"], baseName = MName \"RLWRParams\"}), hsRawDefault = Nothing, hsDefault = Nothing})], oneofMakeLenses = False}], keys = fromList [], extRanges = [], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False},DescriptorInfo {descName = ProtoName {protobufName = FIName \".Challenges.InstanceCont1\", haskellPrefix = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule = [MName \"Challenges\"], baseName = MName \"InstanceCont1\"}, descFilePath = [\"Crypto\",\"Proto\",\"RLWE\",\"Challenges\",\"InstanceCont1.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.InstanceCont1.challengeID\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"InstanceCont1\"], baseName' = FName \"challengeID\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 1}, wireTag = WireTag {getWireTag = 8}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 5}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.InstanceCont1.instanceID\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"InstanceCont1\"], baseName' = FName \"instanceID\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 2}, wireTag = WireTag {getWireTag = 16}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 5}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.InstanceCont1.params\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"InstanceCont1\"], baseName' = FName \"params\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 3}, wireTag = WireTag {getWireTag = 26}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".Challenges.ContParams\", haskellPrefix = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule = [MName \"Challenges\"], baseName = MName \"ContParams\"}), hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.InstanceCont1.samples\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"InstanceCont1\"], baseName' = FName \"samples\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 4}, wireTag = WireTag {getWireTag = 34}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = True, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".RLWE.SampleCont1\", haskellPrefix = [MName \"Crypto\",MName \"Proto\"], parentModule = [MName \"RLWE\"], baseName = MName \"SampleCont1\"}), hsRawDefault = Nothing, hsDefault = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False},DescriptorInfo {descName = ProtoName {protobufName = FIName \".Challenges.InstanceDisc1\", haskellPrefix = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule = [MName \"Challenges\"], baseName = MName \"InstanceDisc1\"}, descFilePath = [\"Crypto\",\"Proto\",\"RLWE\",\"Challenges\",\"InstanceDisc1.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.InstanceDisc1.challengeID\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"InstanceDisc1\"], baseName' = FName \"challengeID\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 1}, wireTag = WireTag {getWireTag = 8}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 5}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.InstanceDisc1.instanceID\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"InstanceDisc1\"], baseName' = FName \"instanceID\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 2}, wireTag = WireTag {getWireTag = 16}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 5}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.InstanceDisc1.params\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"InstanceDisc1\"], baseName' = FName \"params\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 3}, wireTag = WireTag {getWireTag = 26}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".Challenges.DiscParams\", haskellPrefix = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule = [MName \"Challenges\"], baseName = MName \"DiscParams\"}), hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.InstanceDisc1.samples\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"InstanceDisc1\"], baseName' = FName \"samples\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 4}, wireTag = WireTag {getWireTag = 34}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = True, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".RLWE.SampleDisc1\", haskellPrefix = [MName \"Crypto\",MName \"Proto\"], parentModule = [MName \"RLWE\"], baseName = MName \"SampleDisc1\"}), hsRawDefault = Nothing, hsDefault = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False},DescriptorInfo {descName = ProtoName {protobufName = FIName \".Challenges.InstanceRLWR1\", haskellPrefix = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule = [MName \"Challenges\"], baseName = MName \"InstanceRLWR1\"}, descFilePath = [\"Crypto\",\"Proto\",\"RLWE\",\"Challenges\",\"InstanceRLWR1.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.InstanceRLWR1.challengeID\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"InstanceRLWR1\"], baseName' = FName \"challengeID\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 1}, wireTag = WireTag {getWireTag = 8}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 5}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.InstanceRLWR1.instanceID\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"InstanceRLWR1\"], baseName' = FName \"instanceID\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 2}, wireTag = WireTag {getWireTag = 16}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 5}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.InstanceRLWR1.params\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"InstanceRLWR1\"], baseName' = FName \"params\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 3}, wireTag = WireTag {getWireTag = 26}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".Challenges.RLWRParams\", haskellPrefix = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule = [MName \"Challenges\"], baseName = MName \"RLWRParams\"}), hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.InstanceRLWR1.samples\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"InstanceRLWR1\"], baseName' = FName \"samples\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 4}, wireTag = WireTag {getWireTag = 34}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = True, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".RLWE.SampleRLWR1\", haskellPrefix = [MName \"Crypto\",MName \"Proto\"], parentModule = [MName \"RLWE\"], baseName = MName \"SampleRLWR1\"}), hsRawDefault = Nothing, hsDefault = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False},DescriptorInfo {descName = ProtoName {protobufName = FIName \".Challenges.InstanceCont\", haskellPrefix = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule = [MName \"Challenges\"], baseName = MName \"InstanceCont\"}, descFilePath = [\"Crypto\",\"Proto\",\"RLWE\",\"Challenges\",\"InstanceCont.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.InstanceCont.challengeID\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"InstanceCont\"], baseName' = FName \"challengeID\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 1}, wireTag = WireTag {getWireTag = 8}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 5}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.InstanceCont.instanceID\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"InstanceCont\"], baseName' = FName \"instanceID\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 2}, wireTag = WireTag {getWireTag = 16}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 5}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.InstanceCont.params\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"InstanceCont\"], baseName' = FName \"params\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 3}, wireTag = WireTag {getWireTag = 26}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".Challenges.ContParams\", haskellPrefix = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule = [MName \"Challenges\"], baseName = MName \"ContParams\"}), hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.InstanceCont.samples\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"InstanceCont\"], baseName' = FName \"samples\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 4}, wireTag = WireTag {getWireTag = 34}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = True, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".RLWE.SampleCont\", haskellPrefix = [MName \"Crypto\",MName \"Proto\"], parentModule = [MName \"RLWE\"], baseName = MName \"SampleCont\"}), hsRawDefault = Nothing, hsDefault = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False},DescriptorInfo {descName = ProtoName {protobufName = FIName \".Challenges.InstanceDisc\", haskellPrefix = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule = [MName \"Challenges\"], baseName = MName \"InstanceDisc\"}, descFilePath = [\"Crypto\",\"Proto\",\"RLWE\",\"Challenges\",\"InstanceDisc.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.InstanceDisc.challengeID\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"InstanceDisc\"], baseName' = FName \"challengeID\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 1}, wireTag = WireTag {getWireTag = 8}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 5}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.InstanceDisc.instanceID\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"InstanceDisc\"], baseName' = FName \"instanceID\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 2}, wireTag = WireTag {getWireTag = 16}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 5}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.InstanceDisc.params\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"InstanceDisc\"], baseName' = FName \"params\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 3}, wireTag = WireTag {getWireTag = 26}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".Challenges.DiscParams\", haskellPrefix = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule = [MName \"Challenges\"], baseName = MName \"DiscParams\"}), hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.InstanceDisc.samples\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"InstanceDisc\"], baseName' = FName \"samples\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 4}, wireTag = WireTag {getWireTag = 34}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = True, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".RLWE.SampleDisc\", haskellPrefix = [MName \"Crypto\",MName \"Proto\"], parentModule = [MName \"RLWE\"], baseName = MName \"SampleDisc\"}), hsRawDefault = Nothing, hsDefault = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False},DescriptorInfo {descName = ProtoName {protobufName = FIName \".Challenges.InstanceRLWR\", haskellPrefix = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule = [MName \"Challenges\"], baseName = MName \"InstanceRLWR\"}, descFilePath = [\"Crypto\",\"Proto\",\"RLWE\",\"Challenges\",\"InstanceRLWR.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.InstanceRLWR.challengeID\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"InstanceRLWR\"], baseName' = FName \"challengeID\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 1}, wireTag = WireTag {getWireTag = 8}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 5}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.InstanceRLWR.instanceID\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"InstanceRLWR\"], baseName' = FName \"instanceID\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 2}, wireTag = WireTag {getWireTag = 16}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 5}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.InstanceRLWR.params\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"InstanceRLWR\"], baseName' = FName \"params\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 3}, wireTag = WireTag {getWireTag = 26}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".Challenges.RLWRParams\", haskellPrefix = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule = [MName \"Challenges\"], baseName = MName \"RLWRParams\"}), hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.InstanceRLWR.samples\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"InstanceRLWR\"], baseName' = FName \"samples\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 4}, wireTag = WireTag {getWireTag = 34}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = True, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".RLWE.SampleRLWR\", haskellPrefix = [MName \"Crypto\",MName \"Proto\"], parentModule = [MName \"RLWE\"], baseName = MName \"SampleRLWR\"}), hsRawDefault = Nothing, hsDefault = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False},DescriptorInfo {descName = ProtoName {protobufName = FIName \".Challenges.Secret1\", haskellPrefix = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule = [MName \"Challenges\"], baseName = MName \"Secret1\"}, descFilePath = [\"Crypto\",\"Proto\",\"RLWE\",\"Challenges\",\"Secret1.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.Secret1.challengeID\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"Secret1\"], baseName' = FName \"challengeID\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 1}, wireTag = WireTag {getWireTag = 8}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 5}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.Secret1.instanceID\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"Secret1\"], baseName' = FName \"instanceID\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 2}, wireTag = WireTag {getWireTag = 16}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 5}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.Secret1.m\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"Secret1\"], baseName' = FName \"m\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 3}, wireTag = WireTag {getWireTag = 24}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 5}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.Secret1.q\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"Secret1\"], baseName' = FName \"q\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 4}, wireTag = WireTag {getWireTag = 32}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 3}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.Secret1.seed\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"Secret1\"], baseName' = FName \"seed\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 5}, wireTag = WireTag {getWireTag = 42}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 12}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.Secret1.s\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"Secret1\"], baseName' = FName \"s\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 6}, wireTag = WireTag {getWireTag = 50}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".Lol.Rq1\", haskellPrefix = [MName \"Crypto\",MName \"Proto\"], parentModule = [MName \"Lol\"], baseName = MName \"Rq1\"}), hsRawDefault = Nothing, hsDefault = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False},DescriptorInfo {descName = ProtoName {protobufName = FIName \".Challenges.Secret\", haskellPrefix = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule = [MName \"Challenges\"], baseName = MName \"Secret\"}, descFilePath = [\"Crypto\",\"Proto\",\"RLWE\",\"Challenges\",\"Secret.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.Secret.challengeID\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"Secret\"], baseName' = FName \"challengeID\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 1}, wireTag = WireTag {getWireTag = 8}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 5}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.Secret.instanceID\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"Secret\"], baseName' = FName \"instanceID\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 2}, wireTag = WireTag {getWireTag = 16}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 5}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.Secret.m\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"Secret\"], baseName' = FName \"m\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 3}, wireTag = WireTag {getWireTag = 24}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 5}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.Secret.q\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"Secret\"], baseName' = FName \"q\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 4}, wireTag = WireTag {getWireTag = 32}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 3}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.Secret.seed\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"Secret\"], baseName' = FName \"seed\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 5}, wireTag = WireTag {getWireTag = 42}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 12}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.Secret.s\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"Secret\"], baseName' = FName \"s\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 6}, wireTag = WireTag {getWireTag = 50}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".Lol.RqProduct\", haskellPrefix = [MName \"Crypto\",MName \"Proto\"], parentModule = [MName \"Lol\"], baseName = MName \"RqProduct\"}), hsRawDefault = Nothing, hsDefault = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False}], enums = [], oneofs = [OneofInfo {oneofName = ProtoName {protobufName = FIName \".Challenges.Challenge.params\", haskellPrefix = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule = [MName \"Challenges\",MName \"Challenge\"], baseName = MName \"Params\"}, oneofFName = ProtoFName {protobufName' = FIName \".Challenges.Challenge.params\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"Challenge\"], baseName' = FName \"params\", baseNamePrefix' = \"\"}, oneofFilePath = [\"Crypto\",\"Proto\",\"RLWE\",\"Challenges\",\"Challenge\",\"Params.hs\"], oneofFields = fromList [(ProtoName {protobufName = FIName \".Challenges.Challenge.params.cparams\", haskellPrefix = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule = [MName \"Challenges\",MName \"Challenge\",MName \"Params\"], baseName = MName \"Cparams\"},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.Challenge.params.cparams\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"Challenge\",MName \"Params\"], baseName' = FName \"cparams\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 5}, wireTag = WireTag {getWireTag = 42}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".Challenges.ContParams\", haskellPrefix = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule = [MName \"Challenges\"], baseName = MName \"ContParams\"}), hsRawDefault = Nothing, hsDefault = Nothing}),(ProtoName {protobufName = FIName \".Challenges.Challenge.params.dparams\", haskellPrefix = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule = [MName \"Challenges\",MName \"Challenge\",MName \"Params\"], baseName = MName \"Dparams\"},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.Challenge.params.dparams\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"Challenge\",MName \"Params\"], baseName' = FName \"dparams\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 6}, wireTag = WireTag {getWireTag = 50}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".Challenges.DiscParams\", haskellPrefix = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule = [MName \"Challenges\"], baseName = MName \"DiscParams\"}), hsRawDefault = Nothing, hsDefault = Nothing}),(ProtoName {protobufName = FIName \".Challenges.Challenge.params.rparams\", haskellPrefix = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule = [MName \"Challenges\",MName \"Challenge\",MName \"Params\"], baseName = MName \"Rparams\"},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.Challenge.params.rparams\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"Challenge\",MName \"Params\"], baseName' = FName \"rparams\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 7}, wireTag = WireTag {getWireTag = 58}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".Challenges.RLWRParams\", haskellPrefix = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule = [MName \"Challenges\"], baseName = MName \"RLWRParams\"}), hsRawDefault = Nothing, hsDefault = Nothing})], oneofMakeLenses = False}], knownKeyMap = fromList []}"  fileDescriptorProto :: FileDescriptorProto fileDescriptorProto  = P'.getFromBS (P'.wireGet 11)     (P'.pack-      "\245\a\n\DLEChallenges.proto\SUB\nRLWE.proto\"S\n\nContParams\DC2\t\n\SOHm\CAN\SOH \STX(\ENQ\DC2\t\n\SOHq\CAN\STX \STX(\ETX\DC2\f\n\EOTsvar\CAN\ETX \STX(\SOH\DC2\r\n\ENQbound\CAN\EOT \STX(\SOH\DC2\DC2\n\nnumSamples\CAN\ENQ \STX(\ENQ\"S\n\nDiscParams\DC2\t\n\SOHm\CAN\SOH \STX(\ENQ\DC2\t\n\SOHq\CAN\STX \STX(\ETX\DC2\f\n\EOTsvar\CAN\ETX \STX(\SOH\DC2\r\n\ENQbound\CAN\EOT \STX(\ETX\DC2\DC2\n\nnumSamples\CAN\ENQ \STX(\ENQ\"A\n\nRLWRParams\DC2\t\n\SOHm\CAN\SOH \STX(\ENQ\DC2\t\n\SOHq\CAN\STX \STX(\ETX\DC2\t\n\SOHp\CAN\ETX \STX(\ETX\DC2\DC2\n\nnumSamples\CAN\EOT \STX(\ENQ\"\236\SOH\n\tChallenge\DC2\DC3\n\vchallengeID\CAN\SOH \STX(\ENQ\DC2\DC4\n\fnumInstances\CAN\STX \STX(\ENQ\DC2\DC3\n\vbeaconEpoch\CAN\ETX \STX(\ETX\DC2\DC4\n\fbeaconOffset\CAN\EOT \STX(\ENQ\DC2)\n\acparams\CAN\ENQ \SOH(\v2\SYN.Challenges.ContParamsH\NUL\DC2)\n\adparams\CAN\ACK \SOH(\v2\SYN.Challenges.DiscParamsH\NUL\DC2)\n\arparams\CAN\a \SOH(\v2\SYN.Challenges.RLWRParamsH\NULB\b\n\ACKparams\"\130\SOH\n\fInstanceCont\DC2\DC3\n\vchallengeID\CAN\SOH \STX(\ENQ\DC2\DC2\n\ninstanceID\CAN\STX \STX(\ENQ\DC2&\n\ACKparams\CAN\ETX \STX(\v2\SYN.Challenges.ContParams\DC2!\n\asamples\CAN\EOT \ETX(\v2\DLE.RLWE.SampleCont\"\130\SOH\n\fInstanceDisc\DC2\DC3\n\vchallengeID\CAN\SOH \STX(\ENQ\DC2\DC2\n\ninstanceID\CAN\STX \STX(\ENQ\DC2&\n\ACKparams\CAN\ETX \STX(\v2\SYN.Challenges.DiscParams\DC2!\n\asamples\CAN\EOT \ETX(\v2\DLE.RLWE.SampleDisc\"\130\SOH\n\fInstanceRLWR\DC2\DC3\n\vchallengeID\CAN\SOH \STX(\ENQ\DC2\DC2\n\ninstanceID\CAN\STX \STX(\ENQ\DC2&\n\ACKparams\CAN\ETX \STX(\v2\SYN.Challenges.RLWRParams\DC2!\n\asamples\CAN\EOT \ETX(\v2\DLE.RLWE.SampleRLWR\"j\n\ACKSecret\DC2\DC3\n\vchallengeID\CAN\SOH \STX(\ENQ\DC2\DC2\n\ninstanceID\CAN\STX \STX(\ENQ\DC2\t\n\SOHm\CAN\ETX \STX(\ENQ\DC2\t\n\SOHq\CAN\EOT \STX(\ETX\DC2\f\n\EOTseed\CAN\ENQ \STX(\f\DC2\DC3\n\SOHs\CAN\ACK \STX(\v2\b.RLWE.Rq")+      "\136\f\n\DLEChallenges.proto\SUB\tLol.proto\SUB\nRLWE.proto\"S\n\nContParams\DC2\t\n\SOHm\CAN\SOH \STX(\ENQ\DC2\t\n\SOHq\CAN\STX \STX(\ETX\DC2\f\n\EOTsvar\CAN\ETX \STX(\SOH\DC2\r\n\ENQbound\CAN\EOT \STX(\SOH\DC2\DC2\n\nnumSamples\CAN\ENQ \STX(\ENQ\"S\n\nDiscParams\DC2\t\n\SOHm\CAN\SOH \STX(\ENQ\DC2\t\n\SOHq\CAN\STX \STX(\ETX\DC2\f\n\EOTsvar\CAN\ETX \STX(\SOH\DC2\r\n\ENQbound\CAN\EOT \STX(\ETX\DC2\DC2\n\nnumSamples\CAN\ENQ \STX(\ENQ\"A\n\nRLWRParams\DC2\t\n\SOHm\CAN\SOH \STX(\ENQ\DC2\t\n\SOHq\CAN\STX \STX(\ETX\DC2\t\n\SOHp\CAN\ETX \STX(\ETX\DC2\DC2\n\nnumSamples\CAN\EOT \STX(\ENQ\"\236\SOH\n\tChallenge\DC2\DC3\n\vchallengeID\CAN\SOH \STX(\ENQ\DC2\DC4\n\fnumInstances\CAN\STX \STX(\ENQ\DC2\DC3\n\vbeaconEpoch\CAN\ETX \STX(\ETX\DC2\DC4\n\fbeaconOffset\CAN\EOT \STX(\ENQ\DC2)\n\acparams\CAN\ENQ \SOH(\v2\SYN.Challenges.ContParamsH\NUL\DC2)\n\adparams\CAN\ACK \SOH(\v2\SYN.Challenges.DiscParamsH\NUL\DC2)\n\arparams\CAN\a \SOH(\v2\SYN.Challenges.RLWRParamsH\NULB\b\n\ACKparams\"\132\SOH\n\rInstanceCont1\DC2\DC3\n\vchallengeID\CAN\SOH \STX(\ENQ\DC2\DC2\n\ninstanceID\CAN\STX \STX(\ENQ\DC2&\n\ACKparams\CAN\ETX \STX(\v2\SYN.Challenges.ContParams\DC2\"\n\asamples\CAN\EOT \ETX(\v2\DC1.RLWE.SampleCont1\"\132\SOH\n\rInstanceDisc1\DC2\DC3\n\vchallengeID\CAN\SOH \STX(\ENQ\DC2\DC2\n\ninstanceID\CAN\STX \STX(\ENQ\DC2&\n\ACKparams\CAN\ETX \STX(\v2\SYN.Challenges.DiscParams\DC2\"\n\asamples\CAN\EOT \ETX(\v2\DC1.RLWE.SampleDisc1\"\132\SOH\n\rInstanceRLWR1\DC2\DC3\n\vchallengeID\CAN\SOH \STX(\ENQ\DC2\DC2\n\ninstanceID\CAN\STX \STX(\ENQ\DC2&\n\ACKparams\CAN\ETX \STX(\v2\SYN.Challenges.RLWRParams\DC2\"\n\asamples\CAN\EOT \ETX(\v2\DC1.RLWE.SampleRLWR1\"\130\SOH\n\fInstanceCont\DC2\DC3\n\vchallengeID\CAN\SOH \STX(\ENQ\DC2\DC2\n\ninstanceID\CAN\STX \STX(\ENQ\DC2&\n\ACKparams\CAN\ETX \STX(\v2\SYN.Challenges.ContParams\DC2!\n\asamples\CAN\EOT \ETX(\v2\DLE.RLWE.SampleCont\"\130\SOH\n\fInstanceDisc\DC2\DC3\n\vchallengeID\CAN\SOH \STX(\ENQ\DC2\DC2\n\ninstanceID\CAN\STX \STX(\ENQ\DC2&\n\ACKparams\CAN\ETX \STX(\v2\SYN.Challenges.DiscParams\DC2!\n\asamples\CAN\EOT \ETX(\v2\DLE.RLWE.SampleDisc\"\130\SOH\n\fInstanceRLWR\DC2\DC3\n\vchallengeID\CAN\SOH \STX(\ENQ\DC2\DC2\n\ninstanceID\CAN\STX \STX(\ENQ\DC2&\n\ACKparams\CAN\ETX \STX(\v2\SYN.Challenges.RLWRParams\DC2!\n\asamples\CAN\EOT \ETX(\v2\DLE.RLWE.SampleRLWR\"k\n\aSecret1\DC2\DC3\n\vchallengeID\CAN\SOH \STX(\ENQ\DC2\DC2\n\ninstanceID\CAN\STX \STX(\ENQ\DC2\t\n\SOHm\CAN\ETX \STX(\ENQ\DC2\t\n\SOHq\CAN\EOT \STX(\ETX\DC2\f\n\EOTseed\CAN\ENQ \STX(\f\DC2\DC3\n\SOHs\CAN\ACK \STX(\v2\b.Lol.Rq1\"p\n\ACKSecret\DC2\DC3\n\vchallengeID\CAN\SOH \STX(\ENQ\DC2\DC2\n\ninstanceID\CAN\STX \STX(\ENQ\DC2\t\n\SOHm\CAN\ETX \STX(\ENQ\DC2\t\n\SOHq\CAN\EOT \STX(\ETX\DC2\f\n\EOTseed\CAN\ENQ \STX(\f\DC2\EM\n\SOHs\CAN\ACK \STX(\v2\SO.Lol.RqProduct")
+ Crypto/Proto/RLWE/Challenges/InstanceCont1.hs view
@@ -0,0 +1,106 @@+{-# LANGUAGE BangPatterns, DeriveDataTypeable, DeriveGeneric, FlexibleInstances, MultiParamTypeClasses #-}+{-# OPTIONS_GHC  -fno-warn-unused-imports #-}+module Crypto.Proto.RLWE.Challenges.InstanceCont1 (InstanceCont1(..)) where+import Prelude ((+), (/))+import qualified Prelude as Prelude'+import qualified Data.Typeable as Prelude'+import qualified GHC.Generics as Prelude'+import qualified Data.Data as Prelude'+import qualified Text.ProtocolBuffers.Header as P'+import qualified Crypto.Proto.RLWE.Challenges.ContParams as Challenges (ContParams)+import qualified Crypto.Proto.RLWE.SampleCont1 as RLWE (SampleCont1)++data InstanceCont1 = InstanceCont1{challengeID :: !(P'.Int32), instanceID :: !(P'.Int32), params :: !(Challenges.ContParams),+                                   samples :: !(P'.Seq RLWE.SampleCont1)}+                   deriving (Prelude'.Show, Prelude'.Eq, Prelude'.Ord, Prelude'.Typeable, Prelude'.Data, Prelude'.Generic)++instance P'.Mergeable InstanceCont1 where+  mergeAppend (InstanceCont1 x'1 x'2 x'3 x'4) (InstanceCont1 y'1 y'2 y'3 y'4)+   = InstanceCont1 (P'.mergeAppend x'1 y'1) (P'.mergeAppend x'2 y'2) (P'.mergeAppend x'3 y'3) (P'.mergeAppend x'4 y'4)++instance P'.Default InstanceCont1 where+  defaultValue = InstanceCont1 P'.defaultValue P'.defaultValue P'.defaultValue P'.defaultValue++instance P'.Wire InstanceCont1 where+  wireSize ft' self'@(InstanceCont1 x'1 x'2 x'3 x'4)+   = case ft' of+       10 -> calc'Size+       11 -> P'.prependMessageSize calc'Size+       _ -> P'.wireSizeErr ft' self'+    where+        calc'Size = (P'.wireSizeReq 1 5 x'1 + P'.wireSizeReq 1 5 x'2 + P'.wireSizeReq 1 11 x'3 + P'.wireSizeRep 1 11 x'4)+  wirePut ft' self'@(InstanceCont1 x'1 x'2 x'3 x'4)+   = case ft' of+       10 -> put'Fields+       11 -> do+               P'.putSize (P'.wireSize 10 self')+               put'Fields+       _ -> P'.wirePutErr ft' self'+    where+        put'Fields+         = do+             P'.wirePutReq 8 5 x'1+             P'.wirePutReq 16 5 x'2+             P'.wirePutReq 26 11 x'3+             P'.wirePutRep 34 11 x'4+  wireGet ft'+   = case ft' of+       10 -> P'.getBareMessageWith update'Self+       11 -> P'.getMessageWith update'Self+       _ -> P'.wireGetErr ft'+    where+        update'Self wire'Tag old'Self+         = case wire'Tag of+             8 -> Prelude'.fmap (\ !new'Field -> old'Self{challengeID = new'Field}) (P'.wireGet 5)+             16 -> Prelude'.fmap (\ !new'Field -> old'Self{instanceID = new'Field}) (P'.wireGet 5)+             26 -> Prelude'.fmap (\ !new'Field -> old'Self{params = P'.mergeAppend (params old'Self) (new'Field)}) (P'.wireGet 11)+             34 -> Prelude'.fmap (\ !new'Field -> old'Self{samples = P'.append (samples old'Self) new'Field}) (P'.wireGet 11)+             _ -> let (field'Number, wire'Type) = P'.splitWireTag wire'Tag in P'.unknown field'Number wire'Type old'Self++instance P'.MessageAPI msg' (msg' -> InstanceCont1) InstanceCont1 where+  getVal m' f' = f' m'++instance P'.GPB InstanceCont1++instance P'.ReflectDescriptor InstanceCont1 where+  getMessageInfo _ = P'.GetMessageInfo (P'.fromDistinctAscList [8, 16, 26]) (P'.fromDistinctAscList [8, 16, 26, 34])+  reflectDescriptorInfo _+   = Prelude'.read+      "DescriptorInfo {descName = ProtoName {protobufName = FIName \".Challenges.InstanceCont1\", haskellPrefix = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule = [MName \"Challenges\"], baseName = MName \"InstanceCont1\"}, descFilePath = [\"Crypto\",\"Proto\",\"RLWE\",\"Challenges\",\"InstanceCont1.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.InstanceCont1.challengeID\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"InstanceCont1\"], baseName' = FName \"challengeID\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 1}, wireTag = WireTag {getWireTag = 8}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 5}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.InstanceCont1.instanceID\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"InstanceCont1\"], baseName' = FName \"instanceID\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 2}, wireTag = WireTag {getWireTag = 16}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 5}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.InstanceCont1.params\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"InstanceCont1\"], baseName' = FName \"params\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 3}, wireTag = WireTag {getWireTag = 26}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".Challenges.ContParams\", haskellPrefix = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule = [MName \"Challenges\"], baseName = MName \"ContParams\"}), hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.InstanceCont1.samples\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"InstanceCont1\"], baseName' = FName \"samples\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 4}, wireTag = WireTag {getWireTag = 34}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = True, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".RLWE.SampleCont1\", haskellPrefix = [MName \"Crypto\",MName \"Proto\"], parentModule = [MName \"RLWE\"], baseName = MName \"SampleCont1\"}), hsRawDefault = Nothing, hsDefault = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False}"++instance P'.TextType InstanceCont1 where+  tellT = P'.tellSubMessage+  getT = P'.getSubMessage++instance P'.TextMsg InstanceCont1 where+  textPut msg+   = do+       P'.tellT "challengeID" (challengeID msg)+       P'.tellT "instanceID" (instanceID msg)+       P'.tellT "params" (params msg)+       P'.tellT "samples" (samples msg)+  textGet+   = do+       mods <- P'.sepEndBy (P'.choice [parse'challengeID, parse'instanceID, parse'params, parse'samples]) P'.spaces+       Prelude'.return (Prelude'.foldl (\ v f -> f v) P'.defaultValue mods)+    where+        parse'challengeID+         = P'.try+            (do+               v <- P'.getT "challengeID"+               Prelude'.return (\ o -> o{challengeID = v}))+        parse'instanceID+         = P'.try+            (do+               v <- P'.getT "instanceID"+               Prelude'.return (\ o -> o{instanceID = v}))+        parse'params+         = P'.try+            (do+               v <- P'.getT "params"+               Prelude'.return (\ o -> o{params = v}))+        parse'samples+         = P'.try+            (do+               v <- P'.getT "samples"+               Prelude'.return (\ o -> o{samples = P'.append (samples o) v}))
+ Crypto/Proto/RLWE/Challenges/InstanceDisc1.hs view
@@ -0,0 +1,106 @@+{-# LANGUAGE BangPatterns, DeriveDataTypeable, DeriveGeneric, FlexibleInstances, MultiParamTypeClasses #-}+{-# OPTIONS_GHC  -fno-warn-unused-imports #-}+module Crypto.Proto.RLWE.Challenges.InstanceDisc1 (InstanceDisc1(..)) where+import Prelude ((+), (/))+import qualified Prelude as Prelude'+import qualified Data.Typeable as Prelude'+import qualified GHC.Generics as Prelude'+import qualified Data.Data as Prelude'+import qualified Text.ProtocolBuffers.Header as P'+import qualified Crypto.Proto.RLWE.Challenges.DiscParams as Challenges (DiscParams)+import qualified Crypto.Proto.RLWE.SampleDisc1 as RLWE (SampleDisc1)++data InstanceDisc1 = InstanceDisc1{challengeID :: !(P'.Int32), instanceID :: !(P'.Int32), params :: !(Challenges.DiscParams),+                                   samples :: !(P'.Seq RLWE.SampleDisc1)}+                   deriving (Prelude'.Show, Prelude'.Eq, Prelude'.Ord, Prelude'.Typeable, Prelude'.Data, Prelude'.Generic)++instance P'.Mergeable InstanceDisc1 where+  mergeAppend (InstanceDisc1 x'1 x'2 x'3 x'4) (InstanceDisc1 y'1 y'2 y'3 y'4)+   = InstanceDisc1 (P'.mergeAppend x'1 y'1) (P'.mergeAppend x'2 y'2) (P'.mergeAppend x'3 y'3) (P'.mergeAppend x'4 y'4)++instance P'.Default InstanceDisc1 where+  defaultValue = InstanceDisc1 P'.defaultValue P'.defaultValue P'.defaultValue P'.defaultValue++instance P'.Wire InstanceDisc1 where+  wireSize ft' self'@(InstanceDisc1 x'1 x'2 x'3 x'4)+   = case ft' of+       10 -> calc'Size+       11 -> P'.prependMessageSize calc'Size+       _ -> P'.wireSizeErr ft' self'+    where+        calc'Size = (P'.wireSizeReq 1 5 x'1 + P'.wireSizeReq 1 5 x'2 + P'.wireSizeReq 1 11 x'3 + P'.wireSizeRep 1 11 x'4)+  wirePut ft' self'@(InstanceDisc1 x'1 x'2 x'3 x'4)+   = case ft' of+       10 -> put'Fields+       11 -> do+               P'.putSize (P'.wireSize 10 self')+               put'Fields+       _ -> P'.wirePutErr ft' self'+    where+        put'Fields+         = do+             P'.wirePutReq 8 5 x'1+             P'.wirePutReq 16 5 x'2+             P'.wirePutReq 26 11 x'3+             P'.wirePutRep 34 11 x'4+  wireGet ft'+   = case ft' of+       10 -> P'.getBareMessageWith update'Self+       11 -> P'.getMessageWith update'Self+       _ -> P'.wireGetErr ft'+    where+        update'Self wire'Tag old'Self+         = case wire'Tag of+             8 -> Prelude'.fmap (\ !new'Field -> old'Self{challengeID = new'Field}) (P'.wireGet 5)+             16 -> Prelude'.fmap (\ !new'Field -> old'Self{instanceID = new'Field}) (P'.wireGet 5)+             26 -> Prelude'.fmap (\ !new'Field -> old'Self{params = P'.mergeAppend (params old'Self) (new'Field)}) (P'.wireGet 11)+             34 -> Prelude'.fmap (\ !new'Field -> old'Self{samples = P'.append (samples old'Self) new'Field}) (P'.wireGet 11)+             _ -> let (field'Number, wire'Type) = P'.splitWireTag wire'Tag in P'.unknown field'Number wire'Type old'Self++instance P'.MessageAPI msg' (msg' -> InstanceDisc1) InstanceDisc1 where+  getVal m' f' = f' m'++instance P'.GPB InstanceDisc1++instance P'.ReflectDescriptor InstanceDisc1 where+  getMessageInfo _ = P'.GetMessageInfo (P'.fromDistinctAscList [8, 16, 26]) (P'.fromDistinctAscList [8, 16, 26, 34])+  reflectDescriptorInfo _+   = Prelude'.read+      "DescriptorInfo {descName = ProtoName {protobufName = FIName \".Challenges.InstanceDisc1\", haskellPrefix = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule = [MName \"Challenges\"], baseName = MName \"InstanceDisc1\"}, descFilePath = [\"Crypto\",\"Proto\",\"RLWE\",\"Challenges\",\"InstanceDisc1.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.InstanceDisc1.challengeID\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"InstanceDisc1\"], baseName' = FName \"challengeID\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 1}, wireTag = WireTag {getWireTag = 8}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 5}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.InstanceDisc1.instanceID\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"InstanceDisc1\"], baseName' = FName \"instanceID\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 2}, wireTag = WireTag {getWireTag = 16}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 5}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.InstanceDisc1.params\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"InstanceDisc1\"], baseName' = FName \"params\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 3}, wireTag = WireTag {getWireTag = 26}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".Challenges.DiscParams\", haskellPrefix = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule = [MName \"Challenges\"], baseName = MName \"DiscParams\"}), hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.InstanceDisc1.samples\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"InstanceDisc1\"], baseName' = FName \"samples\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 4}, wireTag = WireTag {getWireTag = 34}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = True, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".RLWE.SampleDisc1\", haskellPrefix = [MName \"Crypto\",MName \"Proto\"], parentModule = [MName \"RLWE\"], baseName = MName \"SampleDisc1\"}), hsRawDefault = Nothing, hsDefault = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False}"++instance P'.TextType InstanceDisc1 where+  tellT = P'.tellSubMessage+  getT = P'.getSubMessage++instance P'.TextMsg InstanceDisc1 where+  textPut msg+   = do+       P'.tellT "challengeID" (challengeID msg)+       P'.tellT "instanceID" (instanceID msg)+       P'.tellT "params" (params msg)+       P'.tellT "samples" (samples msg)+  textGet+   = do+       mods <- P'.sepEndBy (P'.choice [parse'challengeID, parse'instanceID, parse'params, parse'samples]) P'.spaces+       Prelude'.return (Prelude'.foldl (\ v f -> f v) P'.defaultValue mods)+    where+        parse'challengeID+         = P'.try+            (do+               v <- P'.getT "challengeID"+               Prelude'.return (\ o -> o{challengeID = v}))+        parse'instanceID+         = P'.try+            (do+               v <- P'.getT "instanceID"+               Prelude'.return (\ o -> o{instanceID = v}))+        parse'params+         = P'.try+            (do+               v <- P'.getT "params"+               Prelude'.return (\ o -> o{params = v}))+        parse'samples+         = P'.try+            (do+               v <- P'.getT "samples"+               Prelude'.return (\ o -> o{samples = P'.append (samples o) v}))
+ Crypto/Proto/RLWE/Challenges/InstanceRLWR1.hs view
@@ -0,0 +1,106 @@+{-# LANGUAGE BangPatterns, DeriveDataTypeable, DeriveGeneric, FlexibleInstances, MultiParamTypeClasses #-}+{-# OPTIONS_GHC  -fno-warn-unused-imports #-}+module Crypto.Proto.RLWE.Challenges.InstanceRLWR1 (InstanceRLWR1(..)) where+import Prelude ((+), (/))+import qualified Prelude as Prelude'+import qualified Data.Typeable as Prelude'+import qualified GHC.Generics as Prelude'+import qualified Data.Data as Prelude'+import qualified Text.ProtocolBuffers.Header as P'+import qualified Crypto.Proto.RLWE.Challenges.RLWRParams as Challenges (RLWRParams)+import qualified Crypto.Proto.RLWE.SampleRLWR1 as RLWE (SampleRLWR1)++data InstanceRLWR1 = InstanceRLWR1{challengeID :: !(P'.Int32), instanceID :: !(P'.Int32), params :: !(Challenges.RLWRParams),+                                   samples :: !(P'.Seq RLWE.SampleRLWR1)}+                   deriving (Prelude'.Show, Prelude'.Eq, Prelude'.Ord, Prelude'.Typeable, Prelude'.Data, Prelude'.Generic)++instance P'.Mergeable InstanceRLWR1 where+  mergeAppend (InstanceRLWR1 x'1 x'2 x'3 x'4) (InstanceRLWR1 y'1 y'2 y'3 y'4)+   = InstanceRLWR1 (P'.mergeAppend x'1 y'1) (P'.mergeAppend x'2 y'2) (P'.mergeAppend x'3 y'3) (P'.mergeAppend x'4 y'4)++instance P'.Default InstanceRLWR1 where+  defaultValue = InstanceRLWR1 P'.defaultValue P'.defaultValue P'.defaultValue P'.defaultValue++instance P'.Wire InstanceRLWR1 where+  wireSize ft' self'@(InstanceRLWR1 x'1 x'2 x'3 x'4)+   = case ft' of+       10 -> calc'Size+       11 -> P'.prependMessageSize calc'Size+       _ -> P'.wireSizeErr ft' self'+    where+        calc'Size = (P'.wireSizeReq 1 5 x'1 + P'.wireSizeReq 1 5 x'2 + P'.wireSizeReq 1 11 x'3 + P'.wireSizeRep 1 11 x'4)+  wirePut ft' self'@(InstanceRLWR1 x'1 x'2 x'3 x'4)+   = case ft' of+       10 -> put'Fields+       11 -> do+               P'.putSize (P'.wireSize 10 self')+               put'Fields+       _ -> P'.wirePutErr ft' self'+    where+        put'Fields+         = do+             P'.wirePutReq 8 5 x'1+             P'.wirePutReq 16 5 x'2+             P'.wirePutReq 26 11 x'3+             P'.wirePutRep 34 11 x'4+  wireGet ft'+   = case ft' of+       10 -> P'.getBareMessageWith update'Self+       11 -> P'.getMessageWith update'Self+       _ -> P'.wireGetErr ft'+    where+        update'Self wire'Tag old'Self+         = case wire'Tag of+             8 -> Prelude'.fmap (\ !new'Field -> old'Self{challengeID = new'Field}) (P'.wireGet 5)+             16 -> Prelude'.fmap (\ !new'Field -> old'Self{instanceID = new'Field}) (P'.wireGet 5)+             26 -> Prelude'.fmap (\ !new'Field -> old'Self{params = P'.mergeAppend (params old'Self) (new'Field)}) (P'.wireGet 11)+             34 -> Prelude'.fmap (\ !new'Field -> old'Self{samples = P'.append (samples old'Self) new'Field}) (P'.wireGet 11)+             _ -> let (field'Number, wire'Type) = P'.splitWireTag wire'Tag in P'.unknown field'Number wire'Type old'Self++instance P'.MessageAPI msg' (msg' -> InstanceRLWR1) InstanceRLWR1 where+  getVal m' f' = f' m'++instance P'.GPB InstanceRLWR1++instance P'.ReflectDescriptor InstanceRLWR1 where+  getMessageInfo _ = P'.GetMessageInfo (P'.fromDistinctAscList [8, 16, 26]) (P'.fromDistinctAscList [8, 16, 26, 34])+  reflectDescriptorInfo _+   = Prelude'.read+      "DescriptorInfo {descName = ProtoName {protobufName = FIName \".Challenges.InstanceRLWR1\", haskellPrefix = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule = [MName \"Challenges\"], baseName = MName \"InstanceRLWR1\"}, descFilePath = [\"Crypto\",\"Proto\",\"RLWE\",\"Challenges\",\"InstanceRLWR1.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.InstanceRLWR1.challengeID\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"InstanceRLWR1\"], baseName' = FName \"challengeID\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 1}, wireTag = WireTag {getWireTag = 8}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 5}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.InstanceRLWR1.instanceID\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"InstanceRLWR1\"], baseName' = FName \"instanceID\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 2}, wireTag = WireTag {getWireTag = 16}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 5}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.InstanceRLWR1.params\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"InstanceRLWR1\"], baseName' = FName \"params\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 3}, wireTag = WireTag {getWireTag = 26}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".Challenges.RLWRParams\", haskellPrefix = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule = [MName \"Challenges\"], baseName = MName \"RLWRParams\"}), hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.InstanceRLWR1.samples\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"InstanceRLWR1\"], baseName' = FName \"samples\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 4}, wireTag = WireTag {getWireTag = 34}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = False, canRepeat = True, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".RLWE.SampleRLWR1\", haskellPrefix = [MName \"Crypto\",MName \"Proto\"], parentModule = [MName \"RLWE\"], baseName = MName \"SampleRLWR1\"}), hsRawDefault = Nothing, hsDefault = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False}"++instance P'.TextType InstanceRLWR1 where+  tellT = P'.tellSubMessage+  getT = P'.getSubMessage++instance P'.TextMsg InstanceRLWR1 where+  textPut msg+   = do+       P'.tellT "challengeID" (challengeID msg)+       P'.tellT "instanceID" (instanceID msg)+       P'.tellT "params" (params msg)+       P'.tellT "samples" (samples msg)+  textGet+   = do+       mods <- P'.sepEndBy (P'.choice [parse'challengeID, parse'instanceID, parse'params, parse'samples]) P'.spaces+       Prelude'.return (Prelude'.foldl (\ v f -> f v) P'.defaultValue mods)+    where+        parse'challengeID+         = P'.try+            (do+               v <- P'.getT "challengeID"+               Prelude'.return (\ o -> o{challengeID = v}))+        parse'instanceID+         = P'.try+            (do+               v <- P'.getT "instanceID"+               Prelude'.return (\ o -> o{instanceID = v}))+        parse'params+         = P'.try+            (do+               v <- P'.getT "params"+               Prelude'.return (\ o -> o{params = v}))+        parse'samples+         = P'.try+            (do+               v <- P'.getT "samples"+               Prelude'.return (\ o -> o{samples = P'.append (samples o) v}))
Crypto/Proto/RLWE/Challenges/Secret.hs view
@@ -7,10 +7,10 @@ import qualified GHC.Generics as Prelude' import qualified Data.Data as Prelude' import qualified Text.ProtocolBuffers.Header as P'-import qualified Crypto.Proto.RLWE.Rq as RLWE (Rq)+import qualified Crypto.Proto.Lol.RqProduct as Lol (RqProduct)  data Secret = Secret{challengeID :: !(P'.Int32), instanceID :: !(P'.Int32), m :: !(P'.Int32), q :: !(P'.Int64),-                     seed :: !(P'.ByteString), s :: !(RLWE.Rq)}+                     seed :: !(P'.ByteString), s :: !(Lol.RqProduct)}             deriving (Prelude'.Show, Prelude'.Eq, Prelude'.Ord, Prelude'.Typeable, Prelude'.Data, Prelude'.Generic)  instance P'.Mergeable Secret where@@ -75,7 +75,7 @@    = P'.GetMessageInfo (P'.fromDistinctAscList [8, 16, 24, 32, 42, 50]) (P'.fromDistinctAscList [8, 16, 24, 32, 42, 50])   reflectDescriptorInfo _    = Prelude'.read-      "DescriptorInfo {descName = ProtoName {protobufName = FIName \".Challenges.Secret\", haskellPrefix = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule = [MName \"Challenges\"], baseName = MName \"Secret\"}, descFilePath = [\"Crypto\",\"Proto\",\"RLWE\",\"Challenges\",\"Secret.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.Secret.challengeID\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"Secret\"], baseName' = FName \"challengeID\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 1}, wireTag = WireTag {getWireTag = 8}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 5}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.Secret.instanceID\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"Secret\"], baseName' = FName \"instanceID\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 2}, wireTag = WireTag {getWireTag = 16}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 5}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.Secret.m\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"Secret\"], baseName' = FName \"m\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 3}, wireTag = WireTag {getWireTag = 24}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 5}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.Secret.q\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"Secret\"], baseName' = FName \"q\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 4}, wireTag = WireTag {getWireTag = 32}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 3}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.Secret.seed\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"Secret\"], baseName' = FName \"seed\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 5}, wireTag = WireTag {getWireTag = 42}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 12}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.Secret.s\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"Secret\"], baseName' = FName \"s\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 6}, wireTag = WireTag {getWireTag = 50}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".RLWE.Rq\", haskellPrefix = [MName \"Crypto\",MName \"Proto\"], parentModule = [MName \"RLWE\"], baseName = MName \"Rq\"}), hsRawDefault = Nothing, hsDefault = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False}"+      "DescriptorInfo {descName = ProtoName {protobufName = FIName \".Challenges.Secret\", haskellPrefix = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule = [MName \"Challenges\"], baseName = MName \"Secret\"}, descFilePath = [\"Crypto\",\"Proto\",\"RLWE\",\"Challenges\",\"Secret.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.Secret.challengeID\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"Secret\"], baseName' = FName \"challengeID\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 1}, wireTag = WireTag {getWireTag = 8}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 5}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.Secret.instanceID\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"Secret\"], baseName' = FName \"instanceID\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 2}, wireTag = WireTag {getWireTag = 16}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 5}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.Secret.m\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"Secret\"], baseName' = FName \"m\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 3}, wireTag = WireTag {getWireTag = 24}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 5}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.Secret.q\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"Secret\"], baseName' = FName \"q\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 4}, wireTag = WireTag {getWireTag = 32}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 3}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.Secret.seed\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"Secret\"], baseName' = FName \"seed\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 5}, wireTag = WireTag {getWireTag = 42}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 12}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.Secret.s\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"Secret\"], baseName' = FName \"s\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 6}, wireTag = WireTag {getWireTag = 50}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".Lol.RqProduct\", haskellPrefix = [MName \"Crypto\",MName \"Proto\"], parentModule = [MName \"Lol\"], baseName = MName \"RqProduct\"}), hsRawDefault = Nothing, hsDefault = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False}"  instance P'.TextType Secret where   tellT = P'.tellSubMessage
+ Crypto/Proto/RLWE/Challenges/Secret1.hs view
@@ -0,0 +1,127 @@+{-# LANGUAGE BangPatterns, DeriveDataTypeable, DeriveGeneric, FlexibleInstances, MultiParamTypeClasses #-}+{-# OPTIONS_GHC  -fno-warn-unused-imports #-}+module Crypto.Proto.RLWE.Challenges.Secret1 (Secret1(..)) where+import Prelude ((+), (/))+import qualified Prelude as Prelude'+import qualified Data.Typeable as Prelude'+import qualified GHC.Generics as Prelude'+import qualified Data.Data as Prelude'+import qualified Text.ProtocolBuffers.Header as P'+import qualified Crypto.Proto.Lol.Rq1 as Lol (Rq1)++data Secret1 = Secret1{challengeID :: !(P'.Int32), instanceID :: !(P'.Int32), m :: !(P'.Int32), q :: !(P'.Int64),+                       seed :: !(P'.ByteString), s :: !(Lol.Rq1)}+             deriving (Prelude'.Show, Prelude'.Eq, Prelude'.Ord, Prelude'.Typeable, Prelude'.Data, Prelude'.Generic)++instance P'.Mergeable Secret1 where+  mergeAppend (Secret1 x'1 x'2 x'3 x'4 x'5 x'6) (Secret1 y'1 y'2 y'3 y'4 y'5 y'6)+   = Secret1 (P'.mergeAppend x'1 y'1) (P'.mergeAppend x'2 y'2) (P'.mergeAppend x'3 y'3) (P'.mergeAppend x'4 y'4)+      (P'.mergeAppend x'5 y'5)+      (P'.mergeAppend x'6 y'6)++instance P'.Default Secret1 where+  defaultValue = Secret1 P'.defaultValue P'.defaultValue P'.defaultValue P'.defaultValue P'.defaultValue P'.defaultValue++instance P'.Wire Secret1 where+  wireSize ft' self'@(Secret1 x'1 x'2 x'3 x'4 x'5 x'6)+   = case ft' of+       10 -> calc'Size+       11 -> P'.prependMessageSize calc'Size+       _ -> P'.wireSizeErr ft' self'+    where+        calc'Size+         = (P'.wireSizeReq 1 5 x'1 + P'.wireSizeReq 1 5 x'2 + P'.wireSizeReq 1 5 x'3 + P'.wireSizeReq 1 3 x'4 ++             P'.wireSizeReq 1 12 x'5+             + P'.wireSizeReq 1 11 x'6)+  wirePut ft' self'@(Secret1 x'1 x'2 x'3 x'4 x'5 x'6)+   = case ft' of+       10 -> put'Fields+       11 -> do+               P'.putSize (P'.wireSize 10 self')+               put'Fields+       _ -> P'.wirePutErr ft' self'+    where+        put'Fields+         = do+             P'.wirePutReq 8 5 x'1+             P'.wirePutReq 16 5 x'2+             P'.wirePutReq 24 5 x'3+             P'.wirePutReq 32 3 x'4+             P'.wirePutReq 42 12 x'5+             P'.wirePutReq 50 11 x'6+  wireGet ft'+   = case ft' of+       10 -> P'.getBareMessageWith update'Self+       11 -> P'.getMessageWith update'Self+       _ -> P'.wireGetErr ft'+    where+        update'Self wire'Tag old'Self+         = case wire'Tag of+             8 -> Prelude'.fmap (\ !new'Field -> old'Self{challengeID = new'Field}) (P'.wireGet 5)+             16 -> Prelude'.fmap (\ !new'Field -> old'Self{instanceID = new'Field}) (P'.wireGet 5)+             24 -> Prelude'.fmap (\ !new'Field -> old'Self{m = new'Field}) (P'.wireGet 5)+             32 -> Prelude'.fmap (\ !new'Field -> old'Self{q = new'Field}) (P'.wireGet 3)+             42 -> Prelude'.fmap (\ !new'Field -> old'Self{seed = new'Field}) (P'.wireGet 12)+             50 -> Prelude'.fmap (\ !new'Field -> old'Self{s = P'.mergeAppend (s old'Self) (new'Field)}) (P'.wireGet 11)+             _ -> let (field'Number, wire'Type) = P'.splitWireTag wire'Tag in P'.unknown field'Number wire'Type old'Self++instance P'.MessageAPI msg' (msg' -> Secret1) Secret1 where+  getVal m' f' = f' m'++instance P'.GPB Secret1++instance P'.ReflectDescriptor Secret1 where+  getMessageInfo _+   = P'.GetMessageInfo (P'.fromDistinctAscList [8, 16, 24, 32, 42, 50]) (P'.fromDistinctAscList [8, 16, 24, 32, 42, 50])+  reflectDescriptorInfo _+   = Prelude'.read+      "DescriptorInfo {descName = ProtoName {protobufName = FIName \".Challenges.Secret1\", haskellPrefix = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule = [MName \"Challenges\"], baseName = MName \"Secret1\"}, descFilePath = [\"Crypto\",\"Proto\",\"RLWE\",\"Challenges\",\"Secret1.hs\"], isGroup = False, fields = fromList [FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.Secret1.challengeID\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"Secret1\"], baseName' = FName \"challengeID\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 1}, wireTag = WireTag {getWireTag = 8}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 5}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.Secret1.instanceID\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"Secret1\"], baseName' = FName \"instanceID\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 2}, wireTag = WireTag {getWireTag = 16}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 5}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.Secret1.m\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"Secret1\"], baseName' = FName \"m\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 3}, wireTag = WireTag {getWireTag = 24}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 5}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.Secret1.q\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"Secret1\"], baseName' = FName \"q\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 4}, wireTag = WireTag {getWireTag = 32}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 3}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.Secret1.seed\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"Secret1\"], baseName' = FName \"seed\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 5}, wireTag = WireTag {getWireTag = 42}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 12}, typeName = Nothing, hsRawDefault = Nothing, hsDefault = Nothing},FieldInfo {fieldName = ProtoFName {protobufName' = FIName \".Challenges.Secret1.s\", haskellPrefix' = [MName \"Crypto\",MName \"Proto\",MName \"RLWE\"], parentModule' = [MName \"Challenges\",MName \"Secret1\"], baseName' = FName \"s\", baseNamePrefix' = \"\"}, fieldNumber = FieldId {getFieldId = 6}, wireTag = WireTag {getWireTag = 50}, packedTag = Nothing, wireTagLength = 1, isPacked = False, isRequired = True, canRepeat = False, mightPack = False, typeCode = FieldType {getFieldType = 11}, typeName = Just (ProtoName {protobufName = FIName \".Lol.Rq1\", haskellPrefix = [MName \"Crypto\",MName \"Proto\"], parentModule = [MName \"Lol\"], baseName = MName \"Rq1\"}), hsRawDefault = Nothing, hsDefault = Nothing}], descOneofs = fromList [], keys = fromList [], extRanges = [], knownKeys = fromList [], storeUnknown = False, lazyFields = False, makeLenses = False}"++instance P'.TextType Secret1 where+  tellT = P'.tellSubMessage+  getT = P'.getSubMessage++instance P'.TextMsg Secret1 where+  textPut msg+   = do+       P'.tellT "challengeID" (challengeID msg)+       P'.tellT "instanceID" (instanceID msg)+       P'.tellT "m" (m msg)+       P'.tellT "q" (q msg)+       P'.tellT "seed" (seed msg)+       P'.tellT "s" (s msg)+  textGet+   = do+       mods <- P'.sepEndBy (P'.choice [parse'challengeID, parse'instanceID, parse'm, parse'q, parse'seed, parse's]) P'.spaces+       Prelude'.return (Prelude'.foldl (\ v f -> f v) P'.defaultValue mods)+    where+        parse'challengeID+         = P'.try+            (do+               v <- P'.getT "challengeID"+               Prelude'.return (\ o -> o{challengeID = v}))+        parse'instanceID+         = P'.try+            (do+               v <- P'.getT "instanceID"+               Prelude'.return (\ o -> o{instanceID = v}))+        parse'm+         = P'.try+            (do+               v <- P'.getT "m"+               Prelude'.return (\ o -> o{m = v}))+        parse'q+         = P'.try+            (do+               v <- P'.getT "q"+               Prelude'.return (\ o -> o{q = v}))+        parse'seed+         = P'.try+            (do+               v <- P'.getT "seed"+               Prelude'.return (\ o -> o{seed = v}))+        parse's+         = P'.try+            (do+               v <- P'.getT "s"+               Prelude'.return (\ o -> o{s = v}))
+ Crypto/RLWE/Challenges/Beacon.hs view
@@ -0,0 +1,72 @@+{-|+Module      : Crypto.RLWE.Challenges.Beacon+Description : Utility functions for working with the NIST randomness beacon.+Copyright   : (c) Eric Crockett, 2011-2017+                  Chris Peikert, 2011-2017+License     : GPL-2+Maintainer  : ecrockett0@email.com+Stability   : experimental+Portability : POSIX++Utility functions for working with the+<http://www.nist.gov/itl/csd/ct/nist_beacon.cfm NIST Randomness+Beacon>.+-}++{-# LANGUAGE FlexibleContexts #-}++module Crypto.RLWE.Challenges.Beacon where++import Data.Int+import Data.Time.Calendar    (fromGregorian)+import Data.Time.Clock       (UTCTime (..), secondsToDiffTime)+import Data.Time.Clock.POSIX (utcTimeToPOSIXSeconds)+import Data.Time.LocalTime   (getCurrentTimeZone, timeZoneMinutes)++type BeaconEpoch = Int64+type BeaconOffset = Int32++-- | The number of bytes (@512 / 8 = 64@) per beacon.+bytesPerBeacon :: BeaconOffset+bytesPerBeacon = 64++-- | The number of seconds (@60@) between beacon outputs.+beaconInterval :: BeaconEpoch+beaconInterval = 60++-- | Represents a byte offset in a beacon output at a particular time.+data BeaconAddr = BA !BeaconEpoch !BeaconOffset deriving (Eq, Show)++-- | Tests whether a 'BeaconAddr' is valid or not.+validBeaconAddr :: BeaconAddr -> Bool+validBeaconAddr (BA epoch offset) =+  (epoch `mod` beaconInterval == 0) && offset >= 0 && offset < bytesPerBeacon++-- | Advances the beacon position by one byte, overflowing to the next+-- beacon if necessary.+nextBeaconAddr :: BeaconAddr -> BeaconAddr+nextBeaconAddr (BA time byteOffset) =+  if byteOffset == bytesPerBeacon-1+  then BA (time+beaconInterval) 0+  else BA time (byteOffset+1)++-- | The number of seconds elapsed from a given GMT time since the (GMT) epoch.+gmtDateToSeconds :: Int -> Int -> Integer -> Int -> Int -> Int+gmtDateToSeconds month day year hour minute |+  hour >= 0 && hour < 24 && minute >= 0 && minute < 60 =+    round $ utcTimeToPOSIXSeconds $+    UTCTime (fromGregorian year month day)+    (secondsToDiffTime $ fromIntegral $ 3600*hour+60*minute)+gmtDateToSeconds _ _ _ _ _ = error "invalid date to gmtDateToSeconds"++-- | The number of seconds elapsed from a given local time since the+-- (GMT) epoch.+localDateToSeconds :: Int -> Int -> Integer -> Int -> Int -> IO BeaconEpoch+localDateToSeconds month day year hour minute = do+  let gmt = gmtDateToSeconds month day year hour minute+  minuteOffset <- timeZoneMinutes <$> getCurrentTimeZone+  return $ fromIntegral $ gmt - (minuteOffset*60)++-- | Yield the largest beacon epoch that does not exceed the input.+beaconFloor :: BeaconEpoch -> BeaconEpoch+beaconFloor e = e - e `mod` beaconInterval
+ Crypto/RLWE/Challenges/Common.hs view
@@ -0,0 +1,183 @@+{-|+Module      : Crypto.RLWE.Challenges.Common+Description : Utility functions for handling exceptions and creating file paths.+Copyright   : (c) Eric Crockett, 2011-2017+                  Chris Peikert, 2011-2017+License     : GPL-2+Maintainer  : ecrockett0@email.com+Stability   : experimental+Portability : POSIX++Utility functions for handling exceptions and creating file paths.+-}++{-# LANGUAGE FlexibleContexts      #-}+{-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE RecordWildCards       #-}++module Crypto.RLWE.Challenges.Common where++import Crypto.RLWE.Challenges.Beacon++import           Crypto.Lol.Cyclotomic.Tensor.CPP+import           Crypto.Lol.Types     hiding (RRq)+import qualified Crypto.Lol.Types as RRq++import Crypto.Proto.RLWE.Challenges.Challenge+import Crypto.Proto.RLWE.Challenges.InstanceCont+import Crypto.Proto.RLWE.Challenges.InstanceDisc+import Crypto.Proto.RLWE.Challenges.InstanceRLWR+import Crypto.Proto.RLWE.Challenges.Secret++import Crypto.Random.DRBG++import Control.Monad.Except++import Data.ByteString.Lazy (unpack)+import Data.Int+import Data.Maybe++import Net.Beacon++import System.Console.ANSI+import System.Directory    (doesDirectoryExist, doesFileExist,+                            getDirectoryContents)+import System.FilePath     ((</>))++import Text.Printf++type ChallengeID = Int32+type InstanceID = Int32+type InstDRBG = GenBuffered CtrDRBG++-- | Concrete Tensor type used to generate and verify instances.+type T = CT++-- | Holds an (untyped) proto-buf Ring-LWE/LWR challenge.+data ChallengeU = CU !Challenge ![InstanceU]++-- | Holds an (untyped) proto-buf Ring-LWE/LWR instance.+data InstanceU = IC {secret :: !Secret, instc :: !InstanceCont}+               | ID {secret :: !Secret, instd :: !InstanceDisc}+               | IR {secret :: !Secret, instr :: !InstanceRLWR}++-- | Concrete type used to generate and verify instances+type Zq q = ZqBasic q Int64+-- | Concrete type used to generate and verify instances+type RRq q = RRq.RRq q Double++-- | Yield a list of challenge names by getting all directory contents+-- and filtering on all directories whose names start with "chall".+challengeList :: (MonadIO m) => FilePath -> m [String]+challengeList path = liftIO $ do+  challDirExists <- doesDirectoryExist path+  unless challDirExists $ error $ "Could not find " ++ path+  -- putStrLn $ "Reading challenges from \"" ++ challDir ++ "\""+  names <- filterM (doesDirectoryExist . (path </>)) =<<+    filter (("chall" ==) . take 5) <$> getDirectoryContents path+  when (null names) $ error "No challenges found."+  return names++-- | Do nothing if the file exists, otherwise throw an exception in the monad.+checkFileExists :: (MonadIO m, MonadError String m) => FilePath -> m ()+checkFileExists file = do+  fileExists <- liftIO $ doesFileExist file+  throwErrorUnless fileExists $+    "Error reading " ++ file ++ ": file does not exist."++-- | Parse the beacon time/offset used to reveal a challenge from a proto-buf stream.+parseBeaconAddr :: (MonadError String m) => Challenge -> m BeaconAddr+parseBeaconAddr Challenge{..} = do+  let ba = BA beaconEpoch beaconOffset+  -- validate the time and offset+  throwErrorUnless (validBeaconAddr ba) $ "Invalid beacon address: " ++ show ba+  return ba++-- | Yield the ID of the suppressed secret for a challenge, given a+-- beacon record and a byte offset.+suppressedSecretID :: InstanceID -> Record -> Int32 -> InstanceID+suppressedSecretID numInstances record byteOffset =+  let output = outputValue record+      byte = unpack output !! fromIntegral byteOffset+  in fromIntegral byte `mod` numInstances++-- * Directory Structure++-- | The root directory for challenges and their instances.+challengeFilesDir :: FilePath -> String -> FilePath+challengeFilesDir path name = path </> name++-- | The name for a challenge file is some string+-- with a .challenge extension.+challFilePath :: FilePath -> String -> FilePath+challFilePath path name = challengeFilesDir path name </> name ++ ".challenge"++-- | The name for an instance file is some string followed by a hex ID+-- with a .instance extension.+instFilePath :: FilePath -> String -> InstanceID -> FilePath+instFilePath path name instID = challengeFilesDir path name </> name ++ "-" +++  instIDString instID ++ ".instance"++-- | The name for a secret file is some string followed by a hex ID+-- with the .secret extension.+secretFilePath :: FilePath -> String -> InstanceID -> FilePath+secretFilePath path name instID = challengeFilesDir path name </> name ++ "-" +++  instIDString instID ++ ".secret"++-- | The name of a beacon XML file.+beaconFilePath :: FilePath -> BeaconEpoch -> FilePath+beaconFilePath path t = path </> "epoch-" ++ show t ++ ".xml"++-- | The filename for the NIST X509 certificate.+certFilePath :: FilePath -> FilePath+certFilePath path = path </> "beacon.cer"++-- | Hex representation of the instance ID.+instIDString :: InstanceID -> String+instIDString = printf "%02X"++-- * Functions for easy exceptions.++-- | Throw an error if the condition is 'True'.+throwErrorIf :: (MonadError String m) => Bool -> String -> m ()+throwErrorIf b = when b . throwError++-- | Throw an error if the condition is 'False'.+throwErrorUnless :: (MonadError String m) => Bool -> String -> m ()+throwErrorUnless b = unless b . throwError++-- | Throw an error if the input is 'Nothing'.+maybeThrowError :: (MonadError String m) => Maybe a -> String -> m a+maybeThrowError m str = do+  throwErrorIf (isNothing m) str+  return $ fromJust m++-- | Pretty printing of error messages.+printPassFailGeneric :: (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)+printPassFailGeneric failColor str pass e = do+  liftIO $ putStr str+  res <- runExceptT e+  case res of+    (Left st) -> do printANSI failColor st+                    return Nothing+    (Right a) -> do printANSI Green pass+                    return $ Just a++printPassFail, printPassWarn :: (MonadIO m)+  => String -> String -> ExceptT String m a -> m (Maybe a)+-- | Specialized version of 'printPassFailGeneric' that fails in red.+printPassFail = printPassFailGeneric Red+-- | Specialized version of 'printPassFailGeneric' that fails in yellow.+printPassWarn = printPassFailGeneric Yellow++-- | Print the input string in the specified color.+printANSI :: (MonadIO m) => Color -> String -> m ()+printANSI sgr str = liftIO $ do+  setSGR [SetColor Foreground Vivid sgr]+  putStrLn str+  setSGR [Reset]
+ Crypto/RLWE/Challenges/Generate.hs view
@@ -0,0 +1,215 @@+{-|+Module      : Crypto.RLWE.Challenges.Generate+Description : Generates challenges in non-legacy proto format.+Copyright   : (c) Eric Crockett, 2011-2017+                  Chris Peikert, 2011-2017+License     : GPL-2+Maintainer  : ecrockett0@email.com+Stability   : experimental+Portability : POSIX++Generates challenges in non-legacy proto format.+-}++{-# LANGUAGE FlexibleContexts      #-}+{-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE RebindableSyntax      #-}+{-# LANGUAGE RecordWildCards       #-}+{-# LANGUAGE ScopedTypeVariables   #-}++module Crypto.RLWE.Challenges.Generate+(generateMain,genChallengeU+,writeChallengeU+,instanceCont, instanceDisc, instanceRLWR) where++import Crypto.RLWE.Challenges.Beacon+import Crypto.RLWE.Challenges.Common+import Crypto.RLWE.Challenges.Params as P++import Crypto.Lol                 hiding (lift)+import Crypto.Lol.RLWE.Continuous as C+import Crypto.Lol.RLWE.Discrete   as D+import Crypto.Lol.RLWE.RLWR       as R+import Crypto.Lol.Types.Proto+import Crypto.Lol.Types.Random++import Crypto.Proto.RLWE.Challenges.Challenge+import Crypto.Proto.RLWE.Challenges.Challenge.Params+import Crypto.Proto.RLWE.Challenges.ContParams+import Crypto.Proto.RLWE.Challenges.DiscParams+import Crypto.Proto.RLWE.Challenges.InstanceCont+import Crypto.Proto.RLWE.Challenges.InstanceDisc+import Crypto.Proto.RLWE.Challenges.InstanceRLWR+import Crypto.Proto.RLWE.Challenges.RLWRParams+import Crypto.Proto.RLWE.Challenges.Secret           as S+import Crypto.Proto.RLWE.SampleCont+import Crypto.Proto.RLWE.SampleDisc+import Crypto.Proto.RLWE.SampleRLWR++import Crypto.Random.DRBG++import Control.Applicative+import Control.Monad+import Control.Monad.Except+import Control.Monad.Random++import qualified Data.ByteString.Lazy as BS+import           Data.Reflection      hiding (D)+import qualified Data.Tagged          as T++import System.Directory (createDirectoryIfMissing)++import Text.Printf++-- | Generate and serialize challenges given the path to the root of the tree+-- and an initial beacon address.+generateMain :: FilePath -> BeaconAddr -> [ChallengeParams] -> IO ()+generateMain path beaconStart cps = do+  let len = length cps+      beaconAddrs = take len $ iterate nextBeaconAddr beaconStart+  evalCryptoRandIO (zipWithM_ (genAndWriteChallenge path) cps beaconAddrs+    :: RandT (CryptoRand HashDRBG) IO ())++genAndWriteChallenge :: (MonadRandom m, MonadIO m)+  => FilePath -> ChallengeParams -> BeaconAddr -> m ()+genAndWriteChallenge path cp ba@(BA _ _) = do+  let name = challengeName cp+  liftIO $ putStrLn $ "Generating challenge " ++ name++  -- CJP: not printing warning because it's annoying to implement+  -- correctly: dont want to trust local time, don't want to rely on+  -- network when generating++  -- isAvail <- isBeaconAvailable t+  -- when isAvail $ printANSI Red "Beacon is already available!"++  chall <- genChallengeU cp ba+  liftIO $ writeChallengeU path name chall++-- | The name for each challenge directory.+challengeName :: ChallengeParams -> FilePath+challengeName params =+  "chall-id" ++ printf "%04d" (challID params) +++    case params of+      C{..} -> "-rlwec-m" ++ show m ++ "-q" ++ show q +++        "-l" ++ show (P.numSamples params) +++        if null annotation then "" else "-" ++ annotation+      D{..} -> "-rlwed-m" ++ show m ++ "-q" ++ show q +++        "-l" ++ show (P.numSamples params) +++        if null annotation then "" else "-" ++ annotation+      R{..} -> "-rlwr-m" ++ show m ++ "-q" ++ show q ++ "-p" ++ show p +++        "-l" ++ show (P.numSamples params) +++        if null annotation then "" else "-" ++ annotation++-- | Generate a challenge with the given parameters.+genChallengeU :: (MonadRandom m)+  => ChallengeParams -> BeaconAddr -> m ChallengeU+genChallengeU cp (BA beaconEpoch beaconOffset) = do+  let challengeID = challID cp+      params' = toProtoParams cp+      numInstances = P.numInstances cp+      numInsts = fromIntegral numInstances+      chall = Challenge{params=Just params',..}+      instIDs = take numInsts [0..]+      seedLen = T.proxy genSeedLength (Proxy::Proxy InstDRBG)+  seeds <- replicateM numInsts (BS.pack <$> replicateM seedLen getRandom)+  let insts = zipWith (genInstanceU params' challengeID) instIDs seeds+  return $ CU chall insts++-- | Generate an instance for the given parameters.+genInstanceU :: Params -> ChallengeID -> InstanceID -> BS.ByteString -> InstanceU++genInstanceU (Cparams params@ContParams{..}) challengeID instanceID seed =+  let (Right (g :: CryptoRand InstDRBG)) = newGen $ BS.toStrict seed+  in flip evalRand g $ reify q (\(_::Proxy q) ->+    reifyFactI (fromIntegral m) (\(_::proxy m) -> do+      (s', samples' :: [C.Sample T m (Zq q) (RRq q)]) <- instanceCont svar $ fromIntegral numSamples+      let s'' = Secret{s = toProto s', ..}+          samples = uncurry SampleCont <$> toProto samples'+      return $ IC s'' InstanceCont{..}))++genInstanceU (Dparams params@DiscParams{..}) challengeID instanceID seed =+  let (Right (g :: CryptoRand InstDRBG)) = newGen $ BS.toStrict seed+  in flip evalRand g $ reify q (\(_::Proxy q) ->+    reifyFactI (fromIntegral m) (\(_::proxy m) -> do+      (s', samples' :: [D.Sample T m (Zq q)]) <- instanceDisc svar $ fromIntegral numSamples+      let s'' = Secret{s = toProto s', ..}+          samples = uncurry SampleDisc <$> toProto samples'+      return $ ID s'' InstanceDisc{..}))++genInstanceU (Rparams params@RLWRParams{..}) challengeID instanceID seed =+  let (Right (g :: CryptoRand InstDRBG)) = newGen $ BS.toStrict seed+  in flip evalRand g $ reify q (\(_::Proxy q) -> reify p (\(_::Proxy p) ->+    reifyFactI (fromIntegral m) (\(_::proxy m) -> do+      (s', samples' :: [R.Sample T m (Zq q) (Zq p)]) <- instanceRLWR $ fromIntegral numSamples+      let s'' = Secret{s = toProto s', ..}+          samples = uncurry SampleRLWR <$> toProto samples'+      return $ IR s'' InstanceRLWR{..})))++-- | Convert the parsed 'ChallengeParams' into serializable 'Params'+toProtoParams :: ChallengeParams -> Params+toProtoParams C{..} =+  reifyFactI (fromIntegral m) (\(_::proxy m) ->+    let bound = proxy (C.errorBound svar eps) (Proxy::Proxy m)+    in Cparams ContParams {..})+toProtoParams D{..} =+  reifyFactI (fromIntegral m) (\(_::proxy m) ->+    let bound = proxy (D.errorBound svar eps) (Proxy::Proxy m)+    in Dparams DiscParams {..})+toProtoParams R{..} = Rparams RLWRParams {..}++-- | Writes a 'ChallengeU' to a file given a path to the root of the tree+-- and the name of the challenge.+writeChallengeU :: FilePath -> String -> ChallengeU -> IO ()+writeChallengeU path challName (CU c insts) = do+  let challDir = challengeFilesDir path challName+      challFN = challFilePath path challName+  createDirectoryIfMissing True challDir+  writeProtoType challFN c+  mapM_ (writeInstanceU path challName) insts++-- | Writes an 'InstanceU' to a file given a path to the root of the tree+-- and the name of the challenge.+writeInstanceU :: FilePath -> String -> InstanceU -> IO ()+writeInstanceU path challName iu = do+  let s = secret iu+      idx = S.instanceID s+      instFN = instFilePath path challName idx+      secretFN = secretFilePath path challName idx+  case iu of+    (IC _ inst) -> writeProtoType instFN inst+    (ID _ inst) -> writeProtoType instFN inst+    (IR _ inst) -> writeProtoType instFN inst+  writeProtoType secretFN s++-- | Generate a continuous RLWE instance along with its (uniformly+-- random) secret, using the given scaled variance and number of+-- desired samples.+instanceCont :: (C.RLWECtx t m zq rrq, Random zq, Random (LiftOf rrq),+                 OrdFloat (LiftOf rrq), MonadRandom rnd, ToRational v)+  => v -> Int -> rnd (Cyc t m zq, [C.Sample t m zq rrq])+instanceCont svar num = do+  s <- getRandom+  samples <- replicateM num $ C.sample svar s+  return (s, samples)++-- | Generate a discrete RLWE instance along with its (uniformly+-- random) secret, using the given scaled variance and number of+-- desired samples.+instanceDisc :: (D.RLWECtx t m zq, Random zq, MonadRandom rnd, ToRational v)+  => v -> Int -> rnd (Cyc t m zq, [D.Sample t m zq])+instanceDisc svar num = do+  s <- getRandom+  samples <- replicateM num $ D.sample svar s+  return (s, samples)++-- | Generate a discrete RLWR instance along with its (uniformly+-- random) secret, using the given scaled variance and number of+-- desired samples.+instanceRLWR :: (R.RLWRCtx t m zq zp, Random zq, MonadRandom rnd)+  => Int -> rnd (Cyc t m zq, [R.Sample t m zq zp])+instanceRLWR num = do+  s <- getRandom+  samples <- replicateM num $ R.sample s+  return (s, samples)+
+ Crypto/RLWE/Challenges/Params.hs view
@@ -0,0 +1,165 @@+{-|+Module      : Crypto.RLWE.Challenges.Params+Description : Parser for a list of challenge parameters.+Copyright   : (c) Eric Crockett, 2011-2017+                  Chris Peikert, 2011-2017+License     : GPL-2+Maintainer  : ecrockett0@email.com+Stability   : experimental+Portability : POSIX++Parser for a list of challenge parameters.+-}++{-# LANGUAGE FlexibleContexts      #-}+{-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE RecordWildCards       #-}++module Crypto.RLWE.Challenges.Params+(ChallengeParams(..)+,epsDef+,parseChallParams) where++import Crypto.RLWE.Challenges.Common (ChallengeID, InstanceID)++import Control.Applicative  hiding ((<|>))+import Control.Monad.Except+import Data.Int+import Prelude              hiding (lex)+import Text.Parsec+import Text.Parsec.Token++-- | Information to generate a challenge.+data ChallengeParams =+    C { challID :: ChallengeID,     -- ^ Challenge ID+        m :: Int32,                 -- ^ Cyclotomic index of the challenge+        q :: Int64,                 -- ^ Modulus of the challenge+        svar :: Double,             -- ^ Scaled variance used to generate the error term.+        numSamples :: Int32,        -- ^ Number of RLWE samples per instance.+        numInstances :: InstanceID, -- ^ Number of RLWE instances per challenge.+        eps :: Double,              -- ^ \(\epsilon\) used to comput the error bound.+        annotation :: String }      -- ^ String associated with this challenge.+  | D { challID :: ChallengeID,     -- ^ Challenge ID+        m :: Int32,                 -- ^ Cyclotomic index of the challenge+        q :: Int64,                 -- ^ Modulus of the challenge+        svar :: Double,             -- ^ Scaled variance used to generate the error term.+        numSamples :: Int32,        -- ^ Number of RLWE samples per instance.+        numInstances :: InstanceID, -- ^ Number of RLWE instances per challenge.+        eps :: Double,              -- ^ \(\epsilon\) used to comput the error bound.+        annotation :: String }      -- ^ String associated with this challenge.+  | R { challID :: ChallengeID,     -- ^ Challenge ID+        m :: Int32,                 -- ^ Cyclotomic index of the challenge+        q :: Int64,                 -- ^ Initial modulus+        p :: Int64,                 -- ^ Rounding modulus+        numSamples :: Int32,        -- ^ Number of RLWR samples per instance.+        numInstances :: InstanceID, -- ^ Number of RLWR instances per challenge.+        annotation :: String }      -- ^ String associated with this challenge.+  deriving (Show)++contLineID, discLineID, rlwrLineID :: String+contLineID = "Cont"+discLineID = "Disc"+rlwrLineID = "RLWR"++-- | Default probability \(\epsilon\) to use, for computing the RLWE error bound.+epsDef :: Double+epsDef = 2 ** (-25)++lang :: (Stream s m Char) => GenLanguageDef s u m+lang = LanguageDef+  {commentStart = "/*",+   commentEnd = "*/",+   commentLine = "--",+   nestedComments = True,+   identStart = letter,+   identLetter = letter,+   opStart = letter,+   opLetter = letter,+   reservedNames = [],+   reservedOpNames = [],+   caseSensitive = True}++-- applies `p` zero or more times, stopping when it reaches EOF+-- if an error occurs, it stops parsing and reports the error+manyError :: (Stream s m Char) => ParsecT s u m a -> ParsecT s u m [a]+manyError p = try (eof *> return []) <|> liftA2 (:) p (manyError p)++lex :: (Stream s m Char) => ParsecT s u m a -> ParsecT s u m a+lex = lexeme langParser++langParser :: (Stream s m Char) => GenTokenParser s u m+langParser = makeTokenParser lang++parseIntegral :: (Integral i, Stream s m Char) => ParsecT s u m i+parseIntegral = fromIntegral <$> lex (natural langParser)++parseDouble :: (Stream s m Char) => ParsecT s u m Double+parseDouble = lex $ float langParser++parseString :: (Stream s m Char) => ParsecT s u m String+parseString = lex $ stringLiteral langParser++parseWord ::  (Stream s m Char) => String -> ParsecT s u m ()+parseWord = lex . void . try . string++paramsFile :: (MonadError String m, Stream s m Char) => ParsecT s InstanceID m [ChallengeParams]+paramsFile = do+  whiteSpace langParser -- skip leading whitespace+  manyError line++line :: (MonadError String m, Stream s m Char) => ParsecT s InstanceID m ChallengeParams+line = try rlwecParams <|> try rlwedParams <|> try rlwrParams <?> "Expected one of '" +++  show contLineID ++ "', '" +++  show discLineID ++ "', or '" +++  show rlwrLineID ++ "'."++rlwecParams, rlwedParams, rlwrParams ::+  (MonadError String m, Stream s m Char) => ParsecT s InstanceID m ChallengeParams+rlwecParams = do+  challID <- parseIntegral+  parseWord contLineID+  m <- parseIntegral+  q <- parseIntegral+  svar <- parseDouble+  numSamples <- parseIntegral+  annotation <- parseString++  numInstances <- getState+  let eps = epsDef+  return C{..}++rlwedParams = do+  challID <- parseIntegral+  parseWord discLineID+  m <- parseIntegral+  q <- parseIntegral+  svar <- parseDouble+  numSamples <- parseIntegral+  annotation <- parseString++  numInstances <- getState+  let eps = epsDef+  return D{..}++rlwrParams = do+  challID <- parseIntegral+  parseWord rlwrLineID+  m <- parseIntegral+  q <- parseIntegral+  p <- parseIntegral+  numSamples <- parseIntegral+  annotation <- parseString++  numInstances <- getState+  when (p > q) $ throwError $+    "Expected p <= q; parsed q=" ++ show q ++ " and p=" ++ show p+  return R{..}++parseChallParams :: String -> InstanceID -> [ChallengeParams]+parseChallParams input numInsts = do+  let output = runExcept $ runParserT paramsFile numInsts "" input+  case output of+    Left e -> error $ "Invalid parameters: " ++ e+    Right r -> case r of+      Left e -> error $ "Error parsing input:" ++ show e+      Right v -> v
+ Crypto/RLWE/Challenges/Suppress.hs view
@@ -0,0 +1,132 @@+{-|+Module      : Crypto.RLWE.Challenges.Suppress+Description : Suppress a secret from a challenge.+Copyright   : (c) Eric Crockett, 2011-2017+                  Chris Peikert, 2011-2017+License     : GPL-2+Maintainer  : ecrockett0@email.com+Stability   : experimental+Portability : POSIX++Suppresses the instance secret for the official challenge instance.+-}++{-# LANGUAGE FlexibleContexts #-}++module Crypto.RLWE.Challenges.Suppress+(suppressMain, getNistCert, writeBeaconXML, suppressChallenge) where++import Crypto.RLWE.Challenges.Beacon+import Crypto.RLWE.Challenges.Common++import Control.Exception (try)+import Control.Monad.Except+import Control.Monad.State++import Crypto.Lol.Types.Proto+import Crypto.Proto.RLWE.Challenges.Challenge++import Data.ByteString.Lazy (writeFile)+import Data.ByteString.Char8 (unpack)+import Data.Maybe (isNothing)+import Data.Time.Clock.POSIX++import Data.Map             (Map, empty, insert, lookup)++import Net.Beacon+import Network.HTTP.Client hiding (path)+import Network.HTTP.Conduit (simpleHttp)++import Prelude hiding (lookup, writeFile)++import System.Directory (removeFile)+import System.Exit++-- | Deletes the secret indicated by NIST beacon for each challenge in+-- the tree, given the path to the root of the tree.+suppressMain :: FilePath -> IO ()+suppressMain path = do+  -- get list of challenges+  challs <- challengeList path++  -- suppress a secret from each challenge, collecting beacon records as we go+  recs <- flip execStateT empty $ mapM_ (suppressChallenge path) challs++  -- write all beacon records+  mapM_ (writeBeaconXML path) recs++  -- write the NIST certificate+  getNistCert path++-- | A map from beacon times to beacon records.+type RecordState = Map BeaconEpoch Record++-- | Lookup the secret index based on the randomness for this challenge,+-- then remove the corresponding secret.+suppressChallenge :: (MonadIO m, MonadState RecordState m)+                     => FilePath -> String -> m ()+suppressChallenge path name = do+  x <- printPassFail ("Deleting secret for challenge " ++ name ++ ":\n") "DONE" $ do+    -- read the beacon address of the randomness for this challenge+    let challFN = challFilePath path name+    challProto <- readProtoType challFN+    (BA time offset) <- parseBeaconAddr challProto+    let numInsts = fromIntegral $ numInstances challProto++    -- get the record, and compute the secret index+    rec <- retrieveRecord time+    let secID = suppressedSecretID numInsts rec offset+        secFile = secretFilePath path name secID++    -- delete the secret corresponding to the secret index+    checkFileExists secFile+    liftIO $ putStr $ "\tRemoving " ++ secFile ++ "\n\t"+    liftIO $ removeFile secFile+  when (isNothing x) $ liftIO $ die "To avoid publishing all instance secrets, we are dying early."+  return ()++-- | Attempt to find the record in the state, otherwise download it from NIST.+retrieveRecord :: (MonadIO m, MonadError String m, MonadState RecordState m)+                  => BeaconEpoch -> m Record+retrieveRecord t = do+  mrec <- gets (lookup t)+  case mrec of+    (Just r) -> return r+    Nothing -> do+      liftIO $ putStrLn $ "\tDownloading record " ++ show t+      trec <- liftIO $ try $ getCurrentRecord $ fromIntegral t+      rec <- case trec of+               Left e -> catchHttpException t e+               Right a -> return a+      rec' <- maybeThrowError rec $ "Couldn't parse XML for beacon at time " ++ show t+      modify (insert t rec')+      return rec'++catchHttpException :: (MonadIO m, MonadError String m)+  => BeaconEpoch -> HttpException -> m a+catchHttpException t (HttpExceptionRequest _ (StatusCodeException _ s)) = do+  currTime <- round <$> (liftIO getPOSIXTime)+  throwError $ case currTime < t of+    True -> "You are requesting a beacon that doesn't exist yet.\n" +++            "Wait another " ++ show (t-currTime) ++ " seconds and try again."+    False -> "The beacon you are requesting should be available, " +++             "but it just isn't there:\n" ++ unpack s+catchHttpException _ (HttpExceptionRequest _ (ConnectionFailure _)) =+  throwError "Failed to connect to NIST servers. They might be down for maintenance."+catchHttpException _ _ =+  throwError "An unexpected IO error occurred while downloading the beacon."++-- | Writes a beacon record to a file.+writeBeaconXML :: (MonadIO m) => FilePath -> Record -> m ()+writeBeaconXML path rec = do+  let beacon = toXML rec+      filePath = beaconFilePath path $ fromIntegral $ timeStamp rec+  liftIO $ writeFile filePath beacon++-- | Downloads the NIST certificate and saves it.+getNistCert :: (MonadIO m) => FilePath -> m ()+getNistCert path = liftIO $ do+  let certPath = certFilePath path+  putStrLn $ "Writing NIST certificate to " ++ certPath+  bs <- simpleHttp "https://beacon.nist.gov/certificate/beacon.cer"+  writeFile certPath bs
+ Crypto/RLWE/Challenges/Verify.hs view
@@ -0,0 +1,356 @@+{-|+Module      : Crypto.RLWE.Challenges.Verify+Description : Verify generated challenges.+Copyright   : (c) Eric Crockett, 2011-2017+                  Chris Peikert, 2011-2017+License     : GPL-2+Maintainer  : ecrockett0@email.com+Stability   : experimental+Portability : POSIX++Verify RLWE/RLWR challenges to ensure that challenges are generated faithfully.+-}++{-# LANGUAGE FlexibleContexts      #-}+{-# LANGUAGE GADTs                 #-}+{-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE PartialTypeSignatures #-}+{-# LANGUAGE RebindableSyntax      #-}+{-# LANGUAGE NamedFieldPuns            #-}+{-# LANGUAGE RecordWildCards       #-}+{-# LANGUAGE ScopedTypeVariables   #-}++{-# OPTIONS_GHC -fno-warn-partial-type-signatures #-}++module Crypto.RLWE.Challenges.Verify+(verifyMain, verifyInstanceU+,readChallenge, regenChallenge+,beaconAvailable, readBeacon) where++import Crypto.RLWE.Challenges.Beacon+import Crypto.RLWE.Challenges.Common+import Crypto.RLWE.Challenges.Generate++import           Crypto.Lol+import           Crypto.Lol.Cyclotomic.UCyc+import qualified Crypto.Lol.RLWE.RLWR        as R+import qualified Crypto.Lol.RLWE.Continuous as C+import qualified Crypto.Lol.RLWE.Discrete   as D+import           Crypto.Lol.Types.Proto+import           Crypto.Lol.Types.Random++import Crypto.Proto.RLWE.Challenges.Challenge+import Crypto.Proto.RLWE.Challenges.Challenge.Params+import Crypto.Proto.RLWE.Challenges.ContParams+import Crypto.Proto.RLWE.Challenges.DiscParams+import Crypto.Proto.RLWE.Challenges.InstanceCont+import Crypto.Proto.RLWE.Challenges.InstanceDisc+import Crypto.Proto.RLWE.Challenges.InstanceRLWR+import Crypto.Proto.RLWE.Challenges.InstanceCont1+import Crypto.Proto.RLWE.Challenges.InstanceDisc1+import Crypto.Proto.RLWE.Challenges.InstanceRLWR1+import Crypto.Proto.RLWE.Challenges.RLWRParams+import Crypto.Proto.RLWE.Challenges.Secret+import Crypto.Proto.RLWE.Challenges.Secret1++import Crypto.Proto.Lol.KqProduct+import Crypto.Proto.Lol.RqProduct+import Crypto.Proto.RLWE.SampleCont1+import Crypto.Proto.RLWE.SampleDisc1+import Crypto.Proto.RLWE.SampleRLWR1+import Crypto.Proto.RLWE.SampleCont+import Crypto.Proto.RLWE.SampleDisc+import Crypto.Proto.RLWE.SampleRLWR++import Crypto.Random.DRBG++import           Control.Applicative+import           Control.Monad.Except hiding (lift)+import           Control.Monad.Random hiding (lift)+import qualified Data.ByteString.Lazy as BS+import           Data.Int+import           Data.List            (nub)+import           Data.Maybe+import           Data.Reflection      hiding (D)+import           Data.Sequence        (singleton)+import qualified Data.Tagged          as T++import Net.Beacon++import System.Console.ANSI+import System.Directory    (doesFileExist)++-- | Verifies all instances in the challenge tree, given the path to the+-- root of the tree.+verifyMain :: FilePath -> IO ()+verifyMain path = do+  -- get a list of challenges to reveal+  challNames <- challengeList path++  beaconAddrs <- sequence <$> mapM (readAndVerifyChallenge path) challNames++  -- verify that all beacon addresses are distinct+  case beaconAddrs of+    (Just addrs) -> do+      _ <- printPassFail "Checking for distinct beacon addresses... " "DISTINCT"+        $ throwErrorIf (length (nub addrs) /= length addrs) "NOT DISTINCT"+      putStrLn "\nAttempting to regenerate challenges from random seeds. This will take awhile..."+      regens <- sequence <$> mapM (regenChallenge path) challNames+      when (isNothing regens) $ printANSI Yellow "NOTE: one or more instances could not be\n \+        \regenerated from the provided PRG seed. This is NON-FATAL,\n \+        \and is likely due to the use of a different compiler/platform\n \+        \than the one used to generate the challenges."+    Nothing -> return ()++-- | Reads a challenge and verifies all instances.+-- Returns the beacon address for the challenge.+readAndVerifyChallenge :: (MonadIO m)+  => FilePath -> String -> m (Maybe BeaconAddr)+readAndVerifyChallenge path challName =+  printPassFail ("Verifying " ++ challName) "VERIFIED" $ do+    (ba, insts) <- readChallenge path challName+    mapM_ verifyInstanceU insts+    return ba++-- | Reads a challenge and attempts to regenerate all instances from the+-- provided seed.+-- Returns (Just ()) if regeneration succeeded for all instances.+regenChallenge :: (MonadIO m)+  => FilePath -> String -> m (Maybe ())+regenChallenge path challName = do+  printPassWarn ("Regenerating " ++ challName ++ "... ") "VERIFIED" $ do+    (_, insts) <- readChallenge path challName+    regens <- mapM regenInstance insts+    unless (and regens) $ throwError "UNSUCCESSFUL"++-- | Read a challenge from a file, outputting the beacon address and a+-- list of instances to be verified.+readChallenge :: (MonadIO m, MonadError String m)+  => FilePath -> String -> m (BeaconAddr, [InstanceU])+readChallenge path challName = do+  let challFile = challFilePath path challName+  c <- readProtoType challFile+  isAvail <- beaconAvailable path $ beaconEpoch c++  let (msg, readChall) =+        if isAvail+        then (" (expecting one missing secret)... ",+              readSuppChallenge)+        else (" (expecting all secrets)... ",+              readFullChallenge)++  liftIO $ putStr msg+  _ <- parseBeaconAddr c -- verify that the beacon address is valid+  readChall path challName c++-- | Whether we have an XML file for the beacon at the given epoch.+beaconAvailable :: (MonadIO m) => FilePath -> BeaconEpoch -> m Bool+beaconAvailable path = liftIO . doesFileExist . beaconFilePath path++readSuppChallenge, readFullChallenge :: (MonadIO m, MonadError String m)+  => FilePath -> String -> Challenge -> m (BeaconAddr, [InstanceU])++readSuppChallenge path challName Challenge{..} = do+  let numInsts' = fromIntegral numInstances+  beacon <- readBeacon path beaconEpoch+  let deletedID = suppressedSecretID numInstances beacon beaconOffset+  let delSecretFile = secretFilePath path challName deletedID+  delSecretExists <- liftIO $ doesFileExist delSecretFile+  throwErrorIf delSecretExists $+    "Secret " ++ show deletedID +++    " should not exist, but it does! You may need to run the 'suppress' command."+  throwErrorUnless (isJust params) $ "Challenge " ++ challName ++ " does not contain parameters."+  insts <- mapM (readInstanceU (fromJust params) path challName challengeID) $+    filter (/= deletedID) $ take numInsts' [0..]+  checkParamsEq challName "numInstances" (numInsts'-1) (length insts)+  return (BA beaconEpoch beaconOffset, insts)++readFullChallenge path challName Challenge{..} = do+  let numInsts' = fromIntegral numInstances+  throwErrorUnless (isJust params) $ "Challenge " ++ challName ++ " does not contain parameters."+  insts <- mapM (readInstanceU (fromJust params) path challName challengeID) $ take numInsts' [0..]+  checkParamsEq challName "numInstances" numInsts' (length insts)+  return (BA beaconEpoch beaconOffset, insts)++validateSecret :: (MonadError String m)+  => String -> ChallengeID -> InstanceID -> Int32 -> Int64 -> Secret -> m ()+validateSecret sfile cid iid m q (Secret cid' iid' m' q' seed _) = do+  checkParamsEq sfile "challID" cid cid'+  checkParamsEq sfile "instID" iid iid'+  checkParamsEq sfile "m" m m'+  checkParamsEq sfile "q" q q'+  let minSeedLen = fromIntegral $ T.proxy genSeedLength (Proxy::Proxy InstDRBG)+      seedLen = length $ BS.unpack seed+  throwErrorIf (seedLen < minSeedLen) $ "Seed length is too short! Expected at least " +++    show minSeedLen ++ " bytes, but only found " ++ show seedLen ++ " bytes."++validateInstance :: (MonadError String m)+  => String -> ChallengeID -> InstanceID -> Params+            -> ChallengeID -> InstanceID -> Params -> m ()+validateInstance instFile cid iid params cid' iid' params' = do+  checkParamsEq instFile "challID" cid cid'+  checkParamsEq instFile "instID" iid iid'+  checkParamsEq instFile "params" params params'++-- | Read an 'InstanceU' from a file. Attempts to read in legacy proto format+-- first, then new proto format.+readInstanceU :: (MonadIO m, MonadError String m)+                 => Params -> FilePath -> String+                 -> ChallengeID -> InstanceID -> m InstanceU+readInstanceU params' path challName cid iid = do+  let secFile = secretFilePath path challName iid+  s <- catchError+         (readProtoType secFile >>= \Secret1{..} -> return Secret{s=RqProduct $ singleton s,..})+         (\_->readProtoType secFile)+  let instFile = instFilePath path challName iid+  case params' of+    (Cparams ContParams{..}) -> do+      inst@(InstanceCont cid' iid' iparams _) <- catchError+        (readProtoType instFile >>= \InstanceCont1{..} ->+          return $ InstanceCont{samples=updateLegacySampleCont<$>samples,..})+        (\_->readProtoType instFile)+      validateSecret secFile cid iid m q s+      validateInstance instFile cid iid params' cid' iid' (Cparams iparams)+      return $ IC s inst+    (Dparams DiscParams{..}) -> do+      inst@(InstanceDisc cid' iid' iparams _) <- catchError+        (readProtoType instFile >>= \InstanceDisc1{..} ->+          return InstanceDisc{samples=updateLegacySampleDisc<$>samples,..})+        (\_->readProtoType instFile)+      validateSecret secFile cid iid m q s+      validateInstance instFile cid iid params' cid' iid' (Dparams iparams)+      return $ ID s inst+    (Rparams RLWRParams{..}) -> do+      inst@(InstanceRLWR cid' iid' iparams _) <- catchError+        (readProtoType instFile >>= \InstanceRLWR1{..} ->+          return InstanceRLWR{samples=updateLegacySampleRLWR<$>samples,..})+        (\_->readProtoType instFile)+      validateSecret secFile cid iid m q s+      validateInstance instFile cid iid params' cid' iid' (Rparams iparams)+      return $ IR s inst++updateLegacySampleCont :: SampleCont1 -> SampleCont+updateLegacySampleCont SampleCont1{..} = SampleCont{a = RqProduct $ singleton a, b = KqProduct $ singleton b}++updateLegacySampleDisc :: SampleDisc1 -> SampleDisc+updateLegacySampleDisc SampleDisc1{..} = SampleDisc{a = RqProduct $ singleton a, b = RqProduct $ singleton b}++updateLegacySampleRLWR :: SampleRLWR1 -> SampleRLWR+updateLegacySampleRLWR SampleRLWR1{..} = SampleRLWR{a = RqProduct $ singleton a, b = RqProduct $ singleton b}++checkParamsEq :: (MonadError String m, Show a, Eq a)+  => String -> String -> a -> a -> m ()+checkParamsEq data' param expected actual =+  throwErrorUnless (expected == actual) $ "Error while reading " +++    data' ++ ": " ++ param ++ " mismatch. Expected " +++    show expected ++ " but got " ++ show actual++-- | Outputs whether or not we successfully regenerated this instance from the DRBG seed.+regenInstance :: (MonadError String m) => InstanceU -> m Bool+-- as always with floating point arithmetic, nothing is perfect (even+-- deterministic generation of instances).+-- the secret and a_i are discrete, so they should match exactly.+-- the b_i shouldn't be too far off.+regenInstance (IC (Secret _ _ _ _ seed s) InstanceCont{..}) =+  let ContParams {..} = params+      (Right (g :: CryptoRand InstDRBG)) = newGen $ BS.toStrict seed+  in reifyFactI (fromIntegral m) (\(_::proxy m) ->+      reify (fromIntegral q :: Int64) (\(_::Proxy q) -> do+        let (expectedS, expectedSamples :: [C.Sample T m (Zq q) (RRq q)]) =+              flip evalRand g $ instanceCont svar (fromIntegral numSamples)+            csampleEq (a,b) (a',b') =+              (a == a') && maximum (fmapDec abs $ lift $ b-b') < 2 ^- (-20)+        s' :: Cyc T m (Zq q) <- fromProto s+        samples' :: [C.Sample _ _ _ (RRq q)] <- fromProto $+          fmap (\(SampleCont a b) -> (a,b)) samples+        return $ (expectedS == s') && (and $ zipWith csampleEq expectedSamples samples')))++regenInstance (ID (Secret _ _ _ _ seed s) InstanceDisc{..}) =+  let DiscParams {..} = params+  in reifyFactI (fromIntegral m) (\(_::proxy m) ->+    reify (fromIntegral q :: Int64) (\(_::Proxy q) -> do+      g :: CryptoRand InstDRBG <- either (throwError . show) return $ newGen $ BS.toStrict seed+      let (expectedS, expectedSamples :: [D.Sample T m (Zq q)]) =+            flip evalRand g $ instanceDisc svar (fromIntegral numSamples)+      s' :: Cyc T m (Zq q) <- fromProto s+      samples' <- fromProto $ fmap (\(SampleDisc a b) -> (a,b)) samples+      return $ (expectedS == s') && (expectedSamples == samples')))++regenInstance (IR (Secret _ _ _ _ seed s) InstanceRLWR{..}) =+  let RLWRParams {..} = params+  in reifyFactI (fromIntegral m) (\(_::proxy m) ->+    reify (fromIntegral q :: Int64) (\(_::Proxy q) ->+      reify (fromIntegral p :: Int64) (\(_::Proxy p) -> do+        g :: CryptoRand InstDRBG <- either (throwError . show) return $ newGen $ BS.toStrict seed+        let (expectedS, expectedSamples :: [R.Sample T m (Zq q) (Zq p)]) =+              flip evalRand g $ instanceRLWR (fromIntegral numSamples)+        s' :: Cyc T m (Zq q) <- fromProto s+        samples' :: [R.Sample _ _ _ (Zq p)] <- fromProto $+          fmap (\(SampleRLWR a b) -> (a,b)) samples+        return $ (expectedS == s') && (expectedSamples == samples'))))+++-- | Verify an 'InstanceU'.+verifyInstanceU :: (MonadError String m) => InstanceU -> m ()++verifyInstanceU (IC (Secret _ _ _ _ _ s) InstanceCont{..}) =+  let ContParams {..} = params+  in reifyFactI (fromIntegral m) (\(_::proxy m) ->+    reify (fromIntegral q :: Int64) (\(_::Proxy q) -> do+      s' :: Cyc T m (Zq q) <- fromProto s+      samples' :: [C.Sample _ _ _ (RRq q)] <- fromProto $+        fmap (\(SampleCont a b) -> (a,b)) samples+      throwErrorUnless (validInstanceCont bound s' samples')+        "A continuous RLWE sample exceeded the error bound."))++verifyInstanceU (ID (Secret _ _ _ _ _ s) InstanceDisc{..}) =+  let DiscParams {..} = params+  in reifyFactI (fromIntegral m) (\(_::proxy m) ->+    reify (fromIntegral q :: Int64) (\(_::Proxy q) -> do+      s' :: Cyc T m (Zq q) <- fromProto s+      samples' <- fromProto $ fmap (\(SampleDisc a b) -> (a,b)) samples+      throwErrorUnless (validInstanceDisc bound s' samples')+        "A discrete RLWE sample exceeded the error bound."))++verifyInstanceU (IR (Secret _ _ _ _ _ s) InstanceRLWR{..}) =+  let RLWRParams {..} = params+  in reifyFactI (fromIntegral m) (\(_::proxy m) ->+    reify (fromIntegral q :: Int64) (\(_::Proxy q) ->+      reify (fromIntegral p :: Int64) (\(_::Proxy p) -> do+        s' :: Cyc T m (Zq q) <- fromProto s+        samples' :: [R.Sample _ _ _ (Zq p)] <- fromProto $+          fmap (\(SampleRLWR a b) -> (a,b)) samples+        throwErrorUnless (validInstanceRLWR s' samples')+          "An RLWR sample was invalid.")))++-- | Read an XML file for the beacon corresponding to the provided time.+readBeacon :: (MonadIO m, MonadError String m)+              => FilePath -> BeaconEpoch -> m Record+readBeacon path time = do+  let file = beaconFilePath path time+  checkFileExists file+  rec' <- liftIO $ fromXML <$> BS.readFile file+  maybeThrowError rec' $ "Could not parse " ++ file++-- | Test if the 'gSqNorm' of the error for each RLWE sample in the+-- instance (given the secret) is less than the given bound.+validInstanceCont ::+  (C.RLWECtx t m zq rrq, Ord (LiftOf rrq), Ring (LiftOf rrq))+  => LiftOf rrq -> Cyc t m zq -> [C.Sample t m zq rrq] -> Bool+validInstanceCont bound s = all ((bound > ) . C.errorGSqNorm s)++-- | Test if the 'gSqNorm' of the error for each RLWE sample in the+-- instance (given the secret) is less than the given bound.+validInstanceDisc :: (D.RLWECtx t m zq)+                     => LiftOf zq -> Cyc t m zq -> [D.Sample t m zq] -> Bool+validInstanceDisc bound s = all ((bound > ) . D.errorGSqNorm s)++-- | Test if the given RLWR instance is valid for the given secret.+validInstanceRLWR :: (R.RLWRCtx t m zq zp, Eq zp)+  => Cyc t m zq -> [R.Sample t m zq zp] -> Bool+validInstanceRLWR s = let s' = adviseCRT s in all (validSampleRLWR s')++-- | Test if the given RLWR sample is valid for the given secret.+validSampleRLWR :: (R.RLWRCtx t m zq zp, Eq zp)+  => Cyc t m zq -> R.Sample t m zq zp -> Bool+validSampleRLWR s (a,b) = b == R.roundedProd s a
README view
@@ -1,2 +1,4 @@  This package contains code to generate and verify the RLWE challenges. It also contains one of the protobuf files needed to read the serialized challenges. The proto file can be used with any language with an implementation of protocol-buffers.++The library only contains files generated by hprotoc; the executable contains the code to generate, suppress, and verify challenges.
− exec/Beacon.hs
@@ -1,60 +0,0 @@-{-# LANGUAGE FlexibleContexts #-}---- | Utility functions for working with the--- <http://www.nist.gov/itl/csd/ct/nist_beacon.cfm NIST Randomness--- Beacon>.--module Beacon where--import Data.Int-import Data.Time.Calendar    (fromGregorian)-import Data.Time.Clock       (UTCTime (..), secondsToDiffTime)-import Data.Time.Clock.POSIX (utcTimeToPOSIXSeconds)-import Data.Time.LocalTime   (getCurrentTimeZone, timeZoneMinutes)--type BeaconEpoch = Int64-type BeaconOffset = Int32---- | The number of bytes (@512 / 8 = 64@) per beacon.-bytesPerBeacon :: BeaconOffset-bytesPerBeacon = 64---- | The number of seconds (@60@) between beacon outputs.-beaconInterval :: BeaconEpoch-beaconInterval = 60---- | Represents a byte offset in a beacon output at a particular time.-data BeaconAddr = BA !BeaconEpoch !BeaconOffset deriving (Eq, Show)--validBeaconAddr :: BeaconAddr -> Bool-validBeaconAddr (BA epoch offset) =-  (epoch `mod` beaconInterval == 0) && offset >= 0 && offset < bytesPerBeacon---- | Advances the beacon position by one byte, overflowing to the next--- beacon if necessary.-nextBeaconAddr :: BeaconAddr -> BeaconAddr-nextBeaconAddr (BA time byteOffset) =-  if byteOffset == bytesPerBeacon-1-  then BA (time+beaconInterval) 0-  else BA time (byteOffset+1)---- | The number of seconds elapsed from a given GMT time since the (GMT) epoch.-gmtDateToSeconds :: Int -> Int -> Integer -> Int -> Int -> Int-gmtDateToSeconds month day year hour minute |-  hour >= 0 && hour < 24 && minute >= 0 && minute < 60 =-    round $ utcTimeToPOSIXSeconds $-    UTCTime (fromGregorian year month day)-    (secondsToDiffTime $ fromIntegral $ 3600*hour+60*minute)-gmtDateToSeconds _ _ _ _ _ = error "invalid date to gmtDateToSeconds"---- | The number of seconds elapsed from a given local time since the--- (GMT) epoch.-localDateToSeconds :: Int -> Int -> Integer -> Int -> Int -> IO BeaconEpoch-localDateToSeconds month day year hour minute = do-  let gmt = gmtDateToSeconds month day year hour minute-  minuteOffset <- timeZoneMinutes <$> getCurrentTimeZone-  return $ fromIntegral $ gmt - (minuteOffset*60)---- | Yield the largest beacon epoch that does not exceed the input.-beaconFloor :: BeaconEpoch -> BeaconEpoch-beaconFloor e = e - e `mod` beaconInterval
− exec/Common.hs
@@ -1,174 +0,0 @@-{-# LANGUAGE FlexibleContexts      #-}-{-# LANGUAGE MultiParamTypeClasses #-}-{-# LANGUAGE RecordWildCards       #-}--module Common where--import Beacon--import           Crypto.Lol.Types     hiding (RRq)-import qualified Crypto.Lol.Types.RRq as RRq--import Crypto.Proto.RLWE.Challenges.Challenge-import Crypto.Proto.RLWE.Challenges.InstanceCont-import Crypto.Proto.RLWE.Challenges.InstanceDisc-import Crypto.Proto.RLWE.Challenges.InstanceRLWR-import Crypto.Proto.RLWE.Challenges.Secret--import Crypto.Random.DRBG--import Control.Monad.Except--import           Data.ByteString.Lazy (unpack)-import qualified Data.ByteString.Lazy as BS-import           Data.Int-import           Data.Maybe--import Net.Beacon--import System.Console.ANSI-import System.Directory    (doesDirectoryExist, doesFileExist,-                            getDirectoryContents)-import System.FilePath     ((</>))--import Text.Printf-import Text.ProtocolBuffers        (messageGet)-import Text.ProtocolBuffers.Header (ReflectDescriptor, Wire)--type ChallengeID = Int32-type InstanceID = Int32-type InstDRBG = CtrDRBG---- | Tensor type used to generate and verify instances-type T = CT--data ChallengeU = CU !Challenge ![InstanceU]--data InstanceU = IC {secret :: !Secret, instc :: !InstanceCont}-               | ID {secret :: !Secret, instd :: !InstanceDisc}-               | IR {secret :: !Secret, instr :: !InstanceRLWR}---- Types used to generate and verify instances-type Zq q = ZqBasic q Int64-type RRq q = RRq.RRq q Double---- | Yield a list of challenge names by getting all directory contents--- and filtering on all directories whose names start with "chall".-challengeList :: (MonadIO m) => FilePath -> m [String]-challengeList path = liftIO $ do-  challDirExists <- doesDirectoryExist path-  unless challDirExists $ error $ "Could not find " ++ path-  -- putStrLn $ "Reading challenges from \"" ++ challDir ++ "\""-  names <- filterM (doesDirectoryExist . (path </>)) =<<-    filter (("chall" ==) . take 5) <$> getDirectoryContents path-  when (null names) $ error "No challenges found."-  return names--checkFileExists :: (MonadIO m, MonadError String m) => FilePath -> m ()-checkFileExists file = do-  fileExists <- liftIO $ doesFileExist file-  throwErrorUnless fileExists $-    "Error reading " ++ file ++ ": file does not exist."---- | Read a serialized protobuffer from a file.-readProtoType :: (ReflectDescriptor a, Wire a, MonadIO m, MonadError String m)-                 => FilePath -> m a-readProtoType file = do-  checkFileExists file-  bs <- liftIO $ BS.readFile file-  case messageGet bs of-    (Left str) -> throwError $-      "Error when reading from protocol buffer. Got string " ++ str-    (Right (a,bs')) -> do-      throwErrorUnless (BS.null bs')-        "Error when reading from protocol buffer. There were leftover bits!"-      return a---- | Parse the beacon time/offset used to reveal a challenge.-parseBeaconAddr :: (MonadError String m) => Challenge -> m BeaconAddr-parseBeaconAddr Challenge{..} = do-  let ba = BA beaconEpoch beaconOffset-  -- validate the time and offset-  throwErrorUnless (validBeaconAddr ba) $ "Invalid beacon address: " ++ show ba-  return ba---- | Yield the ID of the suppressed secret for a challenge, given a--- beacon record and a byte offset.-suppressedSecretID :: InstanceID -> Record -> Int32 -> InstanceID-suppressedSecretID numInstances record byteOffset =-  let output = outputValue record-      byte = unpack output !! fromIntegral byteOffset-  in fromIntegral byte `mod` numInstances---- * Directory Structure---- | The root directory for challenges and their instances.-challengeFilesDir :: FilePath -> String -> FilePath-challengeFilesDir path name = path </> name---- | The name for a challenge file is some string--- with a .challenge extension.-challFilePath :: FilePath -> String -> FilePath-challFilePath path name = challengeFilesDir path name </> name ++ ".challenge"---- | The name for an instance file is some string followed by a hex ID--- with a .instance extension.-instFilePath :: FilePath -> String -> InstanceID -> FilePath-instFilePath path name instID = challengeFilesDir path name </> name ++ "-" ++-  instIDString instID ++ ".instance"---- | The name for a secret file is some string followed by a hex ID--- with the .secret extension.-secretFilePath :: FilePath -> String -> InstanceID -> FilePath-secretFilePath path name instID = challengeFilesDir path name </> name ++ "-" ++-  instIDString instID ++ ".secret"---- | The name of a beacon XML file.-beaconFilePath :: FilePath -> BeaconEpoch -> FilePath-beaconFilePath path t = path </> "epoch-" ++ show t ++ ".xml"---- | The filename for the NIST X509 certificate.-certFilePath :: FilePath -> FilePath-certFilePath path = path </> "beacon.cer"--instIDString :: InstanceID -> String-instIDString = printf "%02X"---- * Functions for easy exceptions.---- | Throw an error if the condition is 'True'.-throwErrorIf :: (MonadError String m) => Bool -> String -> m ()-throwErrorIf b = when b . throwError---- | Throw an error if the condition is 'False'.-throwErrorUnless :: (MonadError String m) => Bool -> String -> m ()-throwErrorUnless b = unless b . throwError---- | Throw an error if the input is 'Nothing'.-maybeThrowError :: (MonadError String m) => Maybe a -> String -> m a-maybeThrowError m str = do-  throwErrorIf (isNothing m) str-  return $ fromJust m---- | Pretty printing of error messages.-printPassFailGeneric :: (MonadIO m)-                 => Color -> String -> String -> ExceptT String m a -> m (Maybe a)-printPassFailGeneric failColor str pass e = do-  liftIO $ putStr str-  res <- runExceptT e-  case res of-    (Left st) -> do printANSI failColor st-                    return Nothing-    (Right a) -> do printANSI Green pass-                    return $ Just a--printPassFail, printPassWarn :: (MonadIO m)-  => String -> String -> ExceptT String m a -> m (Maybe a)-printPassFail = printPassFailGeneric Red-printPassWarn = printPassFailGeneric Yellow--printANSI :: (MonadIO m) => Color -> String -> m ()-printANSI sgr str = liftIO $ do-  setSGR [SetColor Foreground Vivid sgr]-  putStrLn str-  setSGR [Reset]
− exec/Generate.hs
@@ -1,206 +0,0 @@-{-# LANGUAGE FlexibleContexts      #-}-{-# LANGUAGE MultiParamTypeClasses #-}-{-# LANGUAGE NoImplicitPrelude     #-}-{-# LANGUAGE RebindableSyntax      #-}-{-# LANGUAGE RecordWildCards       #-}-{-# LANGUAGE ScopedTypeVariables   #-}--module Generate (generateMain, instanceCont, instanceDisc, instanceRLWR) where--import Beacon-import Common-import Params as P--import Crypto.Lol                 hiding (lift)-import Crypto.Lol.RLWE.Continuous as C-import Crypto.Lol.RLWE.Discrete   as D-import Crypto.Lol.RLWE.RLWR       as R-import Crypto.Lol.Types.Proto-import Crypto.Lol.Types.Random--import Crypto.Proto.RLWE.Challenges.Challenge-import Crypto.Proto.RLWE.Challenges.Challenge.Params-import Crypto.Proto.RLWE.Challenges.ContParams-import Crypto.Proto.RLWE.Challenges.DiscParams-import Crypto.Proto.RLWE.Challenges.InstanceCont-import Crypto.Proto.RLWE.Challenges.InstanceDisc-import Crypto.Proto.RLWE.Challenges.InstanceRLWR-import Crypto.Proto.RLWE.Challenges.RLWRParams-import Crypto.Proto.RLWE.Challenges.Secret           as S-import Crypto.Proto.RLWE.SampleCont-import Crypto.Proto.RLWE.SampleDisc-import Crypto.Proto.RLWE.SampleRLWR--import Crypto.Random.DRBG--import Control.Applicative-import Control.Monad-import Control.Monad.Except-import Control.Monad.Random--import qualified Data.ByteString.Lazy as BS-import           Data.Reflection      hiding (D)-import qualified Data.Tagged          as T--import System.Directory (createDirectoryIfMissing)--import Text.Printf-import Text.ProtocolBuffers        (messagePut)-import Text.ProtocolBuffers.Header hiding (ByteString, pack)---- | Generate and serialize challenges given the path to the root of the tree--- and an initial beacon address.-generateMain :: FilePath -> BeaconAddr -> [ChallengeParams] -> IO ()-generateMain path beaconStart cps = do-  let len = length cps-      beaconAddrs = take len $ iterate nextBeaconAddr beaconStart-  evalCryptoRandIO (zipWithM_ (genAndWriteChallenge path) cps beaconAddrs-    :: RandT (CryptoRand HashDRBG) IO ())--genAndWriteChallenge :: (MonadRandom m, MonadIO m)-  => FilePath -> ChallengeParams -> BeaconAddr -> m ()-genAndWriteChallenge path cp ba@(BA _ _) = do-  let name = challengeName cp-  liftIO $ putStrLn $ "Generating challenge " ++ name--  -- CJP: not printing warning because it's annoying to implement-  -- correctly: dont want to trust local time, don't want to rely on-  -- network when generating--  -- isAvail <- isBeaconAvailable t-  -- when isAvail $ printANSI Red "Beacon is already available!"--  chall <- genChallengeU cp ba-  liftIO $ writeChallengeU path name chall---- | The name for each challenge directory.-challengeName :: ChallengeParams -> FilePath-challengeName params =-  "chall-id" ++ printf "%04d" (challID params) ++-    case params of-      C{..} -> "-rlwec-m" ++ show m ++ "-q" ++ show q ++-        "-l" ++ show (P.numSamples params) ++-        if null annotation then "" else "-" ++ annotation-      D{..} -> "-rlwed-m" ++ show m ++ "-q" ++ show q ++-        "-l" ++ show (P.numSamples params) ++-        if null annotation then "" else "-" ++ annotation-      R{..} -> "-rlwr-m" ++ show m ++ "-q" ++ show q ++ "-p" ++ show p ++-        "-l" ++ show (P.numSamples params) ++-        if null annotation then "" else "-" ++ annotation---- | Generate a challenge with the given parameters.-genChallengeU :: (MonadRandom m)-  => ChallengeParams -> BeaconAddr -> m ChallengeU-genChallengeU cp (BA beaconEpoch beaconOffset) = do-  let challengeID = challID cp-      params' = toProtoParams cp-      numInstances = P.numInstances cp-      numInsts = fromIntegral numInstances-      chall = Challenge{params=Just params',..}-      instIDs = take numInsts [0..]-      seedLen = T.proxy genSeedLength (Proxy::Proxy InstDRBG)-  seeds <- replicateM numInsts (BS.pack <$> replicateM seedLen getRandom)-  let insts = zipWith (genInstanceU params' challengeID) instIDs seeds-  return $ CU chall insts---- | Generate an instance for the given parameters.-genInstanceU :: Params -> ChallengeID -> InstanceID -> BS.ByteString -> InstanceU--genInstanceU (Cparams params@ContParams{..}) challengeID instanceID seed =-  let (Right (g :: CryptoRand InstDRBG)) = newGen $ BS.toStrict seed-  in flip evalRand g $ reify q (\(_::Proxy q) ->-    reifyFactI (fromIntegral m) (\(_::proxy m) -> do-      (s', samples' :: [C.Sample T m (Zq q) (RRq q)]) <- instanceCont svar $ fromIntegral numSamples-      let s'' = Secret{s = toProto s', ..}-          samples = uncurry SampleCont <$> toProto samples'-      return $ IC s'' InstanceCont{..}))--genInstanceU (Dparams params@DiscParams{..}) challengeID instanceID seed =-  let (Right (g :: CryptoRand InstDRBG)) = newGen $ BS.toStrict seed-  in flip evalRand g $ reify q (\(_::Proxy q) ->-    reifyFactI (fromIntegral m) (\(_::proxy m) -> do-      (s', samples' :: [D.Sample T m (Zq q)]) <- instanceDisc svar $ fromIntegral numSamples-      let s'' = Secret{s = toProto s', ..}-          samples = uncurry SampleDisc <$> toProto samples'-      return $ ID s'' InstanceDisc{..}))--genInstanceU (Rparams params@RLWRParams{..}) challengeID instanceID seed =-  let (Right (g :: CryptoRand InstDRBG)) = newGen $ BS.toStrict seed-  in flip evalRand g $ reify q (\(_::Proxy q) -> reify p (\(_::Proxy p) ->-    reifyFactI (fromIntegral m) (\(_::proxy m) -> do-      (s', samples' :: [R.Sample T m (Zq q) (Zq p)]) <- instanceRLWR $ fromIntegral numSamples-      let s'' = Secret{s = toProto s', ..}-          samples = uncurry SampleRLWR <$> toProto samples'-      return $ IR s'' InstanceRLWR{..})))---- | Convert the parsed 'ChallengeParams' into serializable 'Params'-toProtoParams :: ChallengeParams -> Params-toProtoParams C{..} =-  reifyFactI (fromIntegral m) (\(_::proxy m) ->-    let bound = proxy (C.errorBound svar eps) (Proxy::Proxy m)-    in Cparams ContParams {..})-toProtoParams D{..} =-  reifyFactI (fromIntegral m) (\(_::proxy m) ->-    let bound = proxy (D.errorBound svar eps) (Proxy::Proxy m)-    in Dparams DiscParams {..})-toProtoParams R{..} = Rparams RLWRParams {..}---- | Writes a 'ChallengeU' to a file given a path to the root of the tree--- and the name of the challenge.-writeChallengeU :: FilePath -> String -> ChallengeU -> IO ()-writeChallengeU path challName (CU c insts) = do-  let challDir = challengeFilesDir path challName-      challFN = challFilePath path challName-  createDirectoryIfMissing True challDir-  writeProtoType challFN c-  mapM_ (writeInstanceU path challName) insts---- | Writes an 'InstanceU' to a file given a path to the root of the tree--- and the name of the challenge.-writeInstanceU :: FilePath -> String -> InstanceU -> IO ()-writeInstanceU path challName iu = do-  let s = secret iu-      idx = S.instanceID s-      instFN = instFilePath path challName idx-      secretFN = secretFilePath path challName idx-  case iu of-    (IC _ inst) -> writeProtoType instFN inst-    (ID _ inst) -> writeProtoType instFN inst-    (IR _ inst) -> writeProtoType instFN inst-  writeProtoType secretFN s---- | Writes any auto-gen'd proto object to path/filename.-writeProtoType :: (ReflectDescriptor a, Wire a) => FilePath -> a -> IO ()-writeProtoType fileName obj = BS.writeFile fileName $ messagePut obj---- | Generate a continuous RLWE instance along with its (uniformly--- random) secret, using the given scaled variance and number of--- desired samples.-instanceCont :: (C.RLWECtx t m zq rrq, Random zq, Random (LiftOf rrq),-                 OrdFloat (LiftOf rrq), MonadRandom rnd, ToRational v)-  => v -> Int -> rnd (Cyc t m zq, [C.Sample t m zq rrq])-instanceCont svar num = do-  s <- getRandom-  samples <- replicateM num $ C.sample svar s-  return (s, samples)---- | Generate a discrete RLWE instance along with its (uniformly--- random) secret, using the given scaled variance and number of--- desired samples.-instanceDisc :: (D.RLWECtx t m zq, Random zq, MonadRandom rnd, ToRational v)-  => v -> Int -> rnd (Cyc t m zq, [D.Sample t m zq])-instanceDisc svar num = do-  s <- getRandom-  samples <- replicateM num $ D.sample svar s-  return (s, samples)---- | Generate a discrete RLWR instance along with its (uniformly--- random) secret, using the given scaled variance and number of--- desired samples.-instanceRLWR :: (R.RLWRCtx t m zq zp, Random zq, MonadRandom rnd)-  => Int -> rnd (Cyc t m zq, [R.Sample t m zq zp])-instanceRLWR num = do-  s <- getRandom-  samples <- replicateM num $ R.sample s-  return (s, samples)-
− exec/Main.hs
@@ -1,90 +0,0 @@-{-# LANGUAGE RecordWildCards #-}---- | Main module for the rlwe-challenges executable.--module Main where--import Control.Monad         (when)-import Data.Time.Clock.POSIX-import Options--import System.Console.ANSI-import System.Exit-import System.IO--import Beacon-import Common   (InstanceID, printANSI)-import Generate-import Params-import Suppress-import Verify--data MainOpts =-  MainOpts-  { optChallDir :: FilePath -- ^ location of challenges-  }--instance Options MainOpts where-  defineOptions = MainOpts <$>-    simpleOption "challenge-dir" "challenges/" "Path to challenges"--data GenOpts =-  GenOpts-  { optParamsFile      :: FilePath, -- ^ file with parameters for generation-    optNumInstances    :: InstanceID, -- ^ number of instances per challenge-    optInitBeaconEpoch :: BeaconEpoch -- ^ initial beacon epoch for suppress phase-  }--instance Options GenOpts where-  defineOptions = GenOpts <$>-    simpleOption "params" "params.txt" "File containing RLWE/R parameters" <*>-    simpleOption "num-instances" 32-    "Number N of instances per challenge, N = 2^k <= 256" <*>-    defineOption optionType_int64 (\o ->-      o {optionLongFlags = ["init-beacon"],-         optionDescription = "Initial beacon epoch for suppress phase."})---- | Epoch that's @n@ days from now, rounded to a multiple of 60 for--- NIST beacon purposes.-daysFromNow :: Int -> IO BeaconEpoch-daysFromNow n = do-  t <- round <$> getPOSIXTime-  return $ 86400 * fromIntegral n + t--data NullOpts = NullOpts--instance Options NullOpts where-  defineOptions = pure NullOpts--main :: IO ()-main = do-  -- for nice printing when running executable-  hSetBuffering stdout NoBuffering-  runSubcommand-    [ subcommand "generate" generate-    , subcommand "suppress" suppress-    , subcommand "verify" verify-    ]--generate :: MainOpts -> GenOpts -> [String] -> IO ()-generate MainOpts{..} GenOpts{..} _ = do-  let initBeaconTime = beaconFloor optInitBeaconEpoch-      initBeacon = BA initBeaconTime 0-  when (initBeaconTime == 0) $ do-    putStrLn "You must specify the initial beacon time with --init-beacon"-    exitFailure-  currTime <- round <$> getPOSIXTime-  if initBeaconTime > currTime-    then putStrLn $ "Challenges can be revealed starting at " ++-         show initBeaconTime ++ ", " ++ show (initBeaconTime-currTime) ++-         " seconds from now."-    else printANSI Yellow "WARNING: Reveal time is in the past!"-  paramContents <- readFile optParamsFile-  let params = parseChallParams paramContents optNumInstances-  generateMain optChallDir initBeacon params--suppress :: MainOpts -> NullOpts -> [String] -> IO ()-suppress MainOpts{..} _ _ = suppressMain optChallDir--verify :: MainOpts -> NullOpts -> [String] -> IO ()-verify MainOpts{..} _ _ = verifyMain optChallDir
− exec/Params.hs
@@ -1,132 +0,0 @@-{-# LANGUAGE FlexibleContexts      #-}-{-# LANGUAGE MultiParamTypeClasses #-}-{-# LANGUAGE RecordWildCards       #-}--module Params where--import Common (ChallengeID, InstanceID)--import Control.Applicative  hiding ((<|>))-import Control.Monad.Except-import Data.Int-import Prelude              hiding (lex)-import Text.Parsec-import Text.Parsec.Token---- | Information to generate a challenge.-data ChallengeParams =-    C { challID :: ChallengeID, m :: Int32, q :: Int64, svar :: Double, numSamples :: Int32,-        numInstances :: InstanceID, eps :: Double, annotation :: String }-  | D { challID :: ChallengeID, m :: Int32, q :: Int64, svar :: Double, numSamples :: Int32,-        numInstances :: InstanceID, eps :: Double, annotation :: String }-  | R { challID :: ChallengeID, m :: Int32, q :: Int64, p :: Int64, numSamples :: Int32,-        numInstances :: InstanceID, annotation :: String }-  deriving (Show)--contLineID, discLineID, rlwrLineID :: String-contLineID = "Cont"-discLineID = "Disc"-rlwrLineID = "RLWR"---- default probability eps to use-epsDef :: Double-epsDef = 2 ** (-25)--lang :: (Stream s m Char) => GenLanguageDef s u m-lang = LanguageDef-  {commentStart = "/*",-   commentEnd = "*/",-   commentLine = "--",-   nestedComments = True,-   identStart = letter,-   identLetter = letter,-   opStart = letter,-   opLetter = letter,-   reservedNames = [],-   reservedOpNames = [],-   caseSensitive = True}---- applies `p` zero or more times, stopping when it reaches EOF--- if an error occurs, it stops parsing and reports the error-manyError :: (Stream s m Char) => ParsecT s u m a -> ParsecT s u m [a]-manyError p = try (eof *> return []) <|> liftA2 (:) p (manyError p)--lex :: (Stream s m Char) => ParsecT s u m a -> ParsecT s u m a-lex = lexeme langParser--langParser :: (Stream s m Char) => GenTokenParser s u m-langParser = makeTokenParser lang--parseIntegral :: (Integral i, Stream s m Char) => ParsecT s u m i-parseIntegral = fromIntegral <$> lex (natural langParser)--parseDouble :: (Stream s m Char) => ParsecT s u m Double-parseDouble = lex $ float langParser--parseString :: (Stream s m Char) => ParsecT s u m String-parseString = lex $ stringLiteral langParser--parseWord ::  (Stream s m Char) => String -> ParsecT s u m ()-parseWord = lex . void . try . string--paramsFile :: (MonadError String m, Stream s m Char) => ParsecT s InstanceID m [ChallengeParams]-paramsFile = do-  whiteSpace langParser -- skip leading whitespace-  manyError line--line :: (MonadError String m, Stream s m Char) => ParsecT s InstanceID m ChallengeParams-line = try rlwecParams <|> try rlwedParams <|> try rlwrParams <?> "Expected one of '" ++-  show contLineID ++ "', '" ++-  show discLineID ++ "', or '" ++-  show rlwrLineID ++ "'."--rlwecParams, rlwedParams, rlwrParams ::-  (MonadError String m, Stream s m Char) => ParsecT s InstanceID m ChallengeParams-rlwecParams = do-  challID <- parseIntegral-  parseWord contLineID-  m <- parseIntegral-  q <- parseIntegral-  svar <- parseDouble-  numSamples <- parseIntegral-  annotation <- parseString--  numInstances <- getState-  let eps = epsDef-  return C{..}--rlwedParams = do-  challID <- parseIntegral-  parseWord discLineID-  m <- parseIntegral-  q <- parseIntegral-  svar <- parseDouble-  numSamples <- parseIntegral-  annotation <- parseString--  numInstances <- getState-  let eps = epsDef-  return D{..}--rlwrParams = do-  challID <- parseIntegral-  parseWord rlwrLineID-  m <- parseIntegral-  q <- parseIntegral-  p <- parseIntegral-  numSamples <- parseIntegral-  annotation <- parseString--  numInstances <- getState-  when (p > q) $ throwError $-    "Expected p <= q; parsed q=" ++ show q ++ " and p=" ++ show p-  return R{..}--parseChallParams :: String -> InstanceID -> [ChallengeParams]-parseChallParams input numInsts = do-  let output = runExcept $ runParserT paramsFile numInsts "" input-  case output of-    Left e -> error $ "Invalid parameters: " ++ e-    Right r -> case r of-      Left e -> error $ "Error parsing input:" ++ show e-      Right v -> v
+ exec/RLWEChallengesMain.hs view
@@ -0,0 +1,90 @@+{-# LANGUAGE RecordWildCards #-}++-- | Main module for the rlwe-challenges executable.++module RLWEChallengesMain where++import Control.Monad         (when)+import Data.Time.Clock.POSIX+import Options++import System.Console.ANSI+import System.Exit+import System.IO++import Crypto.RLWE.Challenges.Beacon+import Crypto.RLWE.Challenges.Common   (InstanceID, printANSI)+import Crypto.RLWE.Challenges.Generate+import Crypto.RLWE.Challenges.Params+import Crypto.RLWE.Challenges.Suppress+import Crypto.RLWE.Challenges.Verify++data MainOpts =+  MainOpts+  { optChallDir :: FilePath -- ^ location of challenges+  }++instance Options MainOpts where+  defineOptions = MainOpts <$>+    simpleOption "challenge-dir" "challenges/" "Path to challenges"++data GenOpts =+  GenOpts+  { optParamsFile      :: FilePath, -- ^ file with parameters for generation+    optNumInstances    :: InstanceID, -- ^ number of instances per challenge+    optInitBeaconEpoch :: BeaconEpoch -- ^ initial beacon epoch for suppress phase+  }++instance Options GenOpts where+  defineOptions = GenOpts <$>+    simpleOption "params" "params.txt" "File containing RLWE/R parameters" <*>+    simpleOption "num-instances" 32+    "Number N of instances per challenge, N = 2^k <= 256" <*>+    defineOption optionType_int64 (\o ->+      o {optionLongFlags = ["init-beacon"],+         optionDescription = "Initial beacon epoch for suppress phase."})++-- | Epoch that's @n@ days from now, rounded to a multiple of 60 for+-- NIST beacon purposes.+daysFromNow :: Int -> IO BeaconEpoch+daysFromNow n = do+  t <- round <$> getPOSIXTime+  return $ 86400 * fromIntegral n + t++data NullOpts = NullOpts++instance Options NullOpts where+  defineOptions = pure NullOpts++main :: IO ()+main = do+  -- for nice printing when running executable+  hSetBuffering stdout NoBuffering+  runSubcommand+    [ subcommand "generate" generate+    , subcommand "suppress" suppress+    , subcommand "verify" verify+    ]++generate :: MainOpts -> GenOpts -> [String] -> IO ()+generate MainOpts{..} GenOpts{..} _ = do+  let initBeaconTime = beaconFloor optInitBeaconEpoch+      initBeacon = BA initBeaconTime 0+  when (initBeaconTime == 0) $ do+    putStrLn "You must specify the initial beacon time with --init-beacon"+    exitFailure+  currTime <- round <$> getPOSIXTime+  if initBeaconTime > currTime+    then putStrLn $ "Challenges can be revealed starting at " +++         show initBeaconTime ++ ", " ++ show (initBeaconTime-currTime) +++         " seconds from now."+    else printANSI Yellow "WARNING: Reveal time is in the past!"+  paramContents <- readFile optParamsFile+  let params = parseChallParams paramContents optNumInstances+  generateMain optChallDir initBeacon params++suppress :: MainOpts -> NullOpts -> [String] -> IO ()+suppress MainOpts{..} _ _ = suppressMain optChallDir++verify :: MainOpts -> NullOpts -> [String] -> IO ()+verify MainOpts{..} _ _ = verifyMain optChallDir
− exec/Suppress.hs
@@ -1,117 +0,0 @@-{-# LANGUAGE FlexibleContexts #-}--module Suppress (suppressMain) where--import Beacon-import Common--import Control.Exception (try)-import Control.Monad.Except-import Control.Monad.State--import Crypto.Proto.RLWE.Challenges.Challenge--import Data.ByteString.Lazy (writeFile)-import Data.ByteString.Char8 (unpack)-import Data.Maybe (isNothing)-import Data.Time.Clock.POSIX--import Data.Map             (Map, empty, insert, lookup)--import Net.Beacon-import Network.HTTP.Client-import Network.HTTP.Conduit (simpleHttp)--import Prelude hiding (lookup, writeFile)--import System.Directory (removeFile)-import System.Exit---- | Deletes the secret indicated by NIST beacon for each challenge in--- the tree, given the path to the root of the tree.-suppressMain :: FilePath -> IO ()-suppressMain path = do-  -- get list of challenges-  challs <- challengeList path--  -- suppress a secret from each challenge, collecting beacon records as we go-  recs <- flip execStateT empty $ mapM_ (suppressChallenge path) challs--  -- write all beacon records-  mapM_ (writeBeaconXML path) recs--  -- write the NIST certificate-  getNistCert path---- | A map from beacon times to beacon records.-type RecordState = Map BeaconEpoch Record---- | Lookup the secret index based on the randomness for this challenge,--- then remove the corresponding secret.-suppressChallenge :: (MonadIO m, MonadState RecordState m)-                     => FilePath -> String -> m ()-suppressChallenge path name = do-  x <- printPassFail ("Deleting secret for challenge " ++ name ++ ":\n") "DONE" $ do-    -- read the beacon address of the randomness for this challenge-    let challFN = challFilePath path name-    challProto <- readProtoType challFN-    (BA time offset) <- parseBeaconAddr challProto-    let numInsts = fromIntegral $ numInstances challProto--    -- get the record, and compute the secret index-    rec <- retrieveRecord time-    let secID = suppressedSecretID numInsts rec offset-        secFile = secretFilePath path name secID--    -- delete the secret corresponding to the secret index-    checkFileExists secFile-    liftIO $ putStr $ "\tRemoving " ++ secFile ++ "\n\t"-    liftIO $ removeFile secFile-  when (isNothing x) $ liftIO $ die "To avoid publishing all instance secrets, we are dying early."-  return ()---- | Attempt to find the record in the state, otherwise download it from NIST.-retrieveRecord :: (MonadIO m, MonadError String m, MonadState RecordState m)-                  => BeaconEpoch -> m Record-retrieveRecord t = do-  mrec <- gets (lookup t)-  case mrec of-    (Just r) -> return r-    Nothing -> do-      liftIO $ putStrLn $ "\tDownloading record " ++ show t-      trec <- liftIO $ try $ getCurrentRecord $ fromIntegral t-      rec <- case trec of-               Left e -> catchHttpException t e-               Right a -> return a-      rec' <- maybeThrowError rec $ "Couldn't parse XML for beacon at time " ++ show t-      modify (insert t rec')-      return rec'--catchHttpException :: (MonadIO m, MonadError String m)-  => BeaconEpoch -> HttpException -> m a-catchHttpException t (HttpExceptionRequest _ (StatusCodeException _ s)) = do-  currTime <- round <$> (liftIO getPOSIXTime)-  throwError $ case currTime < t of-    True -> "You are requesting a beacon that doesn't exist yet.\n" ++-            "Wait another " ++ show (t-currTime) ++ " seconds and try again."-    False -> "The beacon you are requesting should be available, " ++-             "but it just isn't there:\n" ++ unpack s-catchHttpException _ (HttpExceptionRequest _ (ConnectionFailure _)) =-  throwError "Failed to connect to NIST servers. They might be down for maintenance."-catchHttpException _ _ =-  throwError "An unexpected IO error occurred while downloading the beacon."---- | Writes a beacon record to a file.-writeBeaconXML :: (MonadIO m) => FilePath -> Record -> m ()-writeBeaconXML path rec = do-  let beacon = toXML rec-      filePath = beaconFilePath path $ fromIntegral $ timeStamp rec-  liftIO $ writeFile filePath beacon---- | Downloads the NIST certificate and saves it.-getNistCert :: (MonadIO m) => FilePath -> m ()-getNistCert path = liftIO $ do-  let certPath = certFilePath path-  putStrLn $ "Writing NIST certificate to " ++ certPath-  bs <- simpleHttp "https://beacon.nist.gov/certificate/beacon.cer"-  writeFile certPath bs
− exec/Verify.hs
@@ -1,306 +0,0 @@-{-# LANGUAGE FlexibleContexts      #-}-{-# LANGUAGE GADTs                 #-}-{-# LANGUAGE MultiParamTypeClasses #-}-{-# LANGUAGE NoImplicitPrelude     #-}-{-# LANGUAGE PartialTypeSignatures #-}-{-# LANGUAGE RebindableSyntax      #-}-{-# LANGUAGE RecordWildCards       #-}-{-# LANGUAGE ScopedTypeVariables   #-}--module Verify where--import Beacon-import Common-import Generate--import           Crypto.Lol-import           Crypto.Lol.Cyclotomic.UCyc-import qualified Crypto.Lol.RLWE.Continuous as C-import qualified Crypto.Lol.RLWE.Discrete   as D-import qualified Crypto.Lol.RLWE.RLWR       as R-import           Crypto.Lol.Types.Proto-import           Crypto.Lol.Types.Random--import Crypto.Proto.RLWE.Challenges.Challenge-import Crypto.Proto.RLWE.Challenges.Challenge.Params-import Crypto.Proto.RLWE.Challenges.ContParams-import Crypto.Proto.RLWE.Challenges.DiscParams-import Crypto.Proto.RLWE.Challenges.InstanceCont-import Crypto.Proto.RLWE.Challenges.InstanceDisc-import Crypto.Proto.RLWE.Challenges.InstanceRLWR-import Crypto.Proto.RLWE.Challenges.RLWRParams-import Crypto.Proto.RLWE.Challenges.Secret-import Crypto.Proto.RLWE.SampleCont-import Crypto.Proto.RLWE.SampleDisc-import Crypto.Proto.RLWE.SampleRLWR--import Crypto.Random.DRBG--import           Control.Applicative-import           Control.Monad.Except hiding (lift)-import           Control.Monad.Random-import qualified Data.ByteString.Lazy as BS-import           Data.Int-import           Data.List            (nub)-import           Data.Maybe-import           Data.Reflection      hiding (D)-import qualified Data.Tagged          as T--import Net.Beacon--import System.Console.ANSI-import System.Directory    (doesFileExist)---- | Verifies all instances in the challenge tree, given the path to the--- root of the tree.-verifyMain :: FilePath -> IO ()-verifyMain path = do-  -- get a list of challenges to reveal-  challNames <- challengeList path--  beaconAddrs <- sequence <$> mapM (readAndVerifyChallenge path) challNames--  -- verify that all beacon addresses are distinct-  case beaconAddrs of-    (Just addrs) -> do-      _ <- printPassFail "Checking for distinct beacon addresses... " "DISTINCT"-        $ throwErrorIf (length (nub addrs) /= length addrs) "NOT DISTINCT"-      putStrLn "\nAttempting to regenerate challenges from random seeds. This will take awhile..."-      regens <- sequence <$> mapM (regenChallenge path) challNames-      when (isNothing regens) $ printANSI Yellow "NOTE: one or more instances could not be\n \-        \regenerated from the provided PRG seed. This is NON-FATAL,\n \-        \and is likely due to the use of a different compiler/platform\n \-        \than the one used to generate the challenges."-    Nothing -> return ()---- | Reads a challenge and verifies all instances.--- Returns the beacon address for the challenge.-readAndVerifyChallenge :: (MonadIO m)-  => FilePath -> String -> m (Maybe BeaconAddr)-readAndVerifyChallenge path challName =-  printPassFail ("Verifying " ++ challName) "VERIFIED" $ do-    (ba, insts) <- readChallenge path challName-    mapM_ verifyInstanceU insts-    return ba---- | Reads a challenge and attempts to regenerate all instances from the--- provided seed.--- Returns (Just ()) if regeneration succeeded for all instances.-regenChallenge :: (MonadIO m)-  => FilePath -> String -> m (Maybe ())-regenChallenge path challName = do-  printPassWarn ("Regenerating " ++ challName ++ "... ") "VERIFIED" $ do-    (_, insts) <- readChallenge path challName-    regens <- mapM regenInstance insts-    unless (and regens) $ throwError "UNSUCCESSFUL"---- | Read a challenge from a file, outputting the beacon address and a--- list of instances to be verified.-readChallenge :: (MonadIO m, MonadError String m)-  => FilePath -> String -> m (BeaconAddr, [InstanceU])-readChallenge path challName = do-  let challFile = challFilePath path challName-  c <- readProtoType challFile-  isAvail <- beaconAvailable path $ beaconEpoch c--  let (msg, readChall) =-        if isAvail-        then (" (expecting one missing secret)... ",-              readSuppChallenge)-        else (" (expecting all secrets)... ",-              readFullChallenge)--  liftIO $ putStr msg-  _ <- parseBeaconAddr c -- verify that the beacon address is valid-  readChall path challName c---- | Whether we have an XML file for the beacon at the given epoch.-beaconAvailable :: (MonadIO m) => FilePath -> BeaconEpoch -> m Bool-beaconAvailable path = liftIO . doesFileExist . beaconFilePath path--readSuppChallenge, readFullChallenge :: (MonadIO m, MonadError String m)-  => FilePath -> String -> Challenge -> m (BeaconAddr, [InstanceU])--readSuppChallenge path challName Challenge{..} = do-  let numInsts' = fromIntegral numInstances-  beacon <- readBeacon path beaconEpoch-  let deletedID = suppressedSecretID numInstances beacon beaconOffset-  let delSecretFile = secretFilePath path challName deletedID-  delSecretExists <- liftIO $ doesFileExist delSecretFile-  throwErrorIf delSecretExists $-    "Secret " ++ show deletedID ++-    " should not exist, but it does! You may need to run the 'suppress' command."-  throwErrorUnless (isJust params) $ "Challenge " ++ challName ++ " does not contain parameters."-  insts <- mapM (readInstanceU (fromJust params) path challName challengeID) $-    filter (/= deletedID) $ take numInsts' [0..]-  checkParamsEq challName "numInstances" (numInsts'-1) (length insts)-  return (BA beaconEpoch beaconOffset, insts)--readFullChallenge path challName Challenge{..} = do-  let numInsts' = fromIntegral numInstances-  throwErrorUnless (isJust params) $ "Challenge " ++ challName ++ " does not contain parameters."-  insts <- mapM (readInstanceU (fromJust params) path challName challengeID) $ take numInsts' [0..]-  checkParamsEq challName "numInstances" numInsts' (length insts)-  return (BA beaconEpoch beaconOffset, insts)--validateSecret :: (MonadError String m)-  => String -> ChallengeID -> InstanceID -> Int32 -> Int64 -> Secret -> m ()-validateSecret sfile cid iid m q (Secret cid' iid' m' q' seed _) = do-  checkParamsEq sfile "challID" cid cid'-  checkParamsEq sfile "instID" iid iid'-  checkParamsEq sfile "m" m m'-  checkParamsEq sfile "q" q q'-  let minSeedLen = fromIntegral $ T.proxy genSeedLength (Proxy::Proxy InstDRBG)-      seedLen = length $ BS.unpack seed-  throwErrorIf (seedLen < minSeedLen) $ "Seed length is too short! Expected at least " ++-    show minSeedLen ++ " bytes, but only found " ++ show seedLen ++ " bytes."--validateInstance :: (MonadError String m)-  => String -> ChallengeID -> InstanceID -> Params-            -> ChallengeID -> InstanceID -> Params -> m ()-validateInstance instFile cid iid params cid' iid' params' = do-  checkParamsEq instFile "challID" cid cid'-  checkParamsEq instFile "instID" iid iid'-  checkParamsEq instFile "params" params params'---- | Read an 'InstanceU' from a file.-readInstanceU :: (MonadIO m, MonadError String m)-                 => Params -> FilePath -> String-                 -> ChallengeID -> InstanceID -> m InstanceU-readInstanceU params path challName cid iid = do-  let secFile = secretFilePath path challName iid-  s <- readProtoType secFile-  let instFile = instFilePath path challName iid-  case params of-    (Cparams ContParams{..}) -> do-      inst@(InstanceCont cid' iid' params' _) <- readProtoType instFile-      validateSecret secFile cid iid m q s-      validateInstance instFile cid iid params cid' iid' (Cparams params')-      return $ IC s inst-    (Dparams DiscParams{..}) -> do-      inst@(InstanceDisc cid' iid' params' _) <- readProtoType instFile-      validateSecret secFile cid iid m q s-      validateInstance instFile cid iid params cid' iid' (Dparams params')-      return $ ID s inst-    (Rparams RLWRParams{..}) -> do-      inst@(InstanceRLWR cid' iid' params' _) <- readProtoType instFile-      validateSecret secFile cid iid m q s-      validateInstance instFile cid iid params cid' iid' (Rparams params')-      return $ IR s inst--checkParamsEq :: (MonadError String m, Show a, Eq a)-  => String -> String -> a -> a -> m ()-checkParamsEq data' param expected actual =-  throwErrorUnless (expected == actual) $ "Error while reading " ++-    data' ++ ": " ++ param ++ " mismatch. Expected " ++-    show expected ++ " but got " ++ show actual---- | Outputs whether or not we successfully regenerated this instance from the DRBG seed.-regenInstance :: (MonadError String m) => InstanceU -> m Bool--- as always with floating point arithmetic, nothing is perfect (even--- deterministic generation of instances).--- the secret and a_i are discrete, so they should match exactly.--- the b_i shouldn't be too far off.-regenInstance (IC (Secret _ _ _ _ seed s) InstanceCont{..}) =-  let ContParams {..} = params-      (Right (g :: CryptoRand InstDRBG)) = newGen $ BS.toStrict seed-  in reifyFactI (fromIntegral m) (\(_::proxy m) ->-      reify (fromIntegral q :: Int64) (\(_::Proxy q) -> do-        let (expectedS, expectedSamples :: [C.Sample T m (Zq q) (RRq q)]) =-              flip evalRand g $ instanceCont svar (fromIntegral numSamples)-            csampleEq (a,b) (a',b') =-              (a == a') && maximum (fmapDec abs $ lift $ b-b') < 2 ^- (-20)-        s' :: Cyc T m (Zq q) <- fromProto s-        samples' :: [C.Sample _ _ _ (RRq q)] <- fromProto $-          fmap (\(SampleCont a b) -> (a,b)) samples-        return $ (expectedS == s') && (and $ zipWith csampleEq expectedSamples samples')))--regenInstance (ID (Secret _ _ _ _ seed s) InstanceDisc{..}) =-  let DiscParams {..} = params-  in reifyFactI (fromIntegral m) (\(_::proxy m) ->-    reify (fromIntegral q :: Int64) (\(_::Proxy q) -> do-      g :: CryptoRand InstDRBG <- either (throwError . show) return $ newGen $ BS.toStrict seed-      let (expectedS, expectedSamples :: [D.Sample T m (Zq q)]) =-            flip evalRand g $ instanceDisc svar (fromIntegral numSamples)-      s' :: Cyc T m (Zq q) <- fromProto s-      samples' <- fromProto $ fmap (\(SampleDisc a b) -> (a,b)) samples-      return $ (expectedS == s') && (expectedSamples == samples')))--regenInstance (IR (Secret _ _ _ _ seed s) InstanceRLWR{..}) =-  let RLWRParams {..} = params-  in reifyFactI (fromIntegral m) (\(_::proxy m) ->-    reify (fromIntegral q :: Int64) (\(_::Proxy q) ->-      reify (fromIntegral p :: Int64) (\(_::Proxy p) -> do-        g :: CryptoRand InstDRBG <- either (throwError . show) return $ newGen $ BS.toStrict seed-        let (expectedS, expectedSamples :: [R.Sample T m (Zq q) (Zq p)]) =-              flip evalRand g $ instanceRLWR (fromIntegral numSamples)-        s' :: Cyc T m (Zq q) <- fromProto s-        samples' :: [R.Sample _ _ _ (Zq p)] <- fromProto $-          fmap (\(SampleRLWR a b) -> (a,b)) samples-        return $ (expectedS == s') && (expectedSamples == samples'))))----- | Verify an 'InstanceU'.-verifyInstanceU :: (MonadError String m) => InstanceU -> m ()--verifyInstanceU (IC (Secret _ _ _ _ _ s) InstanceCont{..}) =-  let ContParams {..} = params-  in reifyFactI (fromIntegral m) (\(_::proxy m) ->-    reify (fromIntegral q :: Int64) (\(_::Proxy q) -> do-      s' :: Cyc T m (Zq q) <- fromProto s-      samples' :: [C.Sample _ _ _ (RRq q)] <- fromProto $-        fmap (\(SampleCont a b) -> (a,b)) samples-      throwErrorUnless (validInstanceCont bound s' samples')-        "A continuous RLWE sample exceeded the error bound."))--verifyInstanceU (ID (Secret _ _ _ _ _ s) InstanceDisc{..}) =-  let DiscParams {..} = params-  in reifyFactI (fromIntegral m) (\(_::proxy m) ->-    reify (fromIntegral q :: Int64) (\(_::Proxy q) -> do-      s' :: Cyc T m (Zq q) <- fromProto s-      samples' <- fromProto $ fmap (\(SampleDisc a b) -> (a,b)) samples-      throwErrorUnless (validInstanceDisc bound s' samples')-        "A discrete RLWE sample exceeded the error bound."))--verifyInstanceU (IR (Secret _ _ _ _ _ s) InstanceRLWR{..}) =-  let RLWRParams {..} = params-  in reifyFactI (fromIntegral m) (\(_::proxy m) ->-    reify (fromIntegral q :: Int64) (\(_::Proxy q) ->-      reify (fromIntegral p :: Int64) (\(_::Proxy p) -> do-        s' :: Cyc T m (Zq q) <- fromProto s-        samples' :: [R.Sample _ _ _ (Zq p)] <- fromProto $-          fmap (\(SampleRLWR a b) -> (a,b)) samples-        throwErrorUnless (validInstanceRLWR s' samples')-          "An RLWR sample was invalid.")))---- | Read an XML file for the beacon corresponding to the provided time.-readBeacon :: (MonadIO m, MonadError String m)-              => FilePath -> BeaconEpoch -> m Record-readBeacon path time = do-  let file = beaconFilePath path time-  checkFileExists file-  rec' <- liftIO $ fromXML <$> BS.readFile file-  maybeThrowError rec' $ "Could not parse " ++ file---- | Test if the 'gSqNorm' of the error for each RLWE sample in the--- instance (given the secret) is less than the given bound.-validInstanceCont ::-  (C.RLWECtx t m zq rrq, Ord (LiftOf rrq), Ring (LiftOf rrq))-  => LiftOf rrq -> Cyc t m zq -> [C.Sample t m zq rrq] -> Bool-validInstanceCont bound s = all ((bound > ) . C.errorGSqNorm s)---- | Test if the 'gSqNorm' of the error for each RLWE sample in the--- instance (given the secret) is less than the given bound.-validInstanceDisc :: (D.RLWECtx t m zq)-                     => LiftOf zq -> Cyc t m zq -> [D.Sample t m zq] -> Bool-validInstanceDisc bound s = all ((bound > ) . D.errorGSqNorm s)---- | Test if the given RLWR instance is valid for the given secret.-validInstanceRLWR :: (R.RLWRCtx t m zq zp, Eq zp)-  => Cyc t m zq -> [R.Sample t m zq zp] -> Bool-validInstanceRLWR s = let s' = adviseCRT s in all (validSampleRLWR s')---- | Test if the given RLWR sample is valid for the given secret.-validSampleRLWR :: (R.RLWRCtx t m zq zp, Eq zp)-  => Cyc t m zq -> R.Sample t m zq zp -> Bool-validSampleRLWR s (a,b) = b == R.roundedProd s a
rlwe-challenges.cabal view
@@ -5,7 +5,7 @@ -- PVP summary:      +-+------- breaking API changes --                   | | +----- non-breaking API additions --                   | | | +--- code changes with no API change-version:             0.0.0.1+version:             0.1.0.0 synopsis:            Ring-LWE/LWR challenges using Lol. homepage:            https://github.com/cpeikert/Lol Bug-Reports:         https://github.com/cpeikert/Lol/issues@@ -17,9 +17,15 @@ category:            Crypto stability:           experimental build-type:          Simple-extra-source-files:  README, CHANGES.md+extra-source-files:  README, CHANGES.md, Challenges.proto cabal-version:       >= 1.10-description:         TODO.+description:+    Contains a library for reading serialized challenges+    (generated with <https://hackage.haskell.org/package/hprotoc hprotoc>)+    and an executable used to generate, suppress, and verify RLWE and RLWR+    challenges using <https://hackage.haskell.org/package/lol Λ ∘ λ>  (Lol).+    You can find more information about the challenges+    <https://web.eecs.umich.edu/~cpeikert/rlwe-challenges here>.  source-repository head   type: git@@ -27,7 +33,7 @@  library   default-language: Haskell2010-  ghc-options: -O3 -auto-all -caf-all -Wall+  ghc-options: -O2 -Wall    exposed-modules:     Crypto.Proto.RLWE.Challenges@@ -40,46 +46,53 @@     Crypto.Proto.RLWE.Challenges.InstanceDisc     Crypto.Proto.RLWE.Challenges.InstanceRLWR     Crypto.Proto.RLWE.Challenges.Secret--  build-depends: base < 5,-                 lol >= 0.5.0.0,-                 MonadRandom,-                 protocol-buffers,-                 protocol-buffers-descriptor--executable rlwe-challenges-  default-language: Haskell2010-  hs-source-dirs: exec-  main-is: Main.hs--  ghc-options: -threaded -rtsopts -O3 -auto-all -caf-all -fno-warn-partial-type-signatures+    Crypto.Proto.RLWE.Challenges.InstanceCont1+    Crypto.Proto.RLWE.Challenges.InstanceDisc1+    Crypto.Proto.RLWE.Challenges.InstanceRLWR1+    Crypto.Proto.RLWE.Challenges.Secret1 -  other-modules:-    Beacon-    Common-    Generate-    Params-    Suppress-    Verify+    Crypto.RLWE.Challenges.Beacon+    Crypto.RLWE.Challenges.Common+    Crypto.RLWE.Challenges.Generate+    Crypto.RLWE.Challenges.Params+    Crypto.RLWE.Challenges.Suppress+    Crypto.RLWE.Challenges.Verify    build-depends: ansi-terminal,-                 base,+                 base >= 4.9 && < 5,                  bytestring,                  containers,                  directory,                  DRBG,                  filepath,-                 http-client,+                 http-client >= 0.5,                  http-conduit,-                 lol >= 0.5.0.0,+                 lol >= 0.6.0.0,+                 lol-cpp,                  MonadRandom,                  mtl,-                 options,                  nist-beacon,                  parsec,                  protocol-buffers,+                 protocol-buffers-descriptor,                  reflection,-                 rlwe-challenges,                  tagged,+                 time++executable rlwe-challenges+  default-language: Haskell2010+  hs-source-dirs:   exec+  main-is:          RLWEChallengesMain.hs+  ghc-options:      -main-is RLWEChallengesMain++  ghc-options: -threaded -rtsopts -O2 -auto-all -caf-all -fno-warn-partial-type-signatures++  build-depends: ansi-terminal,+                 base >= 4.9 && < 5,+                 lol >= 0.6.0.0,+                 MonadRandom,+                 options,+                 protocol-buffers,+                 rlwe-challenges,                  time,                  transformers