diff options
author | Benjamin Barenblat <bbaren@google.com> | 2018-08-02 17:08:44 -0400 |
---|---|---|
committer | Benjamin Barenblat <bbaren@google.com> | 2018-08-02 17:08:44 -0400 |
commit | 2152e7728db7e0cf86ea23d29a05294af24b6898 (patch) | |
tree | 68d29e2afe6a92391350e36ef67c4f7489ed715d | |
parent | 5214c3f61d3aaaf18baff8020a066cc2160d612d (diff) |
Begin cleaning up internal modules
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.
-rw-r--r-- | btls.cabal | 20 | ||||
-rw-r--r-- | src/BTLS/BoringSSL/Base.chs (renamed from src/Internal/Base.chs) | 2 | ||||
-rw-r--r-- | src/BTLS/BoringSSL/Digest.chs (renamed from src/Internal/Digest.chs) | 10 | ||||
-rw-r--r-- | src/BTLS/BoringSSL/HKDF.chs (renamed from src/Internal/HKDF.chs) | 6 | ||||
-rw-r--r-- | src/BTLS/BoringSSL/HMAC.chs (renamed from src/Internal/HMAC.chs) | 10 | ||||
-rw-r--r-- | src/BTLS/Cast.hs (renamed from src/Foreign/Ptr/Cast.hs) | 2 | ||||
-rw-r--r-- | src/BTLS/ConstantTimeEquals.chs (renamed from src/Foreign/Ptr/ConstantTimeEquals.chs) | 4 | ||||
-rw-r--r-- | src/BTLS/CreateWithFinalizer.hs (renamed from src/Foreign/Ptr/CreateWithFinalizer.hs) | 2 | ||||
-rw-r--r-- | src/BTLS/Result.hs (renamed from src/Result.hs) | 2 | ||||
-rw-r--r-- | src/BTLS/Types.hs (renamed from src/Types.hs) | 2 | ||||
-rw-r--r-- | src/Codec/Crypto/HKDF.hs | 8 | ||||
-rw-r--r-- | src/Data/Digest.hs | 4 | ||||
-rw-r--r-- | src/Data/Digest/Internal.hs | 4 | ||||
-rw-r--r-- | src/Data/HMAC.hs | 8 |
14 files changed, 42 insertions, 42 deletions
@@ -70,16 +70,16 @@ library exposed-modules: Codec.Crypto.HKDF , Data.Digest , Data.HMAC - other-modules: Data.Digest.Internal - , Foreign.Ptr.Cast - , Foreign.Ptr.ConstantTimeEquals - , Foreign.Ptr.CreateWithFinalizer - , Internal.Base - , Internal.Digest - , Internal.HKDF - , Internal.HMAC - , Result - , Types + other-modules: BTLS.BoringSSL.Base + , BTLS.BoringSSL.Digest + , BTLS.BoringSSL.HKDF + , BTLS.BoringSSL.HMAC + , BTLS.Cast + , BTLS.ConstantTimeEquals + , BTLS.CreateWithFinalizer + , BTLS.Result + , BTLS.Types + , Data.Digest.Internal c-sources: cbits/btls.c -- Use special names for the BoringSSL libraries to avoid accidentally pulling -- in OpenSSL. diff --git a/src/Internal/Base.chs b/src/BTLS/BoringSSL/Base.chs index f0b03cc..347e3f4 100644 --- a/src/Internal/Base.chs +++ b/src/BTLS/BoringSSL/Base.chs @@ -14,7 +14,7 @@ {-# OPTIONS_GHC -Wno-unused-imports #-} -module Internal.Base where +module BTLS.BoringSSL.Base where import Foreign (Ptr, nullPtr) diff --git a/src/Internal/Digest.chs b/src/BTLS/BoringSSL/Digest.chs index bd331a7..69f3a0a 100644 --- a/src/Internal/Digest.chs +++ b/src/BTLS/BoringSSL/Digest.chs @@ -14,7 +14,7 @@ {-# OPTIONS_GHC -Wno-missing-methods #-} -module Internal.Digest +module BTLS.BoringSSL.Digest ( evpMD5, evpSHA1, evpSHA224, evpSHA256, evpSHA384, evpSHA512 , mallocEVPMDCtx , evpDigestInitEx, evpDigestUpdate, evpDigestFinalEx @@ -23,11 +23,11 @@ module Internal.Digest import Foreign (FinalizerPtr, ForeignPtr, Ptr, Storable(alignment, sizeOf)) import Foreign.C.Types -import Foreign.Ptr.Cast (asVoidPtr) -import Foreign.Ptr.CreateWithFinalizer (createWithFinalizer) -{#import Internal.Base#} -import Result +{#import BTLS.BoringSSL.Base#} +import BTLS.Cast (asVoidPtr) +import BTLS.CreateWithFinalizer (createWithFinalizer) +import BTLS.Result #include <openssl/digest.h> diff --git a/src/Internal/HKDF.chs b/src/BTLS/BoringSSL/HKDF.chs index a3a48ed..3710c0c 100644 --- a/src/Internal/HKDF.chs +++ b/src/BTLS/BoringSSL/HKDF.chs @@ -12,15 +12,15 @@ -- License for the specific language governing permissions and limitations under -- the License. -module Internal.HKDF +module BTLS.BoringSSL.HKDF ( hkdfExtract, hkdfExpand ) where import Foreign (Ptr) import Foreign.C.Types -{#import Internal.Base#} -import Result +{#import BTLS.BoringSSL.Base#} +import BTLS.Result #include <openssl/hkdf.h> diff --git a/src/Internal/HMAC.chs b/src/BTLS/BoringSSL/HMAC.chs index 2151785..5c53122 100644 --- a/src/Internal/HMAC.chs +++ b/src/BTLS/BoringSSL/HMAC.chs @@ -14,7 +14,7 @@ {-# OPTIONS_GHC -Wno-missing-methods #-} -module Internal.HMAC +module BTLS.BoringSSL.HMAC ( mallocHMACCtx , hmacInitEx, hmacUpdate, hmacFinal ) where @@ -22,10 +22,10 @@ module Internal.HMAC import Foreign (FinalizerPtr, ForeignPtr, Ptr, Storable(alignment, sizeOf)) import Foreign.C.Types -import Foreign.Ptr.Cast (asVoidPtr) -import Foreign.Ptr.CreateWithFinalizer (createWithFinalizer) -{#import Internal.Base#} -import Result +{#import BTLS.BoringSSL.Base#} +import BTLS.Cast (asVoidPtr) +import BTLS.CreateWithFinalizer (createWithFinalizer) +import BTLS.Result #include <openssl/hmac.h> diff --git a/src/Foreign/Ptr/Cast.hs b/src/BTLS/Cast.hs index 653604a..6f29469 100644 --- a/src/Foreign/Ptr/Cast.hs +++ b/src/BTLS/Cast.hs @@ -12,7 +12,7 @@ -- License for the specific language governing permissions and limitations under -- the License. -module Foreign.Ptr.Cast where +module BTLS.Cast where import Foreign (Ptr) import Unsafe.Coerce (unsafeCoerce) diff --git a/src/Foreign/Ptr/ConstantTimeEquals.chs b/src/BTLS/ConstantTimeEquals.chs index a96fc66..77b1af0 100644 --- a/src/Foreign/Ptr/ConstantTimeEquals.chs +++ b/src/BTLS/ConstantTimeEquals.chs @@ -12,12 +12,12 @@ -- License for the specific language governing permissions and limitations under -- the License. -module Foreign.Ptr.ConstantTimeEquals where +module BTLS.ConstantTimeEquals where import Foreign (Ptr) import Foreign.C.Types -import Foreign.Ptr.Cast (asVoidPtr) +import BTLS.Cast (asVoidPtr) #include <openssl/mem.h> diff --git a/src/Foreign/Ptr/CreateWithFinalizer.hs b/src/BTLS/CreateWithFinalizer.hs index b1dd583..3862225 100644 --- a/src/Foreign/Ptr/CreateWithFinalizer.hs +++ b/src/BTLS/CreateWithFinalizer.hs @@ -12,7 +12,7 @@ -- License for the specific language governing permissions and limitations under -- the License. -module Foreign.Ptr.CreateWithFinalizer (createWithFinalizer) where +module BTLS.CreateWithFinalizer (createWithFinalizer) where import Foreign (FinalizerPtr, ForeignPtr, Ptr, Storable, addForeignPtrFinalizer, diff --git a/src/Result.hs b/src/BTLS/Result.hs index dfd3b9f..b9ad4a7 100644 --- a/src/Result.hs +++ b/src/BTLS/Result.hs @@ -12,7 +12,7 @@ -- License for the specific language governing permissions and limitations under -- the License. -module Result where +module BTLS.Result where import Control.Exception (assert) import Foreign (throwIf_) diff --git a/src/Types.hs b/src/BTLS/Types.hs index 3c0f350..dbd806a 100644 --- a/src/Types.hs +++ b/src/BTLS/Types.hs @@ -12,7 +12,7 @@ -- License for the specific language governing permissions and limitations under -- the License. -module Types +module BTLS.Types ( AssociatedData(AssociatedData) , Salt(Salt), noSalt , SecretKey(SecretKey) diff --git a/src/Codec/Crypto/HKDF.hs b/src/Codec/Crypto/HKDF.hs index 1c1dbda..8c1db0a 100644 --- a/src/Codec/Crypto/HKDF.hs +++ b/src/Codec/Crypto/HKDF.hs @@ -24,11 +24,11 @@ import Foreign.C.Types import Foreign.Marshal.Unsafe (unsafeLocalState) import Unsafe.Coerce (unsafeCoerce) -import Data.Digest.Internal (Algorithm(Algorithm)) -import Internal.Digest (evpMaxMDSize) -import Internal.HKDF -import Types +import BTLS.BoringSSL.Digest (evpMaxMDSize) +import BTLS.BoringSSL.HKDF +import BTLS.Types (AssociatedData(AssociatedData), Salt(Salt), SecretKey(SecretKey), noSalt) +import Data.Digest.Internal (Algorithm(Algorithm)) -- | Computes an HKDF pseudorandom key (PRK) as specified by RFC 5869. extract :: Algorithm -> Salt -> SecretKey -> SecretKey diff --git a/src/Data/Digest.hs b/src/Data/Digest.hs index b5c7390..2d06389 100644 --- a/src/Data/Digest.hs +++ b/src/Data/Digest.hs @@ -27,9 +27,9 @@ import Foreign.C.Types import Foreign.Marshal.Unsafe (unsafeLocalState) import Unsafe.Coerce (unsafeCoerce) +import BTLS.BoringSSL.Base +import BTLS.BoringSSL.Digest import Data.Digest.Internal -import Internal.Base -import Internal.Digest type LazyByteString = ByteString.Lazy.ByteString diff --git a/src/Data/Digest/Internal.hs b/src/Data/Digest/Internal.hs index 02b879c..88a0d9f 100644 --- a/src/Data/Digest/Internal.hs +++ b/src/Data/Digest/Internal.hs @@ -28,8 +28,8 @@ import Data.Word (Word8) import Foreign (ForeignPtr, Storable(peek), Ptr, alloca, allocaArray, withForeignPtr) import Foreign.C.Types -import Internal.Base (EVPMD) -import Internal.Digest (evpMaxMDSize) +import BTLS.BoringSSL.Base (EVPMD) +import BTLS.BoringSSL.Digest (evpMaxMDSize) type LazyByteString = ByteString.Lazy.ByteString diff --git a/src/Data/HMAC.hs b/src/Data/HMAC.hs index 85e6886..29b6ce0 100644 --- a/src/Data/HMAC.hs +++ b/src/Data/HMAC.hs @@ -26,12 +26,12 @@ import Foreign.C.Types import Foreign.Marshal.Unsafe (unsafeLocalState) import Unsafe.Coerce (unsafeCoerce) +import BTLS.BoringSSL.Base +import BTLS.BoringSSL.HMAC +import BTLS.ConstantTimeEquals (constantTimeEquals) +import BTLS.Types (SecretKey(SecretKey)) import Data.Digest.Internal (Algorithm(Algorithm), Digest(Digest), initUpdateFinalize) -import Foreign.Ptr.ConstantTimeEquals (constantTimeEquals) -import Internal.Base -import Internal.HMAC -import Types (SecretKey(SecretKey)) type LazyByteString = ByteString.Lazy.ByteString |