diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2016-05-19 04:48:59 +0300 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2016-05-19 04:48:59 +0300 |
commit | f0393777befc4ff1024513dab3ab6bad0e7ec45f (patch) | |
tree | 97571103c522ff60f96a8fdde35a0bbee9532837 /src/padding.c | |
parent | rename the project (diff) | |
download | aes-tools-f0393777befc4ff1024513dab3ab6bad0e7ec45f.tar.gz aes-tools-f0393777befc4ff1024513dab3ab6bad0e7ec45f.zip |
'aesni' -> 'aes'
Diffstat (limited to '')
-rw-r--r-- | src/padding.c | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/src/padding.c b/src/padding.c index f76e7ca..1bbe7f2 100644 --- a/src/padding.c +++ b/src/padding.c @@ -11,77 +11,77 @@ #include <stdlib.h> #include <string.h> -static AesNI_StatusCode aesni_extract_padding_size_pkcs7( +static AES_StatusCode aes_extract_padding_size_pkcs7( const void* src, size_t src_size, size_t* padding_size, - AesNI_ErrorDetails* err_details) + AES_ErrorDetails* err_details) { const unsigned char* cursor = (const unsigned char*) src + src_size - 1; *padding_size = *cursor; for (size_t i = 1; i < *padding_size; ++i) if (cursor[0 - i] != *padding_size) - return aesni_error_invalid_pkcs7_padding(err_details); + return aes_error_invalid_pkcs7_padding(err_details); - return AESNI_SUCCESS; + return AES_SUCCESS; } -AesNI_StatusCode aesni_extract_padding_size( - AesNI_PaddingMethod method, +AES_StatusCode aes_extract_padding_size( + AES_PaddingMethod method, const void* src, size_t src_size, size_t* padding_size, - AesNI_ErrorDetails* err_details) + AES_ErrorDetails* err_details) { assert(src); assert(padding_size); if (src == NULL) - return aesni_error_null_argument(err_details, "src"); + return aes_error_null_argument(err_details, "src"); if (padding_size == NULL) - return aesni_error_null_argument(err_details, "padding_size"); + return aes_error_null_argument(err_details, "padding_size"); switch (method) { - case AESNI_PADDING_PKCS7: - return aesni_extract_padding_size_pkcs7( + case AES_PADDING_PKCS7: + return aes_extract_padding_size_pkcs7( src, src_size, padding_size, err_details); default: - return aesni_error_not_implemented( + return aes_error_not_implemented( err_details, "unsupported padding method"); } } -static AesNI_StatusCode aesni_fill_with_padding_pkcs7( +static AES_StatusCode aes_fill_with_padding_pkcs7( void* dest, size_t padding_size, - AesNI_ErrorDetails* err_details) + AES_ErrorDetails* err_details) { memset(dest, padding_size, padding_size); - return AESNI_SUCCESS; + return AES_SUCCESS; } -AesNI_StatusCode aesni_fill_with_padding( - AesNI_PaddingMethod method, +AES_StatusCode aes_fill_with_padding( + AES_PaddingMethod method, void* dest, size_t padding_size, - AesNI_ErrorDetails* err_details) + AES_ErrorDetails* err_details) { assert(dest); if (dest == NULL) - return aesni_error_null_argument(err_details, "dest"); + return aes_error_null_argument(err_details, "dest"); switch (method) { - case AESNI_PADDING_PKCS7: - return aesni_fill_with_padding_pkcs7( + case AES_PADDING_PKCS7: + return aes_fill_with_padding_pkcs7( dest, padding_size, err_details); default: - return aesni_error_not_implemented( + return aes_error_not_implemented( err_details, "unsupported padding method"); } } |