#include <unistd.h>#include <stdlib.h>#include <string.h>#include <glib.h>#include <openssl/cmac.h>#include <openssl/rand.h>#include <openssl/evp.h>#include <openssl/sha.h>#include "messages.h"#include "slog.h"
Macros | |
| #define | LONG_OPT_INDICATOR "--" |
| #define | SHORT_OPT_INDICATOR "-" |
Functions | |
| void | cond_msg_error (GError *myError, char *errorMsg) |
| void | deriveSubKeys (unsigned char *mainKey, unsigned char *encKey, unsigned char *MACKey) |
| void | deriveEncSubKey (unsigned char *mainKey, unsigned char *encKey) |
| void | deriveMACSubKey (unsigned char *mainKey, unsigned char *MACKey) |
| int | sLogEncrypt (unsigned char *plaintext, int plaintext_len, unsigned char *key, unsigned char *iv, unsigned char *ciphertext, unsigned char *tag) |
| int | sLogDecrypt (unsigned char *ciphertext, int ciphertext_len, unsigned char *tag, unsigned char *key, unsigned char *iv, unsigned char *plaintext) |
| void | sLogEntry (guint64 numberOfLogEntries, GString *text, unsigned char *mainKey, unsigned char *inputBigMac, GString *output, unsigned char *outputBigMac, gsize outputBigMac_capacity) |
| void | deriveKey (unsigned char *dst, guint64 index, guint64 currentKey) |
| guchar * | convertToBin (char *input, gsize *outLen) |
| gchar * | convertToBase64 (unsigned char *input, gsize len) |
| void | cmac (unsigned char *key, const void *input, gsize length, unsigned char *out, gsize *outlen, gsize out_capacity) |
| void | evolveKey (unsigned char *key) |
| void | PRF (unsigned char *key, unsigned char *originalInput, guint64 inputLength, unsigned char *output, guint64 outputLength) |
| int | generateMasterKey (guchar *masterkey) |
| int | deriveHostKey (guchar *masterkey, gchar *macAddr, gchar *serial, guchar *hostkey) |
| int | writeBigMAC (gchar *filename, char *outputBuffer) |
| int | readBigMAC (gchar *filename, char *outputBuffer) |
| int | readKey (char *destKey, guint64 *destCounter, gchar *keypath) |
| int | writeKey (char *key, guint64 counter, gchar *keypath) |
| int | iterateBuffer (guint64 entriesInBuffer, GString **input, guint64 *nextLogEntry, unsigned char *mainKey, unsigned char *keyZero, guint keyNumber, GString **output, guint64 *numberOfLogEntries, unsigned char *cmac_tag, gsize cmac_tag_capacity, GHashTable *tab) |
| int | finalizeVerify (guint64 startingEntry, guint64 entriesInFile, unsigned char *bigMac, unsigned char *cmac_tag, GHashTable *tab) |
| int | initVerify (guint64 entriesInFile, unsigned char *mainKey, guint64 *nextLogEntry, guint64 *startingEntry, GString **input, GHashTable **tab) |
| int | iterativeFileVerify (unsigned char *previousMAC, unsigned char *mainKey, char *inputFileName, unsigned char *bigMAC, char *outputFileName, guint64 entriesInFile, int chunkLength, guint64 keyNumber) |
| int | fileVerify (unsigned char *mainKey, char *inputFileName, char *outputFileName, unsigned char *bigMac, guint64 entriesInFile, int chunkLength) |
| int | slog_usage (GOptionContext *ctx, GOptionGroup *grp, GString *errormsg) |
| gboolean | validFileNameArg (const gchar *option_name, const gchar *value, gpointer data, GError **error) |
| #define LONG_OPT_INDICATOR "--" |
| #define SHORT_OPT_INDICATOR "-" |
| void cmac | ( | unsigned char * | key, |
| const void * | input, | ||
| gsize | length, | ||
| unsigned char * | out, | ||
| gsize * | outlen, | ||
| gsize | out_capacity | ||
| ) |
| void cond_msg_error | ( | GError * | myError, |
| char * | errorMsg | ||
| ) |
| gchar* convertToBase64 | ( | unsigned char * | input, |
| gsize | len | ||
| ) |
| guchar* convertToBin | ( | char * | input, |
| gsize * | outLen | ||
| ) |
| void deriveEncSubKey | ( | unsigned char * | mainKey, |
| unsigned char * | encKey | ||
| ) |
| int deriveHostKey | ( | guchar * | masterkey, |
| gchar * | macAddr, | ||
| gchar * | serial, | ||
| guchar * | hostkey | ||
| ) |
| void deriveKey | ( | unsigned char * | dst, |
| guint64 | index, | ||
| guint64 | currentKey | ||
| ) |
| void deriveMACSubKey | ( | unsigned char * | mainKey, |
| unsigned char * | MACKey | ||
| ) |
| void deriveSubKeys | ( | unsigned char * | mainKey, |
| unsigned char * | encKey, | ||
| unsigned char * | MACKey | ||
| ) |
| void evolveKey | ( | unsigned char * | key | ) |
| int fileVerify | ( | unsigned char * | mainKey, |
| char * | inputFileName, | ||
| char * | outputFileName, | ||
| unsigned char * | bigMac, | ||
| guint64 | entriesInFile, | ||
| int | chunkLength | ||
| ) |
| int finalizeVerify | ( | guint64 | startingEntry, |
| guint64 | entriesInFile, | ||
| unsigned char * | bigMac, | ||
| unsigned char * | cmac_tag, | ||
| GHashTable * | tab | ||
| ) |
| int generateMasterKey | ( | guchar * | masterkey | ) |
| int initVerify | ( | guint64 | entriesInFile, |
| unsigned char * | mainKey, | ||
| guint64 * | nextLogEntry, | ||
| guint64 * | startingEntry, | ||
| GString ** | input, | ||
| GHashTable ** | tab | ||
| ) |
| int iterateBuffer | ( | guint64 | entriesInBuffer, |
| GString ** | input, | ||
| guint64 * | nextLogEntry, | ||
| unsigned char * | mainKey, | ||
| unsigned char * | keyZero, | ||
| guint | keyNumber, | ||
| GString ** | output, | ||
| guint64 * | numberOfLogEntries, | ||
| unsigned char * | cmac_tag, | ||
| gsize | cmac_tag_capacity, | ||
| GHashTable * | tab | ||
| ) |
| int iterativeFileVerify | ( | unsigned char * | previousMAC, |
| unsigned char * | mainKey, | ||
| char * | inputFileName, | ||
| unsigned char * | bigMAC, | ||
| char * | outputFileName, | ||
| guint64 | entriesInFile, | ||
| int | chunkLength, | ||
| guint64 | keyNumber | ||
| ) |
| void PRF | ( | unsigned char * | key, |
| unsigned char * | originalInput, | ||
| guint64 | inputLength, | ||
| unsigned char * | output, | ||
| guint64 | outputLength | ||
| ) |
| int readBigMAC | ( | gchar * | filename, |
| char * | outputBuffer | ||
| ) |
| int readKey | ( | char * | destKey, |
| guint64 * | destCounter, | ||
| gchar * | keypath | ||
| ) |
| int slog_usage | ( | GOptionContext * | ctx, |
| GOptionGroup * | grp, | ||
| GString * | errormsg | ||
| ) |
| int sLogDecrypt | ( | unsigned char * | ciphertext, |
| int | ciphertext_len, | ||
| unsigned char * | tag, | ||
| unsigned char * | key, | ||
| unsigned char * | iv, | ||
| unsigned char * | plaintext | ||
| ) |
| int sLogEncrypt | ( | unsigned char * | plaintext, |
| int | plaintext_len, | ||
| unsigned char * | key, | ||
| unsigned char * | iv, | ||
| unsigned char * | ciphertext, | ||
| unsigned char * | tag | ||
| ) |
| void sLogEntry | ( | guint64 | numberOfLogEntries, |
| GString * | text, | ||
| unsigned char * | mainKey, | ||
| unsigned char * | inputBigMac, | ||
| GString * | output, | ||
| unsigned char * | outputBigMac, | ||
| gsize | outputBigMac_capacity | ||
| ) |
| gboolean validFileNameArg | ( | const gchar * | option_name, |
| const gchar * | value, | ||
| gpointer | data, | ||
| GError ** | error | ||
| ) |
| int writeBigMAC | ( | gchar * | filename, |
| char * | outputBuffer | ||
| ) |
| int writeKey | ( | char * | key, |
| guint64 | counter, | ||
| gchar * | keypath | ||
| ) |