Data Structures | Defines | Functions

# key.c File Reference

`#include "wizard/studio.h"`
`#include "wizard/cipher.h"`
`#include "wizard/exception.h"`
`#include "wizard/exception-private.h"`
`#include "wizard/hmac.h"`
`#include "wizard/key.h"`
`#include "wizard/memory_.h"`
`#include "wizard/random_.h"`
`#include "wizard/splay-tree.h"`

## Data Structures
struct | _KeyInfo
## Defines
#define | KeymapCipher AESCipher
#define | KeymapMode CTRMode
#define | SessionKeyHash SHA256Hash
#define | SessionKeyLength 512
## Functions
static void * | DestroyNode (void *entry)
WizardExport KeyInfo * | AcquireKeyInfo (void)
WizardExport KeyInfo * | DestroyKeyInfo (KeyInfo *key_info)
WizardExport StringInfo * | GenerateSessionKey (KeyInfo *key_info)
WizardExport StringInfo * | GetKeyInfo (KeyInfo *key_info, const StringInfo *id)
WizardExport WizardBooleanType | SetKeyInfo (KeyInfo *key_info, const StringInfo *id, const StringInfo *key)

## Define Documentation

#define KeymapCipher AESCipher

Referenced by AcquireKeyInfo().

#define KeymapMode CTRMode

Referenced by AcquireKeyInfo().

#define SessionKeyHash SHA256Hash

Referenced by AcquireKeyInfo(), and GenerateSessionKey().

#define SessionKeyLength 512

Referenced by GenerateSessionKey().

## Function Documentation

WizardExport KeyInfo* AcquireKeyInfo | ( | void |  | ) |

References AcquireCipherInfo(), AcquireRandomInfo(), AcquireWizardMemory(), _KeyInfo::cipher_info, CompareSplayTreeStringInfo(), DestroyNode(), GenerateCipherNonce(), GenerateSessionKey(), _KeyInfo::id, _KeyInfo::key_map, KeymapCipher, KeymapDomain, KeymapMode, MemoryError, NewSplayTree(), _KeyInfo::nonce, _KeyInfo::random_info, ResetWizardMemory(), SessionKeyHash, _KeyInfo::signature, ThrowWizardFatalError, and _KeyInfo::timestamp.

WizardExport KeyInfo* DestroyKeyInfo | ( | KeyInfo * | key_info | ) |

References _KeyInfo::cipher_info, CipherDomain, DestroyCipherInfo(), DestroyRandomInfo(), DestroySplayTree(), DestroyStringInfo(), GetWizardModule, _KeyInfo::id, _KeyInfo::key_map, LogWizardEvent(), _KeyInfo::nonce, _KeyInfo::random_info, RelinquishWizardMemory(), _KeyInfo::signature, TraceEvent, WizardAssert, and WizardSignature.

static void* DestroyNode | ( | void * | entry | ) | `[static]`

References DestroyStringInfo().

Referenced by AcquireKeyInfo().

WizardExport StringInfo* GenerateSessionKey | ( | KeyInfo * | key_info | ) |

References AcquireHMACInfo(), AddValueToSplayTree(), CipherDomain, CloneStringInfo(), ConstructHMAC(), DestroyHMACInfo(), DestroyStringInfo(), GetHMACDigest(), GetRandomKey(), GetWizardModule, _KeyInfo::id, _KeyInfo::key_map, KeyError, KeymapDomain, LogWizardEvent(), _KeyInfo::random_info, SessionKeyHash, SessionKeyLength, SetKeyInfo(), _KeyInfo::signature, ThrowWizardFatalError, _KeyInfo::timestamp, TraceEvent, WizardAssert, WizardFalse, and WizardSignature.

Referenced by AcquireKeyInfo().

WizardExport StringInfo* GetKeyInfo | ( | KeyInfo * | key_info,
|  | const StringInfo * | id |
| ) |  |  |

References _KeyInfo::cipher_info, CipherDomain, CloneStringInfo(), DecipherCipher(), GetValueFromSplayTree(), GetWizardModule, _KeyInfo::id, _KeyInfo::key_map, KeyError, KeymapDomain, LogWizardEvent(), _KeyInfo::nonce, SetCipherKey(), SetCipherNonce(), ThrowWizardFatalError, TraceEvent, and WizardAssert.

WizardExport WizardBooleanType SetKeyInfo | ( | KeyInfo * | key_info,
|  | const StringInfo * | id,
|  | const StringInfo * | key |
| ) |  |  |

References AddValueToSplayTree(), _KeyInfo::cipher_info, CipherDomain, CloneStringInfo(), EncipherCipher(), GetValueFromSplayTree(), GetWizardModule, _KeyInfo::id, _KeyInfo::key_map, KeyError, KeymapDomain, LogWizardEvent(), _KeyInfo::nonce, SetCipherKey(), SetCipherNonce(), ThrowWizardFatalError, TraceEvent, and WizardAssert.

Referenced by GenerateSessionKey().