| Commit message (Collapse) | Author | Age |
|
|
|
| |
It’s getting messy, so switch to a parameters datatype pattern.
|
|
|
|
|
|
| |
Replace tables of tuples with simple function calls, and normalize
argument order to have outputs to the right of inputs. Also factor out
some common patterns.
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
| |
Use unsigned char buffers more pervasively throughout the code. This
removes most calls to `asCUCharBuf`, isolating `unsafeCoerce` further.
By making some type signatures slightly more flexible, also eliminate
most explicit integer conversions.
|
|
|
|
|
|
| |
Move Data.Digest.Internal’s functions and types into more appropriate
modules. There’s now a single BTLS hierarchy that contains all internal
modules for the project.
|
| |
|
|
|
|
|
|
| |
Clarify the division between internal and external modules in the source
by consolidating all internal modules except Data.Digest.Internal into a
flatter BTLS directory.
|
| |
|
| |
|
|
|
|
|
|
| |
I don’t always like the output hindent gives, so reformat the project
to be a bit closer to what you see in published Haskell books and the
like.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
Let the computer figure out its own types for most foreign imports.
Continue using the vanilla FFI for finalizers, though, as that’s the
easiest way to deal with function pointers.
Reuse the build hook from gtk2hs-buildtools to work around Cabal’s
inability to topologically sort .chs dependencies
(https://github.com/haskell/cabal/issues/1906).
|
| |
|
|
|
|
|
|
|
| |
Eliminate the functional interface for hashing. Hashing now occurs
exclusively through the `hash` function, which accepts a
`Data.Digest.Algorithm`. This makes btls somewhat less extensible, but
it’s the most elegant way to support HMACs.
|
|
|
|
|
|
|
|
|
| |
Rework the SHA-2 implementation to use the low-level sha.h interface
rather than the higher-level evp.h. This allows us to preallocate all
the data structures, eliminating BoringSSL cleanup functions. As a
result, we can implement hashing under `unsafeLocalState` (a.k.a.
`unsafeDupablePerformIO`) instead of `unsafePerformIO`, which should
improve performance in multithreaded programs.
|
|
So far, btls provides SHA-224, SHA-256, SHA-384, and SHA-512 algorithms.
To do that, I
- vendor BoringSSL and create a custom `Setup.hs` to build it,
- wrap a number of functions and values from BoringSSL's EVP
subsystem, and
- implement the four SHA-2 algorithms using the wrapped routines.
I provide conformance tests incorporating the official NIST example
vectors and the vectors used in the Go SHA-2 test suite. The tests also
use SmallCheck to compare btls’s SHA-2 implementations with those
provided by the system’s Coreutils and openssl(1) installations.
|