/* * Stream Ciphers * (C) 2015 Jack Lloyd * * Botan is released under the Simplified BSD License (see license.txt) */ #include #include #if defined(BOTAN_HAS_CHACHA) #include #endif #if defined(BOTAN_HAS_SALSA20) #include #endif #if defined(BOTAN_HAS_CTR_BE) #include #endif #if defined(BOTAN_HAS_OFB) #include #endif #if defined(BOTAN_HAS_RC4) #include #endif namespace Botan { std::unique_ptr StreamCipher::create(const std::string& algo_spec, const std::string& provider) { return std::unique_ptr(make_a(Botan::StreamCipher::Spec(algo_spec), provider)); } std::vector StreamCipher::providers(const std::string& algo_spec) { return providers_of(StreamCipher::Spec(algo_spec)); } StreamCipher::StreamCipher() {} StreamCipher::~StreamCipher() {} void StreamCipher::set_iv(const byte[], size_t iv_len) { if(!valid_iv_length(iv_len)) throw Invalid_IV_Length(name(), iv_len); } #if defined(BOTAN_HAS_CHACHA) BOTAN_REGISTER_T_1LEN(StreamCipher, ChaCha, 20); #endif #if defined(BOTAN_HAS_SALSA20) BOTAN_REGISTER_T_NOARGS(StreamCipher, Salsa20); #endif #if defined(BOTAN_HAS_CTR_BE) BOTAN_REGISTER_NAMED_T(StreamCipher, "CTR-BE", CTR_BE, CTR_BE::make); #endif #if defined(BOTAN_HAS_OFB) BOTAN_REGISTER_NAMED_T(StreamCipher, "OFB", OFB, OFB::make); #endif #if defined(BOTAN_HAS_RC4) BOTAN_REGISTER_NAMED_T(StreamCipher, "RC4", RC4, RC4::make); #endif }