1 /*
2  * Common code for the OpenBSD-SoftRAID format.
3  *
4  * This file takes replicated but common code, shared between the CPU
5  * and the GPU formats, and places it into one common location.
6  */
7 
8 #include "formats.h"
9 
10 #define FORMAT_NAME                 ""
11 #define FORMAT_TAG                  "$openbsd-softraid$"
12 #define FORMAT_TAG_LEN              (sizeof(FORMAT_TAG)-1)
13 #define OPENBSD_SOFTRAID_SALTLENGTH 128
14 #define OPENBSD_SOFTRAID_KEYS       32
15 #define OPENBSD_SOFTRAID_KEYLENGTH  64  /* AES-XTS-256 keys are 512 bits long */
16 #define OPENBSD_SOFTRAID_MACLENGTH  20
17 #define BINARY_SIZE                 OPENBSD_SOFTRAID_MACLENGTH
18 #define BINARY_ALIGN                sizeof(uint32_t)
19 
20 struct custom_salt {
21 	unsigned int num_iterations;
22 	unsigned char salt[OPENBSD_SOFTRAID_SALTLENGTH];
23 	unsigned char masked_keys[OPENBSD_SOFTRAID_KEYLENGTH * OPENBSD_SOFTRAID_KEYS];
24 	int kdf_type;
25 };
26 
27 int openbsdsoftraid_valid(char* ciphertext, struct fmt_main *self, int is_cpu);
28 void *openbsdsoftraid_get_salt(char *ciphertext);
29 void *openbsdsoftraid_get_binary(char *ciphertext);
30 unsigned int openbsdsoftraid_get_kdf_type(void *salt);
31 unsigned int openbsdsoftraid_get_iteration_count(void *salt);
32