aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--include/aesni/box.h2
-rw-r--r--include/aesni/box_data.h31
-rw-r--r--src/box.c26
-rw-r--r--src/box_aes.c58
-rw-r--r--utils/decrypt_block.cpp18
-rw-r--r--utils/decrypt_bmp.cpp18
-rw-r--r--utils/decrypt_file.cpp18
-rw-r--r--utils/encrypt_block.cpp18
-rw-r--r--utils/encrypt_bmp.cpp18
-rw-r--r--utils/encrypt_file.cpp18
10 files changed, 116 insertions, 109 deletions
diff --git a/include/aesni/box.h b/include/aesni/box.h
index 1ff7941..04c2b6c 100644
--- a/include/aesni/box.h
+++ b/include/aesni/box.h
@@ -22,7 +22,7 @@ extern "C"
AesNI_StatusCode aesni_box_init(
AesNI_Box* box,
AesNI_Algorithm algorithm,
- const AesNI_BoxAlgorithmParams* algorithm_params,
+ const AesNI_BoxKey* box_key,
AesNI_Mode mode,
const AesNI_BoxBlock* iv,
AesNI_ErrorDetails* err_details);
diff --git a/include/aesni/box_data.h b/include/aesni/box_data.h
index 5d27641..d184c30 100644
--- a/include/aesni/box_data.h
+++ b/include/aesni/box_data.h
@@ -25,7 +25,7 @@ typedef union
AesNI_AES192_Key aes192_key;
AesNI_AES256_Key aes256_key;
}
-AesNI_BoxAlgorithmParams;
+AesNI_BoxKey;
typedef union
{
@@ -33,7 +33,7 @@ typedef union
AesNI_AES192_RoundKeys aes192_encryption_keys;
AesNI_AES256_RoundKeys aes256_encryption_keys;
}
-AesNI_BoxEncryptionParams;
+AesNI_BoxEncryptionRoundKeys;
typedef union
{
@@ -41,7 +41,7 @@ typedef union
AesNI_AES192_RoundKeys aes192_decryption_keys;
AesNI_AES256_RoundKeys aes256_decryption_keys;
}
-AesNI_BoxDecryptionParams;
+AesNI_BoxDecryptionRoundKeys;
typedef union
{
@@ -49,21 +49,26 @@ typedef union
}
AesNI_BoxBlock;
-typedef AesNI_StatusCode (*AesNI_BoxDeriveParams)(
- const AesNI_BoxAlgorithmParams* params,
- AesNI_BoxEncryptionParams*,
- AesNI_BoxDecryptionParams*,
+typedef AesNI_StatusCode (*AesNI_BoxCalculateRoundKeys)(
+ const AesNI_BoxKey* params,
+ AesNI_BoxEncryptionRoundKeys*,
+ AesNI_BoxDecryptionRoundKeys*,
AesNI_ErrorDetails* err_details);
+/* typedef AesNI_StatusCode (*AesNI_BoxParseBlock)(
+ AesNI_BoxBlock* dest,
+ const char* src,
+ AesNI_ErrorDetails* err_details); */
+
typedef AesNI_StatusCode (*AesNI_BoxEncryptBlock)(
const AesNI_BoxBlock* plaintext,
- const AesNI_BoxEncryptionParams* params,
+ const AesNI_BoxEncryptionRoundKeys* params,
AesNI_BoxBlock* ciphertext,
AesNI_ErrorDetails* err_details);
typedef AesNI_StatusCode (*AesNI_BoxDecryptBlock)(
const AesNI_BoxBlock* ciphertext,
- const AesNI_BoxDecryptionParams* params,
+ const AesNI_BoxDecryptionRoundKeys* params,
AesNI_BoxBlock* plaintext,
AesNI_ErrorDetails* err_details);
@@ -92,7 +97,9 @@ typedef AesNI_StatusCode (*AesNI_BoxLoadBlock)(
typedef struct
{
- AesNI_BoxDeriveParams derive_params;
+ AesNI_BoxCalculateRoundKeys calc_round_keys;
+ //AesNI_BoxParseBlock parse_block;
+ //AesNI_BoxParseKey parse_key;
AesNI_BoxEncryptBlock encrypt_block;
AesNI_BoxDecryptBlock decrypt_block;
AesNI_BoxXorBlock xor_block;
@@ -106,8 +113,8 @@ AesNI_BoxAlgorithmInterface;
typedef struct
{
const AesNI_BoxAlgorithmInterface* algorithm;
- AesNI_BoxEncryptionParams encrypt_params;
- AesNI_BoxDecryptionParams decrypt_params;
+ AesNI_BoxEncryptionRoundKeys encryption_keys;
+ AesNI_BoxDecryptionRoundKeys decryption_keys;
AesNI_Mode mode;
AesNI_BoxBlock iv;
}
diff --git a/src/box.c b/src/box.c
index 5883629..5f63063 100644
--- a/src/box.c
+++ b/src/box.c
@@ -21,7 +21,7 @@ static const AesNI_BoxAlgorithmInterface* aesni_box_algorithms[] =
AesNI_StatusCode aesni_box_init(
AesNI_Box* box,
AesNI_Algorithm algorithm,
- const AesNI_BoxAlgorithmParams* algorithm_params,
+ const AesNI_BoxKey* box_key,
AesNI_Mode mode,
const AesNI_BoxBlock* iv,
AesNI_ErrorDetails* err_details)
@@ -30,10 +30,10 @@ AesNI_StatusCode aesni_box_init(
box->algorithm = aesni_box_algorithms[algorithm];
- if (aesni_is_error(status = box->algorithm->derive_params(
- algorithm_params,
- &box->encrypt_params,
- &box->decrypt_params,
+ if (aesni_is_error(status = box->algorithm->calc_round_keys(
+ box_key,
+ &box->encryption_keys,
+ &box->decryption_keys,
err_details)))
return status;
@@ -51,7 +51,7 @@ static AesNI_StatusCode aesni_box_encrypt_block_ecb(
AesNI_ErrorDetails* err_details)
{
return box->algorithm->encrypt_block(
- input, &box->encrypt_params, output, err_details);
+ input, &box->encryption_keys, output, err_details);
}
static AesNI_StatusCode aesni_box_encrypt_block_cbc(
@@ -68,7 +68,7 @@ static AesNI_StatusCode aesni_box_encrypt_block_cbc(
return status;
if (aesni_is_error(status = box->algorithm->encrypt_block(
- &xored_input, &box->encrypt_params, output, err_details)))
+ &xored_input, &box->encryption_keys, output, err_details)))
return status;
box->iv = *output;
@@ -84,7 +84,7 @@ static AesNI_StatusCode aesni_box_encrypt_block_cfb(
AesNI_StatusCode status = AESNI_SUCCESS;
if (aesni_is_error(status = box->algorithm->encrypt_block(
- &box->iv, &box->encrypt_params, output, err_details)))
+ &box->iv, &box->encryption_keys, output, err_details)))
return status;
if (aesni_is_error(status = box->algorithm->xor_block(
@@ -104,7 +104,7 @@ static AesNI_StatusCode aesni_box_encrypt_block_ofb(
AesNI_StatusCode status = AESNI_SUCCESS;
if (aesni_is_error(status = box->algorithm->encrypt_block(
- &box->iv, &box->encrypt_params, &box->iv, err_details)))
+ &box->iv, &box->encryption_keys, &box->iv, err_details)))
return status;
*output = box->iv;
@@ -125,7 +125,7 @@ static AesNI_StatusCode aesni_box_encrypt_block_ctr(
AesNI_StatusCode status = AESNI_SUCCESS;
if (aesni_is_error(status = box->algorithm->encrypt_block(
- &box->iv, &box->encrypt_params, output, err_details)))
+ &box->iv, &box->encryption_keys, output, err_details)))
return status;
if (aesni_is_error(status = box->algorithm->xor_block(
@@ -171,7 +171,7 @@ static AesNI_StatusCode aesni_box_decrypt_block_ecb(
AesNI_ErrorDetails* err_details)
{
return box->algorithm->decrypt_block(
- input, &box->decrypt_params, output, err_details);
+ input, &box->decryption_keys, output, err_details);
}
static AesNI_StatusCode aesni_box_decrypt_block_cbc(
@@ -183,7 +183,7 @@ static AesNI_StatusCode aesni_box_decrypt_block_cbc(
AesNI_StatusCode status = AESNI_SUCCESS;
if (aesni_is_error(status = box->algorithm->decrypt_block(
- input, &box->decrypt_params, output, err_details)))
+ input, &box->decryption_keys, output, err_details)))
return status;
if (aesni_is_error(status = box->algorithm->xor_block(
@@ -203,7 +203,7 @@ static AesNI_StatusCode aesni_box_decrypt_block_cfb(
AesNI_StatusCode status = AESNI_SUCCESS;
if (aesni_is_error(status = box->algorithm->encrypt_block(
- &box->iv, &box->encrypt_params, output, err_details)))
+ &box->iv, &box->encryption_keys, output, err_details)))
return status;
if (aesni_is_error(status = box->algorithm->xor_block(
diff --git a/src/box_aes.c b/src/box_aes.c
index 8642f31..8468687 100644
--- a/src/box_aes.c
+++ b/src/box_aes.c
@@ -12,49 +12,49 @@
#include <string.h>
static AesNI_StatusCode aesni_box_derive_params_aes128(
- const AesNI_BoxAlgorithmParams* algorithm_params,
- AesNI_BoxEncryptionParams* encrypt_params,
- AesNI_BoxDecryptionParams* decrypt_params,
+ const AesNI_BoxKey* box_key,
+ AesNI_BoxEncryptionRoundKeys* encryption_keys,
+ AesNI_BoxDecryptionRoundKeys* decryption_keys,
AesNI_ErrorDetails* err_details)
{
aesni_AES128_expand_key_(
- algorithm_params->aes128_key.key,
- &encrypt_params->aes128_encryption_keys);
+ box_key->aes128_key.key,
+ &encryption_keys->aes128_encryption_keys);
aesni_AES128_derive_decryption_keys_(
- &encrypt_params->aes128_encryption_keys,
- &decrypt_params->aes128_decryption_keys);
+ &encryption_keys->aes128_encryption_keys,
+ &decryption_keys->aes128_decryption_keys);
return AESNI_SUCCESS;
}
static AesNI_StatusCode aesni_box_derive_params_aes192(
- const AesNI_BoxAlgorithmParams* algorithm_params,
- AesNI_BoxEncryptionParams* encrypt_params,
- AesNI_BoxDecryptionParams* decrypt_params,
+ const AesNI_BoxKey* box_key,
+ AesNI_BoxEncryptionRoundKeys* encryption_keys,
+ AesNI_BoxDecryptionRoundKeys* decryption_keys,
AesNI_ErrorDetails* err_details)
{
aesni_AES192_expand_key_(
- algorithm_params->aes192_key.lo,
- algorithm_params->aes192_key.hi,
- &encrypt_params->aes192_encryption_keys);
+ box_key->aes192_key.lo,
+ box_key->aes192_key.hi,
+ &encryption_keys->aes192_encryption_keys);
aesni_AES192_derive_decryption_keys_(
- &encrypt_params->aes192_encryption_keys,
- &decrypt_params->aes192_decryption_keys);
+ &encryption_keys->aes192_encryption_keys,
+ &decryption_keys->aes192_decryption_keys);
return AESNI_SUCCESS;
}
static AesNI_StatusCode aesni_box_derive_params_aes256(
- const AesNI_BoxAlgorithmParams* algorithm_params,
- AesNI_BoxEncryptionParams* encrypt_params,
- AesNI_BoxDecryptionParams* decrypt_params,
+ const AesNI_BoxKey* box_key,
+ AesNI_BoxEncryptionRoundKeys* encryption_keys,
+ AesNI_BoxDecryptionRoundKeys* decryption_keys,
AesNI_ErrorDetails* err_details)
{
aesni_AES256_expand_key_(
- algorithm_params->aes256_key.lo,
- algorithm_params->aes256_key.hi,
- &encrypt_params->aes256_encryption_keys);
+ box_key->aes256_key.lo,
+ box_key->aes256_key.hi,
+ &encryption_keys->aes256_encryption_keys);
aesni_AES256_derive_decryption_keys_(
- &encrypt_params->aes256_encryption_keys,
- &decrypt_params->aes256_decryption_keys);
+ &encryption_keys->aes256_encryption_keys,
+ &decryption_keys->aes256_decryption_keys);
return AESNI_SUCCESS;
}
@@ -103,7 +103,7 @@ static AesNI_StatusCode aesni_box_load_block_aes(
static AesNI_StatusCode aesni_box_encrypt_block_aes128(
const AesNI_BoxBlock* input,
- const AesNI_BoxEncryptionParams* params,
+ const AesNI_BoxEncryptionRoundKeys* params,
AesNI_BoxBlock* output,
AesNI_ErrorDetails* err_details)
{
@@ -115,7 +115,7 @@ static AesNI_StatusCode aesni_box_encrypt_block_aes128(
static AesNI_StatusCode aesni_box_decrypt_block_aes128(
const AesNI_BoxBlock* input,
- const AesNI_BoxDecryptionParams* params,
+ const AesNI_BoxDecryptionRoundKeys* params,
AesNI_BoxBlock* output,
AesNI_ErrorDetails* err_details)
{
@@ -127,7 +127,7 @@ static AesNI_StatusCode aesni_box_decrypt_block_aes128(
static AesNI_StatusCode aesni_box_encrypt_block_aes192(
const AesNI_BoxBlock* input,
- const AesNI_BoxEncryptionParams* params,
+ const AesNI_BoxEncryptionRoundKeys* params,
AesNI_BoxBlock* output,
AesNI_ErrorDetails* err_details)
{
@@ -139,7 +139,7 @@ static AesNI_StatusCode aesni_box_encrypt_block_aes192(
static AesNI_StatusCode aesni_box_decrypt_block_aes192(
const AesNI_BoxBlock* input,
- const AesNI_BoxDecryptionParams* params,
+ const AesNI_BoxDecryptionRoundKeys* params,
AesNI_BoxBlock* output,
AesNI_ErrorDetails* err_details)
{
@@ -151,7 +151,7 @@ static AesNI_StatusCode aesni_box_decrypt_block_aes192(
static AesNI_StatusCode aesni_box_encrypt_block_aes256(
const AesNI_BoxBlock* input,
- const AesNI_BoxEncryptionParams* params,
+ const AesNI_BoxEncryptionRoundKeys* params,
AesNI_BoxBlock* output,
AesNI_ErrorDetails* err_details)
{
@@ -163,7 +163,7 @@ static AesNI_StatusCode aesni_box_encrypt_block_aes256(
static AesNI_StatusCode aesni_box_decrypt_block_aes256(
const AesNI_BoxBlock* input,
- const AesNI_BoxDecryptionParams* params,
+ const AesNI_BoxDecryptionRoundKeys* params,
AesNI_BoxBlock* output,
AesNI_ErrorDetails* err_details)
{
diff --git a/utils/decrypt_block.cpp b/utils/decrypt_block.cpp
index 6159eb5..7c8e773 100644
--- a/utils/decrypt_block.cpp
+++ b/utils/decrypt_block.cpp
@@ -131,7 +131,7 @@ namespace
template <aesni::Algorithm algorithm>
bool decrypt_using_boxes_with_algorithm(
- const AesNI_BoxAlgorithmParams& algorithm_params,
+ const AesNI_BoxKey& box_key,
aesni::Mode mode,
const std::string& key,
std::deque<std::string> ciphertexts)
@@ -153,7 +153,7 @@ namespace
aesni_box_init(
&box,
algorithm,
- &algorithm_params,
+ &box_key,
mode,
iv_ptr,
aesni::ErrorDetailsThrowsInDestructor());
@@ -183,27 +183,27 @@ namespace
const std::string& key,
std::deque<std::string> ciphertexts)
{
- AesNI_BoxAlgorithmParams algorithm_params;
+ AesNI_BoxKey box_key;
switch (algorithm)
{
case AESNI_AES128:
aesni::from_string<AESNI_AES128>(
- algorithm_params.aes128_key, key);
+ box_key.aes128_key, key);
return decrypt_using_boxes_with_algorithm<AESNI_AES128>(
- algorithm_params, mode, key, ciphertexts);
+ box_key, mode, key, ciphertexts);
case AESNI_AES192:
aesni::from_string<AESNI_AES192>(
- algorithm_params.aes192_key, key);
+ box_key.aes192_key, key);
return decrypt_using_boxes_with_algorithm<AESNI_AES192>(
- algorithm_params, mode, key, ciphertexts);
+ box_key, mode, key, ciphertexts);
case AESNI_AES256:
aesni::from_string<AESNI_AES256>(
- algorithm_params.aes256_key, key);
+ box_key.aes256_key, key);
return decrypt_using_boxes_with_algorithm<AESNI_AES256>(
- algorithm_params, mode, key, ciphertexts);
+ box_key, mode, key, ciphertexts);
default:
return false;
diff --git a/utils/decrypt_bmp.cpp b/utils/decrypt_bmp.cpp
index aafde38..802283d 100644
--- a/utils/decrypt_bmp.cpp
+++ b/utils/decrypt_bmp.cpp
@@ -62,7 +62,7 @@ namespace
template <aesni::Algorithm algorithm>
bool decrypt_bmp_with_algorithm(
- const AesNI_BoxAlgorithmParams& algorithm_params,
+ const AesNI_BoxKey& box_key,
aesni::Mode mode,
std::deque<std::string>& args)
{
@@ -98,7 +98,7 @@ namespace
aesni_box_init(
&box,
algorithm,
- &algorithm_params,
+ &box_key,
mode,
iv_ptr,
aesni::ErrorDetailsThrowsInDestructor());
@@ -139,30 +139,30 @@ namespace
if (args.empty())
return false;
- AesNI_BoxAlgorithmParams algorithm_params;
+ AesNI_BoxKey box_key;
switch (algorithm)
{
case AESNI_AES128:
aesni::from_string<AESNI_AES128>(
- algorithm_params.aes128_key, args.front());
+ box_key.aes128_key, args.front());
args.pop_front();
return decrypt_bmp_with_algorithm<AESNI_AES128>(
- algorithm_params, mode, args);
+ box_key, mode, args);
case AESNI_AES192:
aesni::from_string<AESNI_AES192>(
- algorithm_params.aes192_key, args.front());
+ box_key.aes192_key, args.front());
args.pop_front();
return decrypt_bmp_with_algorithm<AESNI_AES192>(
- algorithm_params, mode, args);
+ box_key, mode, args);
case AESNI_AES256:
aesni::from_string<AESNI_AES256>(
- algorithm_params.aes256_key, args.front());
+ box_key.aes256_key, args.front());
args.pop_front();
return decrypt_bmp_with_algorithm<AESNI_AES256>(
- algorithm_params, mode, args);
+ box_key, mode, args);
default:
return false;
diff --git a/utils/decrypt_file.cpp b/utils/decrypt_file.cpp
index 2e4da3b..d8c42c4 100644
--- a/utils/decrypt_file.cpp
+++ b/utils/decrypt_file.cpp
@@ -59,7 +59,7 @@ namespace
template <aesni::Algorithm algorithm>
bool decrypt_file_with_algorithm(
- const AesNI_BoxAlgorithmParams& algorithm_params,
+ const AesNI_BoxKey& box_key,
aesni::Mode mode,
std::deque<std::string>& args)
{
@@ -89,7 +89,7 @@ namespace
aesni_box_init(
&box,
algorithm,
- &algorithm_params,
+ &box_key,
mode,
iv_ptr,
aesni::ErrorDetailsThrowsInDestructor());
@@ -129,30 +129,30 @@ namespace
if (args.empty())
return false;
- AesNI_BoxAlgorithmParams algorithm_params;
+ AesNI_BoxKey box_key;
switch (algorithm)
{
case AESNI_AES128:
aesni::from_string<AESNI_AES128>(
- algorithm_params.aes128_key, args.front());
+ box_key.aes128_key, args.front());
args.pop_front();
return decrypt_file_with_algorithm<AESNI_AES128>(
- algorithm_params, mode, args);
+ box_key, mode, args);
case AESNI_AES192:
aesni::from_string<AESNI_AES192>(
- algorithm_params.aes192_key, args.front());
+ box_key.aes192_key, args.front());
args.pop_front();
return decrypt_file_with_algorithm<AESNI_AES192>(
- algorithm_params, mode, args);
+ box_key, mode, args);
case AESNI_AES256:
aesni::from_string<AESNI_AES256>(
- algorithm_params.aes256_key, args.front());
+ box_key.aes256_key, args.front());
args.pop_front();
return decrypt_file_with_algorithm<AESNI_AES256>(
- algorithm_params, mode, args);
+ box_key, mode, args);
default:
return false;
diff --git a/utils/encrypt_block.cpp b/utils/encrypt_block.cpp
index c8313a6..1a62bda 100644
--- a/utils/encrypt_block.cpp
+++ b/utils/encrypt_block.cpp
@@ -130,7 +130,7 @@ namespace
template <aesni::Algorithm algorithm>
bool encrypt_using_boxes_with_algorithm(
- const AesNI_BoxAlgorithmParams& algorithm_params,
+ const AesNI_BoxKey& box_key,
aesni::Mode mode,
const std::string& key,
std::deque<std::string> plaintexts)
@@ -152,7 +152,7 @@ namespace
aesni_box_init(
&box,
algorithm,
- &algorithm_params,
+ &box_key,
mode,
iv_ptr,
aesni::ErrorDetailsThrowsInDestructor());
@@ -182,27 +182,27 @@ namespace
const std::string& key,
std::deque<std::string> plaintexts)
{
- AesNI_BoxAlgorithmParams algorithm_params;
+ AesNI_BoxKey box_key;
switch (algorithm)
{
case AESNI_AES128:
aesni::from_string<AESNI_AES128>(
- algorithm_params.aes128_key, key);
+ box_key.aes128_key, key);
return encrypt_using_boxes_with_algorithm<AESNI_AES128>(
- algorithm_params, mode, key, plaintexts);
+ box_key, mode, key, plaintexts);
case AESNI_AES192:
aesni::from_string<AESNI_AES192>(
- algorithm_params.aes192_key, key);
+ box_key.aes192_key, key);
return encrypt_using_boxes_with_algorithm<AESNI_AES192>(
- algorithm_params, mode, key, plaintexts);
+ box_key, mode, key, plaintexts);
case AESNI_AES256:
aesni::from_string<AESNI_AES256>(
- algorithm_params.aes256_key, key);
+ box_key.aes256_key, key);
return encrypt_using_boxes_with_algorithm<AESNI_AES256>(
- algorithm_params, mode, key, plaintexts);
+ box_key, mode, key, plaintexts);
default:
return false;
diff --git a/utils/encrypt_bmp.cpp b/utils/encrypt_bmp.cpp
index 4eaa767..7e2ad21 100644
--- a/utils/encrypt_bmp.cpp
+++ b/utils/encrypt_bmp.cpp
@@ -62,7 +62,7 @@ namespace
template <aesni::Algorithm algorithm>
bool encrypt_bmp_with_algorithm(
- const AesNI_BoxAlgorithmParams& algorithm_params,
+ const AesNI_BoxKey& box_key,
aesni::Mode mode,
std::deque<std::string>& args)
{
@@ -98,7 +98,7 @@ namespace
aesni_box_init(
&box,
algorithm,
- &algorithm_params,
+ &box_key,
mode,
iv_ptr,
aesni::ErrorDetailsThrowsInDestructor());
@@ -138,30 +138,30 @@ namespace
if (args.empty())
return false;
- AesNI_BoxAlgorithmParams algorithm_params;
+ AesNI_BoxKey box_key;
switch (algorithm)
{
case AESNI_AES128:
aesni::from_string<AESNI_AES128>(
- algorithm_params.aes128_key, args.front());
+ box_key.aes128_key, args.front());
args.pop_front();
return encrypt_bmp_with_algorithm<AESNI_AES128>(
- algorithm_params, mode, args);
+ box_key, mode, args);
case AESNI_AES192:
aesni::from_string<AESNI_AES192>(
- algorithm_params.aes192_key, args.front());
+ box_key.aes192_key, args.front());
args.pop_front();
return encrypt_bmp_with_algorithm<AESNI_AES192>(
- algorithm_params, mode, args);
+ box_key, mode, args);
case AESNI_AES256:
aesni::from_string<AESNI_AES256>(
- algorithm_params.aes256_key, args.front());
+ box_key.aes256_key, args.front());
args.pop_front();
return encrypt_bmp_with_algorithm<AESNI_AES256>(
- algorithm_params, mode, args);
+ box_key, mode, args);
default:
return false;
diff --git a/utils/encrypt_file.cpp b/utils/encrypt_file.cpp
index 0619568..13f2ce1 100644
--- a/utils/encrypt_file.cpp
+++ b/utils/encrypt_file.cpp
@@ -59,7 +59,7 @@ namespace
template <aesni::Algorithm algorithm>
bool encrypt_file_with_algorithm(
- const AesNI_BoxAlgorithmParams& algorithm_params,
+ const AesNI_BoxKey& box_key,
aesni::Mode mode,
std::deque<std::string>& args)
{
@@ -89,7 +89,7 @@ namespace
aesni_box_init(
&box,
algorithm,
- &algorithm_params,
+ &box_key,
mode,
iv_ptr,
aesni::ErrorDetailsThrowsInDestructor());
@@ -129,30 +129,30 @@ namespace
if (args.empty())
return false;
- AesNI_BoxAlgorithmParams algorithm_params;
+ AesNI_BoxKey box_key;
switch (algorithm)
{
case AESNI_AES128:
aesni::from_string<AESNI_AES128>(
- algorithm_params.aes128_key, args.front());
+ box_key.aes128_key, args.front());
args.pop_front();
return encrypt_file_with_algorithm<AESNI_AES128>(
- algorithm_params, mode, args);
+ box_key, mode, args);
case AESNI_AES192:
aesni::from_string<AESNI_AES192>(
- algorithm_params.aes192_key, args.front());
+ box_key.aes192_key, args.front());
args.pop_front();
return encrypt_file_with_algorithm<AESNI_AES192>(
- algorithm_params, mode, args);
+ box_key, mode, args);
case AESNI_AES256:
aesni::from_string<AESNI_AES256>(
- algorithm_params.aes256_key, args.front());
+ box_key.aes256_key, args.front());
args.pop_front();
return encrypt_file_with_algorithm<AESNI_AES256>(
- algorithm_params, mode, args);
+ box_key, mode, args);
default:
return false;