From 6fe3b7eb73fb11e1cba27b28add5b14430b66259 Mon Sep 17 00:00:00 2001 From: Mark Haines Date: Fri, 12 Jun 2015 16:15:37 +0100 Subject: Move utils for pickling into a separate file --- include/axolotl/ratchet.hh | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) (limited to 'include/axolotl/ratchet.hh') diff --git a/include/axolotl/ratchet.hh b/include/axolotl/ratchet.hh index eaf1352..0874cf0 100644 --- a/include/axolotl/ratchet.hh +++ b/include/axolotl/ratchet.hh @@ -114,21 +114,6 @@ struct Ratchet { Curve25519KeyPair const & our_ratchet_key ); - /** The number of bytes needed to persist the current session. */ - std::size_t pickle_length(); - - /** Persists a session as a sequence of bytes - * Returns the number of output bytes used. */ - std::size_t pickle( - std::uint8_t * output, std::size_t output_length - ); - - /** Loads a session from a sequence of bytes. - * Returns 0 on success, or std::size_t(-1) on failure. */ - std::size_t unpickle( - std::uint8_t * input, std::size_t input_length - ); - /** The number of bytes of output the encrypt method will write for * a given message length. */ std::size_t encrypt_output_length( @@ -172,4 +157,21 @@ struct Ratchet { }; +std::size_t pickle_length( + Ratchet const & value +); + + +std::uint8_t * pickle( + std::uint8_t * pos, + Ratchet const & value +); + + +std::uint8_t const * unpickle( + std::uint8_t const * pos, std::uint8_t const * end, + Ratchet & value +); + + } // namespace axolotl -- cgit v1.2.3