1 /*
2  * Common code for the Android Backup 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 "common.h"
9 #include "formats.h"
10 #include "jumbo.h"
11 
12 #define FORMAT_NAME             ""
13 #define FORMAT_TAG              "$ab$"
14 #define TAG_LENGTH              (sizeof(FORMAT_TAG) - 1)
15 
16 #define SALTLEN                 64
17 #define IVLEN                   16
18 #define TAGLEN                  16
19 #define MAX_MASTERKEYBLOB_LEN   128
20 
21 struct custom_salt {
22 	uint32_t iv_length;
23 	uint32_t iterations;
24 	unsigned char iv[IVLEN];
25 	unsigned char user_salt[SALTLEN];
26 	uint32_t user_salt_length;
27 	unsigned char ck_salt[SALTLEN];
28 	uint32_t ck_salt_length;
29 	unsigned char masterkey_blob[MAX_MASTERKEYBLOB_LEN];
30 	uint32_t masterkey_blob_length;
31 };
32 
33 extern struct fmt_tests ab_tests[];
34 
35 int ab_valid(char *ciphertext, struct fmt_main *self);
36 
37 void *ab_get_salt(char *ciphertext);
38 
39 unsigned int ab_iteration_count(void *salt);
40