Вы находитесь на странице: 1из 25

28147-89,

Intel x86.

(avin@chat.ru).
,
,
Intel x86,
.
, 1,5 1995 .

..................................................................................................................... 2
1. . ................................................................................................................ 4
1.1. . ................................................................................................... 4
1.2. ...................... 5
1.3. . ............................................................................ 5
1.4. . ................................................... 6
1.5. ....................................................................................... 8
2. ......................................................... 15
2.1. ........................................................................... 15
2.2. .................................................................................. 16
2.3. . ....................... 17
3. . ...................................................................................................... 19
3.1. . ................................................................................................... 19
3.2. . ........................................................... 20
3.3. . ................................................................................................. 22
4. . ...................................................................................... 23
4.1. . ................................................................................................. 23
4.2. ................................................................................................ 24
4.3. . ............................................................ 25

2
.
, , ,

. - .
,
,
. ,
.
, ,
, ,
, ! .

,
. , , , ,
, , .
,

. ,
,
. ,

.

. ,
,
, . ,

. ,
, , .
,
,
, ,
, .
- ,
, .
, ,
, ,
.
.
,
. 28147-89, ,
, 1989 . , ,
.
, . ,
, 70-
.
. , , .
. ,

3
,
.

. .
,
, , . ,
, ,
, , ,
. 334 03.04.95
.
,
, ,
, ,
.., , , ,
.
, ,
,
, ?
, ,
. ,
,
. , , , ,
, .

.
, ,
DES, , .
? , , ,
, DES. ,
, ?!

, , ,
, - .
,
, , ,
.
, 91 94 ,
Intel x86,
.

Intel x86.
,
- .
,
,
.

4
. ,
,
. ,
1. .
1.1. .

,
28147-89. ,
, .
,
.
, , ,

, .
, ,
.
,
, ,
.
.

(, X). |X| X
. , X
, : 0 X < 2|X |.
,
: X = (X0,X1,,Xn1) = X0 || X1 || ||Xn1.

||. ,
: |X| = |X0| + |X1| + + |Xn-1|.

. ,
,
:
( X 0 , X 1 ,..., X n-1 ) = X 0 || X 1||...|| X n-1 = X 0 + 2|X 0 | ( X 1 + 2|X1| (...( X n-2 + 2|X n-2 | X n-1 )...)).

, , ,
, :
X = (x0,x1,,xn1) = x0 + 21x1 + + 2n1xn1.
,
, ,
. A B = (a0 b0,a1 b1,,an1 bn1),
n = |A| = |B|, ;
, ,
2: a b = (a + b) mod 2.

5
1.2. .
2814789, ,
.
,
. ,
.
, .
, :
(32-);
(32-);
(16-).
,
,
.
, , :
) ;
) ;
) .
,
, . ,
,
.
. ,
, .
.
1. 32- ,
K: K = {Ki}0 i 7.
32- : 0 Ki 232. ,
328 = 256 32 .
2. 8 16, 4 , 0 15.
, ,
16 0 15
. H: H = {H i , j }00 ij715 ,

0 Hi,j 15. , : 8 16 /
4 / = 512 64 .
1.3. .

,
64- .
32- , -
. 1.
:
0. :
N 64- , (N1)
(N2) 32- .
, N=(N1,N2).

6
X 32- ;
1. .
232
,
1
;
S = (N1 + X )mod232
2. . 32- ,
m = 0..7
,
4-
2

: S = (S0,S1,S2,S3,S4,S5,S6,S7).
S m = H m ,S m

,
3
: Si
S = R11 ( S )
Si- (
) i- (.. i-
, ). ,
4

S = S N2
,
,
5
,
N 2 = N1 , N1 = S
4- .
:
4- 326
, ,
(N)
4 , 24,
. 1.

.
28147-89.
3. 11 .
11
.
R11 11 ,
.. .
4. : , 3, 2
.
5. : ,
.
6.
.
0
(N, X)

1.4. .

,
, .
, ,
, ,
.
,
.
,
.
,
. , ,
.

7
,
,
.
, ,
.

.
.
1. 32-:
K0,K1,K2,K3,K4,K5,K6,K7,K0,K1,K2,K3,K4,K5,K6,K7,K0,K1,K2,K3,K4,K5,K6,K7,K7,K6,K5,K4,K3,K2,K1,K0.

2. 32-:
K0,K1,K2,K3,K4,K5,K6,K7,K7,K6,K5,K4,K3,K2,K1,K0,K7,K6,K5,K4,K3,K2,K1,K0,K7,K6,K5,K4,K3,K2,K1,K0.

3. 16-:
K0,K1,K2,K3,K4,K5,K6,K7,K0,K1,K2,K3,K4,K5,K6,K7.

- ,
n-X, (n),
, (X), ,
() ()
. :
,

, : 32-(32-(T)) = T, T
64- , X(T) X
T. , ,
,
.
,
32- 32-.
: ,
0
(N)
k = 1..3
j = 0..7

0
(N)
j = 0..7
1

N=(N, Kj)

N=(N, Kj)
k = 1..3
j = 7..0
j = 7..0

N=(N, Kj)
3

N1 N2

(N)

. 2. 32-.

N=(N, Kj)

N1 N2

(N)

. 2. 32-.

8
32- 32-. ,
,
.
,
, 2814789
.
,
, 16
, ,
,
.

0

2-.
(N)
64k = 1..2

, N.
j = 0..7
(N,X)
1
N
N=(N, Kj)
X.

, :
2


(N)
,
.
. 2.
16-.

1.5. .

28147-89 :
,
,
,
.
64 ,
, ,
.
8 ,
,
8 .

, ,
:
T,T ;
Ti , Ti i- 64-
: T = (T1 , T2 ,..., Tn ) , T = (T1 , T2 ,..., Tn ) , 1 i n ,
: | Ti | =| Ti | = 64 1 i <n, 1 |Tn | =|Tn | 64 ;

64- ;

64-
X.
:
1. .
32-
, 32- .
, 64-
.
3 ,
.
,
, 64 : |T| = |T| = 64n,

0
.
(T)

i = 1.. n
:
1.

1

Ti = 32- (Ti )
,


2
.
(T)

. 3.
,
.

,
0
(T)
.
2.
i = 1.. n
8 64 , ,
1


Ti = 32- (Ti )
64 .
, .
2

(T)
, ,

. 3.
.


,
. , ,
, 64 ,
.
,
,
64 , 64- . ,
. ,
: , 32 , 64
. , 8-
,

10
. , ,
, ,
,
(. ). ,

.
2. .
? 64
, ,
.
, . ()
() , ,
, () .

, , 264 64-
. 2,
, ,
. ; ,
, , . ,
64 ,
, .
.
:
() 64-
, 32-,
, .
,
,
, 5.
, , :
Wi+1 = f(Wi), Wi , f
. , ,
W0. ,
, S,
, .
,
32-: W0=32-(S). , ,
,
: Wi = fi (W0), fi (X ) = f( fi1(X )),
f0(X ) = X.
:
i = 32-(Wi) = 32-( fi (W0)) = 32-( fi (32-(S))) = ji (S,K), i i- , K
.

11
,
.
, -
. ,
,
,
.

,
, .
,
. , ,
-
.
:
, ,
( )
264;
, ,
, ;
,
, , ,
32 .

, :
64- :
Wi = ( W0i , W1i ), |W0i |=| W1i |= 32, W0i +1 = f ( W0i ), W1i +1 = f% ( W1i ) ; ,
.
:
W0i +1 = (W0i + C1 )mod 232 , C1=101010116;
W1i +1 = (W1i + C2 - 1)mod (232 - 1)+1 , C2=101010416;
, ,
, , 16- .
,
: W1i +1 = (W1i + C2 )mod (232 - 1) , C2.
, , ,
2321 , . ,
(2321) mod (2321) = (2321), 0. ,
, .
232,
2321, 232(2321),
, , .
, , ,
32- .
4,
:
0. :

12

T() () ,
(),
64 ;
S , 64- ,
;
1. ,
0
,
(T() , S)
,
,
1
;
S=323(S)
2. , .
i = 1..n
(S
1) (S0)
2
32

;
S0=(S0+C1)mod 2
3. . 64- ,
S1=(S1+C21)
, 32
mod (2 1) +1
32,

3
()
Ti() = Ti() 32-(S)
() .
4.
4
() .
(T())

. 4.
()
.


.
1.

,

.
2. ,
,
. , 1
.
3. , , -
.
:
,

, 8 ;

,
;
, , ,
, , .
,
,
,
.
, . ,

13
, ,
.

.
, . ,
,
, .
,
,
, ()
. ,
,
.
.
. ,
, ,
: ti = ti g i = f ( ti , i ) . ,

:
ti = ti 1 = (ti g i ) 1 = (ti 1) g i = ti g i ,

t t ( 0 = 1, 1 = 0 ).

, ,
. ,
. ,


.
, ,

,
.
.
3. .


32- ,

.

.
.
.
-
5 .

14

, ,
.
:
Ti = Ti Gi , ;
Ti = Ti 32- (Ti-1 ) , ;

0

(T() , S)
,
i = 1.. n

1
.
Ti() = Ti () 32- ( S )
,
,

2
S = Ti
. ,
,

3
,
(T())

. 5.
, ,
()
.

,
.
,
,
1/2 .
4. .

. ,

,
.
, , . ,
,
? .
,

, ,
. , , ,
. , , ,
, .
, , ,
. : , ,
, .

15
. ,
.

. , ,
.
,
:

0
;
(T)

;
1

S=0
6.
i = 1..n
, ,
32 .
2
S = 16 - ( S Ti )
,

2|I | ,
3

I = (s0,s1,...,sr-1)
,
.
4
32
(I )
232 0.23109.
. 6.

.

2. .
2.1. .


,
.
:
;
, ;
, ,
.
,
, .
,
, . ,
,
, ,
. ,
.
,
, ,
, ,

16
.



.
,
. ,
,
, .
, DES ,
,
, , ..
. ,
.
256-
2256.
,
.
DES
56 256.
. DES
, .
, 1998 .
2.2. .

, 28147-89
, . , DES. ,
, . ,
,


. ,
N2
N1

, .
,
,
,

.

, ,
.
7.
,
.


N1
N2 f (N1, X)
, ,
. 7.


,
, .

17
. ,
(X ),
. ,
: |N1| = |N2| = |X |, DES
32 .

,
, 1,2,3 (. . 1)
, 4 5
.
DES ,
.
32 , DES 16.
DES,
.
.
,
.
DES Intel x86

, .
, ,
DES,
.
2.3. .

.
.
, DES ,

, .

- , .
.
, , ,
, .

.
. , ,
, ,
,
.
, ,
:
1. , 0 1.
,
. , ,
. ,

18
,
, .
,
, , ,
, , . ,
, . ,
. ,
0 1
( ),
.
.
2. ,
, . ,

.
.
.
,
. , .
,
, ,
(.. )
, .
. ,

.
0 15, ,
, ,
.
.
32- 32- ,
0 15. ,
, , , ,
. ,
, . ,
,
, ,
, .
, ,
, ,
()
.
, .
( )
.
,

19

.
,

make1key.c.
2 , .
.
,
, .
, .
DOS, DOS- Windows 3.x/95 ,
, Windows NT
( )
.
3. .
3.1. .


,
,
.

, .
16- Intel 808880286
, ,

. ,

,
16-. 32-
(Intel 80386 ) 32, .
,
.
, , .
1. ( , -
), 32-
.
,
.

, .
2. 8 4- . 4-
, (xlat).
:
;

20
,
4- .
,
, ,
. 4-
8- , , ,
, . 4-
16 , 8- 256 . ,
, , 4256 = 1024
, . ,
.
3. 11 . 16 32-
1 , ,
1 .
, 11 8 ,
3 . , ,
(xchg). .
xlat,
AL, , ,
. ,
,
8 ,
. , ,
1 , . ,

(adc),
, !

3.2. .


Intel x86,
16- 32- . 32-
16- .
, .

, 1.
,
.
1. 28147-89.

.

1.

16
gost.asm

32
gost~.asm

21

1. 28147-89.

.

2. -

3. -

4.

5.

6.

7.
8. (1)
(128 )
9. , ,
, 32-.
10.

16
simple.asm

32
simple~.asm

gamma.asm

gamma~.asm

gammale.asm

gammale~.asm

gammald.asm

gammald~.asm

imito.asm

imito~.asm

expkey.asm

expkey~.asm

expcht.asm

ge386cpu.asm
gost.h

,
,
.
.
1. (..
) , .
.
:

;
( ) ,
, ,
,
;

, , - (
).
2.
. ,


(, , . )
. ,
8 .

22
3. -
.
.
.
4. -
,
. ,
(. .5, 1),

, .
5.
. , ,
( !)
, , .
6. ()
Borland TASM 2.5 , Borland C/C++ 2.0
.
.


. :
cryptor.c
;
gost.mak
16- ;
gost386.mak 32- .
( )
.
3.3. .

, ,
. ( , 1193180 ),
. ()
.

32
2 /1193180 3599.6 , .
, .

, 32- 32-
. ,
2. 32-
32- (
).
DES, 7/1994.
,
,
, ,

23
. ( )
DES .
2.
, ..,

gamma gammaLD gammaLE simple


imito
1031,
4.52
8.4
8.6
8.7
8.7
16.9
181088
AMI 286
10
20.4
20.7
20.8
20.8
40.8
Intel 80286
Prolinea 325
25
48.0
48.6
48.8
48.0
93.7
Intel 386SX-25
66.0
71.1
67.4
71.5
139
.
33
63.8
64.5
64.7
63.8
124
Intel 386SX-33
87.6
94.5
89.5
95.0
185
BYTEX
40
89
90
91
91
177
Intel 386DX-40
120
135
122
135
264
Acer
33
114
113
114
114
226
Intel486SX33
150
161
151
162
321
Presario 460
66
225
222
229
227
451
Intel486SX2-66
298
319
303
324
637
Acer
66
302
296
307
293
601
Pentium-66
351
397
355
405
777

DES

11.2
22.0
25.9
39.3
41.2
82.2
88.7

.

3 ( 70 /)
4 ( 400 /).
,
. ,
.
? , , .
gost, 32 ,
.
,

32+32+16 = 80
. ,
.
4. .
4.1. .


.
, .
. ,
,
,
, . ,

24
,
.
, , ,
, . , ,
, ,
.
4.2. .


, ,
.
,
. ,

( , ..),
, , . ,
(
). ,
.
,
.

,
N = nm, n 32- , m
, n = 8, m = 4.
,
.
, ,
.
( ), ,
. ,
(
).
,

.
( ),

(m = 4 = 3+1), (n = 2),
.
64- ,
DES 56 .
, ,
,
,

.

25
4.3. .

,
.
.

. ,

0 1 , ,
. ,
.
, , ,
.
,
28147-89, , ,
. ,

, ,
32 .
. ,
, .

, Internet
1988 .
: ,
,
, .
, ,
.
, ,
,
. ,
.

.

Оценить