-- Packing/unpacking for Eulora's communication protocol: -- Serpent Message to/from Serpent Packet -- RSA Message to/from RSA Packet -- S.MG, 2018 with Raw_Types; with Serpent; with RSA_OAEP; package Packing is -- no side effects or internal state BUT it depends on non-pure: -- rsa_oaep because it uses rng (exceptions and sequential_io) -- Packing a Serpent message into Serpent packet, using the given key function Pack( Msg : in Raw_Types.Serpent_Msg; K : in Serpent.Key ) return Raw_Types.Serpent_Pkt; -- Unpacking a Serpent packet into contained message, using the given key function Unpack( Pkt : in Raw_Types.Serpent_Pkt; K : in Serpent.Key) return Raw_Types.Serpent_Msg; -- Packing a RSA message into RSA packet, using the given key function Pack( Msg : in Raw_Types.RSA_Msg; K : in RSA_OAEP.RSA_pkey) return Raw_Types.RSA_Pkt; -- Unpacking a RSA packet into contained message, using the given key function Unpack( Pkt : in Raw_Types.RSA_Pkt; K : in RSA_OAEP.RSA_skey; Success : out Boolean) return Raw_Types.RSA_Msg; -- internals of this package, NOT for outside use private -- length of 1 Serpent block Block_Len: constant Natural := Serpent.Block'Length; -- number of Serpent blocks in one single Serpent message/packet S_Blocks : constant Natural := Raw_Types.SERPENT_OCTETS / Block_Len; end Packing;