MagickCore 7.0.10
|
#include "wizard/studio.h"
#include "wizard/exception.h"
#include "wizard/exception-private.h"
#include "wizard/memory_.h"
#include "wizard/serpent.h"
Go to the source code of this file.
Data Structures | |
struct | _SerpentInfo |
Macros | |
#define | Read32Bits(value, p) |
#define | SerpentBlocksize 32 |
#define | Write32Bits(p, value) |
#define | DecipherSbox0(alpha, beta, gamma, delta, epsilon) |
#define | DecipherSbox1(alpha, beta, gamma, delta, epsilon) |
#define | DecipherSbox2(alpha, beta, gamma, delta, epsilon) |
#define | DecipherSbox3(alpha, beta, gamma, delta, epsilon) |
#define | DecipherSbox4(alpha, beta, gamma, delta, epsilon) |
#define | DecipherSbox5(alpha, beta, gamma, delta, epsilon) |
#define | DecipherSbox6(alpha, beta, gamma, delta, epsilon) |
#define | DecipherSbox7(alpha, beta, gamma, delta, epsilon) |
#define | DecipherK(alpha, beta, gamma, delta, epsilon, i) |
#define | MixKey(alpha, beta, gamma, delta, i) |
#define | EncipherK(alpha, beta, gamma, delta, epsilon, i) |
#define | EncipherSbox0(alpha, beta, gamma, delta, epsilon) |
#define | EncipherSbox1(alpha, beta, gamma, delta, epsilon) |
#define | EncipherSbox2(alpha, beta, gamma, delta, epsilon) |
#define | EncipherSbox3(alpha, beta, gamma, delta, epsilon) |
#define | EncipherSbox4(alpha, beta, gamma, delta, epsilon) |
#define | EncipherSbox5(alpha, beta, gamma, delta, epsilon) |
#define | EncipherSbox6(alpha, beta, gamma, delta, epsilon) |
#define | EncipherSbox7(alpha, beta, gamma, delta, epsilon) |
#define | ChurnKey(alpha, beta, gamma, delta, i, j) |
#define | LoadKey(alpha, beta, gamma, delta, i) |
#define | MaximumSerpentKeyLength 32 |
#define | StoreKey(alpha, beta, gamma, delta, i) |
Functions | |
WizardExport SerpentInfo * | AcquireSerpentInfo (void) |
static unsigned int | Trunc32 (unsigned int x) |
static unsigned int | RotateRight (unsigned int x, unsigned int n) |
WizardExport void | DecipherSerpentBlock (SerpentInfo *serpent_info, const unsigned char *ciphertext, unsigned char *plaintext) |
WizardExport SerpentInfo * | DestroySerpentInfo (SerpentInfo *serpent_info) |
static unsigned int | RotateLeft (unsigned int x, unsigned int n) |
WizardExport void | EncipherSerpentBlock (SerpentInfo *serpent_info, const unsigned char *plaintext, unsigned char *ciphertext) |
WizardExport unsigned int | GetSerpentBlocksize (const SerpentInfo *serpent_info) |
WizardExport void | SetSerpentKey (SerpentInfo *serpent_info, const StringInfo *key) |
#define ChurnKey | ( | alpha, | |
beta, | |||
gamma, | |||
delta, | |||
i, | |||
j | |||
) |
#define DecipherK | ( | alpha, | |
beta, | |||
gamma, | |||
delta, | |||
epsilon, | |||
i | |||
) |
#define DecipherSbox0 | ( | alpha, | |
beta, | |||
gamma, | |||
delta, | |||
epsilon | |||
) |
#define DecipherSbox1 | ( | alpha, | |
beta, | |||
gamma, | |||
delta, | |||
epsilon | |||
) |
#define DecipherSbox2 | ( | alpha, | |
beta, | |||
gamma, | |||
delta, | |||
epsilon | |||
) |
#define DecipherSbox3 | ( | alpha, | |
beta, | |||
gamma, | |||
delta, | |||
epsilon | |||
) |
#define DecipherSbox4 | ( | alpha, | |
beta, | |||
gamma, | |||
delta, | |||
epsilon | |||
) |
#define DecipherSbox5 | ( | alpha, | |
beta, | |||
gamma, | |||
delta, | |||
epsilon | |||
) |
#define DecipherSbox6 | ( | alpha, | |
beta, | |||
gamma, | |||
delta, | |||
epsilon | |||
) |
#define DecipherSbox7 | ( | alpha, | |
beta, | |||
gamma, | |||
delta, | |||
epsilon | |||
) |
#define EncipherK | ( | alpha, | |
beta, | |||
gamma, | |||
delta, | |||
epsilon, | |||
i | |||
) |
#define EncipherSbox0 | ( | alpha, | |
beta, | |||
gamma, | |||
delta, | |||
epsilon | |||
) |
#define EncipherSbox1 | ( | alpha, | |
beta, | |||
gamma, | |||
delta, | |||
epsilon | |||
) |
#define EncipherSbox2 | ( | alpha, | |
beta, | |||
gamma, | |||
delta, | |||
epsilon | |||
) |
#define EncipherSbox3 | ( | alpha, | |
beta, | |||
gamma, | |||
delta, | |||
epsilon | |||
) |
#define EncipherSbox4 | ( | alpha, | |
beta, | |||
gamma, | |||
delta, | |||
epsilon | |||
) |
#define EncipherSbox5 | ( | alpha, | |
beta, | |||
gamma, | |||
delta, | |||
epsilon | |||
) |
#define EncipherSbox6 | ( | alpha, | |
beta, | |||
gamma, | |||
delta, | |||
epsilon | |||
) |
#define EncipherSbox7 | ( | alpha, | |
beta, | |||
gamma, | |||
delta, | |||
epsilon | |||
) |
#define LoadKey | ( | alpha, | |
beta, | |||
gamma, | |||
delta, | |||
i | |||
) |
#define MaximumSerpentKeyLength 32 |
#define MixKey | ( | alpha, | |
beta, | |||
gamma, | |||
delta, | |||
i | |||
) |
#define Read32Bits | ( | value, | |
p | |||
) |
#define StoreKey | ( | alpha, | |
beta, | |||
gamma, | |||
delta, | |||
i | |||
) |
#define Write32Bits | ( | p, | |
value | |||
) |
WizardExport SerpentInfo * AcquireSerpentInfo | ( | void | ) |
Definition at line 100 of file serpent.c.
References AcquireWizardMemory(), _SerpentInfo::blocksize, CipherError, MemoryError, SerpentBlocksize, _SerpentInfo::signature, ThrowWizardFatalError, _SerpentInfo::timestamp, and WizardSignature.
Referenced by AcquireCipherInfo().
WizardExport void DecipherSerpentBlock | ( | SerpentInfo * | serpent_info, |
const unsigned char * | ciphertext, | ||
unsigned char * | plaintext | ||
) |
Definition at line 154 of file serpent.c.
References _SerpentInfo::crypt_key, DecipherK, DecipherSbox0, DecipherSbox1, DecipherSbox2, DecipherSbox3, DecipherSbox4, DecipherSbox5, DecipherSbox6, DecipherSbox7, MixKey, Read32Bits, and Write32Bits.
Referenced by AcquireCipherInfo().
WizardExport SerpentInfo * DestroySerpentInfo | ( | SerpentInfo * | serpent_info | ) |
Definition at line 359 of file serpent.c.
References CipherDomain, GetWizardModule, LogWizardEvent(), RelinquishWizardMemory(), _SerpentInfo::signature, TraceEvent, WizardAssert, and WizardSignature.
Referenced by DestroyCipherInfo().
WizardExport void EncipherSerpentBlock | ( | SerpentInfo * | serpent_info, |
const unsigned char * | plaintext, | ||
unsigned char * | ciphertext | ||
) |
Definition at line 403 of file serpent.c.
References _SerpentInfo::crypt_key, EncipherK, EncipherSbox0, EncipherSbox1, EncipherSbox2, EncipherSbox3, EncipherSbox4, EncipherSbox5, EncipherSbox6, EncipherSbox7, MixKey, Read32Bits, and Write32Bits.
Referenced by AcquireCipherInfo().
WizardExport unsigned int GetSerpentBlocksize | ( | const SerpentInfo * | serpent_info | ) |
Definition at line 603 of file serpent.c.
References _SerpentInfo::blocksize, CipherDomain, GetWizardModule, LogWizardEvent(), _SerpentInfo::signature, TraceEvent, WizardAssert, and WizardSignature.
Referenced by AcquireCipherInfo().
|
inlinestatic |
|
inlinestatic |
WizardExport void SetSerpentKey | ( | SerpentInfo * | serpent_info, |
const StringInfo * | key | ||
) |
Definition at line 637 of file serpent.c.
References ChurnKey, CipherDomain, _SerpentInfo::crypt_key, EncipherSbox0, EncipherSbox1, EncipherSbox2, EncipherSbox3, EncipherSbox4, EncipherSbox5, EncipherSbox6, EncipherSbox7, GetStringInfoDatum(), GetStringInfoLength(), GetWizardModule, LoadKey, LogWizardEvent(), MaximumSerpentKeyLength, Min, Read32Bits, _SerpentInfo::signature, StoreKey, TraceEvent, WizardAssert, and WizardSignature.
Referenced by SetCipherKey().