aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/aesxx
diff options
context:
space:
mode:
authorEgor Tensin <egor@tensin.name>2026-07-21 14:44:58 +0200
committerEgor Tensin <egor@tensin.name>2026-07-21 15:03:00 +0200
commit31b275f8c201570af8a22dfe8c5ceaa9624b638c (patch)
tree8e11af31ec04c7c91b512a548bf23a61bc752d8b /aesxx
parentaes: minor refactoring (diff)
downloadaes-tools-31b275f8c201570af8a22dfe8c5ceaa9624b638c.tar.gz
aes-tools-31b275f8c201570af8a22dfe8c5ceaa9624b638c.zip
blocks are the same for every variant
Diffstat (limited to 'aesxx')
-rw-r--r--aesxx/include/aesxx/box.hpp20
-rw-r--r--aesxx/utils/decrypt_block.cpp2
-rw-r--r--aesxx/utils/decrypt_bmp.cpp2
-rw-r--r--aesxx/utils/decrypt_file.cpp2
-rw-r--r--aesxx/utils/encrypt_block.cpp2
-rw-r--r--aesxx/utils/encrypt_bmp.cpp2
-rw-r--r--aesxx/utils/encrypt_file.cpp2
7 files changed, 12 insertions, 20 deletions
diff --git a/aesxx/include/aesxx/box.hpp b/aesxx/include/aesxx/box.hpp
index 72e3be2..5bd17de 100644
--- a/aesxx/include/aesxx/box.hpp
+++ b/aesxx/include/aesxx/box.hpp
@@ -20,7 +20,7 @@ namespace aes {
class Box {
public:
- typedef AES_BoxBlock Block;
+ typedef AES_Block Block;
typedef AES_BoxKey Key;
static std::string format_key(const Key& src, Algorithm algorithm) {
@@ -29,14 +29,14 @@ public:
return reinterpret_cast<const char*>(&str);
}
- static std::string format_block(const Block& src, Algorithm algorithm) {
- AES_BoxBlockString str;
- aes_box_format_block(&str, algorithm, &src, ErrorDetailsThrowsInDestructor{});
+ static std::string format_block(const Block& src) {
+ AES_BlockString str;
+ aes_AES_format_block(&str, &src, ErrorDetailsThrowsInDestructor{});
return reinterpret_cast<const char*>(&str);
}
- static void parse_block(Block& dest, Algorithm algorithm, std::string_view src) {
- aes_box_parse_block(&dest, algorithm, src.data(), ErrorDetailsThrowsInDestructor{});
+ static void parse_block(Block& dest, std::string_view src) {
+ aes_AES_parse_block(&dest, src.data(), ErrorDetailsThrowsInDestructor{});
}
static void parse_key(Key& dest, Algorithm algorithm, std::string_view src) {
@@ -106,18 +106,10 @@ public:
return dest_buf;
}
- std::string format_block(const Block& src) {
- return format_block(src, get_algorithm());
- }
-
std::string format_key(const Key& src) {
return format_key(src, get_algorithm());
}
- void parse_block(Block& dest, std::string_view src) {
- parse_block(dest, get_algorithm(), src);
- }
-
void parse_key(Key& dest, std::string_view src) {
parse_key(dest, get_algorithm(), src);
}
diff --git a/aesxx/utils/decrypt_block.cpp b/aesxx/utils/decrypt_block.cpp
index ddca7ba..c8edb34 100644
--- a/aesxx/utils/decrypt_block.cpp
+++ b/aesxx/utils/decrypt_block.cpp
@@ -133,7 +133,7 @@ void decrypt_using_boxes(
if (input.has_iv()) {
aes::Box::Block iv;
- aes::Box::parse_block(iv, algorithm, input.get_iv());
+ aes::Box::parse_block(iv, input.get_iv());
aes::Box box{algorithm, key, mode, iv};
decrypt_using_particular_box(box, input.get_blocks());
diff --git a/aesxx/utils/decrypt_bmp.cpp b/aesxx/utils/decrypt_bmp.cpp
index e181081..51a2572 100644
--- a/aesxx/utils/decrypt_bmp.cpp
+++ b/aesxx/utils/decrypt_bmp.cpp
@@ -39,7 +39,7 @@ void decrypt_bmp(const FileSettings& settings) {
if (settings.has_iv()) {
aes::Box::Block iv;
- aes::Box::parse_block(iv, algorithm, settings.get_iv());
+ aes::Box::parse_block(iv, settings.get_iv());
aes::Box box{algorithm, key, mode, iv};
decrypt_bmp(box, settings.get_input_path(), settings.get_output_path());
diff --git a/aesxx/utils/decrypt_file.cpp b/aesxx/utils/decrypt_file.cpp
index 4aa7d6b..6c915b5 100644
--- a/aesxx/utils/decrypt_file.cpp
+++ b/aesxx/utils/decrypt_file.cpp
@@ -37,7 +37,7 @@ void decrypt_file(const FileSettings& settings) {
if (settings.has_iv()) {
aes::Box::Block iv;
- aes::Box::parse_block(iv, algorithm, settings.get_iv());
+ aes::Box::parse_block(iv, settings.get_iv());
aes::Box box{algorithm, key, mode, iv};
decrypt_file(box, settings.get_input_path(), settings.get_output_path());
diff --git a/aesxx/utils/encrypt_block.cpp b/aesxx/utils/encrypt_block.cpp
index 2bad94e..a796483 100644
--- a/aesxx/utils/encrypt_block.cpp
+++ b/aesxx/utils/encrypt_block.cpp
@@ -136,7 +136,7 @@ void encrypt_using_boxes(
if (input.has_iv()) {
aes::Box::Block iv;
- aes::Box::parse_block(iv, algorithm, input.get_iv());
+ aes::Box::parse_block(iv, input.get_iv());
aes::Box box{algorithm, key, mode, iv};
encrypt_using_particular_box(box, input.get_blocks());
diff --git a/aesxx/utils/encrypt_bmp.cpp b/aesxx/utils/encrypt_bmp.cpp
index 6487a3a..19caee4 100644
--- a/aesxx/utils/encrypt_bmp.cpp
+++ b/aesxx/utils/encrypt_bmp.cpp
@@ -37,7 +37,7 @@ void encrypt_bmp(const FileSettings& settings) {
if (settings.has_iv()) {
aes::Box::Block iv;
- aes::Box::parse_block(iv, algorithm, settings.get_iv());
+ aes::Box::parse_block(iv, settings.get_iv());
aes::Box box{algorithm, key, mode, iv};
encrypt_bmp(box, settings.get_input_path(), settings.get_output_path());
diff --git a/aesxx/utils/encrypt_file.cpp b/aesxx/utils/encrypt_file.cpp
index d2d0e51..1b7217c 100644
--- a/aesxx/utils/encrypt_file.cpp
+++ b/aesxx/utils/encrypt_file.cpp
@@ -37,7 +37,7 @@ void encrypt_file(const FileSettings& settings) {
if (settings.has_iv()) {
aes::Box::Block iv;
- aes::Box::parse_block(iv, algorithm, settings.get_iv());
+ aes::Box::parse_block(iv, settings.get_iv());
aes::Box box{algorithm, key, mode, iv};
encrypt_file(box, settings.get_input_path(), settings.get_output_path());