diff options
author | Gregory Mullen (GrayHatter) <greg@grayhatter.com> | 2016-02-13 20:50:16 -0800 |
---|---|---|
committer | Gregory Mullen (GrayHatter) <greg@grayhatter.com> | 2016-02-13 20:50:16 -0800 |
commit | 58ebf7a5b6e006c656b6b704d149f391587f394d (patch) | |
tree | 16ae59b69f3cda092939078901c186f1f9a63c69 /toxencryptsave/toxencryptsave.c | |
parent | ea21a541ff39570d87620d15e67e797e4fce0a2b (diff) |
added versioning to toxencryptsave
Diffstat (limited to 'toxencryptsave/toxencryptsave.c')
-rw-r--r-- | toxencryptsave/toxencryptsave.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/toxencryptsave/toxencryptsave.c b/toxencryptsave/toxencryptsave.c index 5c40f639..800d5d11 100644 --- a/toxencryptsave/toxencryptsave.c +++ b/toxencryptsave/toxencryptsave.c | |||
@@ -47,6 +47,30 @@ | |||
47 | #error TOX_PASS_ENCRYPTION_EXTRA_LENGTH is assumed to be equal to (crypto_box_MACBYTES + crypto_box_NONCEBYTES + crypto_pwhash_scryptsalsa208sha256_SALTBYTES + TOX_ENC_SAVE_MAGIC_LENGTH) | 47 | #error TOX_PASS_ENCRYPTION_EXTRA_LENGTH is assumed to be equal to (crypto_box_MACBYTES + crypto_box_NONCEBYTES + crypto_pwhash_scryptsalsa208sha256_SALTBYTES + TOX_ENC_SAVE_MAGIC_LENGTH) |
48 | #endif | 48 | #endif |
49 | 49 | ||
50 | uint32_t toxes_version_major(void) | ||
51 | { | ||
52 | return TOXES_VERSION_MAJOR; | ||
53 | } | ||
54 | |||
55 | uint32_t toxes_version_minor(void) | ||
56 | { | ||
57 | return TOXES_VERSION_MINOR; | ||
58 | } | ||
59 | |||
60 | uint32_t toxes_version_patch(void) | ||
61 | { | ||
62 | return TOXES_VERSION_PATCH; | ||
63 | } | ||
64 | |||
65 | bool toxes_version_is_compatible(uint32_t major, uint32_t minor, uint32_t patch) | ||
66 | { | ||
67 | return (TOXES_VERSION_MAJOR == major && /* Force the major version */ | ||
68 | (TOXES_VERSION_MINOR > minor || /* Current minor version must be newer than requested -- or -- */ | ||
69 | (TOXES_VERSION_MINOR == minor && TOXES_VERSION_PATCH >= patch) /* the patch must be the same or newer */ | ||
70 | ) | ||
71 | ) | ||
72 | } | ||
73 | |||
50 | /* Clients should consider alerting their users that, unlike plain data, if even one bit | 74 | /* Clients should consider alerting their users that, unlike plain data, if even one bit |
51 | * becomes corrupted, the data will be entirely unrecoverable. | 75 | * becomes corrupted, the data will be entirely unrecoverable. |
52 | * Ditto if they forget their password, there is no way to recover the data. | 76 | * Ditto if they forget their password, there is no way to recover the data. |