aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2015-06-19 01:39:02 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2015-06-19 01:39:02 +0300
commit242d678aeed0b806a30553be0fa87189b7478450 (patch)
treecf0c88992dd3b94eef6a8d0d24a18e34719ad685 /src
parentadd CTR mode to "boxes" (diff)
downloadaes-tools-242d678aeed0b806a30553be0fa87189b7478450.tar.gz
aes-tools-242d678aeed0b806a30553be0fa87189b7478450.zip
OFB/CTR decryption is the same as encryption
Diffstat (limited to 'src')
-rw-r--r--src/box.c39
1 files changed, 2 insertions, 37 deletions
diff --git a/src/box.c b/src/box.c
index c74100c..d10e963 100644
--- a/src/box.c
+++ b/src/box.c
@@ -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(