#include <math.h>
#include <stdio.h>
|
#define | SHORT_BENCH |
|
#define | ENCRYPT 1 |
|
#define | DECRYPT 0 |
|
#define | KEY_SZ 8 |
|
#define | ITERATIONS 128 |
|
#define | HALF_ITERATIONS 64 |
|
#define | c2l(c, l) |
|
#define | c2ln(c, l1, l2, n) |
|
#define | l2c(l, c) |
|
#define | l2cn(l1, l2, c, n) |
|
#define | PERM_OP(a, b, t, n, m) |
|
#define | HPERM_OP(a, t, n, m) |
|
#define | D_ENCRYPT(L, R, S) |
|
#define | NTESTS 20 |
|
#define c2ln |
( |
|
c, |
|
|
|
l1, |
|
|
|
l2, |
|
|
|
n |
|
) |
| |
Value:{ \
switch (n) { \
case 7:
l2|=((
ulong)(*(--(c))))<<16; \
case 6:
l2|=((
ulong)(*(--(c))))<< 8; \
case 4:
l1|=((
ulong)(*(--(c))))<<24; \
case 3:
l1|=((
ulong)(*(--(c))))<<16; \
case 2:
l1|=((
ulong)(*(--(c))))<< 8; \
} \
}
unsigned long ulong
Definition: des.c:15
fpreex g0 bne add l5 st l3 l5 or l3 st fsr!enable exceptions jmpl l1
Definition: grfpu_ops.S:440
fmovs f0 retl nop f0 retl nop f2 fdivd f4 std retl nop o1 st f0 fitod f2 std retl o0 o1 st f0 fitos f2 st retl o0 o2 std f0 fdtoi f2 st retl o0 o2 st f0 fstoi f2 st retl o0 o2 st f0 fstod f0 std retl o0 o2 std f0 fdtos f0 st retl o0 o2 st f5 fmovs f6 st retl o0 o2 st f5 fnegs f6 st retl o0 o2 st f5 fabss f6 st retl o0 o4 std std f0 f2 fcmpd f2 nop a cmpd_end o0 a cmpd_end o0 a cmpd_end o0 a cmpd_end o0 ta!error o4 std std f0 f2 fcmped f2 nop a cmpd_end o0 a cmpd_end o0 a cmpd_end o0 a cmpd_end o0 ta!error o4 st st f0 f1 fcmps f1 nop a cmpd_end o0 a cmpd_end o0 a cmpd_end o0 a cmpd_end o0 ta!error o4 st st f0 f1 fcmpes f1 nop a cmpd_end o0 a cmpd_end o0 a cmpd_end o0 a cmpd_end o0 ta!error o4 std std f0 f2 fsubd f4 std retl o0 o4 st st f0 f1 fadds f2 st retl o0 o4 st st f0 f1 fsubs f2 st retl o0 o4 st st f0 f1 fmuls f2 st retl o0 o4 st st f0 f1 fdivs f2 st retl o0 o4 st f0 fsqrts f1 st retl o0 o1 f2 f0 faddd f10 o1 f0 f1 fadds f4 o3 set o1 set o2 f10 f11 st o4 set o1!change buffer for second run subcc o3 bne grfpc_spdep_tst2_loop nop retl nop o1 set o2 f0 f2 fadds f4!fdivs f5!fmuld f6!fmuls f7 fsqrtd f8 retl std o0 f0 f2 f4 f6 f8 f10 f12 f14 f16 f18 f20 f22 f24 f26 f28 f30 retl nop l4 set l3 st l3 srl l0 and l0 subcc l0 otherwise l7 l7 add l6 std st l5 srl l5 andcc l5 bne nop!std!jmpl l2
Definition: grfpu_ops.S:402
#define D_ENCRYPT |
( |
|
L, |
|
|
|
R, |
|
|
|
S |
|
) |
| |
Value:
t=((t>>4)+(t<<28)); \
L^= des_SPtrans[1][(t )&0x3f]| \
des_SPtrans[3][(t>> 8)&0x3f]| \
des_SPtrans[5][(t>>16)&0x3f]| \
des_SPtrans[7][(t>>24)&0x3f]| \
des_SPtrans[0][(u )&0x3f]| \
des_SPtrans[2][(u>> 8)&0x3f]| \
des_SPtrans[4][(u>>16)&0x3f]| \
des_SPtrans[6][(u>>24)&0x3f];
#define S
Definition: fir2.c:33
volatile unsigned int s
Definition: satcan.c:250
Referenced by des_encrypt().
#define HALF_ITERATIONS 64 |
#define HPERM_OP |
( |
|
a, |
|
|
|
t, |
|
|
|
n, |
|
|
|
m |
|
) |
| |
Value:((t)=((((a)<<(16-(n)))^(a))&(m)),\
(a)=(a)^(t)^(t>>(16-(n))))\
Referenced by des_set_key().
Value:(*((c)++)=(
uchar)(((l) )&0xff), \
*((c)++)=(
uchar)(((l)>> 8)&0xff), \
*((c)++)=(
uchar)(((l)>>16)&0xff), \
*((c)++)=(
uchar)(((l)>>24)&0xff))
unsigned char uchar
Definition: des.c:12
Referenced by des_ecb_encrypt().
#define l2cn |
( |
|
l1, |
|
|
|
l2, |
|
|
|
c, |
|
|
|
n |
|
) |
| |
Value:{ \
c+=n; \
switch (n) { \
case 7: *(--(c))=(
uchar)(((
l2)>>16)&0xff); \
case 6: *(--(c))=(
uchar)(((
l2)>> 8)&0xff); \
case 5: *(--(c))=(
uchar)(((
l2) )&0xff); \
case 4: *(--(c))=(
uchar)(((
l1)>>24)&0xff); \
case 3: *(--(c))=(
uchar)(((
l1)>>16)&0xff); \
case 2: *(--(c))=(
uchar)(((
l1)>> 8)&0xff); \
case 1: *(--(c))=(
uchar)(((
l1) )&0xff); \
} \
}
fpreex g0 bne add l5 st l3 l5 or l3 st fsr!enable exceptions jmpl l1
Definition: grfpu_ops.S:440
fmovs f0 retl nop f0 retl nop f2 fdivd f4 std retl nop o1 st f0 fitod f2 std retl o0 o1 st f0 fitos f2 st retl o0 o2 std f0 fdtoi f2 st retl o0 o2 st f0 fstoi f2 st retl o0 o2 st f0 fstod f0 std retl o0 o2 std f0 fdtos f0 st retl o0 o2 st f5 fmovs f6 st retl o0 o2 st f5 fnegs f6 st retl o0 o2 st f5 fabss f6 st retl o0 o4 std std f0 f2 fcmpd f2 nop a cmpd_end o0 a cmpd_end o0 a cmpd_end o0 a cmpd_end o0 ta!error o4 std std f0 f2 fcmped f2 nop a cmpd_end o0 a cmpd_end o0 a cmpd_end o0 a cmpd_end o0 ta!error o4 st st f0 f1 fcmps f1 nop a cmpd_end o0 a cmpd_end o0 a cmpd_end o0 a cmpd_end o0 ta!error o4 st st f0 f1 fcmpes f1 nop a cmpd_end o0 a cmpd_end o0 a cmpd_end o0 a cmpd_end o0 ta!error o4 std std f0 f2 fsubd f4 std retl o0 o4 st st f0 f1 fadds f2 st retl o0 o4 st st f0 f1 fsubs f2 st retl o0 o4 st st f0 f1 fmuls f2 st retl o0 o4 st st f0 f1 fdivs f2 st retl o0 o4 st f0 fsqrts f1 st retl o0 o1 f2 f0 faddd f10 o1 f0 f1 fadds f4 o3 set o1 set o2 f10 f11 st o4 set o1!change buffer for second run subcc o3 bne grfpc_spdep_tst2_loop nop retl nop o1 set o2 f0 f2 fadds f4!fdivs f5!fmuld f6!fmuls f7 fsqrtd f8 retl std o0 f0 f2 f4 f6 f8 f10 f12 f14 f16 f18 f20 f22 f24 f26 f28 f30 retl nop l4 set l3 st l3 srl l0 and l0 subcc l0 otherwise l7 l7 add l6 std st l5 srl l5 andcc l5 bne nop!std!jmpl l2
Definition: grfpu_ops.S:402
unsigned char uchar
Definition: des.c:12
#define PERM_OP |
( |
|
a, |
|
|
|
b, |
|
|
|
t, |
|
|
|
n, |
|
|
|
m |
|
) |
| |
typedef unsigned long ulong |
int des_ecb_encrypt |
( |
unsigned char * |
input, |
|
|
unsigned char * |
output, |
|
|
void * |
ks, |
|
|
int |
encrypt |
|
) |
| |
void des_set_key |
( |
unsigned char * |
key, |
|
|
void * |
schedule |
|
) |
| |