nwztools: cleanup the code

There was a lot of copy and paste, and the code was just crap. This commit tries
to clarify the code and also document the encryption procedure. Hopefully I didn't
break anything.

Change-Id: I257793010e7cf94f2b090b30bb8608359d3886e3
This commit is contained in:
Amaury Pouly 2016-08-30 17:19:30 +10:00
parent de8950d63d
commit cf82f208e3
6 changed files with 291 additions and 298 deletions

View file

@ -23,6 +23,7 @@
#include <stdbool.h>
#include <stdint.h>
#include "fwp.h"
enum keysig_search_method_t
{
@ -34,7 +35,8 @@ enum keysig_search_method_t
};
/* notify returns true if the key seems ok */
typedef bool (*keysig_notify_fn_t)(void *user, uint8_t key[8], uint8_t sig[8]);
typedef bool (*keysig_notify_fn_t)(void *user, uint8_t key[NWZ_KEY_SIZE],
uint8_t sig[NWZ_SIG_SIZE]);
/* returns true if a key was accepted by notify */
typedef bool (*keysig_search_fn_t)(uint8_t *cipher, keysig_notify_fn_t notify, void *user);