diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2014-05-27 23:44:07 +0200 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2014-05-27 23:44:07 +0200 |
commit | d859894f7a88e07e7beae8dc355278cfd6c185e2 (patch) | |
tree | a0de7e31e8e10dfab1f2b981348d6a11e95597d7 /src/crypto/cipher/ciphers.c.in | |
parent | b9f329256d5911d9694b44ce1e4545d78fdd5340 (diff) | |
download | fastd-d859894f7a88e07e7beae8dc355278cfd6c185e2.tar fastd-d859894f7a88e07e7beae8dc355278cfd6c185e2.zip |
Remove fastd_true()
Diffstat (limited to 'src/crypto/cipher/ciphers.c.in')
-rw-r--r-- | src/crypto/cipher/ciphers.c.in | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/crypto/cipher/ciphers.c.in b/src/crypto/cipher/ciphers.c.in index 2140731..1796cc5 100644 --- a/src/crypto/cipher/ciphers.c.in +++ b/src/crypto/cipher/ciphers.c.in @@ -47,13 +47,17 @@ static const cipher_entry_t ciphers[] = { @CIPHER_LIST@ }; +static inline bool cipher_available(const fastd_cipher_t *cipher) { + return (!cipher->available) || cipher->available(); +} + const fastd_cipher_t** fastd_cipher_config_alloc(void) { const fastd_cipher_t **cipher_conf = calloc(array_size(ciphers), sizeof(const fastd_cipher_t*)); size_t i, j; for (i = 0; i < array_size(ciphers); i++) { for (j = 0; ciphers[i].impls[j].impl; j++) { - if (ciphers[i].impls[j].impl->available()) + if (cipher_available(ciphers[i].impls[j].impl)) break; } @@ -74,7 +78,7 @@ bool fastd_cipher_config(const fastd_cipher_t **cipher_conf, const char *name, c size_t j; for (j = 0; ciphers[i].impls[j].impl; j++) { if (!strcmp(ciphers[i].impls[j].name, impl)) { - if (!ciphers[i].impls[j].impl->available()) + if (!cipher_available(ciphers[i].impls[j].impl)) return false; cipher_conf[i] = ciphers[i].impls[j].impl; @@ -96,7 +100,7 @@ const fastd_cipher_info_t* fastd_cipher_info_get_by_name(const char *name) { continue; for (j = 0; ciphers[i].impls[j].impl; j++) { - if (ciphers[i].impls[j].impl->available()) + if (cipher_available(ciphers[i].impls[j].impl)) return ciphers[i].info; } |