|
| 1 | +{-# OPTIONS_GHC -Wno-overlapping-patterns #-} |
| 2 | + |
1 | 3 | {-|
|
2 | 4 | Module : Botan.Low.Cipher
|
3 | 5 | Description : Symmetric cipher modes
|
@@ -272,7 +274,7 @@ newCipherKey :: (MonadRandomIO m) => Cipher -> m CipherKey
|
272 | 274 | newCipherKey = newKey . cipherKeySpec
|
273 | 275 |
|
274 | 276 | newCipherKeyMaybe :: (MonadRandomIO m) => Int -> Cipher -> m (Maybe CipherKey)
|
275 |
| -newCipherKeyMaybe sz bc = newKeyMaybe sz (cipherKeySpec bc) |
| 277 | +newCipherKeyMaybe sz bc = newKeyMaybe sz (cipherKeySpec bc) |
276 | 278 |
|
277 | 279 | type CipherNonce = ByteString
|
278 | 280 |
|
@@ -347,7 +349,7 @@ cipherDefaultNonceSize (CBC bc _) = blockCipherBlockSize bc
|
347 | 349 | cipherDefaultNonceSize (CFB bc _) = blockCipherBlockSize bc
|
348 | 350 | cipherDefaultNonceSize (XTS bc) = blockCipherBlockSize bc
|
349 | 351 | -- NOTE: This is the value at current, and matches the default in botan,
|
350 |
| --- presumably because 12 is valid for all remaining cipher / AEAD nonces |
| 352 | +-- presumably because 12 is valid for all remaining cipher / AEAD nonces |
351 | 353 | cipherDefaultNonceSize _ = 12
|
352 | 354 | -- NOTE: Extracted from inspecting:
|
353 | 355 | {-
|
@@ -467,7 +469,7 @@ cipherIdealUpdateGranularity cipher = unsafePerformIO $ do
|
467 | 469 | Low.cipherGetIdealUpdateGranularity ctx
|
468 | 470 | {-# NOINLINE cipherIdealUpdateGranularity #-}
|
469 | 471 | -- NOTE: This is machine-dependent, but should stay consistent per-machine
|
470 |
| --- so we do this instead of inlining the values |
| 472 | +-- so we do this instead of inlining the values |
471 | 473 |
|
472 | 474 | cipherOutputLength :: Cipher -> CipherDirection -> Int -> Int
|
473 | 475 | cipherOutputLength c dir n = unsafePerformIO $ do
|
@@ -550,7 +552,7 @@ data CipherDirection
|
550 | 552 | = CipherEncrypt
|
551 | 553 | | CipherDecrypt
|
552 | 554 | deriving (Eq, Ord, Show)
|
553 |
| - |
| 555 | + |
554 | 556 | cipherDirectionFlags :: CipherDirection -> Low.CipherInitFlags
|
555 | 557 | cipherDirectionFlags CipherEncrypt = Low.Encrypt
|
556 | 558 | cipherDirectionFlags CipherDecrypt = Low.Decrypt
|
@@ -612,7 +614,7 @@ getCipherEstimateOutputLength ctx input = do
|
612 | 614 | t <- getCipherTagSize ctx
|
613 | 615 | if mutableCipherDirection ctx == CipherEncrypt
|
614 | 616 | then return (o + u + t)
|
615 |
| - else return (o + u - t) -- TODO: Maybe just 'o'... |
| 617 | + else return (o + u - t) -- TODO: Maybe just 'o'... |
616 | 618 |
|
617 | 619 | -- NOTE: Supposed to be an upper bound, may not always be valid? - needs checking
|
618 | 620 | {-# WARNING getCipherOutputLength "Needs to be confirmed accurate, use getCipherEstimateOutputLength" #-}
|
|
0 commit comments