aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/ffi
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/ffi')
-rw-r--r--src/lib/ffi/ffi.cpp6
-rw-r--r--src/lib/ffi/ffi.h8
2 files changed, 14 insertions, 0 deletions
diff --git a/src/lib/ffi/ffi.cpp b/src/lib/ffi/ffi.cpp
index 3686c26f1..7e96e5514 100644
--- a/src/lib/ffi/ffi.cpp
+++ b/src/lib/ffi/ffi.cpp
@@ -852,6 +852,12 @@ int botan_hash_final(botan_hash_t hash, uint8_t out[])
return BOTAN_FFI_DO(Botan::HashFunction, hash, h, { h.final(out); });
}
+int botan_hash_copy_state(botan_hash_t* dest, const botan_hash_t source)
+ {
+ return BOTAN_FFI_DO(Botan::HashFunction, source, src, {
+ *dest = new botan_hash_struct(src.copy_state().release()); });
+ }
+
int botan_mac_init(botan_mac_t* mac, const char* mac_name, uint32_t flags)
{
try
diff --git a/src/lib/ffi/ffi.h b/src/lib/ffi/ffi.h
index 4953bce06..5ce86a9b0 100644
--- a/src/lib/ffi/ffi.h
+++ b/src/lib/ffi/ffi.h
@@ -225,6 +225,14 @@ typedef struct botan_hash_struct* botan_hash_t;
BOTAN_DLL int botan_hash_init(botan_hash_t* hash, const char* hash_name, uint32_t flags);
/**
+* Copy the state of a hash function object
+* @param dest destination hash object
+* @param source source hash object
+* @return 0 on success, a negative value on failure
+*/
+BOTAN_DLL int botan_hash_copy_state(botan_hash_t *dest, const botan_hash_t source);
+
+/**
* Writes the output length of the hash function to *output_length
* @param hash hash object
* @param output_length output buffer to hold the hash function output length