diff options
Diffstat (limited to 'src/lib/stream')
-rw-r--r-- | src/lib/stream/chacha/chacha.h | 3 | ||||
-rw-r--r-- | src/lib/stream/ctr/ctr.h | 2 | ||||
-rw-r--r-- | src/lib/stream/ofb/ofb.h | 2 | ||||
-rw-r--r-- | src/lib/stream/stream_cipher.h | 28 |
4 files changed, 27 insertions, 8 deletions
diff --git a/src/lib/stream/chacha/chacha.h b/src/lib/stream/chacha/chacha.h index eafeac2fd..6b1c989e2 100644 --- a/src/lib/stream/chacha/chacha.h +++ b/src/lib/stream/chacha/chacha.h @@ -21,7 +21,8 @@ class BOTAN_DLL ChaCha final : public StreamCipher StreamCipher* clone() const override { return new ChaCha(m_rounds); } /** - * Currently only 8, 12 or 20 rounds are supported, all others + * @param rounds number of rounds + * @note Currently only 8, 12 or 20 rounds are supported, all others * will throw an exception */ ChaCha(size_t rounds = 20); diff --git a/src/lib/stream/ctr/ctr.h b/src/lib/stream/ctr/ctr.h index 5d5556254..385edac54 100644 --- a/src/lib/stream/ctr/ctr.h +++ b/src/lib/stream/ctr/ctr.h @@ -41,7 +41,7 @@ class BOTAN_DLL CTR_BE final : public StreamCipher static CTR_BE* make(const Spec& spec); /** - * @param cipher the underlying block cipher to use + * @param cipher the block cipher to use */ explicit CTR_BE(BlockCipher* cipher); diff --git a/src/lib/stream/ofb/ofb.h b/src/lib/stream/ofb/ofb.h index 127a06578..7d77bae7a 100644 --- a/src/lib/stream/ofb/ofb.h +++ b/src/lib/stream/ofb/ofb.h @@ -41,7 +41,7 @@ class BOTAN_DLL OFB final : public StreamCipher static OFB* make(const Spec& spec); /** - * @param cipher the underlying block cipher to use + * @param cipher the block cipher to use */ explicit OFB(BlockCipher* cipher); diff --git a/src/lib/stream/stream_cipher.h b/src/lib/stream/stream_cipher.h index b24a99e39..0cbdf3c65 100644 --- a/src/lib/stream/stream_cipher.h +++ b/src/lib/stream/stream_cipher.h @@ -23,14 +23,16 @@ class BOTAN_DLL StreamCipher : public SymmetricAlgorithm /** * Create an instance based on a name - * Will return a null pointer if the algo/provider combination cannot - * be found. If provider is empty then best available is chosen. + * If provider is empty then best available is chosen. + * @param algo_spec algorithm name + * @param provider provider implementation to use + * @return a null pointer if the algo/provider combination cannot be found */ static std::unique_ptr<StreamCipher> create(const std::string& algo_spec, const std::string& provider = ""); /** - * Returns the list of available providers for this algorithm, empty if not available + * @return list of available providers for this algorithm, empty if not available */ static std::vector<std::string> providers(const std::string& algo_spec); @@ -44,20 +46,36 @@ class BOTAN_DLL StreamCipher : public SymmetricAlgorithm /** * Encrypt or decrypt a message + * The message is encrypted/decrypted in place. * @param buf the plaintext / ciphertext * @param len the length of buf in bytes */ void cipher1(byte buf[], size_t len) { cipher(buf, buf, len); } + /** + * Encrypt a message + * The message is encrypted/decrypted in place. + * @param inout the plaintext / ciphertext + */ template<typename Alloc> void encipher(std::vector<byte, Alloc>& inout) { cipher(inout.data(), inout.data(), inout.size()); } + /** + * Encrypt a message + * The message is encrypted in place. + * @param inout the plaintext / ciphertext + */ template<typename Alloc> void encrypt(std::vector<byte, Alloc>& inout) { cipher(inout.data(), inout.data(), inout.size()); } + /** + * Decrypt a message in place + * The message is decrypted in place. + * @param inout the plaintext / ciphertext + */ template<typename Alloc> void decrypt(std::vector<byte, Alloc>& inout) { cipher(inout.data(), inout.data(), inout.size()); } @@ -67,7 +85,7 @@ class BOTAN_DLL StreamCipher : public SymmetricAlgorithm * @param iv the initialization vector * @param iv_len the length of the IV in bytes */ - virtual void set_iv(const byte[], size_t iv_len) = 0; + virtual void set_iv(const byte iv[], size_t iv_len) = 0; /** * @param iv_len the length of the IV in bytes @@ -76,7 +94,7 @@ class BOTAN_DLL StreamCipher : public SymmetricAlgorithm virtual bool valid_iv_length(size_t iv_len) const { return (iv_len == 0); } /** - * Get a new object representing the same algorithm as *this + * @return a new object representing the same algorithm as *this */ virtual StreamCipher* clone() const = 0; |