diff options
| -rw-r--r-- | aes/CMakeLists.txt | 3 | ||||
| -rw-r--r-- | aes/include/aes/error.h | 1 | ||||
| -rw-r--r-- | aes/src/error.c | 10 |
3 files changed, 14 insertions, 0 deletions
diff --git a/aes/CMakeLists.txt b/aes/CMakeLists.txt index e665b94..e48fe24 100644 --- a/aes/CMakeLists.txt +++ b/aes/CMakeLists.txt @@ -1,3 +1,6 @@ +set(CMAKE_C_STANDARD 11) +set(CMAKE_C_STANDARD_REQUIRED ON) + option(AES_TOOLS_ASM "Use the assembly language implementation instead of the one in C") file(GLOB_RECURSE aes_include CONFIGURE_DEPENDS "include/*.h") diff --git a/aes/include/aes/error.h b/aes/include/aes/error.h index 524184e..cd36b6e 100644 --- a/aes/include/aes/error.h +++ b/aes/include/aes/error.h @@ -22,6 +22,7 @@ typedef enum { AES_MISSING_PADDING_ERROR, AES_MEMORY_ALLOCATION_ERROR, AES_MODE_REQUIRES_INIT_VECTOR_ERROR, + AesErrorCount, } AES_StatusCode; static inline int aes_is_error(AES_StatusCode ec) { diff --git a/aes/src/error.c b/aes/src/error.c index 6a7a2c1..3ee57b3 100644 --- a/aes/src/error.c +++ b/aes/src/error.c @@ -59,6 +59,11 @@ static const char* aes_strerror_messages[] = { "Encryption mode requires init vector", }; +_Static_assert( + sizeof(aes_strerror_messages) / sizeof(aes_strerror_messages[0]) == AesErrorCount, + "Missing error message" +); + const char* aes_strerror(AES_StatusCode ec) { return aes_strerror_messages[ec]; } @@ -137,6 +142,11 @@ static AES_ErrorFormatter err_formatters[] = { &aes_format_error_strerror, }; +_Static_assert( + sizeof(err_formatters) / sizeof(err_formatters[0]) == AesErrorCount, + "Missing error formatter" +); + size_t aes_format_error(const AES_ErrorDetails* err_details, char* dest, size_t dest_size) { assert(err_details); |
