From 81961b091106893a859da9be77d8e139de520f20 Mon Sep 17 00:00:00 2001 From: Denis Fakhrtdinov Date: Fri, 6 Dec 2024 19:59:04 +0200 Subject: [PATCH] Allow AES function for bindgen --- src/aes_hash_bindgen.cpp | 35 +++++++++++++++++++++++++++++++++++ src/aes_hash_bindgen.h | 25 +++++++++++++++++++++++++ 2 files changed, 60 insertions(+) create mode 100644 src/aes_hash_bindgen.cpp create mode 100644 src/aes_hash_bindgen.h diff --git a/src/aes_hash_bindgen.cpp b/src/aes_hash_bindgen.cpp new file mode 100644 index 0000000..a0674a6 --- /dev/null +++ b/src/aes_hash_bindgen.cpp @@ -0,0 +1,35 @@ +#include "aes_hash.hpp" + +extern "C" { + void hashAes1Rx4_soft(const void *input, size_t inputSize, void *hash) { + hashAes1Rx4(input, inputSize, hash); + } + + void hashAes1Rx4_hard(const void *input, size_t inputSize, void *hash) { + hashAes1Rx4(input, inputSize, hash); + } + + void fillAes1Rx4_soft(void *state, size_t outputSize, void *buffer) { + fillAes1Rx4(state, outputSize, buffer); + } + + void fillAes1Rx4_hard(void *state, size_t outputSize, void *buffer) { + fillAes1Rx4(state, outputSize, buffer); + } + + void fillAes4Rx4_soft(void *state, size_t outputSize, void *buffer) { + fillAes4Rx4(state, outputSize, buffer); + } + + void fillAes4Rx4_hard(void *state, size_t outputSize, void *buffer) { + fillAes4Rx4(state, outputSize, buffer); + } + + void hashAndFillAes1Rx4_soft(void *scratchpad, size_t scratchpadSize, void *hash, void* fill_state) { + hashAndFillAes1Rx4(scratchpad, scratchpadSize, hash, fill_state); + } + + void hashAndFillAes1Rx4_hard(void *scratchpad, size_t scratchpadSize, void *hash, void* fill_state) { + hashAndFillAes1Rx4(scratchpad, scratchpadSize, hash, fill_state); + } +} diff --git a/src/aes_hash_bindgen.h b/src/aes_hash_bindgen.h new file mode 100644 index 0000000..06a799d --- /dev/null +++ b/src/aes_hash_bindgen.h @@ -0,0 +1,25 @@ +#ifndef AES_HASH_BINDGEN_H +#define AES_HASH_BINDGEN_H +#endif + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +void hashAes1Rx4_soft(const void *input, size_t inputSize, void *hash); +void hashAes1Rx4_hard(const void *input, size_t inputSize, void *hash); + +void fillAes1Rx4_soft(void *state, size_t outputSize, void *buffer); +void fillAes1Rx4_hard(void *state, size_t outputSize, void *buffer); + +void fillAes4Rx4_soft(void *state, size_t outputSize, void *buffer); +void fillAes4Rx4_hard(void *state, size_t outputSize, void *buffer); + +void hashAndFillAes1Rx4_soft(void *scratchpad, size_t scratchpadSize, void *hash, void* fill_state); +void hashAndFillAes1Rx4_hard(void *scratchpad, size_t scratchpadSize, void *hash, void* fill_state); + +#ifdef __cplusplus +} +#endif