raw
smg_comms_packing...    1   -- Packing/unpacking for Eulora's communication protocol:
smg_comms_packing... 2 -- Serpent Message to/from Serpent Packet
smg_comms_packing... 3 -- RSA Message to/from RSA Packet
smg_comms_packing... 4 -- S.MG, 2018
smg_comms_packing... 5
smg_comms_packing... 6 with Raw_Types;
smg_comms_packing... 7 with Serpent;
smg_comms_packing... 8 with RSA_OAEP;
smg_comms_packing... 9
smg_comms_packing... 10 package Packing is
smg_comms_packing... 11 -- no side effects or internal state BUT it depends on non-pure:
smg_comms_packing... 12 -- rsa_oaep because it uses rng (exceptions and sequential_io)
smg_comms_packing... 13
smg_comms_packing... 14 -- Packing a Serpent message into Serpent packet, using the given key
smg_comms_packing... 15 function Pack( Msg : in Raw_Types.Serpent_Msg;
smg_comms_packing... 16 K : in Serpent.Key )
smg_comms_packing... 17 return Raw_Types.Serpent_Pkt;
smg_comms_packing... 18
smg_comms_packing... 19 -- Unpacking a Serpent packet into contained message, using the given key
smg_comms_packing... 20 function Unpack( Pkt : in Raw_Types.Serpent_Pkt;
smg_comms_packing... 21 K : in Serpent.Key)
smg_comms_packing... 22 return Raw_Types.Serpent_Msg;
smg_comms_packing... 23
smg_comms_packing... 24 -- Packing a RSA message into RSA packet, using the given key
smg_comms_packing... 25 function Pack( Msg : in Raw_Types.RSA_Msg;
smg_comms_packing... 26 K : in RSA_OAEP.RSA_pkey)
smg_comms_packing... 27 return Raw_Types.RSA_Pkt;
smg_comms_packing... 28
smg_comms_packing... 29 -- Unpacking a RSA packet into contained message, using the given key
smg_comms_packing... 30 function Unpack( Pkt : in Raw_Types.RSA_Pkt;
smg_comms_packing... 31 K : in RSA_OAEP.RSA_skey;
smg_comms_packing... 32 Success : out Boolean)
smg_comms_packing... 33 return Raw_Types.RSA_Msg;
smg_comms_packing... 34
smg_comms_packing... 35 -- internals of this package, NOT for outside use
smg_comms_packing... 36 private
smg_comms_packing... 37 -- length of 1 Serpent block
smg_comms_packing... 38 Block_Len: constant Natural := Serpent.Block'Length;
smg_comms_packing... 39
smg_comms_packing... 40 -- number of Serpent blocks in one single Serpent message/packet
smg_comms_packing... 41 S_Blocks : constant Natural := Raw_Types.SERPENT_OCTETS / Block_Len;
smg_comms_packing... 42
smg_comms_packing... 43 end Packing;