Atmel 89S8252 DES (56 bits)
implementations.
|
Important ! The DES library source code is eligible for export
from the U.S. to all customers worldwide, except to U.S. embargoed
destinations. Other countries may exercise separate jurisdiction
over the import, export or use of encryption products. Users who
download this product should observe any local regulations that
may apply to the distribution or use of encryption products.
|
The goal of this project was creation of DES
(56 bits) implementation with usage of ATMEL 89LS8252 microcontroller
on the base of the pervously developed ANSI C compatible code.
Later this project was divided in to two sub projects:
The difference between them is only way to present data and organization
of communication with user.
AT89S8252 microcontroller was the most suitable candidate for
this project because of the certain reasons (big enough reprogrammable
8 K Flash Memory, SPI interface, 2 K EEPROM for storing keys and
sensitive data, 256 Bytes On-chip RAM, 2 DPTRs; 3-Level Program
Memory Lock. Speaking about SPI interface I would recommend to
use very simple but good programmer from Telesystems
. I created a driver for this SPI programmer
in order to have possibility to work with it under WINDOWS NT,
WINDOWS 2000. May be later it will be published as well.
Clear, it would be much better to use a specialized microcontroller
which is optimized for execution of special bits operations, but
it is not easy to obtain such devices from microcontroller's vendors.
I will not spend a lot of time, speaking in detail about the project
- I believe, you already have a certain experience with programming
this type of microcontrollers. The understanding of DES subroutines
will not be a big problem for you, there are all necessary comments.
In order to help you to check crypto operations' results, I included
in each project file "validate.txt" with pre-calculated
results of crypto operations with pre-defined plain texts and
keys.
- Firs subproject (mixed code (C and Assembler) was created
for compatible with uVision2 (Keil)
Integrated Development Environment. This project can be debugged
in an interactive mode - you can interact with AT89S8252 simulator
without leaving uVision2. In "Serial Window #1"
you see menu, giving you possibility to encrypt, decrypt constant
and user defined data, manipulate with ports IO lines. This
is an excellent possibility to test this project without necessity
to have and use any external hardware (hardware in circuit
emulator), without additional efforts for creating device
prototype. This project manages two keys: SUB key and TRANSPORT
key. The difference between them is only nominal - they can
be stored and used independently, but they share the same
data buffer (there plain data are and there encrypted (decrypted)
data will be put.
- Second subproject (pure assembler) is limited edition of
the first one, created for M51 ( (Macro Assembler © 1992,
Sergey Linev, excellent tool). I am sure it will be compiled
with any modern macro assembler. This code is the most suitable
code to be used with real applications, because it does not
contain any auxiliary subroutines and allows working with
one key. This project was tested with a test application (screenshot,
I used DELPHI). Application used standard DES implementation
and has sent plain data and keys to the microcontroller via
serial port (RS232). Microcontroller executed required operation
(encrypt-decrypt) and sent the result back the test application.
Application compared the obtained result with its own and
reported about errors. A lot of iterations were done in such
way. Therefore, I really believe, that this code is workable.There
is a possibility to check this implementation statically,
without communication between test application and real microcontroller.
In order to do it, you have to change M_LOAD_KEY and M_LOAD_DATA
macros. I tested it with predefined values, taken from validate.txt
(screenshot of M51
with "Internal Memory" window opened, encrypt operation
was executed).
After downloading source codes, please read accompanied descriptions,
it will help you a lot.
The next information can be recommended for reading:
-
DES description: visiting FIPS
site;
-
-
-
Alternative DES implementation (C and assembler's
projects) can be found here: Chris
Hills' site;
|
|
|
|