aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/aes/include
diff options
context:
space:
mode:
authorEgor Tensin <egor@tensin.name>2026-07-22 23:48:16 +0200
committerEgor Tensin <egor@tensin.name>2026-07-23 10:54:24 +0200
commitd6ba2397803c5f2d6a39a8684239c53f84e73b80 (patch)
treec33b3fe76890e05ddea32071f461f892f9d17e6a /aes/include
parentaesxx/utils: add tests for invalid inputs (diff)
downloadaes-tools-d6ba2397803c5f2d6a39a8684239c53f84e73b80.tar.gz
aes-tools-d6ba2397803c5f2d6a39a8684239c53f84e73b80.zip
aes: always require full inputs
I.e. no 31 digit for 128-bit blocks, reuse code, etc. Also, generalize hex string parsing.
Diffstat (limited to 'aes/include')
-rw-r--r--aes/include/aes/all.h1
-rw-r--r--aes/include/aes/hex.h25
2 files changed, 26 insertions, 0 deletions
diff --git a/aes/include/aes/all.h b/aes/include/aes/all.h
index fb0a191..8c4b04d 100644
--- a/aes/include/aes/all.h
+++ b/aes/include/aes/all.h
@@ -10,6 +10,7 @@
#include "block.h"
#include "box.h"
#include "error.h"
+#include "hex.h"
#include "key.h"
#include "mode.h"
#include "padding.h"
diff --git a/aes/include/aes/hex.h b/aes/include/aes/hex.h
new file mode 100644
index 0000000..d0e4586
--- /dev/null
+++ b/aes/include/aes/hex.h
@@ -0,0 +1,25 @@
+// Copyright (c) 2026 Egor Tensin <Egor.Tensin@gmail.com>
+// This file is part of the "AES tools" project.
+// For details, see https://github.com/egor-tensin/aes-tools.
+// Distributed under the MIT License.
+
+#pragma once
+
+#include "error.h"
+
+#include <stdlib.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+AES_StatusCode aes_parse_hex_string(
+ unsigned char* dest,
+ const char* src,
+ size_t numof_bytes,
+ AES_ErrorDetails* err_details
+);
+
+#ifdef __cplusplus
+}
+#endif