-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpzmac.h
65 lines (52 loc) · 1.75 KB
/
pzmac.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#ifndef PZMAC
#define PZMAC
#include <stdint.h>
#include "../../forkskinny-opt32/skinny.h"
typedef union {
skinny_128_256_tweakey_schedule_t *tks128;
skinny_64_192_tweakey_schedule_t *tks64;
} TweakeySched;
typedef struct {
uint8_t v[16];
uint8_t u[16];
} MacChains;
typedef struct{
uint8_t in[16];
uint8_t out[16];
skinny_128_256_tweakey_schedule_t *tks1;
skinny_128_256_tweakey_schedule_t *tks2;
} Pmac1Struct;
typedef struct {
uint8_t message[16];
uint8_t tweak[16];
uint8_t out[32];
TweakeySched tks1;
TweakeySched tks2;
} Pmac2xStruct;
typedef struct {
uint8_t message[16];
uint8_t tweak[16];
uint8_t P[32];
uint8_t mask_l[16];
uint8_t mask_r[16];
uint8_t out[32];
TweakeySched tks1;
TweakeySched tks2;
} ZmacStruct;
#define PZMAC_192_N_SIZE 8
#define PZMAC_192_K_SIZE 16
#define PZMAC_192_T_SIZE 7
#define PZMAC_192_P_SIZE (PZMAC_192_N_SIZE + PZMAC_192_T_SIZE)
#define PZMAC_256_N_SIZE 16
#define PZMAC_256_K_SIZE 16
#define PZMAC_256_T_SIZE 15
#define PZMAC_256_P_SIZE (PZMAC_256_N_SIZE + PZMAC_256_T_SIZE)
// PMAC1
void PMAC1_256_skinny(const uint8_t key[16], uint8_t out[16], const uint8_t *message, const uint32_t mlen);
// PMAC2x
void PMAC2x_192_skinny(const uint8_t key[16], uint8_t out_left[ 8], uint8_t out_right[ 8], const uint8_t *message, const uint32_t mlen);
void PMAC2x_256_skinny(const uint8_t key[16], uint8_t out_left[16], uint8_t out_right[16], const uint8_t *message, const uint32_t mlen);
// ZMAC
void ZMAC_192_skinny(const uint8_t key[16], uint8_t out_left[ 8], uint8_t out_right[ 8], const uint8_t *message, const uint32_t mlen);
void ZMAC_256_skinny(const uint8_t key[16], uint8_t out_left[16], uint8_t out_right[16], const uint8_t *message, const uint32_t mlen);
#endif