summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoe Crayne <joe@jerkface.net>2019-07-02 03:33:29 -0400
committerJoe Crayne <joe@jerkface.net>2019-07-02 03:33:29 -0400
commitb472f10fb19182deb4c081940cd1e660a0287fe9 (patch)
tree370f8bc5f5b3a4819224d221399f2b65fa5fbedf
parent5d5ce0e97107619b8e33c76585d7629f106ad3c8 (diff)
Changed KeyKey to avoid serializing bignums.
-rw-r--r--lib/KeyRing/BuildKeyDB.hs6
-rw-r--r--lib/KeyRing/Types.hs13
2 files changed, 7 insertions, 12 deletions
diff --git a/lib/KeyRing/BuildKeyDB.hs b/lib/KeyRing/BuildKeyDB.hs
index d8f8d50..bae2538 100644
--- a/lib/KeyRing/BuildKeyDB.hs
+++ b/lib/KeyRing/BuildKeyDB.hs
@@ -126,10 +126,10 @@ buildKeyDB :: InputFileContext -> Maybe String -> KeyRingOperation
126 ,{- hs -} ({- hostdbs0 -}[Hosts.Hosts], 126 ,{- hs -} ({- hostdbs0 -}[Hosts.Hosts],
127 {- hostdbs -}[Hosts.Hosts], 127 {- hostdbs -}[Hosts.Hosts],
128 {- u1 -}Hosts.Hosts, 128 {- u1 -}Hosts.Hosts,
129 {- gpgnames -}[(SockAddr, (KeyKey, KeyKey))], 129 {- gpgnames -}[(SockAddr, ([ByteString],[ByteString]))],
130 {- outgoing_names -}[SockAddr]) 130 {- outgoing_names -}[SockAddr])
131 ,{- accs -} Map.Map InputFile Access 131 ,{- accs -} Map.Map InputFile Access
132 ,{- doDecrypt -} PacketTranscoder 132 ,{- transcode -} PacketTranscoder
133 ,{- unspilled -} Map.Map InputFile Message 133 ,{- unspilled -} Map.Map InputFile Message
134 ) 134 )
135 ,{- report_imports -} [(FilePath,KikiReportAction)])) 135 ,{- report_imports -} [(FilePath,KikiReportAction)]))
@@ -544,7 +544,7 @@ generateInternals transcode mwk db gens = do
544mergeHostFiles :: KeyRingOperation -> KeyDB -> InputFileContext 544mergeHostFiles :: KeyRingOperation -> KeyDB -> InputFileContext
545 -> IO 545 -> IO
546 (KikiCondition 546 (KikiCondition
547 ( ( Map.Map [Char8.ByteString] KeyData 547 ( ( KeyDB
548 , ( [Hosts.Hosts] 548 , ( [Hosts.Hosts]
549 , [Hosts.Hosts] 549 , [Hosts.Hosts]
550 , Hosts.Hosts 550 , Hosts.Hosts
diff --git a/lib/KeyRing/Types.hs b/lib/KeyRing/Types.hs
index 2383140..e1e19f5 100644
--- a/lib/KeyRing/Types.hs
+++ b/lib/KeyRing/Types.hs
@@ -2,9 +2,10 @@
2module KeyRing.Types where 2module KeyRing.Types where
3 3
4import Data.Char (isLower,toLower) 4import Data.Char (isLower,toLower)
5import Data.List (groupBy) 5import Data.List (groupBy,find)
6import Data.Map as Map (Map) 6import Data.Map as Map (Map)
7import qualified Data.Map as Map 7import qualified Data.Map as Map
8import Data.Maybe (maybeToList)
8import Data.OpenPGP 9import Data.OpenPGP
9import Data.OpenPGP.Util 10import Data.OpenPGP.Util
10import Data.Time.Clock 11import Data.Time.Clock
@@ -298,16 +299,10 @@ data InputFileContext = InputFileContext
298-- which is used for finger-printing and as a lookup key into 299-- which is used for finger-printing and as a lookup key into
299-- maps. This type may be changed to an actual fingerprint in 300-- maps. This type may be changed to an actual fingerprint in
300-- in the future. 301-- in the future.
301type KeyKey = [L.ByteString] 302type KeyKey = [(Char,MPI)]
302 303
303keykey :: Packet -> KeyKey 304keykey :: Packet -> KeyKey
304keykey key = 305keykey k = concatMap (\c -> (maybeToList $ find (\(f,x) -> f==c) (key k))) (public_key_fields $ key_algorithm k)
305 -- Note: The key's timestamp is normally included in it's fingerprint.
306 -- This is undesirable for kiki because it causes the same
307 -- key to be imported multiple times and show as apparently
308 -- distinct keys with different fingerprints.
309 -- Thus, we will remove the timestamp.
310 fingerprint_material (key {timestamp=0}) -- TODO: smaller key?
311 306
312isKey :: Packet -> Bool 307isKey :: Packet -> Bool
313isKey (PublicKeyPacket {}) = True 308isKey (PublicKeyPacket {}) = True