diff options
-rw-r--r-- | Arbitrary.patch | 9 | ||||
-rw-r--r-- | Data/OpenPGP.hs | 6 |
2 files changed, 15 insertions, 0 deletions
diff --git a/Arbitrary.patch b/Arbitrary.patch index aa51d2d..0c2175d 100644 --- a/Arbitrary.patch +++ b/Arbitrary.patch | |||
@@ -28,6 +28,15 @@ | |||
28 | return (SymmetricAlgorithm x1) | 28 | return (SymmetricAlgorithm x1) |
29 | _ -> error "FATAL ERROR: Arbitrary instance, logic bug" | 29 | _ -> error "FATAL ERROR: Arbitrary instance, logic bug" |
30 | 30 | ||
31 | @@ -121,7 +120,7 @@ | ||
32 | 1 -> return ZIP | ||
33 | 2 -> return ZLIB | ||
34 | 3 -> return BZip2 | ||
35 | - 4 -> do x1 <- arbitrary | ||
36 | + 4 -> do x1 <- suchThat arbitrary (`notElem` [0,1,2,3]) | ||
37 | return (CompressionAlgorithm x1) | ||
38 | _ -> error "FATAL ERROR: Arbitrary instance, logic bug" | ||
39 | |||
31 | @@ -134,7 +133,7 @@ | 40 | @@ -134,7 +133,7 @@ |
32 | 41 | ||
33 | instance Arbitrary MPI where | 42 | instance Arbitrary MPI where |
diff --git a/Data/OpenPGP.hs b/Data/OpenPGP.hs index 051bd5d..41a5d4e 100644 --- a/Data/OpenPGP.hs +++ b/Data/OpenPGP.hs | |||
@@ -706,6 +706,7 @@ data SignatureSubpacket = | |||
706 | notation_value::String | 706 | notation_value::String |
707 | } | | 707 | } | |
708 | PreferredHashAlgorithmsPacket [HashAlgorithm] | | 708 | PreferredHashAlgorithmsPacket [HashAlgorithm] | |
709 | PreferredCompressionAlgorithmsPacket [CompressionAlgorithm] | | ||
709 | UnsupportedSignatureSubpacket Word8 B.ByteString | 710 | UnsupportedSignatureSubpacket Word8 B.ByteString |
710 | deriving (Show, Read, Eq) | 711 | deriving (Show, Read, Eq) |
711 | 712 | ||
@@ -776,6 +777,8 @@ put_signature_subpacket (NotationDataPacket human_readable name value) = | |||
776 | flag1 = if human_readable then 0x80 else 0x0 | 777 | flag1 = if human_readable then 0x80 else 0x0 |
777 | put_signature_subpacket (PreferredHashAlgorithmsPacket algos) = | 778 | put_signature_subpacket (PreferredHashAlgorithmsPacket algos) = |
778 | (B.concat $ map encode algos, 21) | 779 | (B.concat $ map encode algos, 21) |
780 | put_signature_subpacket (PreferredCompressionAlgorithmsPacket algos) = | ||
781 | (B.concat $ map encode algos, 22) | ||
779 | put_signature_subpacket (UnsupportedSignatureSubpacket tag bytes) = | 782 | put_signature_subpacket (UnsupportedSignatureSubpacket tag bytes) = |
780 | (bytes, tag) | 783 | (bytes, tag) |
781 | 784 | ||
@@ -839,6 +842,9 @@ parse_signature_subpacket 20 = do | |||
839 | -- PreferredHashAlgorithmsPacket, http://tools.ietf.org/html/rfc4880#section-5.2.3.8 | 842 | -- PreferredHashAlgorithmsPacket, http://tools.ietf.org/html/rfc4880#section-5.2.3.8 |
840 | parse_signature_subpacket 21 = | 843 | parse_signature_subpacket 21 = |
841 | fmap PreferredHashAlgorithmsPacket listUntilEnd | 844 | fmap PreferredHashAlgorithmsPacket listUntilEnd |
845 | -- PreferredCompressionAlgorithms, http://tools.ietf.org/html/rfc4880#section-5.2.3.9 | ||
846 | parse_signature_subpacket 22 = | ||
847 | fmap PreferredCompressionAlgorithmsPacket listUntilEnd | ||
842 | -- Represent unsupported packets as their tag and literal bytes | 848 | -- Represent unsupported packets as their tag and literal bytes |
843 | parse_signature_subpacket tag = | 849 | parse_signature_subpacket tag = |
844 | fmap (UnsupportedSignatureSubpacket tag) getRemainingByteString | 850 | fmap (UnsupportedSignatureSubpacket tag) getRemainingByteString |