diff options
author | Daniel Wyatt <[email protected]> | 2017-05-25 22:15:48 -0400 |
---|---|---|
committer | Daniel Wyatt <[email protected]> | 2017-05-25 22:15:48 -0400 |
commit | da5871a12ca8f5031b1945e3fcca88921ae8ebd8 (patch) | |
tree | 4ab3cf5feb08073f761804841d869b4a768c1a6a /src/lib/ffi | |
parent | d8fc6ff06f955358286973e05142dc6c5066f2b8 (diff) |
Add botan_hash_copy_state FFI function.
Diffstat (limited to 'src/lib/ffi')
-rw-r--r-- | src/lib/ffi/ffi.cpp | 6 | ||||
-rw-r--r-- | src/lib/ffi/ffi.h | 8 |
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 |