aboutsummaryrefslogtreecommitdiff
path: root/include/olm/pickle.h
diff options
context:
space:
mode:
authorRichard van der Hoff <github@rvanderhoff.org.uk>2016-09-06 11:08:04 +0100
committerGitHub <noreply@github.com>2016-09-06 11:08:04 +0100
commit7c84ce8098f58b28e9996f8644caafef8d32d308 (patch)
tree3ffbabe907b4a3f46d740d01114016add4539300 /include/olm/pickle.h
parent8912d13b0b856e5eb3e43594260dd5da3ad6535c (diff)
parent833ecd3c736cea71a693cd9dedec4f1bffa87000 (diff)
Merge pull request #18 from matrix-org/rav/pickle_ed25519_in_c
Convert ed25519 pickling functions to C
Diffstat (limited to 'include/olm/pickle.h')
-rw-r--r--include/olm/pickle.h40
1 files changed, 40 insertions, 0 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