Commit Graph

70 Commits

Author SHA1 Message Date
Trevor Elliott
5a43c1d1fe More precise definition of chunks
Use `padding` directly in the definition of `chunks`, giving an aligned
value to the division.
2017-03-27 16:37:55 -07:00
Trevor Elliott
b93f84cf78 Remove unnecessary constraint that was preventing malicious_SHA1.cry from loading
Cryptol could not prove that subtracting `65 + padding` from `512 * chunks`
in the constraint `msgLen == 512 * chunks - (65 + padding)` was well
defined, and rejected the function. This constraint was redundant, so
removing it allowed the function to typecheck.
2017-03-27 16:36:09 -07:00
Trevor Elliott
4dc5eda23a Expand the width table, and fix a bug in CryptoBox (Thanks @tommd)
The width table in CryptolTC.z3 wasn't large enough to solve constraints
about the width of 64-bit words. This change is a bit of a band-aid, as
larger words will expose the same problem. Longer-term, we should try to
solve these constraints after the SMT-based phase, using some other
approach.

The constraints in CryptoBox were too permissive, and when adjusted to
represent the true intent (that values fit within 64-bits), and the
width table was updated, the example will type-check again.

Thanks to @tommd for tracking both of these down.
2017-03-27 13:45:50 -07:00
Robert Dockins
14af3690c6 Update the SIV example to avoid issue #375. 2016-08-23 14:08:15 -07:00
Robert Dockins
cd9ffed00b Update examples to use (/\) instead of (&&) where appropriate,
and to squash other warnings related to the upcomming precedence change.
2016-08-22 18:14:44 -07:00
Iavor S. Diatchki
8c36992904 Merge pull request #344 from adrianherrera/enhancement/MISTY1
Crytol spec for MISTY1 cipher
2016-07-18 11:19:53 -07:00
Adam C. Foltzer
2c428804bc remove splitBy and update documentation
Closes #291
2016-07-05 09:58:49 -07:00
Adrian Herrera
bedeeb0883 Crytol spec for MISTY1 cipher (as described in RFC 2994) 2016-06-07 22:42:16 +10:00
Brian Huffman
df27f577a4 Fix typo in comment, whitespace 2016-05-24 08:21:55 -07:00
Thomas M. DuBuisson
8b577828f6 Simplify constraints of Minilock prims.
Cryptol 2.3-alpha couldn't math, but thanks to @yav's hard work, Cryptol 2.3 and
later can math!  So with our new found powers comes great simplification.  Not
all is perfect, much like Dori-Mic's situation, but things are much better.
See the width constraints in SCrypt.cry for areas that could be improved with
some semi-obvious statements (forall x. 1 + width x >= width (x - 1)).
2016-04-12 15:53:12 -07:00
Brian Huffman
5e5184d5ee Add alternative implementations of bivium and trivium ciphers 2016-02-19 14:24:07 -08:00
Brian Huffman
ab82097033 Fix bug/typo in Trivium example implementation
See also the Trivium specification:
http://www.ecrypt.eu.org/stream/ciphers/trivium/trivium.pdf
2016-02-19 14:04:52 -08:00
Brian Huffman
1322156d28 Remove trailing whitespace 2016-02-19 10:08:20 -08:00
Aaron Tomb
9809e176eb Add examples from Alexander Semenov
A new Cryptol user! Alexander Semenov from the Russian Academy of
Sciences is the developer of the Transalg tool, which can also translate
cryptographic algorithms (written in imperative form) into SAT problems.
He recently started experimenting with Cryptol, and wrote up
implementations of several stream ciphers, included in this commit.
2016-02-18 15:08:17 -08:00
Thomas M. DuBuisson
9b8d153692 Import ::Extras in minilock modules. 2016-01-20 09:45:13 -08:00
Adam C. Foltzer
bf294a60b8 integrate MiniLock example 2016-01-19 18:19:35 -08:00
Thomas M. DuBuisson
a4e42b8429 Example: miniLock in Cryptol 2016-01-19 18:19:35 -08:00
Adam C. Foltzer
58a605e8ff update examples and documentation 2016-01-19 18:19:35 -08:00
Adam C. Foltzer
4d3fc9a413 Update copyright dates and add missing headers 2016-01-19 18:19:35 -08:00
Adam C. Foltzer
ee99873e43 fix FoxChickenCorn example
The new type signature for popCount is simpler, and more importantly
passes the typechecker. The old one really _ought_ to typecheck, though,
so a shrunken version of it is now in the test suite for #126
2016-01-19 18:18:03 -08:00
Adam C. Foltzer
07da2018b7 switch to more portable seeding for random
The `random` primitive previously took a `[32]` seed, but this causes
inconsistency between 32-bit and 64-bit platforms when the seed is large
enough to wrap around in GHC's representation of an `Int`. This patch
switches to an API that seeds directly with four 64-bit words, and so
should behave the same way on our supported platforms.
2016-01-19 18:17:34 -08:00
Thomas M. DuBuisson
46599a03b5 make SHA1 typecheck with Cryptol 2.3
There were some spurious constraints to help the previous typechecker figure
things out that now confuse the new one... ugh.
2016-01-12 17:22:22 -08:00
Thomas M. DuBuisson
fc04e415d7 Don't expose internal type in the Function API.
I've found that exposing helper types that are only of internal concern to the
function to be bad form.  These values should be in where clauses both to help
the type checker not get distracted and to keep the user-facing API as clean as
possible.
2016-01-12 16:52:40 -08:00
Adam C. Foltzer
9e179d14bc finally add Even-Mansour example; closes #124 2016-01-12 16:49:47 -08:00
Thomas M. DuBuisson
17abf37b7d A rough cut at SIV. 2015-09-16 09:19:27 -07:00
Thomas M. DuBuisson
7643a17182 Fix #272 Don't full blocks in ChaChaPoly8675309 2015-08-28 15:22:03 -07:00
Aaron Tomb
44f8bcd310 Fix comment in Keccak example
Note: this is actually Cryptol 1 code. We should port it. I've started
the process, but don't have a complete port yet.
2015-08-28 09:49:29 -07:00
Dylan McNamee
f12f7d82eb lg2 -> width 2015-04-20 10:00:25 -07:00
Iavor S. Diatchki
afd53bb6a1 Merge remote-tracking branch 'origin/master' into wip/cs
Conflicts:
	cryptol.cabal
	src/Cryptol/TypeCheck/Solve.hs
	src/Cryptol/TypeCheck/Solver/CrySAT.hs
	src/Cryptol/TypeCheck/Solver/Selector.hs
2015-03-30 11:29:20 -07:00
Adam C. Foltzer
0536d0f15a update copyright years 2015-03-24 11:19:52 -07:00
Dylan McNamee
1fd98e02b0 removed property keyword from helper functions. Thanks to Joey Dodds for pointing this out. 2015-03-09 14:43:30 -07:00
Dylan McNamee
a246f25211 coins puzzle added to funstuff 2015-03-03 10:51:18 -08:00
Adam C. Foltzer
9923b6f11a split out notebook into separate package
This involved:

- Moving a couple REPL modules into the Cryptol library hierarchy (those
  that don't depend on console libraries)
- Splitting up the Makefile, which unfortunately resulted in a lot of
  not-quite-duplication between the two Makefiles. Let's look into
  better abstraction...
2015-03-02 15:46:21 -08:00
Adam C. Foltzer
adcd96fa47 make notebook distributable
This commit brings the notebook into the rest of the distribution
infrastructure set up for cryptol. The main points are:

- new icryptol-kernel executable
- new icryptol shell script that wraps ipython and makes sure the
  cryptol profile is set up
- Makefile target for friendly local testing (`make notebook`)
- moved example notebooks to examples subdirectory
2015-02-11 16:21:43 -08:00
Adam C. Foltzer
22df9717cb properties and cleanup for new contrib examples 2015-01-18 12:46:03 -08:00
Adam C. Foltzer
d7e9b9b3c6 add README for contrib 2015-01-18 12:45:39 -08:00
Adam C. Foltzer
473b175922 move RC4 to contrib directory 2015-01-18 11:47:40 -08:00
orchid
1f3c9b8203 RC4 2015-01-18 11:47:40 -08:00
Adam C. Foltzer
85e1725b29 Merge pull request #69 from mknight-tag/master
Add MKRAND RBG to contrib
2015-01-18 11:42:21 -08:00
Dylan McNamee
16bca156d7 Salsa20 working better with type checker improvements (thanks, Sean!) 2014-12-17 06:44:39 -05:00
Dylan McNamee
675ca65c9a fixes to Salsa20 spec suggested by Sean (thanks!) 2014-10-10 12:37:10 -07:00
M Knight
ee86eb87fd Back out ND until Cryptol exposes IO Monad [fd4f4] 2014-09-24 09:13:28 -05:00
Thomas M. DuBuisson
31f0015e8c Merge pull request #29 from TomMD/fnv1a-example
Add an FNV-1a example (non-cryptographic hash).
2014-09-14 15:05:24 -07:00
Dylan McNamee
75852a2596 Merge branch 'master' of https://github.com/GaloisInc/cryptol 2014-09-10 14:27:26 -07:00
Dylan McNamee
81adb95a37 tweaks to documentation and Salsa20 fix from Sean 2014-09-10 14:27:08 -07:00
Adam C. Foltzer
a0bb572388 add note about solvers for ZUC theorem 2014-09-08 14:45:10 -07:00
Adam C. Foltzer
4622a1d177 add ZUC example, translated from Cryptol 1 2014-09-04 11:05:42 -07:00
Adam C. Foltzer
d409116160 Merge branch 'devel'
This was the branch I originally set up for git flow, but we're moving
to production=release and develop=master, so this branch is obsolete.
2014-08-19 10:31:31 -07:00
M Knight
502816fbd3 Add MKRAND RBG 2014-08-10 10:47:19 -05:00
Joey Dodds
7300f29606 changed collision properties to require inputs to be different 2014-08-06 10:16:14 -07:00