aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorRichard van der Hoff <richard@matrix.org>2016-09-05 12:59:12 +0100
committerRichard van der Hoff <richard@matrix.org>2016-09-05 12:59:12 +0100
commit833ecd3c736cea71a693cd9dedec4f1bffa87000 (patch)
tree487626a261a69640e00baa7ff888a35e08b42fbe /include
parentc09aa77c4a8dd27d98d2fe454fa1b589fee47977 (diff)
Convert ed25519 pickling functions to C
... so that I can use them from the group session bits.
Diffstat (limited to 'include')
-rw-r--r--include/olm/pickle.h40
-rw-r--r--include/olm/pickle.hh34
2 files changed, 40 insertions, 34 deletions
diff --git a/include/olm/pickle.h b/include/olm/pickle.h
index c1e8192..0e668bb 100644
--- a/include/olm/pickle.h
+++ b/include/olm/pickle.h
@@ -21,6 +21,10 @@
extern "C" {
#endif
+struct _olm_ed25519_public_key;
+struct _olm_ed25519_key_pair;
+
+
#define _olm_pickle_uint32_length(value) 4
uint8_t * _olm_pickle_uint32(uint8_t * pos, uint32_t value);
uint8_t const * _olm_unpickle_uint32(
@@ -43,6 +47,42 @@ uint8_t const * _olm_unpickle_bytes(uint8_t const * pos, uint8_t const * end,
uint8_t * bytes, size_t bytes_length);
+/** Get the number of bytes needed to pickle an ed25519 public key */
+size_t _olm_pickle_ed25519_public_key_length(
+ const struct _olm_ed25519_public_key * value
+);
+
+/** Pickle the ed25519 public key. Returns a pointer to the next free space in
+ * the buffer. */
+uint8_t * _olm_pickle_ed25519_public_key(
+ uint8_t *pos, const struct _olm_ed25519_public_key * value
+);
+
+/** Unpickle the ed25519 public key. Returns a pointer to the next item in the
+ * buffer. */
+const uint8_t * _olm_unpickle_ed25519_public_key(
+ const uint8_t *pos, const uint8_t *end,
+ struct _olm_ed25519_public_key * value
+);
+
+/** Get the number of bytes needed to pickle an ed25519 key pair */
+size_t _olm_pickle_ed25519_key_pair_length(
+ const struct _olm_ed25519_key_pair * value
+);
+
+/** Pickle the ed25519 key pair. Returns a pointer to the next free space in
+ * the buffer. */
+uint8_t * _olm_pickle_ed25519_key_pair(
+ uint8_t *pos, const struct _olm_ed25519_key_pair * value
+);
+
+/** Unpickle the ed25519 key pair. Returns a pointer to the next item in the
+ * buffer. */
+const uint8_t * _olm_unpickle_ed25519_key_pair(
+ const uint8_t *pos, const uint8_t *end,
+ struct _olm_ed25519_key_pair * value
+);
+
#ifdef __cplusplus
} // extern "C"
#endif
diff --git a/include/olm/pickle.hh b/include/olm/pickle.hh
index a09b8a1..4cf3f36 100644
--- a/include/olm/pickle.hh
+++ b/include/olm/pickle.hh
@@ -141,40 +141,6 @@ std::uint8_t const * unpickle(
_olm_curve25519_key_pair & value
);
-
-std::size_t pickle_length(
- const _olm_ed25519_public_key & value
-);
-
-
-std::uint8_t * pickle(
- std::uint8_t * pos,
- const _olm_ed25519_public_key & value
-);
-
-
-std::uint8_t const * unpickle(
- std::uint8_t const * pos, std::uint8_t const * end,
- _olm_ed25519_public_key & value
-);
-
-
-std::size_t pickle_length(
- const _olm_ed25519_key_pair & value
-);
-
-
-std::uint8_t * pickle(
- std::uint8_t * pos,
- const _olm_ed25519_key_pair & value
-);
-
-
-std::uint8_t const * unpickle(
- std::uint8_t const * pos, std::uint8_t const * end,
- _olm_ed25519_key_pair & value
-);
-
} // namespace olm