From d0707b161d10cf79242d40b24853988c89c7604a Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Fri, 29 Nov 2013 22:15:58 +0100 Subject: crypto: separate cipher/MAC availability check from information request --- src/crypto/cipher/ciphers.c.in | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'src/crypto/cipher') diff --git a/src/crypto/cipher/ciphers.c.in b/src/crypto/cipher/ciphers.c.in index b3c6b1b..84607a0 100644 --- a/src/crypto/cipher/ciphers.c.in +++ b/src/crypto/cipher/ciphers.c.in @@ -107,7 +107,7 @@ void fastd_cipher_free(fastd_context_t *ctx) { free(ctx->cipher_contexts); } -const fastd_cipher_info_t* fastd_cipher_info_get_by_name(const char *name) { +bool fastd_cipher_is_available(const char *name) { size_t i, j; for (i = 0; i < array_size(ciphers); i++) { if (strcmp(ciphers[i].name, name)) @@ -115,12 +115,22 @@ const fastd_cipher_info_t* fastd_cipher_info_get_by_name(const char *name) { for (j = 0; ciphers[i].impls[j].impl; j++) { if (ciphers[i].impls[j].impl->available()) - return ciphers[i].info; + return true; } break; } + return false; +} + +const fastd_cipher_info_t* fastd_cipher_info_get_by_name(const char *name) { + size_t i, j; + for (i = 0; i < array_size(ciphers); i++) { + if (!strcmp(ciphers[i].name, name)) + return ciphers[i].info; + } + return NULL; } -- cgit v1.2.3