Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package ghc-crypton-asn1-encoding for
openSUSE:Factory checked in at 2026-11-27 19:45:01
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ghc-crypton-asn1-encoding (Old)
and /work/SRC/openSUSE:Factory/.ghc-crypton-asn1-encoding.new.1340718
(New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-crypton-asn1-encoding"
Fri Nov 27 19:45:01 2026 rev:3 rq:1401146 version:0.11.0
Changes:
--------
---
/work/SRC/openSUSE:Factory/ghc-crypton-asn1-encoding/ghc-crypton-asn1-encoding.changes
2026-11-24 12:32:27.699776974 +0100
+++
/work/SRC/openSUSE:Factory/.ghc-crypton-asn1-encoding.new.1340718/ghc-crypton-asn1-encoding.changes
2026-11-27 19:49:11.302445392 +0100
@@ -1,0 +2,13 @@
+Thu Nov 19 22:49:07 UTC 2026 - Peter Simons <[email protected]>
+
+- Update crypton-asn1-encoding to version 0.11.0.
+ ## 0.11.0 - 2026-11-19
+
+ * `decodeASN1'` and the other decoding functions return a malformed value as
+ `Left`, rather than throwing an exception when the result is evaluated.
+ * `getBitString` yields type decoding failed, as `Left`, if the `ByteString`
is
+ empty, rather than throwing an exception.
+ * `getBitString` now yields type decoding failed, as `Left`, if unused bits
in
+ the final subsequent octet are specified but there are no subsequent
octets.
+
+-------------------------------------------------------------------
Old:
----
crypton-asn1-encoding-0.10.0.tar.gz
New:
----
crypton-asn1-encoding-0.11.0.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ ghc-crypton-asn1-encoding.spec ++++++
--- /var/tmp/diff_new_pack.aXCEuf/_old 2026-11-27 19:49:12.606500502 +0100
+++ /var/tmp/diff_new_pack.aXCEuf/_new 2026-11-27 19:49:12.610500671 +0100
@@ -20,7 +20,7 @@
%bcond_with ghc_prof
%bcond_with tests
Name: ghc-%pkg_name
-Version: 0.10.0
+Version: 0.11.0
Release: 0
%global pkgver %pkg_name-%{version}
Summary: ASN.1 data (raw, BER or DER) readers and writers
++++++ crypton-asn1-encoding-0.10.0.tar.gz ->
crypton-asn1-encoding-0.11.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/crypton-asn1-encoding-0.10.0/CHANGELOG.md
new/crypton-asn1-encoding-0.11.0/CHANGELOG.md
--- old/crypton-asn1-encoding-0.10.0/CHANGELOG.md 2025-08-02
00:58:33.000000000 +0200
+++ new/crypton-asn1-encoding-0.11.0/CHANGELOG.md 2026-11-19
23:39:15.000000000 +0100
@@ -6,6 +6,15 @@
and this project adheres to the
[Haskell Package Versioning Policy](https://pvp.haskell.org/).
+## 0.11.0 - 2026-11-19
+
+* `decodeASN1'` and the other decoding functions return a malformed value as
+ `Left`, rather than throwing an exception when the result is evaluated.
+* `getBitString` yields type decoding failed, as `Left`, if the `ByteString` is
+ empty, rather than throwing an exception.
+* `getBitString` now yields type decoding failed, as `Left`, if unused bits in
+ the final subsequent octet are specified but there are no subsequent octets.
+
## 0.10.0 - 2025-08-01
* Depend on package `time-hourglass`, rather than `hourglass`. The fields of
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/crypton-asn1-encoding-0.10.0/crypton-asn1-encoding.cabal
new/crypton-asn1-encoding-0.11.0/crypton-asn1-encoding.cabal
--- old/crypton-asn1-encoding-0.10.0/crypton-asn1-encoding.cabal
2025-08-02 01:01:47.000000000 +0200
+++ new/crypton-asn1-encoding-0.11.0/crypton-asn1-encoding.cabal
2026-11-19 23:27:49.000000000 +0100
@@ -1,11 +1,11 @@
cabal-version: 1.22
--- This file has been generated from package.yaml by hpack version 0.38.1.
+-- This file has been generated from package.yaml by hpack version 0.39.6.
--
-- see: https://github.com/sol/hpack
name: crypton-asn1-encoding
-version: 0.10.0
+version: 0.11.0
synopsis: ASN.1 data (raw, BER or DER) readers and writers
description: A library providing readers and writers of data following the
Abstract Syntax
Notation One (ASN.1) standard in raw form or in the high-level
forms of Basic
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/crypton-asn1-encoding-0.10.0/src/Data/ASN1/BinaryEncoding.hs
new/crypton-asn1-encoding-0.11.0/src/Data/ASN1/BinaryEncoding.hs
--- old/crypton-asn1-encoding-0.10.0/src/Data/ASN1/BinaryEncoding.hs
2025-07-15 01:13:26.000000000 +0200
+++ new/crypton-asn1-encoding-0.11.0/src/Data/ASN1/BinaryEncoding.hs
2026-11-19 21:09:41.000000000 +0100
@@ -13,7 +13,6 @@
, DER (..)
) where
-import qualified Control.Exception as E
import Data.ASN1.BinaryEncoding.Parse ( parseLBS )
import Data.ASN1.BinaryEncoding.Writer ( toLazyByteString )
import Data.ASN1.Encoding
@@ -36,18 +35,18 @@
data DER = DER
instance ASN1DecodingRepr BER where
- decodeASN1Repr _ lbs = decodeEventASN1Repr (const Nothing) `fmap` parseLBS
lbs
+ decodeASN1Repr _ lbs = parseLBS lbs >>= decodeEventASN1Repr (const Nothing)
instance ASN1Decoding BER where
decodeASN1 _ lbs =
- (map fst . decodeEventASN1Repr (const Nothing)) `fmap` parseLBS lbs
+ map fst <$> (parseLBS lbs >>= decodeEventASN1Repr (const Nothing))
instance ASN1DecodingRepr DER where
- decodeASN1Repr _ lbs = decodeEventASN1Repr checkDER `fmap` parseLBS lbs
+ decodeASN1Repr _ lbs = parseLBS lbs >>= decodeEventASN1Repr checkDER
instance ASN1Decoding DER where
decodeASN1 _ lbs =
- (map fst . decodeEventASN1Repr checkDER) `fmap` parseLBS lbs
+ map fst <$> (parseLBS lbs >>= decodeEventASN1Repr checkDER)
instance ASN1Encoding DER where
encodeASN1 _ l = toLazyByteString $ encodeToRaw l
@@ -57,24 +56,30 @@
decodeConstruction (ASN1Header Universal 0x11 _ _) = Set
decodeConstruction (ASN1Header c t _ _) = Container c t
-decodeEventASN1Repr :: (ASN1Header -> Maybe ASN1Error) -> [ASN1Event] ->
[ASN1Repr]
-decodeEventASN1Repr checkHeader = loop []
+-- | An error is returned as 'Left' rather than thrown, so that it reaches
+-- the caller of 'decodeASN1' and 'decodeASN1Repr' as the type says.
+decodeEventASN1Repr ::
+ (ASN1Header -> Maybe ASN1Error)
+ -> [ASN1Event]
+ -> Either ASN1Error [ASN1Repr]
+decodeEventASN1Repr checkHeader = loop [] []
where
- loop _ [] = []
- loop acc (h@(Header hdr@(ASN1Header _ _ True _)):ConstructionBegin:xs) =
+ loop out _ [] = Right $ reverse out
+ loop out acc (h@(Header hdr@(ASN1Header _ _ True _)):ConstructionBegin:xs) =
let ctype = decodeConstruction hdr
in case checkHeader hdr of
- Nothing -> (Start ctype,[h,ConstructionBegin]) : loop (ctype:acc) xs
- Just err -> E.throw err
- loop acc (h@(Header hdr@(ASN1Header _ _ False _)):p@(Primitive prim):xs) =
+ Nothing ->
+ loop ((Start ctype, [h, ConstructionBegin]) : out) (ctype:acc) xs
+ Just err -> Left err
+ loop out acc (h@(Header hdr@(ASN1Header _ _ False _)):p@(Primitive prim):xs)
=
case checkHeader hdr of
Nothing -> case decodePrimitive hdr prim of
- Left err -> E.throw err
- Right obj -> (obj, [h, p]) : loop acc xs
- Just err -> E.throw err
- loop (ctype:acc) (ConstructionEnd:xs) =
- (End ctype, [ConstructionEnd]) : loop acc xs
- loop _ (x:_) = E.throw $ StreamUnexpectedSituation (show x)
+ Left err -> Left err
+ Right obj -> loop ((obj, [h, p]) : out) acc xs
+ Just err -> Left err
+ loop out (ctype:acc) (ConstructionEnd:xs) =
+ loop ((End ctype, [ConstructionEnd]) : out) acc xs
+ loop _ _ (x:_) = Left $ StreamUnexpectedSituation (show x)
-- | DER header need to be all of finite size and of minimum possible size.
checkDER :: ASN1Header -> Maybe ASN1Error
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/crypton-asn1-encoding-0.10.0/src/Data/ASN1/Prim.hs
new/crypton-asn1-encoding-0.11.0/src/Data/ASN1/Prim.hs
--- old/crypton-asn1-encoding-0.10.0/src/Data/ASN1/Prim.hs 2025-07-20
23:23:13.000000000 +0200
+++ new/crypton-asn1-encoding-0.11.0/src/Data/ASN1/Prim.hs 2026-11-19
21:09:41.000000000 +0100
@@ -298,20 +298,25 @@
| otherwise -> pure $ l + 1
getBitString :: ByteString -> Either ASN1Error ASN1
-getBitString s =
- let toSkip = B.head s in
- let toSkip' = if toSkip >= 48 && toSkip <= 48 + 7
- then toSkip - fromIntegral ( ord '0')
- else toSkip in
- let xs = B.tail s in
- if toSkip' >= 0 && toSkip' <= 7
- then Right $ BitString $ toBitArray xs (fromIntegral toSkip')
- else Left $ TypeDecodingFailed
- ( "bitstring: skip number not within bound "
- ++ show toSkip'
- ++ " "
- ++ show s
- )
+getBitString s = case B.uncons s of
+ Nothing -> Left $ TypeDecodingFailed "bitstring: no data"
+ Just (toSkip, xs) ->
+ let toSkip' = if toSkip >= 48 && toSkip <= 48 + 7
+ then toSkip - fromIntegral ( ord '0')
+ else toSkip
+ in if toSkip' >= 0 && toSkip' <= 7
+ -- X.690 8.6.2.3: with no subsequent octets, the number of unused
+ -- bits is zero.
+ then if B.null xs && toSkip' /= 0
+ then Left $ TypeDecodingFailed
+ "bitstring: unused bits without subsequent octets"
+ else Right $ BitString $ toBitArray xs (fromIntegral toSkip')
+ else Left $ TypeDecodingFailed
+ ( "bitstring: skip number not within bound "
+ ++ show toSkip'
+ ++ " "
+ ++ show s
+ )
getCharacterString :: ASN1StringEncoding -> ByteString -> Either ASN1Error ASN1
getCharacterString encoding bs = Right $ ASN1String (ASN1CharacterString
encoding bs)
@@ -369,7 +374,8 @@
adjustUTC dt@(DateTime (Date y m d) tod)
| timeType == TimeGeneralized = dt
- | y > 2050 = DateTime (Date (y - 100) m d) tod
+ -- RFC 5280 4.1.2.5.1: YY >= 50 is 19YY
+ | y >= 2050 = DateTime (Date (y - 100) m d) tod
| otherwise = dt
formatNoSeconds = init format
format
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/crypton-asn1-encoding-0.10.0/tests/Tests.hs
new/crypton-asn1-encoding-0.11.0/tests/Tests.hs
--- old/crypton-asn1-encoding-0.10.0/tests/Tests.hs 2025-07-20
23:23:13.000000000 +0200
+++ new/crypton-asn1-encoding-0.11.0/tests/Tests.hs 2026-11-19
21:09:41.000000000 +0100
@@ -5,7 +5,8 @@
import Data.ASN1.BinaryEncoding.Parse ( parseLBS )
import Data.ASN1.BinaryEncoding.Writer ( toLazyByteString )
import Data.ASN1.BitArray ( BitArray, toBitArray )
-import Data.ASN1.Encoding ( ASN1Decoding (..), ASN1Encoding (..) )
+import Data.ASN1.Encoding
+ ( ASN1Decoding (..), ASN1Encoding (..), decodeASN1' )
import Data.ASN1.Get ( Result (..), runGet )
import Data.ASN1.Prim ( mkSmallestLength )
import Data.ASN1.Serialize ( getHeader, putHeader )
@@ -27,7 +28,7 @@
import Test.Tasty ( TestTree, defaultMain, testGroup )
import Test.Tasty.QuickCheck
( Arbitrary (..), Gen, choose, elements, listOf1, oneof
- , resize, suchThat, testProperty
+ , once, resize, suchThat, testProperty
)
instance Arbitrary ASN1Class where
@@ -92,19 +93,20 @@
instance Arbitrary BitArray where
arbitrary = do
bs <- arbitrary
- w <- choose (0, 7) :: Gen Int
+ -- X.690 8.6.2.3: with no octets, there are no unused bits either.
+ w <- if B.null bs then pure 0 else choose (0, 7) :: Gen Int
pure $ toBitArray bs w
instance Arbitrary Date where
arbitrary = do
- y <- choose (1951, 2050)
+ y <- choose (1950, 2049)
m <- elements [ January .. December]
d <- choose (1, 30)
pure $ normalizeDate $ Date y m d
normalizeDate :: Date -> Date
normalizeDate origDate
- | y < 1951 = normalizeDate (Date (y + 50) m d)
+ | y < 1950 = normalizeDate (Date (y + 50) m d)
| otherwise = normalizedDate
where
normalizedDate@(Date y m d) = timeConvert (timeConvert origDate :: Elapsed)
@@ -256,6 +258,15 @@
error ("got: " ++ show got ++ " expected: " ++ show expected)
| otherwise = True
+-- | UTCTime years 50-99 are 1950-1999 and 00-49 are 2000-2049.
+prop_utctime_pivot :: Bool
+prop_utctime_pivot =
+ year "500101000000Z" == Right 1950 && year "491231235959Z" == Right 2049
+ where
+ year s = case decodeASN1' DER (B.pack (0x17 : 13 : map (fromIntegral .
fromEnum) s)) of
+ Right [ASN1Time TimeUTC (DateTime (Date y _ _) _) _] -> Right y
+ r -> Left (show r)
+
marshallingTests :: TestTree
marshallingTests = testGroup "Marshalling"
[ testProperty "Header" prop_header_marshalling_id
@@ -263,7 +274,26 @@
, testProperty "DER" prop_asn1_der_marshalling_id
, testProperty "Real" prop_real_der_marshalling_id
, testProperty "Integral Real" prop_integral_real_der_marshalling_id
+ , testProperty "UTCTime pivot" prop_utctime_pivot
]
+-- | Malformed input is a 'Left', not an exception thrown when the result is
+-- looked at. Each is the DER signature @30 06 02 01 01 02 01 01@ broken.
+malformedTests :: TestTree
+malformedTests = testGroup "Malformed"
+ [ testProperty "primitive SEQUENCE" $ isMalformed
+ [0x10, 0x06, 0x02, 0x01, 0x01, 0x02, 0x01, 0x01]
+ , testProperty "BIT STRING with unused bits and no octets" $ isMalformed
+ [0x30, 0x06, 0x03, 0x01, 0x01, 0x02, 0x01, 0x01]
+ , testProperty "BIT STRING with too many unused bits" $ isMalformed
+ [0x30, 0x06, 0x02, 0x01, 0x01, 0x03, 0x01, 0x09]
+ , testProperty "empty BIT STRING" $ isMalformed
+ [0x30, 0x05, 0x02, 0x01, 0x01, 0x03, 0x00]
+ ]
+ where
+ isMalformed ws = once $ case decodeASN1' DER (B.pack ws) of
+ Left _ -> True
+ Right _ -> False
+
main :: IO ()
-main = defaultMain $ testGroup "asn1-encoding" [marshallingTests]
+main = defaultMain $ testGroup "asn1-encoding" [marshallingTests,
malformedTests]