/* */ #include "LibsslARC4Decryptor.h" #include #include "DlAbortEx.h" #include "fmt.h" namespace aria2 { namespace { void handleError() { throw DL_ABORT_EX (fmt("Exception in libssl routine(ARC4Decryptor class): %s", ERR_error_string(ERR_get_error(), 0))); } } // namespace ARC4Decryptor::ARC4Decryptor() {} ARC4Decryptor::~ARC4Decryptor() {} void ARC4Decryptor::init(const unsigned char* key, size_t keyLength) { ctx_.init(key, keyLength, 0); } void ARC4Decryptor::decrypt(unsigned char* out, size_t outLength, const unsigned char* in, size_t inLength) { int soutLength = outLength; if(!EVP_CipherUpdate(ctx_.getCipherContext(), out, &soutLength, in, inLength)) { handleError(); } } } // namespace aria2