Subversion Repositories Kolibri OS

Rev

Rev 6419 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 6419 Rev 6469
Line 15... Line 15...
15
;
15
;
16
;    You should have received a copy of the GNU General Public License
16
;    You should have received a copy of the GNU General Public License
17
;    along with this program.  If not, see .
17
;    along with this program.  If not, see .
Line 18... Line 18...
18
 
18
 
-
 
19
AES256_ROUNDS           = 14
Line 19... Line 20...
19
AES256_ROUNDS = 14
20
AES256_BLOCKSIZE        = 16
20
 
21
 
21
struct aes256_context
22
struct aes256_context
Line 22... Line -...
22
        key     rd 4*(AES256_ROUNDS+1)
-
 
23
ends
-
 
24
 
-
 
25
proc dump_128bit_hex _ptr
-
 
26
        pushad
-
 
27
 
-
 
28
        mov     esi, [_ptr]
-
 
29
        mov     ecx, 4
-
 
30
  .next_dword:
-
 
31
        lodsd
-
 
32
        bswap   eax
-
 
33
        DEBUGF  1,'%x',eax
-
 
34
        loop    .next_dword
-
 
35
 
-
 
Line 36... Line 23...
36
        popad
23
        key     rd 4*(AES256_ROUNDS+1)
37
        ret
24
ends
38
endp
25
 
39
 
26
 
Line 46... Line 33...
46
        mov     [i], 0
33
        mov     [i], 0
47
        mov     ebx, [_ctx]
34
        mov     ebx, [_ctx]
Line 48... Line 35...
48
 
35
 
49
        mov     esi, [_userkey]
36
        mov     esi, [_userkey]
-
 
37
        lea     edi, [ebx + aes256_context.key]
50
        lea     edi, [ebx + aes256_context.key]
38
repeat 8
51
        lodsd
39
        lodsd
52
        bswap   eax
40
        bswap   eax
53
        stosd
-
 
54
        lodsd
-
 
55
        bswap   eax
-
 
56
        stosd
-
 
57
        lodsd
-
 
58
        bswap   eax
41
        stosd
59
        stosd
-
 
60
        lodsd
-
 
61
        bswap   eax
-
 
62
        stosd
-
 
63
        lodsd
-
 
64
        bswap   eax
-
 
65
        stosd
-
 
66
        lodsd
-
 
67
        bswap   eax
-
 
68
        stosd
-
 
69
        lodsd
-
 
70
        bswap   eax
-
 
71
        stosd
-
 
72
        lodsd
-
 
73
        bswap   eax
-
 
Line 74... Line 42...
74
        stosd
42
end repeat
Line 75... Line 43...
75
 
43
 
76
        lea     esi, [ebx + aes256_context.key]
44
        lea     esi, [ebx + aes256_context.key]
Line 174... Line 142...
174
        add     esi, 4*8
142
        add     esi, 4*8
Line 175... Line 143...
175
 
143
 
Line 176... Line 144...
176
        jmp     .while
144
        jmp     .while
177
 
-
 
178
  .done:
145
 
179
        DEBUGF  1,'                                                     \n'
146
  .done:
180
        pop     edi esi ebx
147
        pop     edi esi ebx
Line 264... Line 231...
264
        r       dd ?
231
        r       dd ?
265
endl
232
endl
266
        push    ebx esi edi
233
        push    ebx esi edi
Line 267... Line 234...
267
 
234
 
268
        DEBUGF  1,'input  : '
235
        DEBUGF  1,'input  : '
269
        stdcall dump_128bit_hex, [_in]
-
 
Line 270... Line 236...
270
        DEBUGF  1,'\n'
236
        stdcall dump_hex, [_in], 4
271
 
237
 
272
        mov     ebx, [_key]
238
        mov     ebx, [_key]
Line 661... Line 627...
661
        lodsd
627
        lodsd
662
        bswap   eax
628
        bswap   eax
663
        stosd
629
        stosd
Line 664... Line 630...
664
 
630
 
665
        DEBUGF  1,'output : '
631
        DEBUGF  1,'output : '
666
        stdcall dump_128bit_hex, [_out]
-
 
Line 667... Line 632...
667
        DEBUGF  1,'\n'
632
        stdcall dump_hex, [_out], 4
668
 
633
 
669
        pop     edi esi ebx
634
        pop     edi esi ebx
Line 677... Line 642...
677
        r       dd ?
642
        r       dd ?
678
endl
643
endl
679
        push    ebx esi edi
644
        push    ebx esi edi
Line 680... Line 645...
680
 
645
 
681
        DEBUGF  1,'input  : '
646
        DEBUGF  1,'input  : '
682
        stdcall dump_128bit_hex, [_in]
-
 
Line 683... Line 647...
683
        DEBUGF  1,'\n'
647
        stdcall dump_hex, [_in], 4
684
 
648
 
685
        mov     ebx, [_key]
649
        mov     ebx, [_key]
Line 1071... Line 1035...
1071
        lodsd
1035
        lodsd
1072
        bswap   eax
1036
        bswap   eax
1073
        stosd
1037
        stosd
Line 1074... Line 1038...
1074
 
1038
 
1075
        DEBUGF  1,'output : '
1039
        DEBUGF  1,'output : '
1076
        stdcall dump_128bit_hex, [_out]
-
 
Line 1077... Line 1040...
1077
        DEBUGF  1,'\n'
1040
        stdcall dump_hex, [_out], 4
1078
 
1041
 
1079
        pop     edi esi ebx
1042
        pop     edi esi ebx