#include "wizard/studio.h"#include "wizard/aes.h"#include "wizard/cipher.h"#include "wizard/exception.h"#include "wizard/exception-private.h"#include "wizard/memory_.h"#include "wizard/random_.h"#include "wizard/serpent.h"#include "wizard/twofish.h"Data Structures | |
| struct | _CipherInfo |
Defines | |
| #define | CipherRandomHash SHA256Hash |
Typedefs | |
| typedef void(* | DecipherBlock )(void *, const unsigned char *, const unsigned char *) |
| typedef void(*)(* | EncipherBlock )(void *, const unsigned char *, const unsigned char *) |
Functions | |
| static StringInfo * | DecipherCTRMode (CipherInfo *, StringInfo *) |
| static StringInfo ** | DecipherECBMode (CipherInfo *, StringInfo *) |
| static StringInfo *** | DecipherOFBMode (CipherInfo *, StringInfo *) |
| static StringInfo **** | EncipherCTRMode (CipherInfo *, StringInfo *) |
| static StringInfo ***** | EncipherECBMode (CipherInfo *, StringInfo *) |
| static StringInfo ****** | EncipherOFBMode (CipherInfo *, StringInfo *) |
| WizardExport CipherInfo * | AcquireCipherInfo (const CipherType cipher, const CipherMode mode) |
| static StringInfo * | DecipherCBCMode (CipherInfo *cipher_info, StringInfo *ciphertext) |
| static StringInfo * | DecipherCFBMode (CipherInfo *cipher_info, StringInfo *ciphertext) |
| WizardExport StringInfo * | DecryptCipher (CipherInfo *cipher_info, StringInfo *plaintext) |
| WizardExport StringInfo * | DecipherCipher (CipherInfo *cipher_info, StringInfo *ciphertext) |
| static void | IncrementCipherNonce (const size_t length, unsigned char *nonce) |
| WizardExport CipherInfo * | DestroyCipherInfo (CipherInfo *cipher_info) |
| static StringInfo * | EncipherCBCMode (CipherInfo *cipher_info, StringInfo *plaintext) |
| static StringInfo * | EncipherCFBMode (CipherInfo *cipher_info, StringInfo *plaintext) |
| WizardExport StringInfo * | EncryptCipher (CipherInfo *cipher_info, StringInfo *plaintext) |
| WizardExport StringInfo * | EncipherCipher (CipherInfo *cipher_info, StringInfo *plaintext) |
| WizardExport size_t | GetCipherBlocksize (const CipherInfo *cipher_info) |
| WizardExport StringInfo * | GenerateCipherNonce (CipherInfo *cipher_info) |
| WizardExport const StringInfo * | GetCipherNonce (CipherInfo *cipher_info) |
| WizardExport void | ResetCipherNonce (CipherInfo *cipher_info) |
| WizardExport void | SetCipherNonce (CipherInfo *cipher_info, const StringInfo *nonce) |
| WizardExport void | SetCipherKey (CipherInfo *cipher_info, const StringInfo *key) |
| #define CipherRandomHash SHA256Hash |
Referenced by AcquireCipherInfo().
| typedef void(* DecipherBlock)(void *, const unsigned char *, const unsigned char *) |
| typedef void(*)(* EncipherBlock)(void *, const unsigned char *, const unsigned char *) |
| WizardExport CipherInfo* AcquireCipherInfo | ( | const CipherType | cipher, | |
| const CipherMode | mode | |||
| ) |
References AcquireAESInfo(), AcquireRandomInfo(), AcquireSerpentInfo(), AcquireTwofishInfo(), AcquireWizardMemory(), AESCipher, _CipherInfo::blocksize, _CipherInfo::cipher, CipherDomain, CipherRandomHash, _CipherInfo::decipher_block, DecipherAESBlock(), DecipherSerpentBlock(), DecipherTwofishBlock(), DestroyStringInfo(), _CipherInfo::encipher_block, EncipherAESBlock(), EncipherSerpentBlock(), EncipherTwofishBlock(), EnumerateError, GenerateCipherNonce(), GetAESBlocksize(), GetSerpentBlocksize(), GetTwofishBlocksize(), _CipherInfo::handle, MemoryError, _CipherInfo::mode, _CipherInfo::nonce, _CipherInfo::random_info, ResetWizardMemory(), SerpentCipher, _CipherInfo::signature, ThrowWizardFatalError, _CipherInfo::timestamp, and TwofishCipher.
Referenced by AcquireKeyInfo(), and AcquireSecretInfo().
| static StringInfo* DecipherCBCMode | ( | CipherInfo * | cipher_info, | |
| StringInfo * | ciphertext | |||
| ) | [static] |
References _CipherInfo::blocksize, CipherDomain, _CipherInfo::decipher_block, GetStringInfoDatum(), GetStringInfoLength(), GetWizardModule, _CipherInfo::handle, LogWizardEvent(), MaxCipherBlocksize, _CipherInfo::nonce, ResetWizardMemory(), _CipherInfo::signature, TraceEvent, WizardAssert, and WizardSignature.
Referenced by DecipherCipher().
| static StringInfo* DecipherCFBMode | ( | CipherInfo * | cipher_info, | |
| StringInfo * | ciphertext | |||
| ) | [static] |
References _CipherInfo::blocksize, CipherDomain, _CipherInfo::encipher_block, GetStringInfoDatum(), GetStringInfoLength(), GetWizardModule, _CipherInfo::handle, LogWizardEvent(), MaxCipherBlocksize, _CipherInfo::nonce, ResetWizardMemory(), _CipherInfo::signature, TraceEvent, WizardAssert, and WizardSignature.
Referenced by DecipherCipher().
| WizardExport StringInfo* DecipherCipher | ( | CipherInfo * | cipher_info, | |
| StringInfo * | ciphertext | |||
| ) |
References CBCMode, CFBMode, CipherDomain, CTRMode, DecipherCBCMode(), DecipherCFBMode(), DecipherCTRMode(), DecipherECBMode(), DecipherOFBMode(), ECBMode, EnumerateError, GetWizardModule, LogWizardEvent(), _CipherInfo::mode, OFBMode, _CipherInfo::signature, ThrowWizardFatalError, TraceEvent, WizardAssert, and WizardSignature.
Referenced by AuthenticateSecretKey(), DecryptCipher(), and GetKeyInfo().
| static StringInfo * DecipherCTRMode | ( | CipherInfo * | cipher_info, | |
| StringInfo * | ciphertext | |||
| ) | [static] |
References _CipherInfo::blocksize, CipherDomain, _CipherInfo::encipher_block, GetStringInfoDatum(), GetStringInfoLength(), GetWizardModule, _CipherInfo::handle, IncrementCipherNonce(), LogWizardEvent(), MaxCipherBlocksize, _CipherInfo::nonce, ResetWizardMemory(), _CipherInfo::signature, TraceEvent, WizardAssert, and WizardSignature.
Referenced by DecipherCipher().
| static StringInfo * DecipherECBMode | ( | CipherInfo * | cipher_info, | |
| StringInfo * | ciphertext | |||
| ) |
References _CipherInfo::blocksize, CipherDomain, _CipherInfo::decipher_block, GetStringInfoDatum(), GetStringInfoLength(), GetWizardModule, _CipherInfo::handle, LogWizardEvent(), MaxCipherBlocksize, _CipherInfo::signature, TraceEvent, WizardAssert, and WizardSignature.
Referenced by DecipherCipher().
| static StringInfo * DecipherOFBMode | ( | CipherInfo * | cipher_info, | |
| StringInfo * | ciphertext | |||
| ) |
References _CipherInfo::blocksize, CipherDomain, _CipherInfo::encipher_block, GetStringInfoDatum(), GetStringInfoLength(), GetWizardModule, _CipherInfo::handle, LogWizardEvent(), MaxCipherBlocksize, _CipherInfo::nonce, ResetWizardMemory(), _CipherInfo::signature, TraceEvent, WizardAssert, and WizardSignature.
Referenced by DecipherCipher().
| WizardExport StringInfo* DecryptCipher | ( | CipherInfo * | cipher_info, | |
| StringInfo * | plaintext | |||
| ) |
References DecipherCipher().
| WizardExport CipherInfo* DestroyCipherInfo | ( | CipherInfo * | cipher_info | ) |
References AESCipher, _CipherInfo::cipher, CipherDomain, DestroyAESInfo(), DestroyRandomInfo(), DestroySerpentInfo(), DestroyStringInfo(), DestroyTwofishInfo(), EnumerateError, GetWizardModule, _CipherInfo::handle, LogWizardEvent(), _CipherInfo::nonce, _CipherInfo::random_info, RelinquishWizardMemory(), SerpentCipher, _CipherInfo::signature, ThrowWizardFatalError, TraceEvent, TwofishCipher, WizardAssert, and WizardSignature.
Referenced by DestroyKeyInfo(), and DestroySecretInfo().
| static StringInfo* EncipherCBCMode | ( | CipherInfo * | cipher_info, | |
| StringInfo * | plaintext | |||
| ) | [static] |
References _CipherInfo::blocksize, CipherDomain, _CipherInfo::encipher_block, GetStringInfoDatum(), GetStringInfoLength(), GetWizardModule, _CipherInfo::handle, LogWizardEvent(), MaxCipherBlocksize, _CipherInfo::nonce, _CipherInfo::random_info, ResetWizardMemory(), SetRandomKey(), _CipherInfo::signature, TraceEvent, WizardAssert, and WizardSignature.
Referenced by EncipherCipher().
| static StringInfo* EncipherCFBMode | ( | CipherInfo * | cipher_info, | |
| StringInfo * | plaintext | |||
| ) | [static] |
References _CipherInfo::blocksize, CipherDomain, _CipherInfo::encipher_block, GetStringInfoDatum(), GetStringInfoLength(), GetWizardModule, _CipherInfo::handle, LogWizardEvent(), MaxCipherBlocksize, _CipherInfo::nonce, ResetWizardMemory(), _CipherInfo::signature, TraceEvent, WizardAssert, and WizardSignature.
Referenced by EncipherCipher().
| WizardExport StringInfo* EncipherCipher | ( | CipherInfo * | cipher_info, | |
| StringInfo * | plaintext | |||
| ) |
References CBCMode, CFBMode, CipherDomain, CTRMode, ECBMode, EncipherCBCMode(), EncipherCFBMode(), EncipherCTRMode(), EncipherECBMode(), EncipherOFBMode(), EnumerateError, GetWizardModule, LogWizardEvent(), _CipherInfo::mode, OFBMode, _CipherInfo::signature, ThrowWizardFatalError, TraceEvent, WizardAssert, and WizardSignature.
Referenced by EncryptCipher(), GenerateSecretKey(), and SetKeyInfo().
| static StringInfo * EncipherCTRMode | ( | CipherInfo * | cipher_info, | |
| StringInfo * | plaintext | |||
| ) |
References _CipherInfo::blocksize, CipherDomain, _CipherInfo::encipher_block, GetStringInfoDatum(), GetStringInfoLength(), GetWizardModule, _CipherInfo::handle, IncrementCipherNonce(), LogWizardEvent(), MaxCipherBlocksize, _CipherInfo::nonce, _CipherInfo::random_info, ResetWizardMemory(), SetRandomKey(), _CipherInfo::signature, TraceEvent, WizardAssert, and WizardSignature.
Referenced by EncipherCipher().
| static StringInfo * EncipherECBMode | ( | CipherInfo * | cipher_info, | |
| StringInfo * | plaintext | |||
| ) |
References _CipherInfo::blocksize, CipherDomain, _CipherInfo::encipher_block, GetStringInfoDatum(), GetStringInfoLength(), GetWizardModule, _CipherInfo::handle, LogWizardEvent(), MaxCipherBlocksize, _CipherInfo::random_info, SetRandomKey(), _CipherInfo::signature, TraceEvent, WizardAssert, and WizardSignature.
Referenced by EncipherCipher().
| static StringInfo * EncipherOFBMode | ( | CipherInfo * | cipher_info, | |
| StringInfo * | plaintext | |||
| ) |
References _CipherInfo::blocksize, CipherDomain, _CipherInfo::encipher_block, GetStringInfoDatum(), GetStringInfoLength(), GetWizardModule, _CipherInfo::handle, LogWizardEvent(), MaxCipherBlocksize, _CipherInfo::nonce, _CipherInfo::random_info, ResetWizardMemory(), SetRandomKey(), _CipherInfo::signature, TraceEvent, WizardAssert, and WizardSignature.
Referenced by EncipherCipher().
| WizardExport StringInfo* EncryptCipher | ( | CipherInfo * | cipher_info, | |
| StringInfo * | plaintext | |||
| ) |
References EncipherCipher().
| WizardExport StringInfo* GenerateCipherNonce | ( | CipherInfo * | cipher_info | ) |
References AcquireStringInfo(), _CipherInfo::blocksize, CBCMode, CFBMode, CipherDomain, CTRMode, ECBMode, EnumerateError, GetRandomKey(), GetStringInfoDatum(), GetWizardModule, LogWizardEvent(), _CipherInfo::mode, OFBMode, _CipherInfo::random_info, ResetStringInfo(), SetRandomKey(), _CipherInfo::signature, ThrowWizardFatalError, TraceEvent, WizardAssert, and WizardSignature.
Referenced by AcquireCipherInfo(), AcquireKeyInfo(), and AcquireSecretInfo().
| WizardExport size_t GetCipherBlocksize | ( | const CipherInfo * | cipher_info | ) |
| WizardExport const StringInfo* GetCipherNonce | ( | CipherInfo * | cipher_info | ) |
References CipherDomain, GetWizardModule, LogWizardEvent(), _CipherInfo::nonce, _CipherInfo::signature, TraceEvent, WizardAssert, and WizardSignature.
| static void IncrementCipherNonce | ( | const size_t | length, | |
| unsigned char * | nonce | |||
| ) | [inline, static] |
References CipherFatalError, and ThrowFatalException.
Referenced by DecipherCTRMode(), and EncipherCTRMode().
| WizardExport void ResetCipherNonce | ( | CipherInfo * | cipher_info | ) |
| WizardExport void SetCipherKey | ( | CipherInfo * | cipher_info, | |
| const StringInfo * | key | |||
| ) |
References AESCipher, _CipherInfo::cipher, CipherDomain, EnumerateError, GetWizardModule, _CipherInfo::handle, LogWizardEvent(), SerpentCipher, SetAESKey(), SetSerpentKey(), SetTwofishKey(), _CipherInfo::signature, ThrowWizardFatalError, TraceEvent, TwofishCipher, WizardAssert, and WizardSignature.
Referenced by AuthenticateSecretKey(), GenerateSecretKey(), GetKeyInfo(), and SetKeyInfo().
| WizardExport void SetCipherNonce | ( | CipherInfo * | cipher_info, | |
| const StringInfo * | nonce | |||
| ) |
References CipherDomain, GetWizardModule, LogWizardEvent(), _CipherInfo::nonce, SetStringInfo(), _CipherInfo::signature, TraceEvent, WizardAssert, and WizardSignature.
Referenced by AuthenticateSecretKey(), GenerateSecretKey(), GetKeyInfo(), and SetKeyInfo().
1.7.1