Hello community,

here is the log from the commit of package ghc-x509 for openSUSE:Factory 
checked in at 2018-10-25 08:19:28
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ghc-x509 (Old)
 and      /work/SRC/openSUSE:Factory/.ghc-x509.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "ghc-x509"

Thu Oct 25 08:19:28 2018 rev:12 rq:642906 version:1.7.4

Changes:
--------
--- /work/SRC/openSUSE:Factory/ghc-x509/ghc-x509.changes        2018-07-21 
10:24:25.286969080 +0200
+++ /work/SRC/openSUSE:Factory/.ghc-x509.new/ghc-x509.changes   2018-10-25 
08:19:32.631986403 +0200
@@ -1,0 +2,6 @@
+Wed Oct 10 19:23:53 UTC 2018 - [email protected]
+
+- Update x509 to version 1.7.4.
+  Upstream does not provide a change log file.
+
+-------------------------------------------------------------------

Old:
----
  x509-1.7.3.tar.gz

New:
----
  x509-1.7.4.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ ghc-x509.spec ++++++
--- /var/tmp/diff_new_pack.Ys2tXW/_old  2018-10-25 08:19:33.787985890 +0200
+++ /var/tmp/diff_new_pack.Ys2tXW/_new  2018-10-25 08:19:33.791985889 +0200
@@ -12,14 +12,14 @@
 # license that conforms to the Open Source Definition (Version 1.9)
 # published by the Open Source Initiative.
 
-# Please submit bugfixes or comments via http://bugs.opensuse.org/
+# Please submit bugfixes or comments via https://bugs.opensuse.org/
 #
 
 
 %global pkg_name x509
 %bcond_with tests
 Name:           ghc-%{pkg_name}
-Version:        1.7.3
+Version:        1.7.4
 Release:        0
 Summary:        X509 reader and writer
 License:        BSD-3-Clause
@@ -45,7 +45,7 @@
 %endif
 
 %description
-X509 reader and writer.
+X509 reader and writer. please see README.
 
 %package devel
 Summary:        Haskell %{pkg_name} library development files

++++++ x509-1.7.3.tar.gz -> x509-1.7.4.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/x509-1.7.3/Data/X509/PrivateKey.hs 
new/x509-1.7.4/Data/X509/PrivateKey.hs
--- old/x509-1.7.3/Data/X509/PrivateKey.hs      2017-07-31 22:17:24.000000000 
+0200
+++ new/x509-1.7.4/Data/X509/PrivateKey.hs      2018-09-13 23:10:49.000000000 
+0200
@@ -13,8 +13,21 @@
     , privkeyToAlg
     ) where
 
+import Control.Applicative ((<$>), pure)
+import Data.Word (Word)
+
+import qualified Data.ByteString as B
+
+import Data.ASN1.Types
+import Data.ASN1.Encoding
+import Data.ASN1.BinaryEncoding
+import Data.ASN1.BitArray
+
 import Data.X509.AlgorithmIdentifier
 import Data.X509.PublicKey (SerializedPoint(..))
+import Data.X509.OID (lookupByOID, curvesOIDTable)
+
+import Crypto.Number.Serialize (i2osp, os2ip)
 import qualified Crypto.PubKey.RSA as RSA
 import qualified Crypto.PubKey.DSA as DSA
 import qualified Crypto.PubKey.ECC.Types as ECC
@@ -46,9 +59,192 @@
     | PrivKeyEC  PrivKeyEC      -- ^ EC private key
     deriving (Show,Eq)
 
+instance ASN1Object PrivKey where
+    fromASN1 = privkeyFromASN1
+    toASN1 = privkeyToASN1
+
+privkeyFromASN1 :: [ASN1] -> Either String (PrivKey, [ASN1])
+privkeyFromASN1 asn1 =
+  (mapFst PrivKeyRSA <$> rsaFromASN1 asn1) <!>
+  (mapFst PrivKeyDSA <$> dsaFromASN1 asn1) <!>
+  (mapFst PrivKeyEC <$> ecdsaFromASN1 asn1)
+  where
+    mapFst f (a, b) = (f a, b)
+
+    Left _ <!> b = b
+    a      <!> _ = a
+
+rsaFromASN1 :: [ASN1] -> Either String (RSA.PrivateKey, [ASN1])
+rsaFromASN1 (Start Sequence : IntVal 0 : IntVal n : IntVal e : IntVal d
+    : IntVal p : IntVal q : IntVal dP : IntVal dQ : IntVal qinv
+    : End Sequence : as) = pure (key, as)
+  where
+    key = RSA.PrivateKey (RSA.PublicKey (go n 1) n e) d p q dP dQ qinv
+    go m i
+        | 2 ^ (i * 8) > m = i
+        | otherwise = go m (i + 1)
+rsaFromASN1 (Start Sequence : IntVal 0 : Start Sequence
+    : OID [1, 2, 840, 113549, 1, 1, 1] : Null : End Sequence
+    : OctetString bytes : End Sequence : as) = do
+        asn1 <- mapLeft failure (decodeASN1' BER bytes)
+        fmap (const as) <$> rsaFromASN1 asn1
+  where
+    failure = ("rsaFromASN1: " ++) . show
+rsaFromASN1 _ = Left "rsaFromASN1: unexpected format"
+
+dsaFromASN1 :: [ASN1] -> Either String (DSA.PrivateKey, [ASN1])
+dsaFromASN1 (Start Sequence : IntVal 0 : IntVal p : IntVal q : IntVal g
+    : IntVal _ : IntVal x : End Sequence : as) =
+        pure (DSA.PrivateKey (DSA.Params p g q) x, as)
+dsaFromASN1 (Start Sequence : IntVal 0 : Start Sequence
+    : OID [1, 2, 840, 10040, 4, 1] : Start Sequence : IntVal p : IntVal q
+    : IntVal g : End Sequence : End Sequence : OctetString bytes
+    : End Sequence : as) = case decodeASN1' BER bytes of
+        Right [IntVal x] -> pure (DSA.PrivateKey (DSA.Params p g q) x, as)
+        Right _ -> Left "DSA.PrivateKey.fromASN1: unexpected format"
+        Left e -> Left $ "DSA.PrivateKey.fromASN1: " ++ show e
+dsaFromASN1 _ = Left "DSA.PrivateKey.fromASN1: unexpected format"
+
+ecdsaFromASN1 :: [ASN1] -> Either String (PrivKeyEC, [ASN1])
+ecdsaFromASN1 = go []
+  where
+    failing = ("ECDSA.PrivateKey.fromASN1: " ++)
+
+    go acc (Start Sequence : IntVal 1 : OctetString bytes : rest) = do
+        key <- subgo (oid ++ acc)
+        case rest'' of
+            End Sequence : rest''' -> pure (key, rest''')
+            _ -> Left $ failing "unexpected EC format"
+      where
+        d = os2ip bytes
+        (oid, rest') = spanTag 0 rest
+        (_, rest'') = spanTag 1 rest'
+        subgo (OID oid_ : _) = maybe failure success mcurve
+          where
+            failure = Left $ failing $ "unknown curve " ++ show oid_
+            success = Right . flip PrivKeyEC_Named d
+            mcurve = lookupByOID curvesOIDTable oid_
+        subgo (Start Sequence : IntVal 1 : Start Sequence
+            : OID [1, 2, 840, 10045, 1, 1] : IntVal p : End Sequence
+            : Start Sequence : OctetString a : OctetString b : BitString s
+            : End Sequence : OctetString g : IntVal o : IntVal c
+            : End Sequence : _) =
+                pure $ PrivKeyEC_Prime d a' b' p g' o c s'
+          where
+            a' = os2ip a
+            b' = os2ip b
+            g' = SerializedPoint g
+            s' = os2ip $ bitArrayGetData s
+        subgo (Null : rest_) = subgo rest_
+        subgo [] = Left $ failing "curve is missing"
+        subgo _ = Left $ failing "unexpected curve format"
+    go acc (Start Sequence : IntVal 0 : Start Sequence
+        : OID [1, 2, 840, 10045, 2, 1] : rest) = case rest' of
+            (OctetString bytes : rest'') -> do
+                asn1 <- mapLeft (failing . show) (decodeASN1' BER bytes)
+                fmap (const rest'') <$> go (oid ++ acc) asn1
+            _ -> Left $ failing "unexpected EC format"
+      where
+        (oid, rest') = spanEnd 0 rest
+    go _ _ = Left $ failing "unexpected EC format"
+
+    spanEnd :: Word -> [ASN1] -> ([ASN1], [ASN1])
+    spanEnd = loop id
+      where
+        loop dlist n (a@(Start _) : as) = loop (dlist . (a :)) (n + 1) as
+        loop dlist 0 (End _ : as) = (dlist [], as)
+        loop dlist n (a@(End _) : as) = loop (dlist . (a :)) (n - 1) as
+        loop dlist n (a : as) = loop (dlist . (a :)) n as
+        loop dlist _ [] = (dlist [], [])
+
+    spanTag :: Int -> [ASN1] -> ([ASN1], [ASN1])
+    spanTag a (Start (Container _ b) : as) | a == b = spanEnd 0 as
+    spanTag _ as = ([], as)
+
+privkeyToASN1 :: PrivKey -> ASN1S
+privkeyToASN1 (PrivKeyRSA rsa) = rsaToASN1 rsa
+privkeyToASN1 (PrivKeyDSA dsa) = dsaToASN1 dsa
+privkeyToASN1 (PrivKeyEC ecdsa) = ecdsaToASN1 ecdsa
+
+rsaToASN1 :: RSA.PrivateKey -> ASN1S
+rsaToASN1 key = (++)
+    [ Start Sequence, IntVal 0, IntVal n, IntVal e, IntVal d, IntVal p
+    , IntVal q, IntVal dP, IntVal dQ, IntVal qinv, End Sequence
+    ]
+  where
+    RSA.PrivateKey (RSA.PublicKey _ n e) d p q dP dQ qinv = key
+
+dsaToASN1 :: DSA.PrivateKey -> ASN1S
+dsaToASN1 (DSA.PrivateKey params@(DSA.Params p g q) y) = (++)
+    [ Start Sequence, IntVal 0, IntVal p, IntVal q, IntVal g, IntVal x
+    , IntVal y, End Sequence
+    ]
+  where
+    x = DSA.calculatePublic params y
+
+ecdsaToASN1 :: PrivKeyEC -> ASN1S
+ecdsaToASN1 (PrivKeyEC_Named curveName d) = (++)
+    [ Start Sequence, IntVal 1, OctetString (i2osp d)
+    , Start (Container Context 0), OID oid, End (Container Context 0)
+    , End Sequence
+    ]
+  where
+    oid = case curveName of
+        ECC.SEC_p112r1 -> [1, 3, 132, 0, 6]
+        ECC.SEC_p112r2 -> [1, 3, 132, 0, 7]
+        ECC.SEC_p128r1 -> [1, 3, 132, 0, 28]
+        ECC.SEC_p128r2 -> [1, 3, 132, 0, 29]
+        ECC.SEC_p160k1 -> [1, 3, 132, 0, 9]
+        ECC.SEC_p160r1 -> [1, 3, 132, 0, 8]
+        ECC.SEC_p160r2 -> [1, 3, 132, 0, 30]
+        ECC.SEC_p192k1 -> [1, 3, 132, 0, 31]
+        ECC.SEC_p192r1 -> [1, 2, 840, 10045, 3, 1, 1]
+        ECC.SEC_p224k1 -> [1, 3, 132, 0, 32]
+        ECC.SEC_p224r1 -> [1, 3, 132, 0, 33]
+        ECC.SEC_p256k1 -> [1, 3, 132, 0, 10]
+        ECC.SEC_p256r1 -> [1, 2, 840, 10045, 3, 1, 7]
+        ECC.SEC_p384r1 -> [1, 3, 132, 0, 34]
+        ECC.SEC_p521r1 -> [1, 3, 132, 0, 35]
+        ECC.SEC_t113r1 -> [1, 3, 132, 0, 4]
+        ECC.SEC_t113r2 -> [1, 3, 132, 0, 5]
+        ECC.SEC_t131r1 -> [1, 3, 132, 0, 22]
+        ECC.SEC_t131r2 -> [1, 3, 132, 0, 23]
+        ECC.SEC_t163k1 -> [1, 3, 132, 0, 1]
+        ECC.SEC_t163r1 -> [1, 3, 132, 0, 2]
+        ECC.SEC_t163r2 -> [1, 3, 132, 0, 15]
+        ECC.SEC_t193r1 -> [1, 3, 132, 0, 24]
+        ECC.SEC_t193r2 -> [1, 3, 132, 0, 25]
+        ECC.SEC_t233k1 -> [1, 3, 132, 0, 26]
+        ECC.SEC_t233r1 -> [1, 3, 132, 0, 27]
+        ECC.SEC_t239k1 -> [1, 3, 132, 0, 3]
+        ECC.SEC_t283k1 -> [1, 3, 132, 0, 16]
+        ECC.SEC_t283r1 -> [1, 3, 132, 0, 17]
+        ECC.SEC_t409k1 -> [1, 3, 132, 0, 36]
+        ECC.SEC_t409r1 -> [1, 3, 132, 0, 37]
+        ECC.SEC_t571k1 -> [1, 3, 132, 0, 38]
+        ECC.SEC_t571r1 -> [1, 3, 132, 0, 39]
+ecdsaToASN1 (PrivKeyEC_Prime d a b p g o c s) = (++)
+    [ Start Sequence, IntVal 1, OctetString (i2osp d)
+    , Start (Container Context 0), Start Sequence, IntVal 1
+    , Start Sequence, OID [1, 2, 840, 10045, 1, 1], IntVal p, End Sequence
+    , Start Sequence, OctetString a', OctetString b', BitString s'
+    , End Sequence, OctetString g' , IntVal o, IntVal c, End Sequence
+    , End (Container Context 0), End Sequence
+    ]
+  where
+    a' = i2osp a
+    b' = i2osp b
+    SerializedPoint g' = g
+    s' = BitArray (8 * fromIntegral (B.length bytes)) bytes
+      where
+        bytes = i2osp s
+
+mapLeft :: (a0 -> a1) -> Either a0 b -> Either a1 b
+mapLeft f (Left x) = Left (f x)
+mapLeft _ (Right x) = Right x
+
 -- | Convert a Private key to the Public Key Algorithm type
 privkeyToAlg :: PrivKey -> PubKeyALG
 privkeyToAlg (PrivKeyRSA _)         = PubKeyALG_RSA
 privkeyToAlg (PrivKeyDSA _)         = PubKeyALG_DSA
 privkeyToAlg (PrivKeyEC _)          = PubKeyALG_EC
-
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/x509-1.7.3/x509.cabal new/x509-1.7.4/x509.cabal
--- old/x509-1.7.3/x509.cabal   2018-03-01 14:21:06.000000000 +0100
+++ new/x509-1.7.4/x509.cabal   2018-09-13 23:15:15.000000000 +0200
@@ -1,6 +1,6 @@
 Name:                x509
-version:             1.7.3
-Description:         X509 reader and writer
+version:             1.7.4
+Description:         X509 reader and writer. please see README
 License:             BSD3
 License-file:        LICENSE
 Copyright:           Vincent Hanquez <[email protected]>

++++++ x509.cabal ++++++
--- /var/tmp/diff_new_pack.Ys2tXW/_old  2018-10-25 08:19:33.895985843 +0200
+++ /var/tmp/diff_new_pack.Ys2tXW/_new  2018-10-25 08:19:33.895985843 +0200
@@ -1,68 +1,65 @@
-Name:                x509
-version:             1.7.3
-x-revision: 1
-Description:         X509 reader and writer
-License:             BSD3
-License-file:        LICENSE
-Copyright:           Vincent Hanquez <[email protected]>
-Author:              Vincent Hanquez <[email protected]>
-Maintainer:          Vincent Hanquez <[email protected]>
-Synopsis:            X509 reader and writer
-Build-Type:          Simple
-Category:            Data
-stability:           experimental
-Homepage:            http://github.com/vincenthz/hs-certificate
-Cabal-Version:       >= 1.10
-
-Library
-  -- Could not find module 'Data.Proxy'
-  build-depends: base >=4.7
-
-  Default-Language:  Haskell2010
-  Build-Depends:     base >= 3 && < 5
-                   , bytestring
-                   , memory
-                   , mtl
-                   , containers
-                   , hourglass
-                   , pem >= 0.1
-                   , asn1-types >= 0.3.1 && < 0.4
-                   , asn1-encoding >= 0.9 && < 0.10
-                   , asn1-parse >= 0.9.3 && < 0.10
-                   , cryptonite >= 0.8
-  Exposed-modules:   Data.X509
-                     Data.X509.EC
-  Other-modules:     Data.X509.Internal
-                     Data.X509.CertificateChain
-                     Data.X509.AlgorithmIdentifier
-                     Data.X509.DistinguishedName
-                     Data.X509.Cert
-                     Data.X509.PublicKey
-                     Data.X509.PrivateKey
-                     Data.X509.Ext
-                     Data.X509.ExtensionRaw
-                     Data.X509.CRL
-                     Data.X509.OID
-                     Data.X509.Signed
-  ghc-options:       -Wall
-
-Test-Suite test-x509
-  Default-Language:  Haskell2010
-  type:              exitcode-stdio-1.0
-  hs-source-dirs:    Tests
-  Main-is:           Tests.hs
-  Build-Depends:     base >= 3 && < 5
-                   , bytestring
-                   , mtl
-                   , tasty
-                   , tasty-quickcheck
-                   , hourglass
-                   , asn1-types
-                   , x509
-                   , cryptonite
-  ghc-options:       -Wall -fno-warn-orphans -fno-warn-missing-signatures
-
-source-repository head
-  type:     git
-  location: git://github.com/vincenthz/hs-certificate
-  subdir:   x509
+Name:                x509
+version:             1.7.4
+x-revision: 1
+Description:         X509 reader and writer. please see README
+License:             BSD3
+License-file:        LICENSE
+Copyright:           Vincent Hanquez <[email protected]>
+Author:              Vincent Hanquez <[email protected]>
+Maintainer:          Vincent Hanquez <[email protected]>
+Synopsis:            X509 reader and writer
+Build-Type:          Simple
+Category:            Data
+stability:           experimental
+Homepage:            http://github.com/vincenthz/hs-certificate
+Cabal-Version:       >= 1.10
+
+Library
+  Default-Language:  Haskell2010
+  Build-Depends:     base >= 4.7 && < 5
+                   , bytestring
+                   , memory
+                   , mtl
+                   , containers
+                   , hourglass
+                   , pem >= 0.1
+                   , asn1-types >= 0.3.1 && < 0.4
+                   , asn1-encoding >= 0.9 && < 0.10
+                   , asn1-parse >= 0.9.3 && < 0.10
+                   , cryptonite >= 0.8
+  Exposed-modules:   Data.X509
+                     Data.X509.EC
+  Other-modules:     Data.X509.Internal
+                     Data.X509.CertificateChain
+                     Data.X509.AlgorithmIdentifier
+                     Data.X509.DistinguishedName
+                     Data.X509.Cert
+                     Data.X509.PublicKey
+                     Data.X509.PrivateKey
+                     Data.X509.Ext
+                     Data.X509.ExtensionRaw
+                     Data.X509.CRL
+                     Data.X509.OID
+                     Data.X509.Signed
+  ghc-options:       -Wall
+
+Test-Suite test-x509
+  Default-Language:  Haskell2010
+  type:              exitcode-stdio-1.0
+  hs-source-dirs:    Tests
+  Main-is:           Tests.hs
+  Build-Depends:     base >= 3 && < 5
+                   , bytestring
+                   , mtl
+                   , tasty
+                   , tasty-quickcheck
+                   , hourglass
+                   , asn1-types
+                   , x509
+                   , cryptonite
+  ghc-options:       -Wall -fno-warn-orphans -fno-warn-missing-signatures
+
+source-repository head
+  type:     git
+  location: git://github.com/vincenthz/hs-certificate
+  subdir:   x509


Reply via email to