summaryrefslogtreecommitdiffstats
path: root/src/crypto/mac/macs.c.in
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2014-05-27 23:44:07 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2014-05-27 23:44:07 +0200
commitd859894f7a88e07e7beae8dc355278cfd6c185e2 (patch)
treea0de7e31e8e10dfab1f2b981348d6a11e95597d7 /src/crypto/mac/macs.c.in
parentb9f329256d5911d9694b44ce1e4545d78fdd5340 (diff)
downloadfastd-d859894f7a88e07e7beae8dc355278cfd6c185e2.tar
fastd-d859894f7a88e07e7beae8dc355278cfd6c185e2.zip
Remove fastd_true()
Diffstat (limited to 'src/crypto/mac/macs.c.in')
-rw-r--r--src/crypto/mac/macs.c.in10
1 files changed, 7 insertions, 3 deletions
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;
}