Main menu

Category Archives: Assembly

After 2009, Intel introduced a new instruction set created to perform AES (Advanced Encryption Standard). The encryption and decryption occurs on silicon level which speeds up the performance for applications that make properly usages of these instructions.
One famous usage of AES instruction set is the Monero coin in crypto-currency scenario. Monero is a cryptocoin that might be mined using regular CPUs that support AES. You actually can mine the coin using old processor if your miner implemented a AES software based but considering the actual difficult level of this crypto-currency and the poor hash/s, you will lose money if your intentions are profit (it is ok if you are just making an educational experiment).

INTRODUCTION TO X86 ASSEMBLY

In order to make this post clear not only for assembly programmers I will give you a quick introduction about X86 Assembly using Intel syntax and how to call assembly function from C/C++ programs. Of course I will not cover the full assembly language. I hope this introduction is enough to make you understand the AES implementation.

The X86 Architecture

The X86 architecture is composed by segment registers, general purposes registers, flags, instruction pointer register and float point units. Check the figure below:

The RAX register is a 64 bits register, that also contains the 32 bits register EAX. In other hand, it is possible to access the lower 16 bits of EAX if AX identifier is used in the intructions set. Finally, it is possible to access the lower and higher 8 bits of AX, using AL and AH respectively.

Not all registers can have their 32, 16 or 8 bits accessible by sub-registers like EAX, AX, AH and AL.

General-Purpose Registers

The following table contains the general purpose registers for 32 and 64 bits.