From d6ba2397803c5f2d6a39a8684239c53f84e73b80 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Wed, 22 Jul 2026 23:48:16 +0200 Subject: aes: always require full inputs I.e. no 31 digit for 128-bit blocks, reuse code, etc. Also, generalize hex string parsing. --- aes/include/aes/all.h | 1 + aes/include/aes/hex.h | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 aes/include/aes/hex.h (limited to 'aes/include') 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 +// 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 + +#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 -- cgit v1.3