diff options
Diffstat (limited to 'src/lib/ffi')
-rw-r--r-- | src/lib/ffi/ffi.h | 10 | ||||
-rw-r--r-- | src/lib/ffi/ffi_cipher.cpp | 5 |
2 files changed, 15 insertions, 0 deletions
diff --git a/src/lib/ffi/ffi.h b/src/lib/ffi/ffi.h index 19e04ce4d..ed3e0bb71 100644 --- a/src/lib/ffi/ffi.h +++ b/src/lib/ffi/ffi.h @@ -467,6 +467,16 @@ BOTAN_PUBLIC_API(2,0) int botan_cipher_set_key(botan_cipher_t cipher, const uint8_t* key, size_t key_len); /** +* Reset the message specific state for this cipher. +* Without resetting the keys, this resets the nonce, and any state +* associated with any message bits that have been processed so far. +* +* It is conceptually equivalent to calling botan_cipher_clear followed +* by botan_cipher_set_key with the original key. +*/ +BOTAN_PUBLIC_API(2,8) int botan_cipher_reset(botan_cipher_t cipher); + +/** * Set the associated data. Will fail if cipher is not an AEAD */ BOTAN_PUBLIC_API(2,0) int botan_cipher_set_associated_data(botan_cipher_t cipher, diff --git a/src/lib/ffi/ffi_cipher.cpp b/src/lib/ffi/ffi_cipher.cpp index e9adc8637..ec6893405 100644 --- a/src/lib/ffi/ffi_cipher.cpp +++ b/src/lib/ffi/ffi_cipher.cpp @@ -41,6 +41,11 @@ int botan_cipher_clear(botan_cipher_t cipher) return BOTAN_FFI_DO(Botan::Cipher_Mode, cipher, c, { c.clear(); }); } +int botan_cipher_reset(botan_cipher_t cipher) + { + return BOTAN_FFI_DO(Botan::Cipher_Mode, cipher, c, { c.reset(); }); + } + int botan_cipher_output_length(botan_cipher_t cipher, size_t in_len, size_t* out_len) { if(out_len == nullptr) |