Added function checksum security

git-svn-id: svn://kolibrios.org@7320 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
pavelyakov 2018-08-25 10:09:02 +00:00
parent bdc68077f4
commit 343e87c60f

View File

@ -189,10 +189,11 @@ endg
; Author Pavel Iakovlev ; Author Pavel Iakovlev
; Return EAX = 0 security kernel, error set function ; Return EAX = 0 security kernel, error set function
; Return Else EAX > 0 success set function ; Return Else EAX > 0 success set function
align 4 align 32
setInt0x40: setInt0x40:
; !!! kernel security !!! ; !!! kernel security !!!
and ebx, 0FFh
mov eax, dword [servetable2 + ebx * 4] mov eax, dword [servetable2 + ebx * 4]
cmp eax, undefined_syscall cmp eax, undefined_syscall
jne errorSet0x40 jne errorSet0x40
@ -201,30 +202,59 @@ setInt0x40:
pushad pushad
add edx, 16 add edx, 16
stdcall kernel_alloc, edx stdcall kernel_alloc, edx
mov dword[tempPointerAlloc], eax push eax
pop dword[tempPointerAlloc]
popad popad
push ebx push ebx
mov eax, dword[tempPointerAlloc] push dword[tempPointerAlloc]
pop eax
mov ebx, eax mov ebx, eax
add eax, edx add eax, edx
push 0
pop dword[hashDataFunction1]
push 1
pop dword[hashDataFunction2]
loopCopyMemory: loopCopyMemory:
mov dh, byte[ecx] xor edx, edx
mov byte[ebx], dh
mov dl, byte[ecx]
mov byte[ebx], dl
; hash security function
add dword[hashDataFunction1], edx
mov edx, dword[hashDataFunction1]
add dword[hashDataFunction2], edx
;-----------------------------
inc ebx inc ebx
inc ecx inc ecx
cmp ebx, eax cmp ebx, eax
jne loopCopyMemory jne loopCopyMemory
pop ebx pop ebx
; check hash security data
; cmp edi, dword[hashDataFunction1]
; jne errorSet0x40
; cmp esi, dword[hashDataFunction2]
; jne errorSet0x40
;-------------------------------
mov eax, dword[tempPointerAlloc] mov eax, dword[tempPointerAlloc]
mov dword [servetable2 + ebx * 4], eax mov dword [servetable2 + ebx * 4], eax
jmp successSet0x40 jmp successSet0x40
errorSet0x40: errorSet0x40:
xor eax, eax xor eax, eax
successSet0x40: successSet0x40:
ret ret
tempPointerAlloc dd ? tempPointerAlloc dd ?
hashDataFunction1 dd ?
hashDataFunction2 dd ?
;------------------- ;-------------------