asm.m4 946 Bytes
Newer Older
1
2
3
changequote(<,>)dnl
changecom(!,<
>)dnl
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

dnl (progn (modify-syntax-entry ?< "(>") (modify-syntax-entry ?> ")<") )
dnl Struct defining macros

dnl STRUCTURE(prefix) 
define(<STRUCTURE>, <define(<SOFFSET>, 0)define(<SPREFIX>, <$1>)>)

dnl STRUCT(name, size)
define(STRUCT,
<define(SPREFIX<_>$1, SOFFSET)dnl
 define(<SOFFSET>, eval(SOFFSET + ($2)))>)

dnl UNSIGNED(name)
define(<UNSIGNED>, <STRUCT(<$1>, 4)>)

19
dnl Offsets in aes_ctx and aes_table
20
21
22
STRUCTURE(AES)
  STRUCT(KEYS, 4*60)
  UNSIGNED(NROUNDS)
23

24
25
26
27
define(AES_SBOX_SIZE,	256)dnl
define(AES_IDX_SIZE,	16)dnl
define(AES_TABLE_SIZE,	1024)dnl

28
29
30
31
32
33
STRUCT(AES)
  STRUCT(SBOX, AES_SBOX_SIZE)

  STRUCT(IDX1, AES_IDX_SIZE)
  STRUCT(IDX2, AES_IDX_SIZE)
  STRUCT(IDX3, AES_IDX_SIZE)
34

35
36
37
  STRUCT(SIDX1, AES_IDX_SIZE)
  STRUCT(SIDX2, AES_IDX_SIZE)
  STRUCT(SIDX3, AES_IDX_SIZE)
38

39
40
41
42
  STRUCT(TABLE0, AES_TABLE_SIZE)
  STRUCT(TABLE1, AES_TABLE_SIZE)
  STRUCT(TABLE2, AES_TABLE_SIZE)
  STRUCT(TABLE3, AES_TABLE_SIZE)