Skip to content
This repository has been archived by the owner on Sep 20, 2023. It is now read-only.

Commit

Permalink
Support building against system argon2/blake2.
Browse files Browse the repository at this point in the history
  • Loading branch information
QuLogic committed Apr 5, 2018
1 parent 8b50830 commit 3e87c66
Showing 1 changed file with 25 additions and 16 deletions.
41 changes: 25 additions & 16 deletions cryptonite.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ source-repository head
type: git
location: https://github.com/haskell-crypto/cryptonite

Flag use-system-library
Description: Use system @libargon2@ (via @pkg-config(1)@) and @blake2@ libraries instead of embedded copies
Default: False
manual: True

Flag support_aesni
Description: allow compilation with AESNI on system and architecture that supports it
Default: True
Expand All @@ -78,7 +83,7 @@ Flag support_pclmuldq
Manual: True

Flag support_sse
Description: Use SSE optimized version of (BLAKE2, ARGON2)
Description: Use SSE optimized version of (BLAKE2, ARGON2) (does nothing when using system libraries)
Default: False
Manual: True

Expand Down Expand Up @@ -330,24 +335,28 @@ Library
, cbits/aes/gf.c
, cbits/cryptonite_aes.c

if arch(x86_64) || flag(support_sse)
C-sources: cbits/blake2/sse/blake2s.c
, cbits/blake2/sse/blake2sp.c
, cbits/blake2/sse/blake2b.c
, cbits/blake2/sse/blake2bp.c
include-dirs: cbits/blake2/sse
if flag(use-system-library)
Extra-libraries: b2
PkgConfig-Depends: libargon2
else
C-sources: cbits/blake2/ref/blake2s-ref.c
, cbits/blake2/ref/blake2sp-ref.c
, cbits/blake2/ref/blake2b-ref.c
, cbits/blake2/ref/blake2bp-ref.c
include-dirs: cbits/blake2/ref
if arch(x86_64) || flag(support_sse)
C-sources: cbits/blake2/sse/blake2s.c
, cbits/blake2/sse/blake2sp.c
, cbits/blake2/sse/blake2b.c
, cbits/blake2/sse/blake2bp.c
include-dirs: cbits/blake2/sse
else
C-sources: cbits/blake2/ref/blake2s-ref.c
, cbits/blake2/ref/blake2sp-ref.c
, cbits/blake2/ref/blake2b-ref.c
, cbits/blake2/ref/blake2bp-ref.c
include-dirs: cbits/blake2/ref

if arch(x86_64) || flag(support_sse)
CPP-options: -DSUPPORT_SSE
if arch(x86_64) || flag(support_sse)
CPP-options: -DSUPPORT_SSE

C-sources: cbits/argon2/argon2.c
include-dirs: cbits/argon2
C-sources: cbits/argon2/argon2.c
include-dirs: cbits/argon2

if os(windows)
cpp-options: -DWINDOWS
Expand Down

0 comments on commit 3e87c66

Please sign in to comment.