diff options
author | Uros Majstorovic <majstor@majstor.org> | 2017-05-23 14:19:26 +0200 |
---|---|---|
committer | Uros Majstorovic <majstor@majstor.org> | 2017-05-23 14:19:26 +0200 |
commit | 3ef6719f47b734b12c0b11c725b7f12e3fb3c08a (patch) | |
tree | a635ac65bfc72d126d97e48e22c38ac33343b4f4 /code/core/crypto/crypto.h | |
parent | 922e8313f2b3f6157a61b3c867fdc3832bb92a68 (diff) |
fs layout updated
Diffstat (limited to 'code/core/crypto/crypto.h')
-rw-r--r-- | code/core/crypto/crypto.h | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/code/core/crypto/crypto.h b/code/core/crypto/crypto.h new file mode 100644 index 0000000..7bd27d5 --- /dev/null +++ b/code/core/crypto/crypto.h @@ -0,0 +1,33 @@ +#include <stddef.h> + +#define CURVE25519_SIZE_KEY 32 +#define CHACHA20_SIZE_KEY 32 +#define POLY1305_SIZE_TAG 16 +#define CHACHA20_SIZE_NONCE 8 + +#define ECP_ECDH_SIZE_KEY 32 +#define ECP_AEAD_SIZE_KEY 32 +#define ECP_AEAD_SIZE_TAG 16 +#define ECP_AEAD_SIZE_NONCE 8 + +#define ECP_DSA_SIZE_KEY 32 + +typedef uint8_t ecp_dh_public_t[ECP_ECDH_SIZE_KEY]; +typedef uint8_t ecp_dh_private_t[ECP_ECDH_SIZE_KEY]; +typedef uint8_t ecp_aead_key_t[ECP_AEAD_SIZE_KEY]; +typedef uint8_t ecp_dsa_public_t[ECP_DSA_SIZE_KEY]; +typedef uint8_t ecp_dsa_private_t[ECP_DSA_SIZE_KEY]; + +int +aead_chacha20_poly1305_seal(unsigned char *out, size_t *out_len, + size_t max_out_len, unsigned char key[32], unsigned char tag_len, + const unsigned char *nonce, size_t nonce_len, + const unsigned char *in, size_t in_len, + const unsigned char *ad, size_t ad_len); + +int +aead_chacha20_poly1305_open(unsigned char *out, size_t *out_len, + size_t max_out_len, unsigned char key[32], unsigned char tag_len, + const unsigned char *nonce, size_t nonce_len, + const unsigned char *in, size_t in_len, + const unsigned char *ad, size_t ad_len); |