wstring EncryptionAlgorithm::GetName (bool forGuiDisplay) const { if (Ciphers.size() < 1) throw NotInitialized (SRC_POS); wstring name; int depth = 0; foreach_reverse_ref (const Cipher &c, Ciphers) { if (name.empty()) name = c.GetName(); else { depth++; if (forGuiDisplay) name += wstring (L"("); else name += wstring (L"-"); name += c.GetName(); } } if (forGuiDisplay && depth) { for (int i = 0; i < depth; i++) name += wstring(L")"); } return name; }
void MpvHandler::Command(const char *args[]) { if(mpv) mpv_command(mpv, args); else NotInitialized(); }
shared_ptr <EncryptionMode> EncryptionAlgorithm::GetMode () const { if (Mode.get() == nullptr) throw NotInitialized (SRC_POS); return Mode; }
void FuseService::WriteVolumeSectors (const ConstBufferPtr &buffer, uint64 byteOffset) { if (!MountedVolume) throw NotInitialized (SRC_POS); MountedVolume->WriteSectors (buffer, byteOffset); }
uint64 FuseService::GetVolumeSize () { if (!MountedVolume) throw NotInitialized (SRC_POS); return MountedVolume->GetSize(); }
boost::shared_ptr<shade::shaders::Value<shade::vec3, shade::local> > shade::UVWInstance::get(void) { if (m_value) return m_value; throw NotInitialized(); }
void Cipher::EncryptBlock (byte *data) const { if (!Initialized) throw NotInitialized (SRC_POS); Encrypt (data); }
void MpvHandler::AsyncCommand(const char *args[]) { if(mpv) mpv_command_async(mpv, 0, args); else NotInitialized(); }
void SecureBuffer::Free () { if (DataPtr == nullptr) throw NotInitialized (SRC_POS); Erase (); Buffer::Free (); }
void Buffer::Free () { if (DataPtr == nullptr) throw NotInitialized (SRC_POS); Memory::Free (DataPtr); DataPtr = nullptr; DataSize = 0; }
void CipherCamellia::DecryptBlocks (byte *data, size_t blockCount) const { if (!Initialized) throw NotInitialized (SRC_POS); #if CRYPTOPP_BOOL_X64 camellia_decrypt_blocks ( ScheduledKey.Ptr(), data, data, blockCount); #else Cipher::DecryptBlocks (data, blockCount); #endif }
void CipherTwofish::DecryptBlocks (byte *data, size_t blockCount) const { if (!Initialized) throw NotInitialized (SRC_POS); #if CRYPTOPP_BOOL_X64 twofish_decrypt_blocks ( (TwofishInstance *) ScheduledKey.Ptr(), data, data, blockCount); #else Cipher::DecryptBlocks (data, blockCount); #endif }
void Cipher::EncryptBlocks (byte *data, size_t blockCount) const { if (!Initialized) throw NotInitialized (SRC_POS); while (blockCount-- > 0) { Encrypt (data); data += GetBlockSize(); } }
size_t EncryptionAlgorithm::GetKeySize () const { if (Ciphers.size() < 1) throw NotInitialized (SRC_POS); size_t keySize = 0; foreach_ref (const Cipher &c, Ciphers) keySize += c.GetKeySize(); return keySize; }
size_t EncryptionModeXTS::GetKeySize () const { if (Ciphers.empty()) throw NotInitialized (SRC_POS); size_t keySize = 0; foreach_ref (const Cipher &cipher, SecondaryCiphers) { keySize += cipher.GetKeySize(); } return keySize; }
void EncryptionAlgorithm::SetKey (const ConstBufferPtr &key) { if (Ciphers.size() < 1) throw NotInitialized (SRC_POS); if (GetKeySize() != key.Size()) throw ParameterIncorrect (SRC_POS); size_t keyOffset = 0; foreach_ref (Cipher &c, Ciphers) { c.SetKey (key.GetRange (keyOffset, c.GetKeySize())); keyOffset += c.GetKeySize(); }
void CipherSerpent::DecryptBlocks (byte *data, size_t blockCount) const { if (!Initialized) throw NotInitialized (SRC_POS); #if CRYPTOPP_BOOL_SSE2_INTRINSICS_AVAILABLE if ((blockCount >= 4) && IsHwSupportAvailable()) { serpent_decrypt_blocks (data, data, blockCount, ScheduledKey.Ptr()); } else #endif Cipher::DecryptBlocks (data, blockCount); }
void CipherAES::EncryptBlocks (byte *data, size_t blockCount) const { if (!Initialized) throw NotInitialized (SRC_POS); #ifdef TC_AES_HW_CPU if ((blockCount & (32 - 1)) == 0 && IsHwSupportAvailable()) { while (blockCount > 0) { aes_hw_cpu_encrypt_32_blocks (ScheduledKey.Ptr(), data); data += 32 * GetBlockSize(); blockCount -= 32; } } else #endif Cipher::EncryptBlocks (data, blockCount); }
void EncryptionMode::ValidateState () const { if (!KeySet || Ciphers.size() < 1) throw NotInitialized (SRC_POS); }
void File::ValidateState () const { if (!FileIsOpen) throw NotInitialized (SRC_POS); }