From 3b705c046c53ee01ba3daed0d0e7468b1a682cbc Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Mon, 22 Jun 2015 01:52:57 +0300 Subject: boxes: a number of improvements * Algorithm interfaces are no longer required to load partial blocks, the space for which is allocated dynamically. * Padding schemes are now also separated, perhaps in the future to become a "box" parameter. Consequently, algorithm interfaces are no longer required to implement padding either. --- src/error.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'src/error.c') diff --git a/src/error.c b/src/error.c index fd9136a..10550f3 100644 --- a/src/error.c +++ b/src/error.c @@ -26,7 +26,8 @@ static const char* aesni_strerror_messages[] = "Couldn't parse", "Invalid PKCS7 padding (wrong key?)", "Not implemented", - "Invalid plaintext length", + "Missing padding", + "Couldn't allocate memory", }; const char* aesni_strerror(AesNI_StatusCode ec) @@ -105,6 +106,7 @@ static AesNI_ErrorFormatter err_formatters[] = &aesni_format_error_strerror, &aesni_format_not_implemented_error, &aesni_format_error_strerror, + &aesni_format_error_strerror, }; size_t aesni_format_error( @@ -204,8 +206,14 @@ AesNI_StatusCode aesni_error_not_implemented( return status; } -AesNI_StatusCode aesni_error_invalid_plaintext_length( +AesNI_StatusCode aesni_error_missing_padding( + AesNI_ErrorDetails* err_details) +{ + return aesni_make_error(err_details, AESNI_MISSING_PADDING_ERROR); +} + +AesNI_StatusCode aesni_error_memory_allocation( AesNI_ErrorDetails* err_details) { - return aesni_make_error(err_details, AESNI_INVALID_PLAINTEXT_LENGTH_ERROR); + return aesni_make_error(err_details, AESNI_MEMORY_ALLOCATION_ERROR); } -- cgit v1.2.3