/* crypto/idea/i_ecb.c */
-/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
+/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
* This package is an SSL implementation written
* [including the GNU Public Licence.]
*/
-#include "idea.h"
+#include <openssl/idea.h>
#include "idea_lcl.h"
+#include <openssl/opensslv.h>
-char *IDEA_version="IDEA part of SSLeay 0.8.1b 29-Jun-1998";
+const char *IDEA_version="IDEA" OPENSSL_VERSION_PTEXT;
-char *idea_options()
+const char *idea_options(void)
{
if (sizeof(short) != sizeof(IDEA_INT))
return("idea(int)");
return("idea(short)");
}
-void idea_ecb_encrypt(in, out, ks)
-unsigned char *in;
-unsigned char *out;
-IDEA_KEY_SCHEDULE *ks;
+void idea_ecb_encrypt(const unsigned char *in, unsigned char *out,
+ IDEA_KEY_SCHEDULE *ks)
{
unsigned long l0,l1,d[2];
l0=l1=d[0]=d[1]=0;
}
-void idea_encrypt(d,key)
-unsigned long *d;
-IDEA_KEY_SCHEDULE *key;
- {
- int i;
- register IDEA_INT *p;
- register unsigned long x1,x2,x3,x4,t0,t1,ul;
-
- x2=d[0];
- x1=(x2>>16);
- x4=d[1];
- x3=(x4>>16);
-
- p= &(key->data[0][0]);
- for (i=0; i<8; i++)
- {
- x1&=0xffff;
- idea_mul(x1,x1,*p,ul); p++;
-
- x2+= *(p++);
- x3+= *(p++);
-
- x4&=0xffff;
- idea_mul(x4,x4,*p,ul); p++;
-
- t0=(x1^x3)&0xffff;
- idea_mul(t0,t0,*p,ul); p++;
-
- t1=(t0+(x2^x4))&0xffff;
- idea_mul(t1,t1,*p,ul); p++;
-
- t0+=t1;
-
- x1^=t1;
- x4^=t0;
- ul=x2^t0; /* do the swap to x3 */
- x2=x3^t1;
- x3=ul;
- }
-
- x1&=0xffff;
- idea_mul(x1,x1,*p,ul); p++;
-
- t0= x3+ *(p++);
- t1= x2+ *(p++);
-
- x4&=0xffff;
- idea_mul(x4,x4,*p,ul);
-
- d[0]=(t0&0xffff)|((x1&0xffff)<<16);
- d[1]=(x4&0xffff)|((t1&0xffff)<<16);
- }