diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2015-06-19 01:39:02 +0300 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2015-06-19 01:39:02 +0300 |
commit | 242d678aeed0b806a30553be0fa87189b7478450 (patch) | |
tree | cf0c88992dd3b94eef6a8d0d24a18e34719ad685 /src | |
parent | add CTR mode to "boxes" (diff) | |
download | aes-tools-242d678aeed0b806a30553be0fa87189b7478450.tar.gz aes-tools-242d678aeed0b806a30553be0fa87189b7478450.zip |
OFB/CTR decryption is the same as encryption
Diffstat (limited to '')
-rw-r--r-- | src/box.c | 39 |
1 files changed, 2 insertions, 37 deletions
@@ -234,41 +234,6 @@ static AesNI_StatusCode aesni_box_decrypt_cfb( return status; } -static AesNI_StatusCode aesni_box_decrypt_ofb( - AesNI_Box* box, - const AesNI_BoxBlock* input, - AesNI_BoxBlock* output, - AesNI_ErrorDetails* err_details) -{ - AesNI_StatusCode status = box->algorithm_iface->encrypt( - &box->iv, - &box->encrypt_params, - output, - err_details); - if (aesni_is_error(status)) - return status; - - box->iv = *output; - - status = box->algorithm_iface->xor_block( - output, - input, - err_details); - if (aesni_is_error(status)) - return status; - - return status; -} - -static AesNI_StatusCode aesni_box_decrypt_ctr( - AesNI_Box* box, - const AesNI_BoxBlock* input, - AesNI_BoxBlock* output, - AesNI_ErrorDetails* err_details) -{ - return aesni_box_encrypt_ctr(box, input, output, err_details); -} - typedef AesNI_BoxEncryptMode AesNI_BoxDecryptMode; static AesNI_BoxDecryptMode aesni_box_decrypt_mode[] = @@ -276,8 +241,8 @@ static AesNI_BoxDecryptMode aesni_box_decrypt_mode[] = &aesni_box_decrypt_ecb, &aesni_box_decrypt_cbc, &aesni_box_decrypt_cfb, - &aesni_box_decrypt_ofb, - &aesni_box_decrypt_ctr, + &aesni_box_encrypt_ofb, + &aesni_box_encrypt_ctr, }; AesNI_StatusCode aesni_box_decrypt( |