summaryrefslogtreecommitdiff
path: root/nettle-internal.h
diff options
context:
space:
mode:
authorNiels Möller <nisse@lysator.liu.se>2011-02-14 14:27:35 +0100
committerNiels Möller <nisse@lysator.liu.se>2011-02-14 14:27:35 +0100
commit6e11deb887a299ade375786c89dd805e517b8efe (patch)
treebd87e5ca57f63c34c60c62b218512b1d168b411b /nettle-internal.h
parentdde540df446e61dae135e80b787cdafa74074a11 (diff)
downloadnettle-6e11deb887a299ade375786c89dd805e517b8efe.tar.gz
(struct nettle_aead): Tentative interface for
authenticated encryption with associated data. Rev: nettle/nettle-internal.h:1.3
Diffstat (limited to 'nettle-internal.h')
-rw-r--r--nettle-internal.h50
1 files changed, 50 insertions, 0 deletions
diff --git a/nettle-internal.h b/nettle-internal.h
index c5b1b532..bead0513 100644
--- a/nettle-internal.h
+++ b/nettle-internal.h
@@ -74,4 +74,54 @@ extern const struct nettle_cipher nettle_openssl_cast128;
extern const struct nettle_hash nettle_openssl_md5;
extern const struct nettle_hash nettle_openssl_sha1;
+/* Tentative interface for "authenticated encryption with associated
+ data" algorithms. Should be moved to nettle-meta.h when stable. */
+struct nettle_aead
+{
+ const char *name;
+
+ unsigned context_size;
+ /* Block size of the input, and the size of the output digest */
+ unsigned block_size;
+
+ /* Suggested key size; other sizes are sometimes possible. */
+ unsigned key_size;
+
+ nettle_set_key_func *set_key;
+ nettle_set_key_func *set_iv;
+ nettle_hash_update_func *update;
+ nettle_crypt_func *encrypt;
+ nettle_crypt_func *decrypt;
+ nettle_hash_digest_func *digest;
+};
+
+#define _NETTLE_AEAD(type, TYPE, name, key_size) { \
+ #type "-" #name #key_size, \
+ sizeof(struct type##_##name##_ctx), \
+ TYPE##_BLOCK_SIZE, \
+ key_size / 8, \
+ (nettle_set_key_func *) type##_##name##_set_key, \
+ (nettle_set_key_func *) type##_##name##_set_iv, \
+ (nettle_hash_update_func *) type##_##name##_update, \
+ (nettle_crypt_func *) type##_##name##_encrypt, \
+ (nettle_crypt_func *) type##_##name##_decrypt, \
+ (nettle_hash_digest_func *) type##_##name##_digest, \
+}
+
+const struct nettle_aead nettle_gcm_aes128;
+const struct nettle_aead nettle_gcm_aes192;
+const struct nettle_aead nettle_gcm_aes256;
+
+const struct nettle_aead nettle_gcm_camellia128;
+const struct nettle_aead nettle_gcm_camellia192;
+const struct nettle_aead nettle_gcm_camellia256;
+
+const struct nettle_aead nettle_gcm_serpent128;
+const struct nettle_aead nettle_gcm_serpent192;
+const struct nettle_aead nettle_gcm_serpent256;
+
+const struct nettle_aead nettle_gcm_twofish128;
+const struct nettle_aead nettle_gcm_twofish192;
+const struct nettle_aead nettle_gcm_twofish256;
+
#endif /* NETTLE_INTERNAL_H_INCLUDED */