From d859894f7a88e07e7beae8dc355278cfd6c185e2 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Tue, 27 May 2014 23:44:07 +0200 Subject: Remove fastd_true() --- src/crypto/mac/ghash/builtin/ghash_builtin.c | 2 -- src/crypto/mac/macs.c.in | 10 +++++++--- 2 files changed, 7 insertions(+), 5 deletions(-) (limited to 'src/crypto/mac') diff --git a/src/crypto/mac/ghash/builtin/ghash_builtin.c b/src/crypto/mac/ghash/builtin/ghash_builtin.c index 2819109..28e9292 100644 --- a/src/crypto/mac/ghash/builtin/ghash_builtin.c +++ b/src/crypto/mac/ghash/builtin/ghash_builtin.c @@ -127,8 +127,6 @@ static void ghash_free(fastd_mac_state_t *state) { } const fastd_mac_t fastd_mac_ghash_builtin = { - .available = fastd_true, - .init = ghash_init, .hash = ghash_hash, .free = ghash_free, diff --git a/src/crypto/mac/macs.c.in b/src/crypto/mac/macs.c.in index ccf560e..3a8c943 100644 --- a/src/crypto/mac/macs.c.in +++ b/src/crypto/mac/macs.c.in @@ -47,13 +47,17 @@ static const mac_entry_t macs[] = { @MAC_LIST@ }; +static inline bool mac_available(const fastd_mac_t *mac) { + return (!mac->available) || mac->available(); +} + const fastd_mac_t** fastd_mac_config_alloc(void) { const fastd_mac_t **mac_conf = calloc(array_size(macs), sizeof(const fastd_mac_t*)); size_t i, j; for (i = 0; i < array_size(macs); i++) { for (j = 0; macs[i].impls[j].impl; j++) { - if (macs[i].impls[j].impl->available()) + if (mac_available(macs[i].impls[j].impl)) break; } @@ -74,7 +78,7 @@ bool fastd_mac_config(const fastd_mac_t **mac_conf, const char *name, const char size_t j; for (j = 0; macs[i].impls[j].impl; j++) { if (!strcmp(macs[i].impls[j].name, impl)) { - if (!macs[i].impls[j].impl->available()) + if (!mac_available(macs[i].impls[j].impl)) return false; mac_conf[i] = macs[i].impls[j].impl; @@ -96,7 +100,7 @@ const fastd_mac_info_t* fastd_mac_info_get_by_name(const char *name) { continue; for (j = 0; macs[i].impls[j].impl; j++) { - if (macs[i].impls[j].impl->available()) + if (mac_available(macs[i].impls[j].impl)) return macs[i].info; } -- cgit v1.2.3