summaryrefslogtreecommitdiffstats
path: root/src/crypto.h
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2013-11-25 23:18:11 +0100
committerMatthias Schiffer <mschiffer@universe-factory.net>2013-11-25 23:18:11 +0100
commitc62a0f592c49b41d393fae580ce9f1293ee7a16d (patch)
tree6d8ef6b7c93fdcaa0fd1bcd590dba531ef8b5140 /src/crypto.h
parent60c2c11de820687887a643344fc1b0a91fd45226 (diff)
downloadfastd-c62a0f592c49b41d393fae580ce9f1293ee7a16d.tar
fastd-c62a0f592c49b41d393fae580ce9f1293ee7a16d.zip
Move crypto algorithm information out of implementation
Diffstat (limited to 'src/crypto.h')
-rw-r--r--src/crypto.h22
1 files changed, 18 insertions, 4 deletions
diff --git a/src/crypto.h b/src/crypto.h
index e7d011b..a11b460 100644
--- a/src/crypto.h
+++ b/src/crypto.h
@@ -30,11 +30,12 @@
#include "fastd.h"
-struct fastd_cipher {
- const char *name;
+struct fastd_cipher_info {
size_t key_length;
size_t iv_length;
+};
+struct fastd_cipher {
fastd_cipher_context_t* (*initialize)(fastd_context_t *ctx);
fastd_cipher_state_t* (*init_state)(fastd_context_t *ctx, const fastd_cipher_context_t *cctx, const uint8_t *key);
@@ -44,10 +45,12 @@ struct fastd_cipher {
void (*free)(fastd_context_t *ctx, fastd_cipher_context_t *cctx);
};
-struct fastd_mac {
- const char *name;
+
+struct fastd_mac_info {
size_t key_length;
+};
+struct fastd_mac {
fastd_mac_context_t* (*initialize)(fastd_context_t *ctx);
fastd_mac_state_t* (*init_state)(fastd_context_t *ctx, const fastd_mac_context_t *mctx, const uint8_t *key);
@@ -57,4 +60,15 @@ struct fastd_mac {
void (*free)(fastd_context_t *ctx, fastd_mac_context_t *mctx);
};
+
+void fastd_cipher_init(fastd_context_t *ctx);
+void fastd_cipher_free(fastd_context_t *ctx);
+const fastd_cipher_info_t* fastd_cipher_info_get_by_name(const char *name);
+const fastd_cipher_t* fastd_cipher_get_by_name(fastd_context_t *ctx, const char *name, const fastd_cipher_info_t **info, const fastd_cipher_context_t **cctx);
+
+void fastd_mac_init(fastd_context_t *ctx);
+void fastd_mac_free(fastd_context_t *ctx);
+const fastd_mac_info_t* fastd_mac_info_get_by_name(const char *name);
+const fastd_mac_t* fastd_mac_get_by_name(fastd_context_t *ctx, const char *name, const fastd_mac_info_t **info, const fastd_mac_context_t **cctx);
+
#endif /* _FASTD_CRYPTO_H_ */