63 static IDEA_INT inverse(
unsigned int xin);
68 private_idea_set_encrypt_key(key, ks);
70 void private_idea_set_encrypt_key(
const unsigned char *key,
IDEA_KEY_SCHEDULE *ks)
74 register IDEA_INT *kt,*kf,r0,r1,r2;
76 kt= &(ks->
data[0][0]);
77 n2s(key,kt[0]);
n2s(key,kt[1]);
n2s(key,kt[2]);
n2s(key,kt[3]);
78 n2s(key,kt[4]);
n2s(key,kt[5]);
n2s(key,kt[6]);
n2s(key,kt[7]);
86 *(kt++)= ((r2<<9) | (r1>>7))&0xffff;
88 *(kt++)= ((r1<<9) | (r0>>7))&0xffff;
90 *(kt++)= ((r0<<9) | (r1>>7))&0xffff;
92 *(kt++)= ((r1<<9) | (r0>>7))&0xffff;
94 *(kt++)= ((r0<<9) | (r1>>7))&0xffff;
96 *(kt++)= ((r1<<9) | (r0>>7))&0xffff;
99 *(kt++)= ((r0<<9) | (r1>>7))&0xffff;
100 *(kt++)= ((r1<<9) | (r2>>7))&0xffff;
108 register IDEA_INT *
fp,*tp,
t;
110 tp= &(dk->
data[0][0]);
111 fp= &(ek->
data[8][0]);
114 *(tp++)=inverse(fp[0]);
115 *(tp++)=((
int)(0x10000L-fp[2])&0xffff);
116 *(tp++)=((
int)(0x10000L-fp[1])&0xffff);
117 *(tp++)=inverse(fp[3]);
124 tp= &(dk->
data[0][0]);
135 static IDEA_INT inverse(
unsigned int xin)
137 long n1,n2,
q,r,b1,b2,
t;
152 {
if (b2 < 0) b2=0x10001+b2; }
163 return((IDEA_INT)b2);