diff options
-rw-r--r-- | lib/OpenPGP.hs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/OpenPGP.hs b/lib/OpenPGP.hs index a1e6072..6a161a7 100644 --- a/lib/OpenPGP.hs +++ b/lib/OpenPGP.hs | |||
@@ -10,6 +10,7 @@ import qualified Data.ByteString.Lazy.UTF8 as LZ (toString, fromString) | |||
10 | 10 | ||
11 | import Data.Binary | 11 | import Data.Binary |
12 | import Data.Binary.Get | 12 | import Data.Binary.Get |
13 | import Data.Binary.Put | ||
13 | import qualified Codec.Compression.Zlib.Raw as Zip | 14 | import qualified Codec.Compression.Zlib.Raw as Zip |
14 | import qualified Codec.Compression.Zlib as Zlib | 15 | import qualified Codec.Compression.Zlib as Zlib |
15 | import qualified Codec.Compression.BZip as BZip2 | 16 | import qualified Codec.Compression.BZip as BZip2 |
@@ -76,7 +77,7 @@ instance Binary Packet where | |||
76 | -- Use 5-octet lengths | 77 | -- Use 5-octet lengths |
77 | put (255 :: Word8) | 78 | put (255 :: Word8) |
78 | put ((fromIntegral $ LZ.length body) :: Word32) | 79 | put ((fromIntegral $ LZ.length body) :: Word32) |
79 | mapM_ putWord8 (LZ.unpack body) | 80 | putLazyByteString body |
80 | where (body, tag) = put_packet p | 81 | where (body, tag) = put_packet p |
81 | get = do | 82 | get = do |
82 | tag <- get :: Get Word8 | 83 | tag <- get :: Get Word8 |
@@ -410,7 +411,7 @@ instance Binary MPI where | |||
410 | put (((fromIntegral . LZ.length $ bytes) - 1) * 8 | 411 | put (((fromIntegral . LZ.length $ bytes) - 1) * 8 |
411 | + floor (logBase 2 $ fromIntegral (bytes `LZ.index` 0)) | 412 | + floor (logBase 2 $ fromIntegral (bytes `LZ.index` 0)) |
412 | + 1 :: Word16) | 413 | + 1 :: Word16) |
413 | mapM_ putWord8 (LZ.unpack bytes) | 414 | putLazyByteString bytes |
414 | where bytes = LZ.unfoldr (\x -> if x == 0 then Nothing | 415 | where bytes = LZ.unfoldr (\x -> if x == 0 then Nothing |
415 | else Just (fromIntegral x, x `shiftR` 8)) i | 416 | else Just (fromIntegral x, x `shiftR` 8)) i |
416 | get = do | 417 | get = do |
@@ -430,7 +431,7 @@ instance Binary SignatureSubpacket where | |||
430 | put (255 :: Word8) | 431 | put (255 :: Word8) |
431 | put ((fromIntegral $ LZ.length body) + 1 :: Word32) | 432 | put ((fromIntegral $ LZ.length body) + 1 :: Word32) |
432 | put tag | 433 | put tag |
433 | mapM_ putWord8 (LZ.unpack body) | 434 | putLazyByteString body |
434 | where (body, tag) = put_signature_subpacket p | 435 | where (body, tag) = put_signature_subpacket p |
435 | get = do | 436 | get = do |
436 | len <- fmap fromIntegral (get :: Get Word8) | 437 | len <- fmap fromIntegral (get :: Get Word8) |