AES Engine: Difference between revisions

mostly courtesy of neimod. someone needs to wikify those tables a bit :P
 
Winmaster (talk | contribs)
m Undo revision 3998 by Lu (talk) SPAM/Vandalism
 
(4 intermediate revisions by 4 users not shown)
Line 1: Line 1:
== Registers ==
== Registers ==
{| class="wikitable" border="1"
{| class="wikitable" border="1"
|-
!  NAME
!  NAME
!  ADDRESS
!  ADDRESS
Line 46: Line 45:
|  48
|  48
|}
|}
(:tableend:)


== REG_AESCNT ==
== REG_AESCNT ==
(:table border=1 cellspacing=0 cellpadding=3  bgcolor=#F0F0F0  :)
{| class="wikitable" border="1"
(:cellnr bgcolor=#E0E0E0 :)'''BIT'''
! BIT
(:cell bgcolor=#E0E0E0 :)'''DESCRIPTION'''
! DESCRIPTION
(:cellnr:)4-0
|-
(:cell:)Write fifo count
4-0
(:cellnr:)9-5
Write fifo count
(:cell:)Read fifo count
|-
(:cellnr:)10
9-5
(:cell:)Flush write fifo
Read fifo count
(:cellnr:)11
|-
(:cell:)Flush read fifo
10
(:cellnr:)15-12
Flush write fifo
(:cell:)?
|-
(:cellnr:)18-16
11
(:cell:)MAC size (size in bytes = s*2+2, e.g, 7 == 16 bytes)
Flush read fifo
(:cellnr:)19
|-
(:cell:)?
15-12
(:cellnr:)20
?
(:cell:)MAC input control (0 = read MAC from FIFO, 1 = read MAC from REG_AESMAC)
|-
(:cellnr:)21
18-16
(:cell:)MAC status (0 = invalid, 1 = verified)
MAC size (size in bytes = s*2+2, e.g, 7 == 16 bytes)
(:cellnr:)23-22
|-
(:cell:)?
19
(:cellnr:)24
?
(:cell:)Key select
|-
(:cellnr:)25
20
(:cell:)Key schedule busy
MAC input control (0 = read MAC from FIFO, 1 = read MAC from REG_AESMAC)
(:cellnr:)27-26
|-
(:cell:)Key slot (0..3)
21
(:cellnr:)29-28
MAC status (0 = invalid, 1 = verified)
(:cell:)Mode (0=AES CCM decrypt, 1=AES CCM encrypt, 2=AES CTR)
|-
(:cellnr:)30
23-22
(:cell:)Interrupt enable
?
(:cellnr:)31
|-
(:cell:)Enable
24
(:tableend:)
Key select
|-
25
Key schedule busy
|-
27-26
Key slot (0..3)
|-
29-28
Mode (0=AES CCM decrypt, 1=AES CCM encrypt, 2=AES CTR)
|-
30
Interrupt enable
|-
31
Enable
|}




== REG_AESBLKCNT ==
== REG_AESBLKCNT ==
(:table border=1 cellspacing=0 cellpadding=3  bgcolor=#F0F0F0  :)
{| class="wikitable" border="1"
(:cellnr bgcolor=#E0E0E0 :)'''BIT'''
! BIT
(:cell bgcolor=#E0E0E0 :)'''DESCRIPTION'''
! DESCRIPTION
(:cellnr:)15-0
|-
(:cell:)CBC-MAC associated data blocks to process (1 block = 4 words)
15-0
(:cellnr:)31-16
CBC-MAC associated data blocks to process (1 block = 4 words)
(:cell:)CTR or payload data blocks to process (1 block = 4 words)
|-
(:tableend:)
31-16
CTR or payload data blocks to process (1 block = 4 words)
|}


== REG_AESKEY0/1/2/3 ==
== REG_AESKEY0/1/2/3 ==
(:table border=1 cellspacing=0 cellpadding=3  bgcolor=#F0F0F0  :)
{| class="wikitable" border="1"
(:cellnr bgcolor=#E0E0E0 :)'''BYTE'''
! BYTE
(:cell bgcolor=#E0E0E0 :)'''DESCRIPTION'''
! DESCRIPTION
(:cellnr:)0-15
|-
(:cell:)Key data
0-15
(:cellnr:)16-31
Key data
(:cell:)Special key data X
|-
(:cellnr:)32-47
16-31
(:cell:)Special key data Y
Special key data X
(:tableend:)
|-
 
32-47
Special key data Y
|}


Key gets updated when either the last word of the key data or the last word of "special key data y" is written. When writing to special key data the actual key is F((key data x) xor (key data y)) where F is some unkown function implemented in hardware.


Key gets updated when either the last word of the key data or the last word of "special key data y" is written. When writing to special key data the actual key is F((key data x) xor (key data y)) where F is some unknown function implemented in hardware.


== AES CCM mode (Counter with CBC-MAC) ==
== AES CCM mode (Counter with CBC-MAC) ==