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 14... Line 14...
14
;
14
;
15
;    You should have received a copy of the GNU General Public License
15
;    You should have received a copy of the GNU General Public License
16
;    along with this program.  If not, see .
16
;    along with this program.  If not, see .
Line 17... Line 17...
17
 
17
 
18
struct aes256_ctr_context aes256_context
18
struct aes256_ctr_context aes256_context
19
        counter rb 16
19
        counter rb AES256_BLOCKSIZE
20
        output  rb 16   ; counter after aes_crypt
20
        output  rb AES256_BLOCKSIZE     ; counter after aes_crypt
Line 21... Line 21...
21
ends
21
ends
22
 
22
 
Line 23... Line 23...
23
 
23
 
24
proc aes256_ctr_init _counter
24
proc aes256_ctr_init _counter
25
        push    ebx esi edi
25
        push    ebx esi edi
26
 
26
 
27
        mcall   68, 12, sizeof.aes256_ctr_context
27
        mcall   68, 12, sizeof.aes256_ctr_context
28
        ; handle errors
28
        ; handle errors
29
        mov     ecx, 16/4
29
        mov     ecx, AES256_BLOCKSIZE/4
Line 40... Line 40...
40
proc aes256_ctr_crypt _ctx, _in, _out
40
proc aes256_ctr_crypt _ctx, _in, _out
Line 41... Line 41...
41
 
41
 
Line 42... Line 42...
42
        push    ebx esi edi
42
        push    ebx esi edi
43
 
43
 
44
        DEBUGF  1,'plain  : '
-
 
Line 45... Line 44...
45
        stdcall dump_128bit_hex, [_in]
44
        DEBUGF  1,'plain  : '
46
        DEBUGF  1,'\n'
45
        stdcall dump_hex, [_in], 4
47
 
46
 
48
        mov     esi, [_ctx]
47
        mov     esi, [_ctx]
Line 99... Line 98...
99
        mov     dword[esi + aes256_ctr_context.counter + 4*1], ebx
98
        mov     dword[esi + aes256_ctr_context.counter + 4*1], ebx
100
        mov     dword[esi + aes256_ctr_context.counter + 4*2], ecx
99
        mov     dword[esi + aes256_ctr_context.counter + 4*2], ecx
101
        mov     dword[esi + aes256_ctr_context.counter + 4*3], edx
100
        mov     dword[esi + aes256_ctr_context.counter + 4*3], edx
Line 102... Line 101...
102
 
101
 
103
        DEBUGF  1,'cipher : '
102
        DEBUGF  1,'cipher : '
104
        stdcall dump_128bit_hex, [_out]
-
 
Line 105... Line 103...
105
        DEBUGF  1,'\n\n'
103
        stdcall dump_hex, [_out], 4
106
 
104
 
107
        pop     edi esi ebx
105
        pop     edi esi ebx
108
        ret
106
        ret