September 2017
Beginner to intermediate
290 pages
6h 58m
English
As we are developing a crypto core here, it is natural to begin with the implementation of the cryptographic functionality first. The following code performs the encryption of data according to the algorithm we previously defined:
f_encrypt: ; The if statement below, when the condition is TRUE, forces the assembler to produce ; 32-bit code if (ACTIVE_TARGET = TARGET_W32_OBJ) |\ (ACTIVE_TARGET = TARGET_W32_DLL) |\ (ACTIVE_TARGET = TARGET_L32_O) push eax ebx esi edi ecx lea esi, [data_pointer] mov esi, [esi] mov edi, esi lea ebx, [data_length] mov ebx, [ebx] lea ecx, [key] mov cx, [ecx] and cl, 0x07 ; Encryption loop @@: lodsb rol al, cl xor al, ch stosb dec ebx or ebx, 0 jnz @b pop ecx edi esi ebx eax ret; In general, ...
Read now
Unlock full access